//主子表卡片 import React, { Component } from 'react'; import { createPage, ajax, base, toast, high, print, cardCache, getMultiLang } from 'nc-lightapp-front'; import { buttonClick, initTemplate, afterEvent, pageInfoClick } from './events'; import { buttonVisible, initCardBodyEditControl, onSelectedCardBodyEditControl, initCardBodybrowseControl } from '../../../public/components/pubUtils/buttonvisible.js'; import { tableId, formId, billType, dataSource, pkname,allocation} from './constants'; import CombinedExaminationModel from '../../../public/components/combinedExaminationModel'; //联查处理情况 import LinkTerm from '../../../public/components/linkTerm'; //联查收付款协议 import PeriodModal from '../../../public/components/periodModel'; import { bodyBeforeEvent } from '../../../public/components/pubUtils/arapTableRefFilter'; import { formBeforeEvent } from '../../../public/components/pubUtils/arapFormRefFilter'; import { calculateHeadMoney, delBlankLine } from '../../../public/components/pubUtils/billPubUtil.js'; import { getContext, loginContextKeys } from '../../../public/components/arapInitInfo/loginContext'; import ExcelOutput from 'uap/common/components/ExcelOutput'; const { BillTrack, PrintOutput } = high; import { dealCardData,checkScommet } from '../../../public/components/pubUtils/dealCardData'; import { onBatchChange } from '../../../public/components/pubUtils/onBatchChange'; import { cardFieldsEditableWithProxy } from '../../../public/components/pubUtils/billFieldEditableUtil.js'; import NCUploader from 'uap/common/components/NCUploader'; import {cancelAllocation,beSureAllocation,setAllocField,ctrAllocBtn} from '../../../public/components/allocation.js'; let { addCache, getNextId, deleteCacheById, getCacheById, updateCache, getCurrentLastId } = cardCache; import TradeTypeButton from '../../../public/components/tradetype'; //交易类型按钮 import '../../../public/less/tradetype.less'; import { setBillDef } from '../../../public/components/pubUtils/CopyBill/arapCopyBill'; const { NCDiv, NCAffix } = base; import poc from 'uap/common/components/printOnClient'; const {printPreview, printOnClient, PubSub, printerView, printOnClientByMoreTem} = poc; class Card extends Component { constructor(props) { super(props); this.state = { isCombinedExaminationModelShow: false, //联查处理情况模态框 isLinkTermModelShow: false, //联查收付款协议模态框 isPeriodModelShow: false, //期初建账 showBillTrack: false, //单据追溯模态框显示的状态 showUploader: false, //附件 target: null, buttonfalg: null, //卡片态点击肩部按钮和表体行按钮改变该值控制按钮状态 forceRender: true,//导出模板懒加载,true为不加载,false为加载 json: {} }; this.printData = { billtype: billType, //单据类型 appcode: this.props.getSearchParam('c'), //功能节点编码,即模板编码 funcode: this.props.getSearchParam('c'), nodekey: props.getSearchParam('p'), //模板节点标识 =交易类型 oids: [this.props.getUrlParam('id')], // 功能节点的数据主键 oids含有多个元素(['1001A41000000000A9LR','1001A410000000009JDD'])时为批量打印, userjson: billType //单据类型,billtype不是必需字段,后台没有设置接收字段,以userjson代替 }; this.outputData = { billtype: billType, //单据类型 appcode: this.props.getSearchParam('c'), funcode: this.props.getSearchParam('c'), nodekey: props.getSearchParam('p'), //模板节点标识 =交易类型 oids: [this.props.getUrlParam('id')], // 功能节点的数据主键 userjson: billType, //单据类型 outputType: 'output' }; this.formId = formId; this.tableId = tableId; this.allocation = allocation; this.billType = billType; this.pkname = pkname; this.Info = { allButtonsKey: [], //保存所有的表体头部按钮 combinedExaminationData: [], //联查处理情况模态框表格数据 linkTermData: [], //联查收付款协议模态框表格数据 selectedPKS: [], //导出数据的主键pk,收付款协议选中子表行 isModelSave: false //是否是整单保存,默认为false }; this.dataInSaga = { //用于saga里面的busiinfo appcode: props.getSearchParam('c') ? props.getSearchParam('c') : null, pagecode: props.getSearchParam('p') ? props.getSearchParam('p') : null, butncode: null } this.billinfo ={ billtype:'card', pagecode:props.getSearchParam('p') ? props.getSearchParam('p') : null, headcode:formId, bodycode:tableId} this.prepay = {display:null,value:null}; props.use.cardTable(tableId); props.use.form(formId); props.use.form(allocation); } //关闭、刷新弹窗时 componentWillMount() { let callback = (json) => { this.setState({ json: json }, () => { window.onbeforeunload = () => { let status = this.props.getUrlParam('status'); if (status == 'edit' || status == 'add') { return ''; } }; this.props.setRelationItemBillinfo(this.billinfo); initTemplate.call(this, this.props, this.initShow); }); }; getMultiLang({ moduleId: ['paybill', 'public'], domainName: 'arap', currentLocale: 'simpchn', callback }); } componentWillUnmount() { window.onbeforeunload=null; } getPagecode = () => { let pagecode = this.props.getUrlParam('pagecode'); if (!pagecode) { pagecode = this.props.getSearchParam('p'); } return pagecode; }; componentWillReceiveProps(nextProps) { } // 附件的关闭点击 onHideUploader = () => { this.setState({ showUploader: false }); }; componentDidMount() { } initShow = () => { if (this.props.getUrlParam('type') == 'copy') { ajax({ url: '/nccloud/arap/arappub/copy.do', data: Object.assign({ pk_bill: this.props.getUrlParam('id'), pageId: this.getPagecode(), billType: this.billType, type: 1, tradeType: this.getPagecode() },this.dataInSaga), success: (res) => { this.props.beforeUpdatePage(); //打开开关 if (res.data) { if (res.data.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); } if (res.data.body) { this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); } } setBillDef(this, this.getPagecode());//设置挂起字段默认值 this.props.resMetaAfterPkorgEdit(); this.state.buttonfalg = true; this.props.cardTable.setStatus(this.tableId, 'edit'); this.props.form.setFormStatus(this.formId, 'edit'); this.props.updatePage(this.formId, this.tableId); //关闭开关 //设置分摊字段属性 setAllocField(this); this.toggleShow(); }, error: (res) => { this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); this.props.setUrlParam({ status: 'browse' }); this.props.cardTable.setStatus(this.tableId, 'browse'); this.props.form.setFormStatus(this.formId, 'browse'); this.toggleShow(); let str = res.message; toast({ color: 'danger', content: str});; } }); } else if (this.props.getUrlParam('status') == 'edit' || this.props.getUrlParam('status') == 'browse') { ajax({ url: '/nccloud/arap/initpaybill/querycard.do', data: Object.assign({ pk_bill: this.props.getUrlParam('id') },this.dataInSaga), success: (res) => { this.props.beforeUpdatePage(); //打开开关 if (res.data) { if (res.data.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); } if (res.data.body) { this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); } } if (this.props.getUrlParam('status') == 'edit') { this.props.resMetaAfterPkorgEdit(); this.state.buttonfalg = true; this.props.form.setFormItemsValue(this.formId,{'officialprintuser':{value:null,display:null},'officialprintdate':{display:null,value:null}}) this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: true }); } else { this.state.buttonfalg = null; } let status = this.props.getUrlParam('status'); this.props.cardTable.setStatus(this.tableId, status); this.props.form.setFormStatus(this.formId, status); this.props.updatePage(this.formId, this.tableId); //关闭开关 updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); this.props.setUrlParam({ pagecode: res.data.head[this.formId].rows[0].values.pk_tradetype.value }); //设置分摊字段属性 if (this.props.getUrlParam('status') == 'edit'){ setAllocField(this); } //控制联查分摊期间按钮 ctrAllocBtn(this); this.toggleShow(); }, error: (res) => { this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); this.props.setUrlParam({ status: 'browse' }); this.props.setUrlParam({ id: null}); deleteCacheById(pkname, this.props.getUrlParam('id'), dataSource); this.props.cardTable.setStatus(this.tableId, 'browse'); this.props.form.setFormStatus(this.formId, 'browse'); this.toggleShow(); let str = res.message; toast({ color: 'danger', content: str});; } }); } else if (this.props.getUrlParam('status') == 'add') { this.initAdd(); //设置分摊字段属性 setAllocField(this); } else { this.toggleShow(); } }; //初始化新增,新增时默认值 initAdd = (isClearPKorg) => { if (!isClearPKorg) { //isClearPKorg如果未未定义等,就取值为false isClearPKorg = false; } ajax({ url: '/nccloud/arap/initpaybill/defvalue.do', data: Object.assign({ isClearPKorg: isClearPKorg, appcode: this.props.getSearchParam('c'), pageId: this.getPagecode(), tradeType: this.getPagecode() },this.dataInSaga), async:false, success: (res) => { if (res.data) { this.props.beforeUpdatePage(); //打开开关 this.props.form.EmptyAllFormValue(this.formId); this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); let cell_pk_org_v = res.data.head[this.formId].rows[0].values.pk_org_v; if (cell_pk_org_v&&cell_pk_org_v.value) { this.props.resMetaAfterPkorgEdit(); this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: false }); this.state.buttonfalg = true; } else { this.state.buttonfalg = null; this.props.initMetaByPkorg('pk_org_v'); } this.props.form.setFormStatus(this.formId, 'edit'); this.props.cardTable.setStatus(this.tableId, 'edit'); this.props.updatePage(this.formId, this.tableId); //关闭开关 this.props.cardTable.setColValue(this.tableId,'prepay', { display:this.prepay.display,value: this.prepay.value}); } //设置分摊字段属性 setAllocField(this); this.toggleShow(); }, error: (res) => {//主要控制列表进卡片抛出错误 let str = res.message; let status = this.props.getUrlParam('status'); if (status != 'browse') { this.props.setUrlParam({ status: 'browse' }); this.props.form.setFormStatus(this.formId, 'browse'); this.props.cardTable.setStatus(this.tableId, 'browse'); this.toggleShow(); } ; toast({ color: 'danger', content: str});; } }); }; //切换页面状态 toggleShow = () => { let status = this.props.getUrlParam('status'); if (!status) { status = 'browse'; } //如果未定义,默认给值浏览态 cardFieldsEditableWithProxy(this); let cardhead = {}; let head = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId).head[this.formId]; if (head) { cardhead = head.rows[0].values; } if (status != 'browse') { this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false); this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: false }); if (this.refs.tradetypeBtn && !getContext(loginContextKeys.transtype)) { this.refs.tradetypeBtn.setVisible(false); //设置交易类型是否显示 } } else { if (!(cardhead.pk_tradetype ? cardhead.pk_tradetype.value : null)) { this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false); } else { this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', true); } this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: true }); if (this.refs.tradetypeBtn && !getContext(loginContextKeys.transtype)) { this.refs.tradetypeBtn.setVisible(true); //设置交易类型是否显示 } } let trueBtn = []; //可见的按钮 let falseBtn = []; //不可见的按钮 for (let i = 0; i < this.Info.allButtonsKey.length; i++) { let flag = buttonVisible(status, cardhead, this.Info.allButtonsKey[i], 'card', this); if (flag) { trueBtn.push(this.Info.allButtonsKey[i]); } else { falseBtn.push(this.Info.allButtonsKey[i]); } } //初始化肩部按钮信息增行等按钮的控制 if (status == 'browse') { initCardBodybrowseControl(this); } else { initCardBodyEditControl(this.props, cardhead.pk_org_v ? cardhead.pk_org_v.value : null, this); } this.props.button.setButtonVisible(trueBtn, true); this.props.button.setButtonVisible(falseBtn, false); //控制单据联查期间分摊按钮显示 ctrAllocBtn(this); }; //卡片表体点击行事件 onSelected = () => { onSelectedCardBodyEditControl(this); }; //删除单据 delConfirm = () => { let id = this.props.getUrlParam('id'); let nextId = getNextId(id, dataSource); ajax({ url: '/nccloud/arap/initpaybill/delete.do', data: [ Object.assign({ pk_bill: this.props.getUrlParam('id'), ts: this.props.form.getFormItemsValue(this.formId, 'ts').value },this.dataInSaga) ], success: (res) => { //删除单据后,卡片界面显示该单据的下一个单据 //如果是最后一个单据,删除后返回list界面 if (res.success) { toast({ color: 'success', content: this.state.json['paybill-000009'] }); /* 国际化处理: 删除成功*/ deleteCacheById(pkname, id, dataSource); if (nextId) { this.props.setUrlParam({ id: nextId }); this.initShow(); } else { this.props.setUrlParam({ id: null }); this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); this.toggleShow(); } } } }); }; cancel = () => { //取消按钮 this.props.form.setFormItemsValue("allocobjrule",  { "allocobjrule": { value: '', display: '' } }); if (this.props.getUrlParam('type')) { //如果type存在就删除 this.props.delUrlParam('type'); } let pk_org_v = this.props.form.getFormItemsValue(this.formId, 'pk_org_v'); if (!pk_org_v || !pk_org_v.value || pk_org_v.value == '') { this.props.resMetaAfterPkorgEdit(); } this.props.beforeUpdatePage(); //打开开关 this.state.buttonfalg = null; if (this.props.getUrlParam('status') === 'edit') { this.props.setUrlParam({ status: 'browse' }); let id = this.props.getUrlParam('id'); let cardData = getCacheById(id, dataSource); if (cardData) { this.props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] }); this.props.cardTable.setTableData(this.tableId, cardData.body[this.tableId]); this.props.cardTable.setStatus(this.tableId, 'browse'); this.props.form.setFormStatus(this.formId, 'browse'); this.props.updatePage(this.formId, this.tableId); //关闭开关 this.toggleShow(); } else { this.initShow(); } } else if (this.props.getUrlParam('status') === 'add') { let id = this.props.getUrlParam('id'); if (!id) { id = getCurrentLastId(dataSource); } if (id) { this.props.setUrlParam({ status: 'browse', id: id }); let cardData = getCacheById(id, dataSource); if (cardData) { this.props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] }); this.props.cardTable.setTableData(this.tableId, cardData.body[this.tableId]); let pagecode = cardData.head[this.formId].rows[0].values.pk_tradetype.value; if (this.getPagecode() != pagecode) { this.props.setUrlParam({ pagecode: pagecode }); initTemplate.call(this, this.props); } this.props.cardTable.setStatus(this.tableId, 'browse'); this.props.form.setFormStatus(this.formId, 'browse'); this.props.updatePage(this.formId, this.tableId); //关闭开关 this.toggleShow(); } else { this.initShow(); } } else { this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); this.props.setUrlParam({ status: 'browse' }); this.props.cardTable.setStatus(this.tableId, 'browse'); this.props.form.setFormStatus(this.formId, 'browse'); this.props.updatePage(this.formId, this.tableId); //关闭开关 this.toggleShow(); } } this.props.cardTable.selectAllRows(this.tableId, false); this.setState({}); }; //挂起操作和取消挂起操作 pause = (url) => { let selectedData = this.props.cardTable.getCheckedRows(this.tableId); if (selectedData.length == 0) { toast({ color: 'success', content: this.state.json['paybill-000025'] }); /* 国际化处理: 请选择至少一条子表数据*/ return; } let pauseObj = []; selectedData.forEach((val) => { pauseObj.push(val.data.values.pk_payitem.value); }); let data = Object.assign({ pk_items: pauseObj, pk_bill: this.props.getUrlParam('id'), ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, pageId: this.getPagecode(), billType: this.billType },this.dataInSaga); ajax({ url: url, data: data, success: (res) => { if (res.data.message) { toast({ duration: 'infinity', color: res.data.PopupWindowStyle, content: res.data.message }); } else { toast({ color: 'success', content: this.state.json['paybill-000026'] }); /* 国际化处理: 操作成功*/ } if (res.data.billCard) { if (res.data.billCard.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.billCard.head[this.formId] }); } if (res.data.billCard.body) { this.props.cardTable.setTableData(this.tableId, res.data.billCard.body[this.tableId]); } let newCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); updateCache(pkname, this.props.getUrlParam('id'), newCardData, this.formId, dataSource); } this.onSelected(); } }); }; //保存单据 saveBill = (modelIndex) => { //删除空白行 let checkCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); delBlankLine(this, this.tableId, this.billType, checkCardData, modelIndex); this.props.form.setFormItemsValue("allocobjrule", { "allocobjrule": { value: '', display: '' } }); let result=this.props.validatePageToToast([ { name: this.formId, type: "form", }, { name: this.tableId, type: "cardTable", } ]); if(result&&!result.allPassed){ return; } let cardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); let newCardData = dealCardData(this, cardData); //去掉空值,减少压缩时间 if(checkScommet(this, cardData)) { return; } let datas = Object.assign({ cardData: newCardData, uiState: this.props.getUrlParam('status') },this.dataInSaga); let callback = () => { ajax({ url: '/nccloud/arap/initpaybill/save.do', data: datas, success: (res) => { let pk_paybill = null; let pk_tradetype = null; if (res.success) { if (res.data) { toast({ color: 'success', content: this.state.json['paybill-000010'] }); /* 国际化处理: 保存成功*/ this.props.beforeUpdatePage(); //打开开关 if (res.data.head && res.data.head[this.formId]) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); pk_paybill = res.data.head[this.formId].rows[0].values.pk_paybill.value; pk_tradetype = res.data.head[this.formId].rows[0].values.pk_tradetype.value; } if (res.data.body && res.data.body[this.tableId]) { this.props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId]); //this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); } this.state.buttonfalg = null; this.props.cardTable.setStatus(this.tableId, 'browse'); this.props.form.setFormStatus(this.formId, 'browse'); this.props.updatePage(this.formId, this.tableId); //关闭开关 let newCardData = this.props.createMasterChildData( this.getPagecode(), this.formId, this.tableId ); if (this.props.getUrlParam('status') == 'add') { addCache(pk_paybill, newCardData, this.formId, dataSource); //新增 let idObj = { id: pk_paybill, status: 1 }//1 修改 2新增 3删除 this.props.cardPagination.setCardPaginationId(idObj); } else { updateCache(pkname, pk_paybill, newCardData, this.formId, dataSource); //修改之后更新缓存 } if (this.props.getUrlParam('type')) { this.props.delUrlParam('type'); } this.props.setUrlParam({ status: 'browse', id: pk_paybill, pagecode: pk_tradetype }); this.props.cardTable.selectAllRows(this.tableId, false); } } if (this.Info.isModelSave) { this.Info.isModelSave = false; this.props.cardTable.closeModel(this.tableId); } //控制联查分摊期间按钮 ctrAllocBtn(this); this.toggleShow(); } }); }; this.props.validateToSave(datas.cardData, callback, { table1: 'cardTable' }, 'card'); }; //获取列表肩部信息 getTableHead = () => { return ( {this.props.button.createButtonApp({ area: 'card_body', buttonLimit: 3, onButtonClick: buttonClick.bind(this), popContainer: document.querySelector('.header-button-area') })} ); }; //联查处理情况按钮 handleCombined = () => { this.setState({ isCombinedExaminationModelShow: true }, () => { if (this.state.isCombinedExaminationModelShow) { this.child.modalOpen(); } else { this.child.modalClose(); } }); }; onRender = (ref) => { this.child = ref; }; //联查收付款协议 handleLinkTerm = () => { this.setState({ isLinkTermModelShow: true },() => { if (this.state.isLinkTermModelShow) { this.child2.modalOpen(); } else { this.child2.modalClose(); } }); }; onRenderTerm =(ref)=>{ this.child2 = ref; } //设置form表单ts的值 setFormTsVal = (ts) => { this.props.form.setFormItemsValue(this.formId, { ts: { value: ts } }); }; //期初弹窗控制 handlePeriodInformation = () => { this.setState({ isPeriodModelShow: !this.state.isPeriodModelShow }); this.childper.modalOpen(); }; onRenderPer = (ref) => { this.childper = ref; }; //打印 onPrint = () => { this.printData.oids = [this.props.getUrlParam('id')]; this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; // print( // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 // '/nccloud/arap/arappub/print.do', //后台服务url // this.printData // // false 去掉后支持弹出选择打印模板 // ); this.printPreviewBill(); }; //正式打印 officalPrintOutput = () => { this.printData.oids = [this.props.getUrlParam('id')]; this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; this.printData.userjson = billType+","+this.props.getSearchParam('p'); ajax({ url: '/nccloud/arap/arappub/officialPrint.do', data: this.printData, async: false, success: (res) => { if (res.success) { // print( // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 // '/nccloud/arap/arappub/print.do', //后台服务url // this.printData, // false // ); this.printPreviewBill(); if (res.data) { updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); if (res.data.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); } if (res.data.body) { this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); } } else { this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); } this.toggleShow(); } } }); }; //预览打印 printPreviewBill = () => { printPreview( this.props, '/nccloud/arap/arappub/print.do', { //billType:"F3", billtype:this.printData.billtype, funcode: this.printData.funcode, appcode: this.printData.appcode, //⼩应⽤编码 pageCode:this.props.getSearchParam('p'), nodekey: this.printData.nodekey, //模板节点标识 oids: this.printData.oids, //userjson: encodeURI(JSON.stringify({numFrom: 1,numEnd: 2})), //controlPrintNum: true, type :'1', sysType: '1', //suffx:['pdf'], realData:true, //新增项 //hideTemplate: true,//是否需要打印模板切换 //printSetting:JSON.stringify({currentNccloudPaper:{paperHeight: 210,paperId: "",paperName: this.state.json['paybill-000028'],paperWidth: 297}}), //⾃定义内容项 //formulaConfig: null, //userjson: this.printData.billtype //单据类型` }, true ) } //取消正式打印 cancelPrintOutput = () => { this.printData.oids = [this.props.getUrlParam('id')]; this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; this.printData.userjson = billType+","+this.props.getSearchParam('p'); ajax({ url: '/nccloud/arap/arappub/cancelPrint.do', data: this.printData, async: false, success: (res) => { if (res.success) { if (res.data) { updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); if (res.data.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); } if (res.data.body) { this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); } } else { this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); } this.toggleShow(); //取消正式打印提示框 toast({ color: 'success', content: this.state.json['paybill-000072'] }); } } }); }; //打印输出 printOutput = () => { this.outputData.oids = [this.props.getUrlParam('id')]; this.outputData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; this.refs.printOutput.open(); }; //输出成功回调函数 onSubmit() { } /** * 刷新 * @param */ refresh = () => { let data = Object.assign({ pk_bill: this.props.getUrlParam('id'), pageId: this.getPagecode() },this.dataInSaga); ajax({ url: '/nccloud/arap/initpaybill/querycard.do', data: data, success: (res) => { if (res.data) { if (res.data.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); } if (res.data.body) { this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); } } else { this.props.form.EmptyAllFormValue(this.formId); this.props.cardTable.setTableData(this.tableId, { rows: [] }); } this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: true }); this.toggleShow(); } }); }; //返回列表 backList = () => { this.props.pushTo('/list', { pagecode: '20080PO_LIST' }); }; //侧拉删行 modelDelRow = () => { calculateHeadMoney(this); let allVisibleRows = this.props.cardTable.getVisibleRows(this.tableId); if (!allVisibleRows || allVisibleRows.length == 0) { this.props.cardTable.closeModel(this.tableId); } }; //侧拉增行 modelAddRow = () => { if (this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value != null) { let allRowsNumber = this.props.cardTable.getNumberOfRows(this.tableId); ajax({ url: '/nccloud/arap/paybillpub/addline.do', data: this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId), success: (res) => { if (res.data) { if (res.data.head) { this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); } if (res.data.body) { this.props.cardTable.updateDataByIndexs(this.tableId, [ { index: allRowsNumber - 1, data: { status: 2, values: res.data.body[this.tableId].rows[0].values } } ]); } } } }); } else { toast({ color: 'warning', content: this.state.json['paybill-000027'] }); /* 国际化处理: 请先选择财务组织*/ } }; //整单保存事件 modelSaveClick = (a, modelIndex) => { this.dataInSaga.butncode='save'; this.Info.isModelSave = true; this.saveBill(modelIndex); }; render() { let { cardTable, form, button, modal, cardPagination } = this.props; const { createBillHeadInfo } = this.props.BillHeadInfo; let buttons = this.props.button.getButtons(); let multiLang = this.props.MutiInit.getIntl(this.moduleId); let { createForm } = form; let { createCardTable } = cardTable; const { createCardPagination } = cardPagination; let { createModal } = modal; let { showUploader, target } = this.state; return (
{createBillHeadInfo({ title: this.state.json['paybill-000028'],//国际化处理: 付款期初 backBtnClick: () => { this.backList(); } })}
{!getContext(loginContextKeys.transtype)?(
{TradeTypeButton({ ref: 'tradetypeBtn', billtype: 'F3', dataSource: dataSource, propschil:this.props, appcode: this.props.getSearchParam('c') ? this.props.getSearchParam('c') : this.props.getUrlParam('c'), pagecode: this.props.getSearchParam('p') ? this.props.getSearchParam('p') : null })}
) : null} {this.props.button.createButtonApp({ area: 'card_head', buttonLimit: 3, onButtonClick: buttonClick.bind(this), popContainer: document.querySelector('.header-button-area') })}
{createCardPagination({ handlePageInfoChange: pageInfoClick.bind(this), dataSource: dataSource })}
{createForm(this.formId, { fieldid: "initpaybill", onBeforeEvent: formBeforeEvent.bind(this), onAfterEvent: afterEvent.bind(this) })}
{createCardTable(this.tableId, { tableHead: this.getTableHead.bind(this, buttons), modelSave: this.modelSaveClick.bind(this), onAfterEvent: afterEvent.bind(this), onBeforeEvent: bodyBeforeEvent.bind(this), modelAddRow: this.modelAddRow.bind(this), modelDelRow: this.modelDelRow.bind(this), onSelected: this.onSelected.bind(this), onSelectedAll: this.onSelected.bind(this), showCheck: true, showIndex: true, adaptionHeight: true, high_selectable: { enable: true //默认为true }, // 框选 onBatchSelected: (...params) => { this.onSelected.call(this) }, onBatchChange: onBatchChange.bind(this) })}
{createModal('delete', { title: multiLang && multiLang.get('20521030-0020'), content: multiLang && multiLang.get('20521030-0006'), beSureBtnClick: this.delConfirm })} {/* {联查处理情况} */} {/* {联查收付款协议} */} {/* 单据追溯组件 */} { this.setState({ showBillTrack: false }); }} pk={this.props.getUrlParam('id')} //单据id type={ this.props.form.getFormItemsValue(this.formId, 'pk_tradetype') ? ( this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value ) : null } //单据类型 /> {showUploader && ( )} {/* {打印输出} */} {/* {导入} */} {createModal('importModal', { noFooter: true, className: 'import-modal', hasBackDrop: false })} {/**分摊模态框 */}
{createModal("allocobjrule", { fieldid: "allocobjrule", title: this.state.json['paybill-000071'],//对象分摊 size: 'sm', zIndex:270, content:
{createForm("allocobjrule", { fieldid: "allocobjrule", onAfterEvent: afterEvent.bind(this), onBeforeEvent: formBeforeEvent.bind(this) })}
, beSureBtnClick: beSureAllocation.bind(this), cancelBtnClick: cancelAllocation.bind(this) })}
); } } Card = createPage({ orderOfHotKey: [formId, tableId],//区域快捷键切换支持 mutiLangCode: '2052', })(Card); export default Card;