diff --git a/src/arap/gatheringbill/gatheringbill/card/constants.js b/src/arap/gatheringbill/gatheringbill/card/constants.js new file mode 100644 index 0000000..d4dc7f3 --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/constants.js @@ -0,0 +1,47 @@ +/*2eGyj/tqvBzCjYfe/jCZpWDRVkX2FFnRx0MwuorADYI=*/ + +/** + * 表头区域 + */ +export const formId = 'head'; + +/** + * 表体区域 + */ +export const tableId = 'bodys'; + +export const leftarea = 'left'; +/** + * 默认交易类型 + */ +export const tradeType = 'D2'; +/** + * 单据类型 + */ +export const billType = 'F2'; + +export const pkItem = 'pkItem'; + + +export const headId = 'headId'; +/** + * 默认模板节点标识 + */ +export const nodekey = 'card'; + +/** +* 单页应用缓存,命名规范为:"领域名.模块名.节点名.自定义名"。 +*/ +export const dataSource = 'fi.arap.gatheringbill.20060GBM'; + +/** + * 单页应用缓存主键名字 + */ +export const pkname = 'pk_gatherbill'; + +/** + * 列表联查页面pageId + */ +export const linkPageId = '20060GBM_LIST_LINK'; + +/*2eGyj/tqvBzCjYfe/jCZpWDRVkX2FFnRx0MwuorADYI=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/afterEvent.js b/src/arap/gatheringbill/gatheringbill/card/events/afterEvent.js new file mode 100644 index 0000000..bdd4dd3 --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/afterEvent.js @@ -0,0 +1,333 @@ +/*DncIqBreQz6WZRX+v7OzgStt3NXSdJfpHrVzjLeRcYA=*/ +import { ajax, getBusinessInfo, promptBox, toast } from 'nc-lightapp-front'; +import { currentTypeAfterFormEvents } from '../../../../public/components/pubUtils/currentTypeAfterEvent'; +import { autoAddLineKeys } from '../../../../public/components/pubUtils/billPubInfo'; +import { + checknoDisplayAfterEvent, + checktypeAfterEvent +} from '../../../../public/components/pubUtils/specialFieldAfterEvent.js'; +import { getColvalues, getRowIds } from '../../../../public/components/pubUtils/billPubUtil'; +import { formulamsgHint, renderData, headAfterEventRenderData, bodyAfterEventRenderData, errorDeal } from '../../../../public/components/afterEventPub/afterEventPubDeal'; +import { moneyAndRateFields } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js'; +import { isExistsTopBill } from '../../../../public/components/pubUtils/billPubUtil.js'; + +export default function afterEvent(props, moduleId, key, value, changedrows, i, record, g) { + if (changedrows instanceof Array) { + if (changedrows[0].newvalue.value == changedrows[0].oldvalue.value) { + return; + } + } + let pagecode = this.getPagecode(); + let index = 0; + if (moduleId == this.formId) { + index = 0; + } else if (moduleId == this.tableId) { + index = i; + } + + //表头编辑后事件 + if (moduleId == this.formId) { + let data = null + switch (key) { + case 'pk_org_v': + if (value.value == null || value.value == '') { + if (this.props.getUrlParam('type') === 'transfer') { + //转单不允许清空财务组织 + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000021'] /* 国际化处理: 确认修改*/, + content: this.state.json['gatheringbill-000080'] /* 国际化处理: 来源于上游的单据不允许清空财务组织!*/, + beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/, + noCancelBtn: true, + beSureBtnClick: () => { + this.props.form.setFormItemsValue(this.formId, { pk_org_v: changedrows }); + }, + closeByClickBackDrop: false + }); + } else { + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000021'] /* 国际化处理: 确认修改*/, + content: this.state.json['gatheringbill-000022'] /* 国际化处理: 确定​修改组织,这样会清空您录入的信息?*/, + beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.initAdd(true); + }, + cancelBtnClick: () => { + this.props.form.setFormItemsValue(this.formId, { pk_org_v: changedrows }); + }, + closeByClickBackDrop: false + }); + } + } else if (changedrows.value != null && changedrows.value != '') { + //切换组织 + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000021'] /* 国际化处理: 确认修改*/, + content: this.state.json['gatheringbill-000022'] /* 国际化处理: 确定​修改组织,这样会清空您录入的信息?*/, + beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + ajax({ + url: '/nccloud/arap/gatheringbill/cardheadafteredit.do', + data: { + pageId: pagecode, + event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value), + uiState: this.props.getUrlParam('status') + }, + async: false, + success: (res) => { + //渲染数据 + renderData(this, res); + //编辑公式提示 + formulamsgHint(this, res); + }, + error: (res) => { + errorDeal(this, res, changedrows, key); + } + }); + }, + cancelBtnClick: () => { + this.props.form.setFormItemsValue(this.formId, { pk_org_v: changedrows }); + }, + closeByClickBackDrop: false + }); + } else { + data = { + pageId: pagecode, + event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value), + uiState: this.props.getUrlParam('status') + } + headFieldAfterRequest.call(this, data, key, changedrows) + } + break; + case 'customer': + data = { + pageId: pagecode, + formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value), + colValues: getColvalues(this.props, this.tableId, ['pk_org','pk_org_v', 'payaccount', 'pk_currtype', 'customer', 'buysellflag', + 'objtype', "direction", "pk_billtype", "top_billtype", "pk_payterm", "pk_psndoc", "pk_deptid", "pk_deptid_v"].concat(moneyAndRateFields)), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + }; + headFieldAfterRequest.call(this, data, key, changedrows) + break; + case 'pk_deptid_v': + data = { + pageId: pagecode, + formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value), + colValues: getColvalues(this.props, this.tableId, ['pk_org','pk_org_v', 'pk_deptid', 'pk_deptid_v', 'pk_currtype', 'customer', 'taxtype', 'buysellflag', 'objtype', "direction"]), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + }; + headFieldAfterRequest.call(this, data, key, changedrows) + break; + case 'pk_psndoc': + data = { + pageId: pagecode, + formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value), + colValues: getColvalues(this.props, this.tableId, ['pk_org', 'pk_org_v','pk_psndoc', 'pk_deptid', 'pk_deptid_v', 'isrefused', 'prepay', 'isdiscount', 'objtype', 'direction', 'agentreceivelocal']), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + }; + headFieldAfterRequest.call(this, data, key, changedrows) + break; + case 'pk_currtype': + data = { + pageId: pagecode, + formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value), + colValues: getColvalues(this.props, this.tableId, ["pk_org",'pk_org_v',"pk_group","pk_currtype","pk_billtype","billdate","rate","grouprate","globalrate", + "buysellflag","taxprice","local_taxprice","taxrate","occupationmny","money_bal","local_money_bal", + "globalcrebit","globalnotax_cre","globaltax_cre","groupcrebit","groupnotax_cre","grouptax_cre", + "local_money_cr","local_notax_cr","local_tax_cr","money_cr","notax_cr","quantity_cr","direction","settlecurr","settlemoney"]), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + } + headFieldAfterRequest.call(this, data, key, changedrows) + //币种事件发送完要判断汇率 + currentTypeAfterFormEvents(this.formId, props, key); + break; + case 'subjcode': + data = { + pageId: pagecode, + event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value), + uiState: this.props.getUrlParam('status') + } + headFieldAfterRequest.call(this, data, key, changedrows) + this.props.form.setFormItemsValue(this.formId, { 'subjcode': { value: value.refpk, display: value.dispname } }); + break; + default: + data = { + pageId: pagecode, + event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value), + uiState: this.props.getUrlParam('status') + } + headFieldAfterRequest.call(this, data, key, changedrows) + break; + } + } + + //表体编辑后事件 + if (moduleId == this.tableId) { + //票据类型 + if (key == 'checktype') { + checktypeAfterEvent(this.props, this.tableId, key, value, i); + } + //非元数据字段,票据号 + if (key == 'checkno_display') { + checknoDisplayAfterEvent(this.props, this.tableId, key, value, i); + key = 'checkno'; + } + //科目字段特殊拼接1121\应收票据 + if(key == "subjcode"){ + this.props.cardTable.setValByKeyAndIndex(this.tableId, i, 'subjcode', { value: value.refpk, display: value.dispname }) + } + + ajax({ + url: '/nccloud/arap/gatheringbill/cardbodyafteredit.do', + data: { + rowindex: 0, + editindex: index, + pageId: pagecode, + tableId:this.tableId, + changedrows: changedrows, + body: props.cardTable.getDataByIndex(this.tableId, index), + formEvent: props.createFormAfterEventData(pagecode, this.formId, this.tableId, key, value), + uiState: this.props.getUrlParam('status') + }, + async: false, + success: (res) => { + //渲染数据 + bodyAfterEventRenderData(this, res); + + if (this.props.getUrlParam('type') == 'transfer') { + this.synTransferData(); + } + //表体改变表头税率编辑性 + if (i == 0 && key == 'pk_currtype') { + currentTypeAfterFormEvents(this.formId, props, 'pk_currtype'); + } + //编辑公式提示 + formulamsgHint(this, res); + }, + error: (res) => { + let str = res.message; + if (str.substring(0,16) == 'convertException') { + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000000'] /* 国际化处理: 折算误差*/, + content: str.substring(16, str.length), + closeByClickBackDrop: false, + beSureBtnClick: () => { + afterTableEvent(this, props, i, pagecode, moduleId, key, changedrows, 'sure', index, value); + }, + cancelBtnClick: () => { + afterTableEvent(this, props, i, pagecode, moduleId, key, changedrows, 'cancel', index, value); + } + }); + } else { + this.props.cardTable.setValByKeyAndRowId(this.tableId, i, key, changedrows); + toast({ color: 'danger', content: str});; + } + } + }); + + //自动增行 + autoAddline.call(this, moduleId, pagecode, key, i) + } + + +} + +function afterTableEvent(that, props, i, pagecode, moduleId, key, changedrows, isCalculateConvert, index, value) { + ajax({ + url: '/nccloud/arap/gatheringbill/cardbodyafteredit.do', + data: { + rowindex: 0, + editindex: index, + pageId: pagecode, + changedrows: changedrows, + tableId:that.tableId, + body: props.cardTable.getDataByIndex(that.tableId, index), + formEvent: props.createFormAfterEventData(pagecode, that.formId, that.tableId, key, value), + uiState: that.props.getUrlParam('status'), + isCalculateConvert: isCalculateConvert + }, + async: false, + success: (res) => { + //渲染数据 + bodyAfterEventRenderData(that, res); + if (that.props.getUrlParam('type') == 'transfer') { + that.synTransferData(); + } + //表体改变表头税率编辑性 + if (i == 0 && key == 'pk_currtype') { + currentTypeAfterFormEvents(that.formId, props, 'pk_currtype'); + } + //编辑公式提示 + formulamsgHint(that, res); + + } + }); +} + +export function headFieldAfterRequest(requestData, key, changedrows) { + ajax({ + url: '/nccloud/arap/gatheringbill/cardheadafteredit.do', + data: requestData, + async: false, + success: (res) => { + //渲染数据 + headAfterEventRenderData(this, res); + + if (key == 'pk_org_v') { + let pk_org = this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value; + if (pk_org) { + this.props.resMetaAfterPkorgEdit(); + this.state.buttonfalg = true; + } else { + this.state.buttonfalg = null; + } + this.toggleShow(); + } + if (this.props.getUrlParam('type') == 'transfer') { + this.synTransferData(); + } + //编辑公式提示 + formulamsgHint(this, res); + + }, + error: (res) => { + errorDeal(this, res, changedrows, key); + } + }); +} + +export function autoAddline(moduleId, pagecode, key, i) { + //自动增行 + let allRowsNumber = this.props.cardTable.getNumberOfRows(this.tableId); + if (moduleId == this.tableId && allRowsNumber == i + 1 && autoAddLineKeys.indexOf(key) != -1 && !isExistsTopBill(this)) { + let data = this.props.createMasterChildData(pagecode, this.formId, this.tableId); + //清空cardData的表体 + data.body[this.tableId].rows = []; + ajax({ + url: '/nccloud/arap/gatheringbill/addline.do', + data: data, + async: false, + 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.addRow(this.tableId, allRowsNumber, res.data.body[this.tableId].rows[0].values, false); + } + } + } + }); + } +} +/*DncIqBreQz6WZRX+v7OzgStt3NXSdJfpHrVzjLeRcYA=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/buttonClick.js b/src/arap/gatheringbill/gatheringbill/card/events/buttonClick.js new file mode 100644 index 0000000..00ab4ed --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/buttonClick.js @@ -0,0 +1,707 @@ +/*q2LCmxM8POvl78IL0LiydqEO8dlmkDpbQUH9Mtm5EjY=*/ +import { ajax, base, toast, cacheTools, createPage, print, cardCache, promptBox } from 'nc-lightapp-front'; +import { headButton, bodyButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { + calculateHeadMoney, + delLine, + copyLine, + pasteLine, + pasteToEndLine, + generate +} from '../../../../public/components/pubUtils/billPubUtil.js'; +import { getTransferInfo } from '../../../../public/components/pubUtils/transferButtonUtil.js'; +import { imageScan, imageView } from 'sscrp/rppub/components/image'; +import { tableId, formId, billType, dataSource, pkname } from '../constants'; +import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.js'; +import initTemplate from './initTemplate'; +import { BodyVerify, WholeVerify } from '../../../../public/components/pubUtils/arapVerifyCheck'; +import arapLinkReport from '../../../../public/components/arapBillLinkReport.js'; +import linkvouchar from '../../../../public/components/linkvouchar.js'; +import madeBill from '../../../../public/components/madeBill.js'; +import { copyBill } from '../../../../public/components/pubUtils/CopyBill/arapCopyBill'; +import { loginContext, getContext, loginContextKeys } from '../../../../public/components/arapInitInfo/loginContext'; +import { moduleEnable, IMAG, SSCIVM } from '../../../../public/components/moduleEnable.js'; +import {throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js'; + + +let { getDefData, setDefData, updateCache, deleteCacheById } = cardCache; + +export default function (props, id) { + let code = getContext(loginContextKeys.transtype); + let pagecode = this.getPagecode(); + this.dataInSaga.butncode=id; + switch (id) { + case headButton.Refund://退款 + ajax({ + url: '/nccloud/arap/arappub/refund.do', + data:Object.assign( { + pk_bill: this.props.getUrlParam('id'), + pageId: this.getPagecode(), + billType: this.billType + },this.dataInSaga), + success: (result) => { + toast({ color: 'success', title: "退款成功" }); + refreshBill.call(this, result) + } + }); + break; + case headButton.CancelRefund://取消退款 + ajax({ + url: '/nccloud/arap/arappub/cancelrefund.do', + data:Object.assign( { + pk_bill: this.props.getUrlParam('id'), + pageId: this.getPagecode(), + billType: this.billType + },this.dataInSaga), + success: (result) => { + toast({ color: 'success', title: "取消退款成功" }); + refreshBill.call(this, result) + } + }); + break; + case headButton.Generate://生成 + generate(this) + break; + case headButton.Commit: //提交 + this.Info.tipUrl = '/nccloud/arap/arappub/commit.do'; + this.commitAndUncommit(); + break; + case headButton.Uncommit: //收回 + this.Info.tipUrl = '/nccloud/arap/arappub/uncommit.do'; + this.commitAndUncommit(); + break; + case headButton.LinkAprv: //审批详情 + this.setState({ showApproveDetail: true }); + break; + case headButton.Save: //保存 + this.saveBill('/nccloud/arap/arappub/save.do'); + break; + case headButton.TempSave: //暂存 + let org = this.props.form.getFormItemsValue(formId, 'pk_org_v').value; + if (!org) { + toast({ + color: 'warning', + content: this.state.json['gatheringbill-000025'] + }); /* 国际化处理: 财务组织为空,不能操作单据!*/ + return; + } + this.saveBill('/nccloud/arap/arappub/tempsave.do'); + break; + case headButton.SaveAndCommit: + this.saveBill('/nccloud/arap/arappub/saveandcommit.do'); + break; + case headButton.Add: + pagecode = getDefData('sessionTradeType', dataSource); + if (code) { + pagecode = code; + } else if (!pagecode) { + pagecode = this.getPagecode(); + } + //缓存中的交易类型和链接中交易类型不一样的话,重新加载模板 + if (pagecode != this.getPagecode()) { + props.setUrlParam({ status: 'add', pagecode: pagecode }); + initTemplate.call(this, this.props); + } else { + props.setUrlParam({ status: 'add', pagecode: pagecode }); + } + this.initAdd(); + break; + case headButton.Edit: + cardBillEdit.call(this) + break; + case headButton.Copy: + copyBill(this, this.getPagecode()); + break; + case headButton.Delete: + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000005'] /* 国际化处理: 删除*/, + content: this.state.json['gatheringbill-000006'] /* 国际化处理: ​确定要删除吗?*/, + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/, + beSureBtnClick: this.delConfirm + }); + break; + case headButton.Cancel: + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/, + content: this.state.json['gatheringbill-000003'] /* 国际化处理: ​确定要取消吗?*/, + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/, + beSureBtnClick: this.cancel + }); + break; + case headButton.Pausetrans: //挂起操作 + this.pause('/nccloud/arap/arappub/pause.do'); + break; + case headButton.Cancelpause: //取消挂起操作 + this.pause('/nccloud/arap/arappub/cancelpause.do'); + break; + //预收付 + case headButton.PrePay: + let prePayDatas = this.props.cardTable.getCheckedRows(this.tableId); + if (prePayDatas.length == 0) { + toast({ color: 'warning', content: this.state.json['gatheringbill-000028'] }); /* 国际化处理: 请选择表体行!*/ + return; + } + let prePayDatasObj = []; + prePayDatas.forEach((val) => { + prePayDatasObj.push(val.data.values.pk_gatheritem.value); + }); + let prePayDatasdata = { + pk_items: prePayDatasObj, + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + pageId: this.getPagecode(), + billType: this.billType + }; + ajax({ + url: '/nccloud/arap/arappub/prepay.do', + data:Object.assign(prePayDatasdata,this.dataInSaga) , + success: (res) => { + toast({ color: 'success', content: this.state.json['gatheringbill-000029'] }); /* 国际化处理: 预收付成功*/ + + 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]); + } + } + let newCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + updateCache(pkname, this.props.getUrlParam('id'), newCardData, this.formId, dataSource); + this.onSelected(); + } + }); + break; + case headButton.RedBack: //红冲操作 + let writebackData = { + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + pageId: this.getPagecode(), + billType: this.billType, + tradeType: this.getPagecode() + }; + ajax({ + url: '/nccloud/arap/arappub/redback.do', + data:Object.assign(writebackData,this.dataInSaga), + success: (res) => { + this.props.beforeUpdatePage(); //打开开关 + 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]); + // this.props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId]) + } + props.setUrlParam({ status: 'add', id: this.props.getUrlParam('id'), type: 'redBack' }); + this.state.buttonfalg = true; + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: true }); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + this.toggleShow('',res); + this.props.button.setButtonVisible([headButton.TempSave], false); + } + }); + break; + case headButton.LinkConfer: //联查协同单据 + ajax({ + url: '/nccloud/arap/arappub/linkconfer.do', + async: false, + data:Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + billType: this.billType + },this.dataInSaga), + success: (res) => { + let data = res.data; + if (data) { + props.openTo(data.url, data.condition); + } + } + }); + break; + case headButton.LinkTbb: //联查计划预算 + ajax({ + url: '/nccloud/arap/arappub/linktbb.do', + data:Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + billType: this.billType + },this.dataInSaga), + success: (res) => { + if (res.success) { + this.Info.tbbLinkSourceData = res.data; + this.setState({ + isTbbLinkshow: true + }); + } + } + }); + break; + case headButton.LinkBal: //联查余额表 + arapLinkReport( + this.props, + this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + this.billType, + this.props.form.getFormItemsValue(this.formId, 'objtype').value + ); + break; + case headButton.MadeBill: //制单 + let madeData = [ + { + pk_bill: props.form.getFormItemsValue(formId, 'pk_gatherbill').value, + billType: this.billType, + tradeType: props.form.getFormItemsValue(formId, 'pk_tradetype').value + } + ]; + madeBill(this, props, madeData, '', props.getSearchParam('c')); + break; + case headButton.LinkVouchar: //联查凭证 + linkvouchar( + this, + props, + this.props.form.getAllFormValue(this.formId), + this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + this.props.getSearchParam('c') + ); + break; + case headButton.LinkDeal: //联查处理情况 + ajax({ + url: '/nccloud/arap/arappub/linkdeal.do', + data:Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + billType: this.billType + },this.dataInSaga), + success: (res) => { + if (res.success) { + //打开处理情况模态框 + let data = res.data; + this.Info.combinedExaminationData = data; + this.handleCombined(); + } + } + }); + break; + case headButton.LinkSettleInfo: //联查结算信息 + ajax({ + url: '/nccloud/arap/arappub/linksettleinfo.do', + data: Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + billType: this.billType + },this.dataInSaga) , + success: (res) => { + let { success, data } = res; + if (success) { + props.openTo('/nccloud/resources/cmp/settlementmanagement/settlement/main/index.html#/card', { + status: 'browse', + srcid: props.form.getFormItemsValue(formId, 'pk_gatherbill').value, + src: '2006', + appcode: '360704SM', + pagecode: '360704SM_C01' + }); + } + } + }); + break; + case headButton.ConnectSettleInfo: //关联结算信息 + ajax({ + url: '/nccloud/arap/arappub/validatecmp.do', + async: false, + data: null, + success: (res) => { + if (res.success) { + pagecode = getDefData('sessionTradeType', dataSource); + if (code) { + pagecode = code; + } else if (!pagecode) { + pagecode = this.getPagecode(); + } + props.openTo('/nccloud/resources/cmp/settlementmanagement/settlepublic/list/index.html', { + appcode: '360704SM', + pagecode: '360704SMP_L01', + callbackappcode: props.getSearchParam('c'), + callbackpagecode: pagecode, + src: 0, + callback: '/nccloud/resources/arap/gatheringbill/gatheringbill/main/index.html#/card' + }); + } + } + }); + + break; + case headButton.LinkInformer: //到账通知 + ajax({ + url: '/nccloud/arap/arappub/linkinformer.do', + data: Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value, + billType: this.billType + },this.dataInSaga), + success: (res) => { + if (res.success && res.data) { + let length = res.data.length; + if (length == 1) { + props.openTo('/nccloud/resources/cmp/informer/LinkBill/card/index.html', { + appcode: '36070AISC', + pagecode: '36070AILLINK', + status: 'browse', + id: res.data + }); + } else { + props.openTo('/nccloud/resources/cmp/informer/LinkBill/list/index.html', { + appcode: '36070AISC', + pagecode: '36070AICLINK', + status: 'browse', + ids: res.data + }); + } + } + } + }); + break; + case headButton.BillLinkQuery: //联查单据 + this.setState({ showBillTrack: true }); + break; + case headButton.Refresh: //刷新 + ajax({ + url: '/nccloud/arap/arappub/cardRefresh.do', + data: Object.assign({ + pk_bill: this.props.getUrlParam('id'), + pageId: this.getPagecode(), + billType: this.billType + },this.dataInSaga), + success: (res) => { + if (res.data) { + toast({ color: 'success', title: this.state.json['gatheringbill-000078'] }); /* 国际化处理: 刷新成功*/ + 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('',res); + throwSagaErrorAgency.call(this,res) + }, + error: (res) => { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + deleteCacheById(pkname, this.props.getUrlParam('id'), dataSource); + this.toggleShow(); + let str = res.message; + toast({ color: 'danger', content: str }); + } + }); + break; + //表体肩部的按钮操作 + case bodyButton.AddLine: + if (this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value != null) { + let rowNum = props.cardTable.getNumberOfRows(this.tableId); + ajax({ + url: '/nccloud/arap/gatheringbill/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.addRow( + this.tableId, + rowNum, + res.data.body[this.tableId].rows[0].values + ); + } + } + } + }); + } + break; + case headButton.BodyVerify: //按表体核销 + BodyVerify(props, this.formId, this.tableId, 'pk_gatherbill', 'pk_gatheritem', this); + break; + case headButton.WholeVerify: //按整单核销 + WholeVerify(props, this.formId, this.tableId, 'pk_gatherbill', this); + break; + case headButton.ReceiptCheck: //影像查看pk_tradetype + if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用 + return; + } + if (props.getUrlParam('status') == 'add') { + toast({ color: 'warning', content: this.state.json['gatheringbill-000030'] }); /* 国际化处理: 单据未暂存!*/ + return; + } + // let pk_tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value + // let showData = props.createMasterChildData(pk_tradetype, formId, tableId); + // let openShowbillid = props.getUrlParam('id'); + // imageView(showData, openShowbillid, pk_tradetype, 'iweb'); + var billInfoMap = {}; + + //基础字段 单据pk,单据类型,交易类型,单据的组织 + billInfoMap.pk_billid = props.getUrlParam('id'); + billInfoMap.pk_billtype = this.props.form.getFormItemsValue(this.formId, 'pk_billtype').value; + billInfoMap.pk_tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + billInfoMap.pk_org = this.props.form.getFormItemsValue(this.formId, 'pk_org').value; + imageView(billInfoMap, 'iweb'); + + break; + case headButton.ReceiptScan: //影像扫描 + if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用 + return; + } + if (props.getUrlParam('status') == 'add') { + toast({ + color: 'warning', + content: this.state.json['gatheringbill-000031'] + }); /* 国际化处理: 请先 <暂存> 单据再扫描影像!*/ + return; + } + let tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + let allData = props.createMasterChildData(tradetype, formId, tableId); + // let openbillid = props.getUrlParam('id'); + // imageScan(allData, openbillid, tradetype, 'iweb'); + + var billInfoMap = {}; + //基础字段 单据pk,单据类型,交易类型,单据的组织 + billInfoMap.pk_billid = props.getUrlParam('id'); + billInfoMap.pk_billtype = allData.head.head.rows[0].values.pk_billtype.value; + billInfoMap.pk_tradetype = allData.head.head.rows[0].values.pk_tradetype.value; + billInfoMap.pk_org = allData.head.head.rows[0].values.pk_org.value; + + //影像所需 FieldMap + billInfoMap.BillType = allData.head.head.rows[0].values.pk_tradetype.value; + billInfoMap.BillDate = allData.head.head.rows[0].values.creationtime.value; + billInfoMap.Busi_Serial_No = allData.head.head.rows[0].values.pk_gatherbill.value; + billInfoMap.pk_billtype = allData.head.head.rows[0].values.pk_billtype.value; + billInfoMap.OrgNo = allData.head.head.rows[0].values.pk_org.value; + billInfoMap.BillCode = allData.head.head.rows[0].values.billno.value; + billInfoMap.OrgName = allData.head.head.rows[0].values.pk_org_v.display; + billInfoMap.Cash = allData.head.head.rows[0].values.money.value; + + imageScan(billInfoMap, 'iweb'); + + break; + case headButton.AttachManage: + let flag = props.getUrlParam('status'); + if (flag == 'add' || props.getUrlParam('type') == 'copy' || props.getUrlParam('type') == 'redBack') { + toast({ color: 'warning', content: this.state.json['gatheringbill-000032'] }); /* 国际化处理: 请保存后再进行上传附件!*/ + return; + } + this.setState({ + showUploader: true, + target: null + }); + break; + case 'Print': //打印 + this.onPrint(); + break; + case headButton.Output: //打印输出 + this.printOutput(); + break; + case headButton.OfficalPrint: //正式打印 + this.officalPrintOutput(); + break; + case headButton.CancelPrint: //取消正式打印 + this.cancelPrintOutput(); + break; + case headButton.ExportData: //导出 + if(this.state.forceRender){ + this.setState({forceRender: false}) + } + let outbillid = props.getUrlParam('id'); + let pk_bills = []; + pk_bills.push(outbillid); + this.Info.selectedPKS = pk_bills; //传递主键数组,之前nc需要导出的加主键 + this.props.modal.show('exportFileModal'); //不需要导出的只执行这行代码 + break; + + //下面是肩部按钮 + case bodyButton.DelLine: //删除行 + delLine(this); + //删行之后控制肩部按钮 + this.onSelected(); + break; + case bodyButton.CopyLine: //复制行 + if (copyLine(this, dataSource)) { + this.setState( + { + buttonfalg: false + }, + () => { + cardBodyControl(props, this.state.buttonfalg, this); + } + ); + } + break; + case bodyButton.PasteLine: //粘贴行 + pasteLine(this); + break; + case bodyButton.PasteToEndLine: //粘贴行到末尾 + pasteToEndLine(this, dataSource); + break; + case bodyButton.CancelLine: //行取消 + this.setState( + { + buttonfalg: true + }, + () => { + cardBodyControl(props, this.state.buttonfalg, this); + } + ); + //取消之后控制肩部按钮 + this.onSelected(); + break; + + default: + let transferInfo = getTransferInfo(this, id); + if (transferInfo) { + ajax({ + url: '/nccloud/arap/arappub/queryrelatedapp.do', + data: { + billType: transferInfo.src_billtype + }, + success: (res) => { + if (res) { + //将业务流程放入缓存 + setDefData( + transferInfo.src_billtype + transferInfo.transtypes[0], + 'transfer.dataSource', + transferInfo.busitypes + ); + let dest_tradetype = getDefData('sessionTradeType', dataSource); + if (code) { + dest_tradetype = code; + } else if (!dest_tradetype) { + dest_tradetype = this.getPagecode(); + } + let url = '/' + transferInfo.src_billtype; + props.pushTo(url, { + src_appcode: res.data.appcode, //来源小应用编码 + src_tradetype: transferInfo.transtypes[0], //来源交易类型 + dest_billtype: this.billType, //目的单据类型 + dest_tradetype: dest_tradetype //目的交易类型 + }); + } + } + }); + } + break; + } +} +export function refreshBill(res) { + let that = this + if (res.data) { + updateCache(pkname, that.props.getUrlParam('id'), res.data, that.formId, dataSource); + if (res.data.head) { + that.props.form.setAllFormValue({ [that.formId]: res.data.head[that.formId] }); + } + if (res.data.body) { + that.props.cardTable.setTableData(that.tableId, res.data.body[that.tableId]); + } + } else { + that.props.form.EmptyAllFormValue(that.formId); + that.props.cardTable.setTableData(that.tableId, { rows: [] }); + } + that.toggleShow('',res); +} + +export function cardBillEdit(){ + this.props.cardTable.selectAllRows(this.tableId, false); + let sceneType = 0; + let scene = this.props.getUrlParam('scene'); + //获取单据编号 + let djbh = this.props.form.getFormItemsValue(this.formId, 'billno').value; + let canEdit = true; + //来源于审批中心 + if (scene == 'approve' || scene == 'approvesce') { + sceneType = 1; + //判断单据是否是当前用户待审批 + ajax({ + url: '/nccloud/riart/message/list.do', + async: false, + data: { + billno: djbh, + isread: 'N' + }, + success: (result) => { + if (result.data) { + if (result.data.total < 1) { + toast({ + content: this.state.json['gatheringbill-000026'], + color: 'warning' + }); /* 国际化处理: 当前单据已审批,不可进行修改操作!*/ + canEdit = false; + } + } + } + }); + } + //来源于我的作业 + if (scene == 'zycl') { + sceneType = 2; + //判断单据是否是当前用户待处理 + ajax({ + url: '/nccloud/ssctp/sscbd/SSCTaskHandlePendingNumAction.do', + async: false, + data: { + billno: djbh + }, + success: (result) => { + if (result.data) { + if (result.data.total < 1) { + toast({ + content: this.state.json['gatheringbill-000027'], + color: 'warning' + }); /* 国际化处理: 当前单据已处理,不可进行修改操作!*/ + canEdit = false; + } + } + } + }); + } + if (!canEdit) { + return; + } + let editData = { + pk_bill: this.props.getUrlParam('id'), + billType: this.billType, + sence: sceneType + }; + ajax({ + url: '/nccloud/arap/arappub/edit.do', + data: editData, + success: (res) => { + if (res.success) { + this.props.setUrlParam({ status: 'edit' }); + this.state.buttonfalg = true; + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + this.props.resMetaAfterPkorgEdit(); + if(res.data && res.data.head){ + this.props.form.setFormItemsDisabled(this.formId, res.data.head); + this.headBack = res.data.headBack + } + if(res.data && res.data.body){ + this.props.cardTable.setColEditableByKey(this.tableId, res.data.body, true) + this.bodyBack = res.data.body + } + if(this.headBack && !res.data){ + this.props.form.setFormItemsDisabled(this.formId, this.headBack); + this.props.cardTable.setColEditableByKey(this.tableId, this.bodyBack, false) + } + this.props.form.setFormItemsDisabled(this.formId, { pk_org: true }); + this.toggleShow('',res); + } + } + }); +} +/*q2LCmxM8POvl78IL0LiydqEO8dlmkDpbQUH9Mtm5EjY=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/index.js b/src/arap/gatheringbill/gatheringbill/card/events/index.js new file mode 100644 index 0000000..08e2739 --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/index.js @@ -0,0 +1,9 @@ +/*5pvMnolyoe65qServnBDiMmMgcFfD43ix8UG2eBl8gI=*/ +import buttonClick from './buttonClick'; +import initTemplate from './initTemplate'; +import afterEvent from './afterEvent'; +import pageInfoClick from './pageInfoClick'; +import transferButtonClick from './transferButtonClick'; +export { buttonClick, afterEvent, initTemplate, pageInfoClick, transferButtonClick }; + +/*5pvMnolyoe65qServnBDiMmMgcFfD43ix8UG2eBl8gI=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/initTemplate.js b/src/arap/gatheringbill/gatheringbill/card/events/initTemplate.js new file mode 100644 index 0000000..1a0cfb0 --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/initTemplate.js @@ -0,0 +1,164 @@ +/*pmFWCFu5nhKkBzYmrkBakU94XhcN/7MP6yCIMRM7Oek=*/ +import { base, ajax, cacheTools, cardCache, toast, excelImportconfig } from 'nc-lightapp-front'; +let { NCPopconfirm } = base; +import tableButtonClick from './tableButtonClick'; +import { tableId, formId, billType, tradeType, dataSource } from '../constants'; +import { buttonVisible, getButtonsKey, getInnerButtonkey, cardBodyAndInnerButtonVisible } from '../../../../public/components/pubUtils/buttonvisible.js'; +import { loginContext, getContext, loginContextKeys } from '../../../../public/components/arapInitInfo/loginContext'; +import {OperationColumn} from '../../../../public/components/pubUtils/arapConstant'; +let { setDefData, getDefData } = cardCache; + +export default function (props,callback) { + const that = this; + //从地址栏获取页面编码 + let appcode = this.props.getSearchParam('c'); + let pagecode = that.getPagecode(); + + if (this.props.getUrlParam('srcbilltype')) { + //处理外系统推单,改变appcode、pagecode + dealOutToGather.call(this, props, appcode, pagecode) + }else { + init(that, props, appcode, pagecode,callback); + } + +} + +function init(that, props, appcode, pagecode,callback) { + let excelimportconfig = excelImportconfig(props, "arap", billType,true,"",{"appcode":appcode,"pagecode":that.getExportPageCode()}); + let tradetype = pagecode + props.createUIDom( + { + pagecode: pagecode,//页面id + appcode: appcode,//注册按钮的id + reqDataQueryallbtns: { + rqUrl: '/arap/arappub/queryallbtns.do', + rqJson: `{\n \"pagecode\": \"${pagecode}\",\n \"appcode\": \"${appcode}\"\n,\n \"billtype\": \"${billType}\"\n,\n \"tradetype\": \"${tradetype}\"\n}`, + rqCode: 'button' + }, + reqDataQuerypage: { + rqUrl: '/arap/arappub/querypage.do', + rqJson: `{\n \"pagecode\": \"${pagecode}\",\n \"appcode\": \"${appcode}\"\n}`, + rqCode: 'template' + } + }, + function (data) { + if (data) { + if(!data.template[tableId]){ + return; + } + if (data.template) { + let meta = data.template; + meta = modifierMeta(that, props, meta); + props.meta.setMeta(meta); + } + if (data.button && data.button.button) { + let button = data.button.button; + let pullBillInfoVOAry = data.button.pullbillinfo; + getButtonsKey(button, that.Info.allButtonsKey);//保存所有头部和肩部按钮 + that.Info.pullBillInfoVOAry = pullBillInfoVOAry; + props.button.setButtons(button); + props.button.setUploadConfig("ImportData", excelimportconfig); + } + if(callback){ + callback(); + } + if (data.context) { + // 初始化上下文变量 + loginContext(data.context); + if(getContext(loginContextKeys.transtype)){ + if (that.refs.tradetypeBtn) { + that.refs.tradetypeBtn.setVisible(false); + } + } + } + } + }//, + //false//请求模板不走缓存 + ) +} + +function modifierMeta(that, props, meta) { + let status = props.getUrlParam('status'); + meta[formId].status = status; + meta[tableId].status = status; + + //添加操作列 + meta[tableId].items.push({ + label: that.state.json['gatheringbill-000007'],/* 国际化处理: 操作*/ + itemtype: 'customer', + attrcode: 'opr', + width: OperationColumn, + visible: true, + fixed: 'right', + render: (text, record, index) => { + let trueBtn = cardBodyAndInnerButtonVisible(that, that.state.buttonfalg, record.expandRowStatus); + return props.button.createOprationButton(trueBtn, { + area: "card_inner", + buttonLimit: 3, + onButtonClick: (props, key) => tableButtonClick(that, props, key, text, record, index) + }); + } + }); + + return meta; +} + + + + + +//处理外系统推收款单 +export function dealOutToGather(props, appcode, pagecode) { + let url = ""; + let data = {}; + let srcbilltype = this.props.getUrlParam('srcbilltype') + //销售订单推收款单 + if (srcbilltype == '30') {//销售订单订单收款 + url = "/nccloud/arap/gatheringbill/saleordertogather.do", + data = { + pk_bill: this.props.getUrlParam('csaleorderid'), + pageId: pagecode + } + } else if (srcbilltype == 'FCT2') {//收款合同收款 + url = "/nccloud/arap/gatheringbill/fct2togatherbill.do", + data = { + pk_bills: cacheTools.get('fct2ToF2Pks'), + pageId: pagecode + } + } else if (srcbilltype == '35') {//客户费用单推收款单 + url = "/nccloud/arap/gatheringbill/arsubtogatherbill.do", + data = { + pk_bills: cacheTools.get('arsubToF2Pks'), + pageId: pagecode + } + } else if (srcbilltype == 'Z3') {//销售合同推收款单 + url = "/nccloud/arap/gatheringbill/cttogatherbill.do", + data = { + pk_bills: cacheTools.get('CtToF2Pks'), + pageId: pagecode + } + }else if(srcbilltype == '36H1'){ //资金收票登记推收款单 + url = "/nccloud/arap/gatheringbill/cmH1togatherbill.do", + data = { + pk_bills: cacheTools.get('H1ToF2Pks'), + pageId: pagecode + } + } + ajax({ + url: url, + data: data, + success: (res) => { + if (res.data) { + pagecode = res.data.head[this.formId].rows[0].values.pk_tradetype.value; + this.data = res.data + init(this, props, appcode, pagecode, this.initShow) + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + toast({ color: 'danger', content: this.state.json['gatheringbill-000033'] });/* 国际化处理: 数据异常,请重新操作!*/ + } + } + }) +} + +/*pmFWCFu5nhKkBzYmrkBakU94XhcN/7MP6yCIMRM7Oek=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/pageInfoClick.js b/src/arap/gatheringbill/gatheringbill/card/events/pageInfoClick.js new file mode 100644 index 0000000..143878f --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/pageInfoClick.js @@ -0,0 +1,67 @@ +/*j07c8riwYnz20MYibuDbtFEGG3gwYuu5zMz1TEQetJM=*/ +import { ajax, cardCache } from 'nc-lightapp-front'; +import { formId, billType, dataSource, pkname } from '../constants'; +import initTemplate from './initTemplate'; +import {throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js'; +let { getCacheById, updateCache, setDefData } = cardCache; + +export default function (props, pk) { + if(!pk){//如果刷新了浏览器,那么pk将不会存在,如果pk不存在,return + return; + } + let cardData = getCacheById(pk, dataSource); + let tradeType = this.getPagecode(); + if (cardData) { + if(!props.getUrlParam("scene")){ + let pagecode = cardData.head[this.formId].rows[0].values.pk_tradetype.value; + props.setUrlParam({id:pk,pagecode:pagecode}) + //点击上一张下一张单据时,要将单据的交易类型放入缓存(和切换交易类型一致),下次点击新增自制时,取缓存中的交易类型 + setDefData('sessionTradeType', dataSource, pagecode); + if(tradeType !=pagecode){ + initTemplate.call(this, this.props); + } + } else{ + props.setUrlParam({id:pk}) + } + props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] }); + props.cardTable.setTableData(this.tableId, cardData.body[this.tableId],null, null, true); + this.toggleShow('',cardData); + throwSagaErrorAgency.call(this,cardData) + } else { + let data = { + pk_bill: pk + }; + ajax({ + url: '/nccloud/arap/gatheringbill/cardquery.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],null, null, true); + } + updateCache(pkname, pk, res.data, this.formId, dataSource); + if(!props.getUrlParam("scene")){ + let pagecode = res.data.head[formId].rows[0].values.pk_tradetype.value; + props.setUrlParam({id:pk,pagecode:pagecode}) + setDefData('sessionTradeType', dataSource, pagecode); + if(tradeType !=pagecode){ + initTemplate.call(this, this.props); + } + }else{ + props.setUrlParam({id:pk}) + } + this.toggleShow('',res); + throwSagaErrorAgency.call(this,res) + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + } + } + }); + } +} + +/*j07c8riwYnz20MYibuDbtFEGG3gwYuu5zMz1TEQetJM=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/tableButtonClick.js b/src/arap/gatheringbill/gatheringbill/card/events/tableButtonClick.js new file mode 100644 index 0000000..e2bfd64 --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/tableButtonClick.js @@ -0,0 +1,75 @@ +/*0GI1xcoeligdpMeXoHBphvFV/InrTFFpynAq7re5K1A=*/ +import { ajax, base, toast, cardCache } from 'nc-lightapp-front'; +import { tableId, dataSource, formId } from '../constants'; +import { innerButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { copyInner, resetBodyPk, clearTopInfos, calculateHeadMoney, deleteInner, pasteInner } from '../../../../public/components/pubUtils/billPubUtil.js'; +import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.js'; +import { modifyChecknoItemtype } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js'; +let { getDefData, setDefData } = cardCache; +export default function (that, props, key, text, record, index) { + + switch (key) { + // 表格操修改 + case innerButton.open_browse: + props.cardTable.toggleRowView(tableId, record); + break; + case innerButton.Close_browse: + props.cardTable.toggleRowView(tableId, record); + break; + case innerButton.open_edit: + let ishideAdd = false + let cardData = that.props.createMasterChildData(that.getPagecode(), that.formId, that.tableId); + if(cardData && cardData.body && cardData.body[that.tableId] && cardData.body[that.tableId].rows){ + let bodyrows= cardData.body[that.tableId].rows; + for(let i=0;i { + cardBodyControl(props, that.state.buttonfalg); + }) + break; + case innerButton.Insert_inner: + let data = props.createMasterChildData(that.getPagecode(), formId, tableId); + //清空cardData的表体 + data.body[tableId].rows = []; + ajax({ + url: '/nccloud/arap/gatheringbill/addline.do', + data: data, + success: (res) => { + if (res.data && res.data.body) { + props.cardTable.addRow(tableId, index + 1, res.data.body[tableId].rows[0].values); + } else { + props.cardTable.addRow(tableId); + } + } + }); + break; + case innerButton.Delete_inner: + deleteInner(that, props, tableId, index); + //删行之后控制肩部按钮 + that.onSelected(); + break; + case innerButton.Paste_inner: + pasteInner(that, props, dataSource, tableId, index) + break; + default: + break; + } +}; + +/*0GI1xcoeligdpMeXoHBphvFV/InrTFFpynAq7re5K1A=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/events/transferButtonClick.js b/src/arap/gatheringbill/gatheringbill/card/events/transferButtonClick.js new file mode 100644 index 0000000..00e3632 --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/events/transferButtonClick.js @@ -0,0 +1,176 @@ +/*Zqktha8lwfXAWZRCgtFOTBGsch2yo65lKMwOc6Hai+A=*/ +import { ajax, base, toast, cardCache, promptBox } from 'nc-lightapp-front'; +import { tableId, formId, leftarea, dataSource, pkname } from '../constants'; +import buttonClick from './buttonClick'; +import {toggleBtnStatus,throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js'; +let { setDefData, getDefData, addCache, deleteCacheById, getCacheById, updateCache } = cardCache; + +export default function transferButtonClick(props, id) { + let that = this + let amount = props.transferTable.getTransformFormAmount(leftarea) + if (amount == 1) { + buttonClick.call(this, props, id); + return + } + switch (id) { + case 'Cancel': + { + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000034'], /* 国际化处理: 请注意*/ + content: this.state.json['gatheringbill-000035'],/* 国际化处理: 是否取消?*/ + beSureBtnName: this.state.json['gatheringbill-000036'],/* 国际化处理: 是*/ + cancelBtnName: this.state.json['gatheringbill-000037'],/* 国际化处理: 否*/ + beSureBtnClick: () => { + if(this.props.getUrlParam('id')){ + this.props.setUrlParam({ status: 'browse' }); + let id = this.props.getUrlParam('id'); + let cardData = getCacheById(id, dataSource); + if (cardData) { + this.props.beforeUpdatePage();//打开开关 + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + 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 { + props.transferTable.setTransformFormStatus(leftarea, { + status: false, + onChange: (current, next) => { + // toast({ color: 'success', content: '取消成功' }); + } + }) + } + } + }) + } + break; + case 'Delete': + promptBox({ + color: 'warning', + title: this.state.json['gatheringbill-000005'] /* 国际化处理: 删除*/, + content: this.state.json['gatheringbill-000006'] /* 国际化处理: ​确定要删除吗?*/, + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['gatheringbill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['gatheringbill-000002'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + ajax({ + url: '/nccloud/arap/arappub/delete.do', + data: [{ + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + billType: this.billType + }], + success: function (res) { + if (props.transferTable.getTransformFormAmount(leftarea) == 1) { + history.go(-1); + } else { + deleteCacheById(pkname, props.getUrlParam('id'), dataSource); + props.transferTable.setTransformFormStatus(leftarea, { + status: false, + onChange: (current, next) => { + toast({ color: 'success', content: that.state.json['gatheringbill-000017'] });/* 国际化处理: 删除成功*/ + } + }) + } + } + }) + } + }); + break; + case 'Copy': + ajax({ + url: '/nccloud/arap/arappub/copy.do', + data: { + pk_bill: props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + pageId: this.getPagecode(), + billType: this.billType, + tradeType: this.getPagecode(), + }, + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.EmptyAllFormValue(this.formId); + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } + this.props.setUrlParam({ status: 'add' }) + this.props.addUrlParam({ operFlag: 'copy' }) + this.state.buttonfalg = true; + props.resMetaAfterPkorgEdit(); + this.props.form.setFormItemsDisabled(this.formId, { 'pk_org_v': false }); + this.toggleShow() + } + }); + break; + default: + buttonClick.call(this, props, id); + break; + } +} + +export function setValue(props, res) { + this.props.beforeUpdatePage();//打开开关 + if(res){ + toggleBtnStatus.call(this,res,'card_head'); + } + if (res.data.head && res.data.head[formId]) { + props.form.setAllFormValue({ [formId]: res.data.head[formId] }); + } + if (res.data.body && res.data.body[tableId]) { + props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId]); + } + let pk_gatherbill = this.props.form.getFormItemsValue(this.formId, 'pk_gatherbill').value + let newCardData = this.props.createMasterChildData( + this.getPagecode(), + this.formId, + this.tableId + ); + + let pkvalues = []; + let amount = this.props.cardTable.getNumberOfRows(this.tableId) * 1 + for(var i =0 ; i< amount; i++){ + pkvalues.push(this.props.cardTable.getValByKeyAndIndex(this.tableId, i, 'top_itemid').value); + } + /** + * 保存转单上游选中表体pks到转单的dataSource中 + */ + props.transferTable.savePk(props.getUrlParam("dataSource"), pkvalues); + /** + * 将新增单据数据保存到dataSource + */ + if (props.getUrlParam('status') == 'add') { + addCache(pk_gatherbill, newCardData, formId, dataSource) + }else { + updateCache(pkname, pk_gatherbill, newCardData, formId, dataSource); + } + this.props.updatePage(this.formId, this.tableId);//关闭开关 + this.props.transferTable.setTransformFormStatus(leftarea, { + status: true + /* onChange: (current, next, currentIndex) => { + this.transferIndex = currentIndex + 1; + this.Info.isNeedSelect = true + props.transferTable.setTransferListValueByIndex( + leftarea, + newCardData, + currentIndex + ) + } */ + }) + throwSagaErrorAgency.call(this,res) + +} + + +/*Zqktha8lwfXAWZRCgtFOTBGsch2yo65lKMwOc6Hai+A=*/ \ No newline at end of file diff --git a/src/arap/gatheringbill/gatheringbill/card/index.js b/src/arap/gatheringbill/gatheringbill/card/index.js new file mode 100644 index 0000000..04f1a6c --- /dev/null +++ b/src/arap/gatheringbill/gatheringbill/card/index.js @@ -0,0 +1,1722 @@ +/*5pvMnolyoe65qServnBDiMmMgcFfD43ix8UG2eBl8gI=*/ +//主子表卡片 +import React, { Component } from 'react'; +import { createPage, ajax, base, toast, high, print, cardCache, getMultiLang, createPageIcon } from 'nc-lightapp-front'; +let { NCDiv, NCButton, NCBackBtn, NCAffix } = base; +import { buttonClick, initTemplate, afterEvent, pageInfoClick, transferButtonClick } from './events'; +import { setValue } from './events/transferButtonClick'; +import { + buttonVisible, + getButtonsKey, + dealTranferBtns, + initCardBodyEditControl, + onSelectedCardBodyEditControl, + initCardBodybrowseControl +} from '../../../public/components/pubUtils/buttonvisible.js'; +import { updatePandC } from '../../../public/components/pubUtils/updatePandC'; +import { dealCardData } from '../../../public/components/pubUtils/dealCardData'; +import CombinedExaminationModel from '../../../public/components/combinedExaminationModel'; //联查处理情况 +import { + tableId, + formId, + billType, + leftarea, + headId, + nodekey, + tradeType, + dataSource, + pkname, + linkPageId +} from './constants'; +const { BillTrack, NCUploader, PrintOutput, Inspection, ApproveDetail } = high; +import { bodyBeforeEvent } from '../../../public/components/pubUtils/arapTableRefFilter'; +import { formBeforeEvent } from '../../../public/components/pubUtils/arapFormRefFilter'; +let { + setDefData, + getDefData, + addCache, + getNextId, + deleteCacheById, + getCacheById, + updateCache, + getCurrentLastId +} = cardCache; +import { calculateHeadMoney, delBlankLine } from '../../../public/components/pubUtils/billPubUtil.js'; +import { modifyChecknoItemtype } from '../../../public/components/pubUtils/specialFieldAfterEvent.js'; +import { billEditProperties } from '../../../public/components/pubUtils/billFieldEditableUtil.js'; +import { loginContext, getContext, loginContextKeys } from '../../../public/components/arapInitInfo/loginContext'; +import linkSourceCard from '../../../public/components/linkSourceCard.js'; +import cmpLinkArapCard from '../../../public/components/cmpLinkArapCard.js'; +import { dealCommisionPayField, fctToArapFieldEditable ,cardFieldsEditableFromCM} from '../../../public/components/pubUtils/billFieldEditableUtil.js'; +import TradeTypeButton from '../../../public/components/tradetype'; //交易类型按钮组件 +import {cardSocketConnect,cardSocketErrorFlag,toggleBtnStatus,throwSagaErrorAgency} from '../../../public/components/pubUtils/MicroServiceSocket.js'; +import '../../../public/less/tradetype.less'; +const { ExcelImport, ApprovalTrans } = high; + +class Card extends Component { + constructor(props) { + super(props); + this.state = { + isCombinedExaminationModelShow: false, //联查处理情况模态框 + isTbbLinkshow: false, //控制联查执行预算的模态框 + showBillTrack: false, //是否显示单据联查模态框 + showUploader: false, //附件 + target: null, + showApproveDetail: false, //审批详情的控制 + buttonfalg: null, //卡片态点击肩部按钮和表体行按钮改变该值控制按钮状态 + compositedisplay: false, //指派信息弹框 + hideAdd: false,//是否隐藏展开中的增行按钮 + forceRender: true,//导出模板懒加载,true为不加载,false为加载 + json: {} + }; + this.printData = { + billtype: billType, //单据类型 + appcode: this.props.getSearchParam('c'), //功能节点编码,即模板编码 + nodekey: props.getSearchParam('p'), //模板节点标识 =交易类型 + oids: [this.props.getUrlParam('id')], // 功能节点的数据主键 + 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.data = null;//推单单据数据缓存 + this.formId = formId; + this.tableId = tableId; + this.billType = billType; + this.leftarea = leftarea; + this.headId = headId; + this.transferIndex = 0; //转单时左侧选择的数据序号 + this.dataSource = dataSource; + this.pkname = pkname; + this.Info = { + allButtonsKey: [], + combinedExaminationData: [], //联查处理情况模态框表格数据 + tbbLinkSourceData: null, //联查执行预算的数据 + selectedPKS: [], //导出数据的主键pk + tipContent: null, //提示框Content + tipUrl: null, //提示框二次交互的url + exType: null, //异常类型,现为三种(1,2,3) + flag: false, //提交收回异常交互参数值,默认为false + pk_bill: null, //提示框二次交互时后台传入前台主键 + ts: null, + billCard: null, //保存提交后,返回的保存单据 + compositedata: null, //指派信息数据 + isModelSave: false, //是否是整单保存,默认为false + saveflag:false//判断走的是保存提交还是先保存后提交 + }; + this.dataInSaga = { //用于saga里面的busiinfo + appcode: props.getSearchParam('c') ? props.getSearchParam('c') : null, + pagecode: props.getSearchParam('p') ? props.getSearchParam('p') : null, + butncode: null + } + } + + //关闭、刷新弹窗时 + componentWillMount() { + if (this.props.getSearchParam('c') == '20062002' && this.props.getSearchParam('scene') != 'approvesce') { + updatePandC(this) + } + let callback = (json) => { + this.setState({ json: json }, () => { + initTemplate.call(this, this.props, this.initShow); + window.onbeforeunload = () => { + let status = this.props.getUrlParam('status'); + if (status == 'edit' || status == 'add') { + return ''; + } + }; + }); + } + getMultiLang({ moduleId: ['gatheringbill', 'public'], domainName: 'arap', currentLocale: 'simpchn', callback }); + } + + componentWillReceiveProps(nextProps) { } + + componentDidMount() { + if (this.props.getUrlParam('scene')) { + let scene = this.props.getUrlParam('scene'); + setDefData('scene', dataSource, scene); + let pagecode = this.getPagecode(); + setDefData('pagecode', dataSource, pagecode); + } + } + + getPagecode = () => { + let pagecode = this.props.getUrlParam('pagecode') + if (!pagecode) { + pagecode = this.props.getSearchParam('p') + } + if (pagecode == '20060GBM_CARD_LINK' && !this.props.getUrlParam('scene')) { + //浏览器的刷新可能导致场景丢失,这里自己塞一次 + this.props.ViewModel.setData('nccloud-router-params', { scene: 'linksce' }); + } + return pagecode + } + getExportPageCode = () => { + let pagecode = "20060GBM_CARD"; + if (this.props.getUrlParam('scene')) { + pagecode = "20060GBM_CARD_LINK"; + } + if (pagecode == '20060GBM_CARD_LINK' && !this.props.getUrlParam('scene')) { + //浏览器的刷新可能导致场景丢失,这里自己塞一次 + this.props.ViewModel.setData('nccloud-router-params', { scene: 'linksce' }); + } + return pagecode; + + } + + //页面初始化 + initShow = () => { + if (this.props.getUrlParam('type') === 'transfer' && this.props.getUrlParam('status') != 'browse') { + let transferIds = this.props.transferTable.getTransferTableSelectedId(); + this.getTransferValue(transferIds); + } else if (this.props.getUrlParam('scene') && this.props.getUrlParam('scene') == 'fip') { + linkSourceCard(this.props, linkPageId, 'pk_gatherbill', this.formId, this.tableId, pkname, dataSource, this); + } else if (this.props.getUrlParam('scene') && this.props.getUrlParam('scene') == 'linksce' && this.props.getUrlParam('flag') == 'ftsLinkArap') { + cmpLinkArapCard(this.props, this.billType, 'pk_gatherbill', this.formId, this.tableId, pkname, dataSource, this); + } else if (this.props.getUrlParam('type') === 'copy') { + this.dataInSaga.butncode='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]); + } + } + 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);//关闭开关 + 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') { + let pk_bill = this.props.getUrlParam('id'); + if (!pk_bill) { + this.toggleShow(); + return; + } + ajax({ + url: '/nccloud/arap/gatheringbill/cardquery.do', + data: { pk_bill: pk_bill }, + 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]); + } + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + } + if (this.props.getUrlParam('status') == 'edit') { + billEditProperties(this, this.props.getUrlParam('id'), this.billType, this.props.getSearchParam('c')) + // this.props.resMetaAfterPkorgEdit(); + // this.state.buttonfalg = true; + // this.props.form.setFormItemsDisabled(this.formId, { 'pk_org': true }); + cardFieldsEditableFromCM(this)//收票登记推单,特殊字段处理 + } else { + this.state.buttonfalg = null; + } + if (!this.props.getUrlParam('scene')) { + this.props.setUrlParam({ + pagecode: res.data.head[this.formId].rows[0].values.pk_tradetype.value + }); + } + + let status = this.props.getUrlParam('status'); + this.props.cardTable.setStatus(this.tableId, status); + this.props.form.setFormStatus(this.formId, status); + throwSagaErrorAgency.call(this,res) + this.props.updatePage(this.formId, this.tableId);//关闭开关 + updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); + this.toggleShow('',res); + }, + 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, pk_bill, 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.props.getUrlParam('src') == 'settlement') { + //资金,关联结算信息 + if (!this.props.getUrlParam('pk_settle')) { + toast({ color: 'danger', content: this.state.json['gatheringbill-000040'] });/* 国际化处理: 数据异常,请重新操作!*/ + } + ajax({ + url: '/nccloud/arap/arappub/associatesettinfo.do', + data: { + pk_bill: this.props.getUrlParam('pk_settle'), + pageId: this.getPagecode(), + billType: this.billType + }, + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.EmptyAllFormValue(this.formId); + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } + this.props.beforeUpdatePage();//打开开关 + this.state.buttonfalg = true; + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + dealCommisionPayField(this.props, this.formId, this.tableId) + this.props.updatePage(this.formId, this.tableId);//关闭开关 + this.toggleShow('',res); + } + }); + } else if (this.props.getUrlParam('status') == 'add' && this.props.getUrlParam('srcbilltype')) { + //推单新增时在inittemplate里处理 + this.props.beforeUpdatePage();//打开开关 + if (this.data.head) { + this.props.form.setAllFormValue({ [this.formId]: this.data.head[this.formId] }); + } + if (this.data.body) { + this.props.cardTable.setTableData(this.tableId, this.data.body[this.tableId]); + } + this.state.buttonfalg = true; + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + fctToArapFieldEditable(this.props, this.formId, this.tableId) + this.props.updatePage(this.formId, this.tableId);//关闭开关 + this.toggleShow(); + } else if (this.props.getUrlParam('status') == 'add') { + //状态为add时请求显示默认值 + this.initAdd(); + } else { + this.toggleShow(); + } + }; + + getTransferValue = (ids) => { + if (ids) { + let data = { + data: ids, + pageId: this.getPagecode(), + destTradetype: this.getPagecode(), + srcBilltype: this.props.getUrlParam('srcBilltype') + }; + ajax({ + url: '/nccloud/arap/arappub/transfer.do', + data: data, + success: (res) => { + if (res && res.data) { + this.props.transferTable.setTransferListValue(this.leftarea, res.data); + } + this.toggleShow('',res); + } + }); + } else { + this.props.transferTable.setTransferListValue(this.leftarea, []); + } + }; + + //同步单据信息到转单控件 + synTransferData = () => { + //重取界面现有数据赋值到转单中 + let amount = this.props.transferTable.getTransformFormAmount(this.leftarea) + if (amount != 1) { + let cardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + this.props.transferTable.setTransferListValueByIndex(this.leftarea, cardData, this.transferIndex); + } + }; + + //新增时初始化 + initAdd = (isClearPKorg) => { + if (!isClearPKorg) { + //isClearPKorg如果未未定义等,就取值为false + isClearPKorg = false; + } + ajax({ + url: '/nccloud/arap/gatheringbill/add.do', + data:Object.assign({ + isClearPKorg: isClearPKorg, + appcode: this.props.getSearchParam('c'), + pageId: this.getPagecode(), + tradeType: this.getPagecode() + },this.dataInSaga), + success: (res) => { + if (res.data) { + this.props.beforeUpdatePage();//打开开关 + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + let pk_org_v = res.data.head[this.formId].rows[0].values.pk_org_v.value; + if (pk_org_v) { + this.props.resMetaAfterPkorgEdit(); + this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: false }); + this.state.buttonfalg = true; + } else { + this.state.buttonfalg = null; + if (!this.props.getUrlParam('type') && !this.props.getUrlParam('srcbilltype') && !this.props.getUrlParam('src')) { + 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.toggleShow('',res); + }, + 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 = (headData,res) => { + if(res){ + toggleBtnStatus.call(this,res,'card_head'); + } + let status = this.props.getUrlParam('status'); + if (!status) { status = 'browse'; } + let cardhead = {}; + if (headData) { + cardhead = headData.rows[0].values; + } else { + 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 ? cardhead.pk_org.value : null, this); + } + + //处理转单不可见按钮 + dealTranferBtns.call(this, falseBtn); + this.props.button.setButtonVisible(trueBtn, true); + this.props.button.setButtonVisible(falseBtn, false); + //联查场景,默认场景,浏览态存在返回按钮 + if (this.props.getUrlParam('scene') && this.props.getUrlParam('scene') != 'linksce' && + this.props.getUrlParam('scene') != 'fip') { + this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: false }); + } + //来自流程中心的,不存在返回按钮 + if(this.props.getUrlParam('mark')&&this.props.getUrlParam('mark')=='processCenter'){ + this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: false }); + } + }; + //卡片表体点击行事件 + onSelected = () => { + onSelectedCardBodyEditControl(this); + }; + + //删除单据 + delConfirm = (extype, flag) => { + ajax({ + url: '/nccloud/arap/arappub/delete.do', + data: [ + Object.assign({ + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + billType: this.billType, + extype: extype, + flag: flag + },this.dataInSaga) + ], + success: (res) => { + //删除单据后,卡片界面显示该单据的下一个单据 + //如果是最后一个单据,删除后返回list界面 + if (res.success) { + if (res.data.exType == '1') { + this.Info.tipContent = res.data.message; + this.Info.exType = '1'; + this.Info.flag = true; + this.props.modal.show('deleteCheck'); + return; + } else { + let id = this.props.getUrlParam('id'); + deleteCacheById(pkname, id, dataSource); + let nextId = getNextId(id, dataSource); + if (nextId) { + if (this.props.getUrlParam('type') === 'transfer') { + this.props.setUrlParam({ status: 'browse' }); + } + 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() + } + this.clearExType(); + } + } + } + }); + }; + + cancel = () => { + //取消按钮 + if (this.props.getUrlParam('type') && this.props.getUrlParam('type') != 'transfer') { + //如果type存在就删除 + this.props.delUrlParam('type'); + } + let pk_org = this.props.form.getFormItemsValue(this.formId, 'pk_org'); + if (!pk_org || !pk_org.value || pk_org.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('',cardData); + } else { + this.initShow(); + } + } else if (this.props.getUrlParam('status') === 'add') { + let id = this.props.getUrlParam('id'); + if (!id) { + id = getCurrentLastId(dataSource); + } + if (id != undefined && (id != null) & (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.getUrlParam('scene')) { + 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('',cardData); + throwSagaErrorAgency.call(this,cardData) + } 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(); + } + } + }; + + //挂起和取消挂起操作 + pause = (url) => { + let selectedData = this.props.cardTable.getCheckedRows(this.tableId); + if (selectedData.length == 0) { + toast({ color: 'warning', content: this.state.json['gatheringbill-000028'] });/* 国际化处理: 请选择表体行!*/ + return; + } + let pauseObj = []; + selectedData.forEach((val) => { + pauseObj.push(val.data.values.pk_gatheritem.value); + }); + let data = { + pk_items: pauseObj, + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + pageId: this.getPagecode(), + billType: this.billType + }; + ajax({ + url: url, + data: Object.assign(data,this.dataInSaga), + 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['gatheringbill-000038'] });/* 国际化处理: 操作成功*/ + } + 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 = (url, extype, flag, modelIndex) => { + if (url != '/nccloud/arap/arappub/tempsave.do') { + //非暂存处理 + //删除空白行 + debugger + let checkCardData = this.props.createMasterChildData( + this.getPagecode(), + this.formId, + this.tableId + ); + // delBlankLine(this, this.tableId, this.billType, checkCardData, modelIndex); + if (!this.props.form.isCheckNow(this.formId)) { + //表单验证 + return; + } + if (!this.props.cardTable.checkTableRequired(this.tableId)) { + //表格验证 + return; + } + } + let cardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + let newCardData = dealCardData(this, cardData);//去掉空值,减少压缩时间 + let datas = { + cardData: newCardData, + uiState: this.props.getUrlParam('status'), + extype: extype, + flag: flag, + pk_settle: this.props.getUrlParam('pk_settle') + }; + if('/nccloud/arap/arappub/save.do'==url){ + this.Info.saveflag=true; + } + let callback = () => { + ajax({ + url: url, + data: Object.assign(datas,this.dataInSaga), + success: (res) => { + let pk_gatherbill = null; + let pk_tradetype = null; + if (res.success) { + if (res.data.exType == '1') { + this.Info.tipContent = res.data.message; + this.Info.pk_bill = res.data.pk_bill; + this.Info.ts = res.data.ts; + this.Info.billCard = res.data.billCard; + this.Info.tipUrl = res.data.pk_bill == null ? url : '/nccloud/arap/arappub/saveandcommit.do'; + this.Info.exType = '1'; + this.Info.flag = true; + if (res.data.pk_bill == null) { + this.props.modal.show('saveCheck'); + }else if (res.data.assignInfo && + res.data.assignInfo.workflow && + (res.data.assignInfo.workflow == 'approveflow' || + res.data.assignInfo.workflow == 'workflow')) { + this.Info.compositedata = res.data.assignInfo; + this.Info.exType = res.data.exType; + this.Info.tipUrl = '/nccloud/arap/arappub/saveandcommit.do'; //指派信息确定按钮继续走保存提交; + this.setState({ compositedisplay: true }); + return; + } else { + this.commitAndUncommit(); + } + // this.props.modal.show(res.data.pk_bill == null ? 'saveCheck' : 'commitAndUncommit'); + return; + } else if (res.data.exType == '2') { + this.Info.tipContent = res.data.message; + this.Info.pk_bill = res.data.pk_bill; + this.Info.ts = res.data.ts; + this.Info.billCard = res.data.billCard; + this.Info.tipUrl = res.data.pk_bill == null ? url : '/nccloud/arap/arappub/saveandcommit.do'; + this.Info.exType = '2'; + this.Info.flag = true; + if (res.data.pk_bill == null) { + this.props.modal.show('saveCheck'); + }else if (res.data.assignInfo && + res.data.assignInfo.workflow && + (res.data.assignInfo.workflow == 'approveflow' || + res.data.assignInfo.workflow == 'workflow')) { + this.Info.compositedata = res.data.assignInfo; + this.Info.exType = res.data.exType; + this.Info.tipUrl = '/nccloud/arap/arappub/saveandcommit.do'; //指派信息确定按钮继续走保存提交; + this.setState({ compositedisplay: true }); + return; + } else { + this.commitAndUncommit(); + } + // this.props.modal.show(res.data.pk_bill == null ? 'saveCheck' : 'commitAndUncommit'); + return; + } else if (res.data.exType == '3') { + //普通异常要捕获到并抛出错误信息,同时要将保存后的单据进行回写 + let content = res.data.message; + // toast({ color: 'danger', content: JSON.stringify(content) }); + } else if ( + res.data.assignInfo && + res.data.assignInfo.workflow && + (res.data.assignInfo.workflow == 'approveflow' || + res.data.assignInfo.workflow == 'workflow') + ) { + this.Info.compositedata = res.data.assignInfo; + this.Info.pk_bill = res.data.pk_bill; + this.Info.ts = res.data.ts; + this.Info.exType = res.data.exType; + this.Info.billCard = res.data.billCard; + this.Info.tipUrl = '/nccloud/arap/arappub/saveandcommit.do'; + this.setState({ compositedisplay: true }); + return; + } + if (res.data) { + if (this.props.getUrlParam('type') == 'transfer') { + setValue.call(this, this.props, res) + } else { + this.props.beforeUpdatePage();//打开开关 + if (res.data.head && res.data.head[this.formId]) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + pk_gatherbill = res.data.head[this.formId].rows[0].values.pk_gatherbill.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.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_gatherbill, newCardData, this.formId, dataSource); //新增 + } else { + updateCache(pkname, pk_gatherbill, newCardData, this.formId, dataSource); //修改之后更新缓存 + } + if (this.props.getUrlParam('type')) { + this.props.delUrlParam('type'); + } + if (this.props.getUrlParam('scene')) { + this.props.setUrlParam({ status: 'browse', id: pk_gatherbill }); + } else { + this.props.setUrlParam({ status: 'browse', id: pk_gatherbill, pagecode: pk_tradetype }); + } + } + if (!res.data.message) { + toast({ color: 'success', content: this.state.json['gatheringbill-000008'] }); /* 国际化处理: 保存成功*/ + } else { + toast({ color: 'danger', content: JSON.stringify(res.data.message) }); + } + this.clearExType(); + } + } + if (this.Info.isModelSave) { + this.Info.isModelSave = false; + this.props.cardTable.closeModel(this.tableId); + } + if (this.props.getUrlParam('type') != 'transfer') { + this.toggleShow('',res); + } + } + }); + }; + this.props.validateToSave(datas.cardData, callback, { table1: 'cardTable' }, 'card'); + }; + + + //提交和收回弹框点击取消 + clearExType = () => { + this.Info.tipContent = ''; + this.Info.pk_bill = null; + this.Info.ts = null; + this.Info.billCard = null; + this.Info.tipUrl = null; + this.Info.exType = null; + this.Info.flag = false; + this.Info.compositedata = null; + this.Info.saveflag=false; + }; + cancelClickInCommit = () => { //保存提交事务,取消指派框 + this.setState({ compositedisplay: false }); + this.Info.saveflag=false; + this.clearExType(); + }; + cancelClick = () => { + this.Info.saveflag=false; + if (this.Info.pk_bill != null) { + if (this.props.getUrlParam('type') && this.props.getUrlParam('type') != 'transfer') { + this.props.delUrlParam('type'); + } + this.props.beforeUpdatePage();//打开开关 + if (this.Info.billCard.head) { + this.props.form.setAllFormValue({ [this.formId]: this.Info.billCard.head[this.formId] }); + } + if (this.Info.billCard.body) { + this.props.cardTable.updateDataByRowId(this.tableId, this.Info.billCard.body[this.tableId]); + } + if (this.props.getUrlParam('scene')) { + this.props.setUrlParam({ + status: 'browse', + id: this.Info.pk_bill == null ? this.props.getUrlParam('id') : this.Info.pk_bill + }); + } else { + this.props.setUrlParam({ + status: 'browse', + id: this.Info.pk_bill == null ? this.props.getUrlParam('id') : this.Info.pk_bill, + pagecode: this.Info.billCard.head[this.formId].rows[0].values.pk_tradetype.value + }); + } + + let newCardData = this.props.createMasterChildData( + this.getPagecode(), + this.formId, + this.tableId + ); + addCache(pkname, newCardData, this.formId, dataSource); //新增 + 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);//关闭开关 + this.toggleShow(); + } + if (this.state.compositedisplay) { + this.setState({ compositedisplay: false }); + } + this.clearExType(); + }; + + //提交and收回公共调用函数 + commitAndUncommit = () => { + let tipUrl = this.Info.tipUrl; + let extype = this.Info.exType; + let flag = this.Info.flag; + ajax({ + url: tipUrl, + data:Object.assign({ + pk_bill: this.Info.pk_bill == null ? this.props.getUrlParam('id') : this.Info.pk_bill, + ts: this.Info.ts == null ? this.props.form.getFormItemsValue(this.formId, 'ts').value : this.Info.ts, + pageId: this.getPagecode(), + billType: this.billType, + type: 2, + extype: extype, + flag: flag, + assignObj: this.Info.compositedata + },this.dataInSaga), + success: (res) => { + if (res.data.exType == '1') { + let content = res.data.message; + this.Info.tipContent = content; + this.Info.exType = '1'; + this.Info.flag = true; + + this.props.modal.show('commitAndUncommit'); + return; + } else if ( + res.data.workflow && + (res.data.workflow == 'approveflow' || res.data.workflow == 'workflow') + ) { + this.Info.compositedata = res.data; + this.Info.tipUrl = tipUrl; + this.setState({ compositedisplay: true }); + return; + } + if (res.success) { + 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]) + } + + let newCardData = this.props.createMasterChildData( + this.getPagecode(), + this.formId, + this.tableId + ); + if (this.Info.pk_bill == null) { + updateCache(pkname, this.props.getUrlParam('id'), newCardData, this.formId, dataSource); + } else { + if (this.props.getUrlParam('type') && this.props.getUrlParam('type') != 'transfer') { + this.props.delUrlParam('type'); + } + addCache(pkname, newCardData, this.formId, dataSource); //新增 + } + if (this.props.getUrlParam('status') != 'browse') { + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + } + this.props.setUrlParam({ + status: 'browse', + id: this.Info.pk_bill == null ? this.props.getUrlParam('id') : this.Info.pk_bill + }); + if (this.state.compositedisplay) { + this.setState({ compositedisplay: false }); + } + this.clearExType(); + this.state.buttonfalg = null; + this.toggleShow('',res); + toast({ color: 'success', content: this.state.json['gatheringbill-000038'] });/* 国际化处理: 操作成功*/ + } + } + }); + }; + commitInSaveAndCommit = () => { + //this.Info.pk_bill始终有值,即便异常当异常抛出到当保存提交亦或时保存再提交。所以判断条件单凭这个PK不够 所以增加参数 + if(this.Info.saveflag){ + this.Info.tipUrl = '/nccloud/arap/arappub/commit.do'; + this.Info.saveflag=false; + this.commitAndUncommit(); + }else{ + let extype = this.Info.exType ? this.Info.exType : null + let flag = this.Info.flag; + let cardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + let newCardData = dealCardData(this, cardData); //去掉空值,减少压缩时间 + ajax({ + url: this.Info.tipUrl, + data:Object.assign({ + pk_bill: this.Info.pk_bill == null ? this.props.getUrlParam('id') : this.Info.pk_bill, + ts: this.Info.ts == null ? this.props.form.getFormItemsValue(this.formId, 'ts').value : this.Info.ts, + cardData: newCardData, + uiState: this.props.getUrlParam('status'), + pageId: this.getPagecode(), + billType: this.billType, + type: 2, + extype: extype, + flag: flag, + assignObj: this.Info.compositedata + },this.dataInSaga) , + success: (res) => { + if (res.success) { + 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]); + } + let newCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + if (this.Info.pk_bill == null) { + updateCache(pkname, this.props.getUrlParam('id'), newCardData, this.formId, dataSource); + } else { + if (this.props.getUrlParam('type') && this.props.getUrlParam('type') != 'transfer') { + this.props.delUrlParam('type'); + } + addCache(pkname, newCardData, this.formId, dataSource); //新增 + } + if (this.props.getUrlParam('status') != 'browse') { + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + } + this.props.setUrlParam({ + status: 'browse', + id: res.data.head.head ? res.data.head.head.rows[0].values.pk_gatherbill.value : res.data.head.rows[0].values.pk_gatherbill.value + }); + if (this.state.compositedisplay) { + this.setState({ compositedisplay: false }); + } + this.clearExType(); + this.toggleShow('',res); + toast({ color: 'success', content: this.state.json['receivablebill-000025'] }); /* 国际化处理: 操作成功*/ + } + } + }); + + } + }; + //获取列表肩部信息 + getTableHead = (buttons) => { + return ( + + {this.props.button.createButtonApp({ + area: 'card_body', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} + + ); + }; + + // 附件的关闭点击 + onHideUploader = () => { + this.setState({ + showUploader: false + }); + }; + + //审批详情模态框控制 + closeApprove = () => { + this.setState({ + showApproveDetail: false + }); + }; + + //联查处理情况按钮 + handleCombined = () => { + this.setState({ + isCombinedExaminationModelShow: !this.state.isCombinedExaminationModelShow + }); + }; + + //关闭联查执行预算的模态框 + tbbLinkcancel() { + this.setState({ + isTbbLinkshow: false + }); + } + + //打印 + 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 去掉后支持弹出选择打印模板 + ); + }; + + //正式打印 + officalPrintOutput = () => { + this.printData.oids = [this.props.getUrlParam('id')]; + this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + 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 + ); + } + } + }); + }; + + //取消正式打印 + cancelPrintOutput = () => { + this.printData.oids = [this.props.getUrlParam('id')]; + this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + ajax({ + url: '/nccloud/arap/arappub/cancelPrint.do', + data: this.printData, + success: (res) => { + if (res.success) { + //取消正式打印提示框 + toast({ color: 'success', content: res.data }); + } + } + }); + }; + + //打印输出 + 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() { + } + + + + backList = () => { + if (this.props.getUrlParam('scene') == 'linksce' || this.props.getUrlParam('scene') == 'fip') { + this.props.pushTo('/list', { + pagecode: '20060GBM_LIST_LINK', + scene: 'linksce' + }); + } else { + this.props.pushTo('/list', { + pagecode: '20060GBM_LIST' + }); + } + }; + + //返回转单页面 + backTransfer = () => { + let dataSource = this.props.getUrlParam('dataSource'); + let src_appcode = getDefData('src_appcode', dataSource); + let src_pagecode = getDefData('src_pagecode', dataSource); + let url = '/' + this.props.getUrlParam('srcBilltype'); + this.props.pushTo(url, { + src_appcode: src_appcode, + dest_billtype: this.billType, + dest_tradetype: this.getPagecode() + }); + }; + + //保存事件模态框确定按钮点击事件 + saveSureBtnClick = () => { + let tipUrl = this.Info.tipUrl; + let exType = this.Info.exType; + let flag = this.Info.flag; + if(this.Info.saveflag){ + tipUrl='/nccloud/arap/arappub/save.do' + this.Info.saveflag=false; + } + this.saveBill(tipUrl, exType, flag); + }; + + //单据删除模态框确定按钮点击事件 + deleteBillSureBtnClick = () => { + let exType = this.Info.exType; + let flag = this.Info.flag; + this.delConfirm(exType, flag); + }; + + //整单保存事件 + modelSaveClick = (a, modelIndex) => { + this.Info.isModelSave = true; + let saveUrl = '/nccloud/arap/arappub/save.do'; + this.saveBill(saveUrl, null, null, modelIndex); + }; + + //侧拉删行 + modelDelRow = (props, moduleId) => { + calculateHeadMoney(this); + let allVisibleRows = this.props.cardTable.getVisibleRows(this.tableId); + if (!allVisibleRows || allVisibleRows.length == 0) { + this.props.cardTable.closeModel(this.tableId); + } + }; + + //侧拉增行 + modelAddRow = (props, moduleId, modelIndex) => { + if (this.props.form.getFormItemsValue(this.formId, 'pk_org').value != null) { + let allRowsNumber = this.props.cardTable.getNumberOfRows(this.tableId); + ajax({ + url: '/nccloud/arap/gatheringbill/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['gatheringbill-000043'] });/* 国际化处理: 请先选择财务组织*/ + } + }; + + + switchTemplate = () => { + //initTemplate.call(this, this.props); + let pagecode = this.getPagecode(); + let appcode = this.props.getSearchParam('c') ? this.props.getSearchParam('c') : this.props.getUrlParam('c'); + let tradetype = getDefData('sessionTradeType', dataSource); + if (!tradetype) { + tradetype = tradeType; + } + ajax({ + url: '/nccloud/arap/arappub/queryallbtns.do', + data: { + appcode: appcode, + pagecode: pagecode, + tradetype: tradetype, + billtype: billType + }, + success: (res) => { + let data = res.data; + if (data.button) { + let button = data.button; + this.Info.pullBillInfoVOAry = data.pullbillinfo; + getButtonsKey(button, this.Info.allButtonsKey);//获取所有按钮 + this.props.button.setButtons(button); + } + + } + }); + }; + + render() { + let { cardTable, form, button, modal, cardPagination, transferTable } = this.props; + const { createBillHeadInfo } = this.props.BillHeadInfo; + let buttons = this.props.button.getButtons(); + let { createForm } = form; + let { createCardTable } = cardTable; + const { createCardPagination } = cardPagination; + let { createModal } = modal; + let transfer = this.props.getUrlParam('type') == 'transfer'; + const { createTransferList } = transferTable; + let { showUploader, target } = this.state; + if (transfer) { + return ( +
+ + +
+ {createBillHeadInfo({ + title: this.props.getSearchParam('n') ? this.props.getSearchParam('n') : this.state.json['gatheringbill-000048'],//国际化处理: 收款单管理 + backBtnClick: () => { + this.backTransfer(); + } + })} +
+
+ {cardSocketConnect.call(this,'card_head',dataSource)} + {cardSocketErrorFlag.call(this,'card_head')} + {this.props.button.createButtonApp({ + area: 'card_head', + buttonLimit: 3, + onButtonClick: transferButtonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} + {getDefData('scene', dataSource) == 'bz' ? null : ( + + {this.state.json['gatheringbill-000049']}{/* 国际化处理: 取消转单*/} + + )} +
+
+
+
+ {createTransferList({ + headcode: this.formId, + bodycode: this.tableId, + transferListId: this.leftarea, //转单列表id + onTransferItemSelected: (record, status, index) => { + //转单缩略图被选中时的钩子函数 + this.transferIndex = index + let isEdit = status ? 'browse' : 'edit'; + if (isEdit == 'browse') { + let id = record.head[this.formId].rows[0].values.pk_gatherbill.value; + record = id == null ? record : getCacheById(id, dataSource) + this.props.setUrlParam({ status: 'browse' }); + this.props.setUrlParam({ id: id }); + } else { + this.props.setUrlParam({ status: 'add' }); + this.props.delUrlParam('id'); + this.state.buttonfalg = true; + } + this.toggleShow(record.head[this.formId]); + this.props.beforeUpdatePage(); //打开开关 + this.props.form.setFormStatus(this.formId, isEdit); + this.props.cardTable.setStatus(this.tableId, isEdit); + this.props.form.setAllFormValue({ [this.formId]: record.head[this.formId] }); + this.props.cardTable.setTableData(this.tableId, record.body[this.tableId]); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + } + })} +
+
+ {createForm(this.formId, { + fieldid: "gatheringbill", + onAfterEvent: afterEvent.bind(this), + onBeforeEvent: formBeforeEvent.bind(this) + })} +
+
+ {createCardTable(this.tableId, { + fieldid: "gatheringbill", + 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, + hideAdd: true, + isAddRow: false, + adaptionHeight: true + })} +
+ {/* {联查处理情况} */} + + {/* {单据追溯} */} + { + 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 && ( + this.closeModal()} + customize={ + { + pk_billType: this.props.form.getFormItemsValue(this.formId, 'pk_billtype') ? ( + this.props.form.getFormItemsValue(this.formId, 'pk_billtype').value + ) : null + } + } + customInterface={ + { + queryLeftTree: "/nccloud/arap/arappub/arapFileLeftTreeQuery.do", + queryAttachments: "/nccloud/arap/arappub/transformBillEnclosureQuery.do" + } + } + /> + )} + {/* {打印输出} */} + + {/* {导入} */} + { + createModal('importModal', { + noFooter: true, + className: 'import-modal', + hasBackDrop: false, + }) + } + + {/* {审批详情模态框} */} + + {/* 计划预算*/} + + {/* 异常模态框 */} +
+ {createModal('saveCheck', { + title: this.state.json['gatheringbill-000044'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + closeModalEve:()=>{ + this.Info.flag = true + this.Info.exType=null + }, + beSureBtnClick: this.saveSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('deleteCheck', { + title: this.state.json['gatheringbill-000045'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 预算异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + closeModalEve:()=>{ + this.Info.flag = true + this.Info.exType=null + }, + beSureBtnClick: this.deleteBillSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('commitAndUncommit', { + title: this.state.json['gatheringbill-000044'],/* 国际化处理: 异常提示信息*/ + content: this.Info.tipContent, + closeModalEve:()=>{ + this.Info.flag = true + this.Info.exType=null + }, + beSureBtnClick: this.commitAndUncommit.bind(this), //点击确定按钮事件 + cancelBtnClick: this.cancelClick.bind(this) //提交和收回取消事件 + })} + {/* 指派信息弹框 */} + {this.state.compositedisplay ? ( + + ) : null} +
+
+
+ +
+ ); + } else { + return ( +
+
+ + +
+ {createBillHeadInfo({ + title: this.props.getSearchParam('n') ? this.props.getSearchParam('n') : this.state.json['gatheringbill-000048'],//国际化处理: 收款单 + backBtnClick: () => { + this.backList(); + } + })} +
+
+ {cardSocketConnect.call(this,'card_head',dataSource)} + {cardSocketErrorFlag.call(this,'card_head')} + {/* {交易类型按钮,默认场景} */} + {!this.props.getUrlParam('scene') && !getContext(loginContextKeys.transtype) ? ( +
+ {TradeTypeButton({ + ref: 'tradetypeBtn', + billtype: 'F2', + dataSource: dataSource, + switchTemplate: this.switchTemplate.bind(this) + })} +
+ ) : null} + {this.props.button.createButtonApp({ + area: 'card_head', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} +
+ {/* {分页按钮,默认场景或者联查场景} */} + {this.props.getUrlParam('scene') == 'linksce' || + this.props.getUrlParam('scene') == 'fip' || + !this.props.getUrlParam('scene') ? ( +
+ {createCardPagination({ + handlePageInfoChange: pageInfoClick.bind(this), + dataSource: dataSource + })} +
+ ) : null} +
+
+
+ {createForm(this.formId, { + fieldid: "gatheringbill", + onAfterEvent: afterEvent.bind(this), + onBeforeEvent: formBeforeEvent.bind(this) + })} +
+ +
+
+
+ {createCardTable(this.tableId, { + fieldid: "gatheringbill", + 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), + sideRowChange: (record) => { + //动态修改票据号字段类型 + modifyChecknoItemtype(this.props, this.tableId, record.values.pk_org.value, record.values.checktype.value) + }, + onSelected: this.onSelected.bind(this), + onSelectedAll: this.onSelected.bind(this), + showCheck: true, + showIndex: true, + hideAdd: this.state.hideAdd, + adaptionHeight: true + })} +
+
+ {/* {联查处理情况} */} + + {/* {审批详情模态框} */} + + {/* {单据追溯} */} + { + 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 && ( + this.closeModal()} + customize={ + { + pk_billType: this.props.form.getFormItemsValue(this.formId, 'pk_billtype') ? ( + this.props.form.getFormItemsValue(this.formId, 'pk_billtype').value + ) : null + } + } + customInterface={ + { + queryLeftTree: "/nccloud/arap/arappub/arapFileLeftTreeQuery.do", + queryAttachments: "/nccloud/arap/arappub/transformBillEnclosureQuery.do" + } + } + /> + )} + {/* {打印输出} */} + + {/* {导入} */} + { + createModal('importModal', { + noFooter: true, + className: 'import-modal', + hasBackDrop: false, + }) + } + + {/* 计划预算*/} + + + {/* 异常模态框 */} +
+ {createModal('saveCheck', { + title: this.state.json['gatheringbill-000045'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 预算异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + closeModalEve:()=>{ + this.Info.flag = true + this.Info.exType=null + }, + beSureBtnClick: this.saveSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('deleteCheck', { + title: this.state.json['gatheringbill-000045'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 预算异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + closeModalEve:()=>{ + this.Info.flag = true + this.Info.exType=null + }, + beSureBtnClick: this.deleteBillSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('commitAndUncommit', { + title: this.state.json['gatheringbill-000046'],/* 国际化处理: 提示信息*/ + content: this.Info.tipContent, + closeModalEve:()=>{ + this.Info.flag = true + this.Info.exType=null + }, + beSureBtnClick: this.commitAndUncommit.bind(this), //点击确定按钮事件 + cancelBtnClick: this.cancelClick.bind(this) //提交和收回取消事件 + })} + {/* 指派信息弹框 */} + {this.state.compositedisplay ? ( + + ) : null} +
+
+ ); + } + } +} + +Card = createPage({})(Card); + +export default Card; + +/*5pvMnolyoe65qServnBDiMmMgcFfD43ix8UG2eBl8gI=*/ \ No newline at end of file