// 初始化处理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 ( { this.viewContract(text, record, index); }} > {record && record['contractnum'] && record['contractnum'].value} ); }; 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 ( { checkBtnPermission(record.pk_psndoc_sub.value, 'attachment', 'contract', () => { this.fileManage(record.pk_psndoc_sub.value) }) }}/> ) } }); 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 ?
{ this.editContract(text, record, index) } } > {json['cm6011-000067']}{/* 国际化处理: 修改*/}
: null ); } }); //contcode const contcode = template['agreementList'].items.find(item => item.attrcode === 'contcode'); contcode.render = (text, record, index) => { return ( { this.viewAgree(text, record, index); }} > {record && record['contcode'] && record['contcode'].value} ); }; 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 ( { checkBtnPermission(record.pk_agreement.value, 'attachment', 'agreement', () => { this.fileManage(record.pk_agreement.value) }) }}/> ) } }); 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 ?
{ this.editAgreement(text, record, index) } } > {json['cm6011-000067']}{/* 国际化处理: 修改*/}
: 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; }