123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- // 初始化处理template数据
- import React from "react";
- import checkBtnPermission from "./checkBtnPermission";
- import getAgreeType from '../functions/getAgreeTypes';
- export default async function processTemplate(template) {
- const {json} = this.state;
- const contractnum = template['contractList'].items.find(item => item.attrcode === 'contractnum');
- contractnum.render = (text, record, index) => {
- return (
- <span
- className="simple-table-title"
- style={{color: '#007ace', cursor: 'pointer'}}
- onClick={() => {
- this.viewContract(text, record, index);
- }}
- >
- {record && record['contractnum'] && record['contractnum'].value}
- </span>
- );
- };
- template['contractList'].items.push({
- attrcode: 'file',
- itemtype: 'customer',
- hyperlinkflag: false,
- label: json['cm6011-000146'], /* 国际化处理: 附件管理*/
- width: '80px',
- textAlign: 'center',
- visible: true,
- fixed: 'right',
- render: (text, record, index) => {
- return (
- <a style={{cursor: 'pointer'}}>
- <i className="icon iconfont icon-fujianshenpi" onClick={() => {
- checkBtnPermission(record.pk_psndoc_sub.value, 'attachment', 'contract', () => {
- this.fileManage(record.pk_psndoc_sub.value)
- })
- }}/>
- </a>
- )
- }
- });
- template['contractList'].items.push({
- itemtype: 'customer',
- width: '130px',
- label: json['cm6011-000064'],/* 国际化处理: 操作,操作*/
- visible: true,
- fixed: 'right',
- attrcode: 'opr',
- render: (text, record, index) => {
- return (
- record.lastflag && record.lastflag.value ? <div>
- <a
- href="javascript:void(0)"
- className="operator-btn"
- onClick={
- () => {
- this.editContract(text, record, index)
- }
- }
- >
- {json['cm6011-000067']}{/* 国际化处理: 修改*/}
- </a>
- </div> : null
- );
- }
- });
- //contcode
- const contcode = template['agreementList'].items.find(item => item.attrcode === 'contcode');
- contcode.render = (text, record, index) => {
- return (
- <span
- className="simple-table-title"
- style={{color: '#007ace', cursor: 'pointer'}}
- onClick={() => {
- this.viewAgree(text, record, index);
- }}
- >
- {record && record['contcode'] && record['contcode'].value}
- </span>
- );
- };
- template['agreementList'].items.push({
- attrcode: 'file',
- itemtype: 'customer',
- hyperlinkflag: false,
- label: json['cm6011-000146'], /* 国际化处理: 附件管理*/
- width: '80px',
- textAlign: 'center',
- visible: true,
- fixed: 'right',
- render: (text, record, index) => {
- return (
- <a style={{cursor: 'pointer'}}>
- <i className="icon iconfont icon-fujianshenpi" onClick={() => {
- checkBtnPermission(record.pk_agreement.value, 'attachment', 'agreement', () => {
- this.fileManage(record.pk_agreement.value)
- })
- }}/>
- </a>
- )
- }
- });
- template['agreementList'].items.push({
- itemtype: 'customer',
- width: '130px',
- label: json['cm6011-000064'],/* 国际化处理: 操作,操作*/
- visible: true,
- fixed: 'right',
- attrcode: 'opr',
- render: (text, record, index) => {
- return (
- record.lastflag && record.lastflag.value ? <div>
- <a
- href="javascript:void(0)"
- className="operator-btn"
- onClick={
- () => {
- this.editAgreement(text, record, index)
- }
- }
- >
- {json['cm6011-000067']}{/* 国际化处理: 修改*/}
- </a>
- </div> : null
- );
- }
- });
- const agreementTypes = await getAgreeType();
- const queryItem = template['agreementquery'].items.find(item => item.attrcode === 'hrcm_agreement.agreementtype');
- queryItem.options = agreementTypes.map(type => {
- return {
- "display": type.name,
- "value": type.code
- }
- });
- return template;
- }
|