From 3ff800fc69f5b0013c5633e8032f3d63eae21603 Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 13 Jan 2026 16:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paybill/confirmpaybill/card/constants.js | 31 + .../confirmpaybill/card/events/afterEvent.js | 233 ++++ .../confirmpaybill/card/events/buttonClick.js | 210 ++++ .../confirmpaybill/card/events/index.js | 6 + .../card/events/initTemplate.js | 75 ++ .../card/events/pageInfoClick.js | 61 + .../card/events/tableButtonClick.js | 37 + src/arap/paybill/confirmpaybill/card/index.js | 787 ++++++++++++ .../paybill/confirmpaybill/list/constants.js | 38 + .../confirmpaybill/list/events/buttonClick.js | 155 +++ .../confirmpaybill/list/events/doubleClick.js | 16 + .../confirmpaybill/list/events/index.js | 7 + .../list/events/initTemplate.js | 108 ++ .../list/events/pageInfoClick.js | 27 + .../list/events/searchBtnClick.js | 38 + .../list/events/tableButtonClick.js | 75 ++ src/arap/paybill/confirmpaybill/list/index.js | 192 +++ .../paybill/confirmpaybill/main/config.json | 22 + src/arap/paybill/confirmpaybill/main/index.js | 7 + .../paybill/confirmpaybill/main/router.js | 19 + .../paybill/debtransfer/hisrecord/index.js | 22 + .../debtransfer/hisrecordapply/index.js | 21 + src/arap/paybill/debtransfer/list/index.js | 20 + src/arap/paybill/debtransfer/main/index.js | 7 + src/arap/paybill/debtransfer/main/router.js | 26 + .../paybill/initpaybill/card/constants.js | 42 + .../initpaybill/card/events/afterEvent.js | 371 ++++++ .../initpaybill/card/events/buttonClick.js | 286 +++++ .../paybill/initpaybill/card/events/index.js | 5 + .../initpaybill/card/events/initTemplate.js | 96 ++ .../initpaybill/card/events/pageInfoClick.js | 56 + .../card/events/tableButtonClick.js | 58 + src/arap/paybill/initpaybill/card/index.js | 1053 +++++++++++++++++ .../paybill/initpaybill/list/constants.js | 41 + .../initpaybill/list/events/buttonClick.js | 338 ++++++ .../initpaybill/list/events/doubleClick.js | 16 + .../paybill/initpaybill/list/events/index.js | 7 + .../initpaybill/list/events/initTemplate.js | 119 ++ .../initpaybill/list/events/pageInfoClick.js | 28 + .../initpaybill/list/events/searchBtnClick.js | 37 + .../list/events/tableButtonClick.js | 59 + src/arap/paybill/initpaybill/list/index.js | 478 ++++++++ src/arap/paybill/initpaybill/main/config.json | 23 + src/arap/paybill/initpaybill/main/index.js | 7 + src/arap/paybill/initpaybill/main/router.js | 19 + src/arap/paybill/paybill/transfer/config.json | 3 + 46 files changed, 5382 insertions(+) create mode 100644 src/arap/paybill/confirmpaybill/card/constants.js create mode 100644 src/arap/paybill/confirmpaybill/card/events/afterEvent.js create mode 100644 src/arap/paybill/confirmpaybill/card/events/buttonClick.js create mode 100644 src/arap/paybill/confirmpaybill/card/events/index.js create mode 100644 src/arap/paybill/confirmpaybill/card/events/initTemplate.js create mode 100644 src/arap/paybill/confirmpaybill/card/events/pageInfoClick.js create mode 100644 src/arap/paybill/confirmpaybill/card/events/tableButtonClick.js create mode 100644 src/arap/paybill/confirmpaybill/card/index.js create mode 100644 src/arap/paybill/confirmpaybill/list/constants.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/buttonClick.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/doubleClick.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/index.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/initTemplate.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/pageInfoClick.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/searchBtnClick.js create mode 100644 src/arap/paybill/confirmpaybill/list/events/tableButtonClick.js create mode 100644 src/arap/paybill/confirmpaybill/list/index.js create mode 100644 src/arap/paybill/confirmpaybill/main/config.json create mode 100644 src/arap/paybill/confirmpaybill/main/index.js create mode 100644 src/arap/paybill/confirmpaybill/main/router.js create mode 100644 src/arap/paybill/debtransfer/hisrecord/index.js create mode 100644 src/arap/paybill/debtransfer/hisrecordapply/index.js create mode 100644 src/arap/paybill/debtransfer/list/index.js create mode 100644 src/arap/paybill/debtransfer/main/index.js create mode 100644 src/arap/paybill/debtransfer/main/router.js create mode 100644 src/arap/paybill/initpaybill/card/constants.js create mode 100644 src/arap/paybill/initpaybill/card/events/afterEvent.js create mode 100644 src/arap/paybill/initpaybill/card/events/buttonClick.js create mode 100644 src/arap/paybill/initpaybill/card/events/index.js create mode 100644 src/arap/paybill/initpaybill/card/events/initTemplate.js create mode 100644 src/arap/paybill/initpaybill/card/events/pageInfoClick.js create mode 100644 src/arap/paybill/initpaybill/card/events/tableButtonClick.js create mode 100644 src/arap/paybill/initpaybill/card/index.js create mode 100644 src/arap/paybill/initpaybill/list/constants.js create mode 100644 src/arap/paybill/initpaybill/list/events/buttonClick.js create mode 100644 src/arap/paybill/initpaybill/list/events/doubleClick.js create mode 100644 src/arap/paybill/initpaybill/list/events/index.js create mode 100644 src/arap/paybill/initpaybill/list/events/initTemplate.js create mode 100644 src/arap/paybill/initpaybill/list/events/pageInfoClick.js create mode 100644 src/arap/paybill/initpaybill/list/events/searchBtnClick.js create mode 100644 src/arap/paybill/initpaybill/list/events/tableButtonClick.js create mode 100644 src/arap/paybill/initpaybill/list/index.js create mode 100644 src/arap/paybill/initpaybill/main/config.json create mode 100644 src/arap/paybill/initpaybill/main/index.js create mode 100644 src/arap/paybill/initpaybill/main/router.js create mode 100644 src/arap/paybill/paybill/transfer/config.json diff --git a/src/arap/paybill/confirmpaybill/card/constants.js b/src/arap/paybill/confirmpaybill/card/constants.js new file mode 100644 index 00000000..5fba560e --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/constants.js @@ -0,0 +1,31 @@ + +/** + * 表头区域 + */ +export const formId = 'head'; + +/** + * 表体区域 + */ +export const tableId = 'bodys'; + +/** + * 默认交易类型 + */ +export const tradeType = 'D3'; + +/** + * 单据类型 + */ +export const billType = 'F3'; + +/** + * 单页应用缓存 + */ +export const dataSource = 'fi.arap.confirmpaybill.20080SPAC'; + +/** + * 单页应用缓存主键名字(该名字为表的主键名字) + */ +export const pkname = 'pk_paybill'; + diff --git a/src/arap/paybill/confirmpaybill/card/events/afterEvent.js b/src/arap/paybill/confirmpaybill/card/events/afterEvent.js new file mode 100644 index 00000000..995bc8ee --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/events/afterEvent.js @@ -0,0 +1,233 @@ +import { ajax, toast, promptBox } from 'nc-lightapp-front'; +import { currentTypeAfterFormEvents } from '../../../../public/components/pubUtils/currentTypeAfterEvent'; +import { formulamsgHint, renderData, headAfterEventRenderData, bodyAfterEventRenderData, errorDeal } from '../../../../public/components/afterEventPub/afterEventPubDeal'; +import { getColvalues, getRowIds } from '../../../../public/components/pubUtils/billPubUtil'; +import { moneyAndRateFields } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js'; +import { checknoDisplayAfterEvent } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js'; + +export default function afterEvent(props, moduleId, key, value, changedrows, i, s, 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 'supplier_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', 'payaccount', 'pk_currtype', 'supplier', 'supplier_v', 'buysellflag', + 'objtype', "direction", "pk_billtype", "top_billtype",'pk_ratetype','ratedate','ordercubasdoc','ordercubasdoc_v'].concat(moneyAndRateFields)), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + }; + headFieldAfterRequest.call(this, data, key, changedrows) + break; + case 'payaccount': + 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', 'supplier', 'supplier_v', 'buysellflag', + 'objtype', "direction", "pk_billtype"].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', 'supplier', 'supplier_v', 'taxtype', 'buysellflag', 'objtype', "direction",'pk_pcorg','pk_pcorg_v', 'costcenter', 'billdate']), + 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','pk_pcorg','pk_pcorg_v']), + 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", + "globaldebit", "globalnotax_de", "globaltax_de", "groupdebit", "groupnotax_de", + "grouptax_de", "local_money_de", "local_notax_de", "local_tax_de", "money_de", "notax_de", "quantity_de", "direction", "pk_ratetype", "ratedate"]), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + } + headFieldAfterRequest.call(this, data, key, changedrows) + //币种事件发送完要判断汇率 + //v2111 汇率控制发生变化,都走编辑前进行控制 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; + case 'pk_ratetype': + data = { + pageId: pagecode, + event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value), + uiState: this.props.getUrlParam('status') + } + if (value.value == null || value.value == '') { + promptBox({ + color: 'warning', + title: this.state.json['paybill-000058'] /* 国际化处理: 确认清空*/, + content: this.state.json['paybill-000059'] /* 国际化处理: 确定​清空汇率类型,这样会清空金额相关的信息!*/, + beSureBtnName: this.state.json['paybill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['paybill-000005'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + headFieldAfterRequest.call(this, data, key, changedrows) + }, + cancelBtnClick: () => { + this.props.form.setFormItemsValue(this.formId, { pk_ratetype: changedrows }); + }, + closeByClickBackDrop: false + }); + } else { + headFieldAfterRequest.call(this, data, key, changedrows) + } + 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) { + //科目字段特殊拼接1121\应收票据 + if (key == "subjcode") { + this.props.cardTable.setValByKeyAndIndex(this.tableId, i, 'subjcode', { value: value.refpk, display: value.dispname }) + } + //非元数据字段,票据号 + if (key == 'checkno_display') { + checknoDisplayAfterEvent(this.props, this.tableId, key, value, i); + key = 'checkno'; + } + + ajax({ + url: '/nccloud/arap/confirmpaybill/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, index); + //编辑公式提示 + formulamsgHint(this, res); + //表体改变表头税率编辑性 + if (i == 0 && key == 'pk_currtype') { + //v2111 汇率控制发生变化,都走编辑前进行控制 currentTypeAfterFormEvents(that.formId, props, 'pk_currtype'); + } + + }, + error: (res) => { + let str = res.message; + if (str.substring(0, 16) == 'convertException') { + promptBox({ + color: 'warning', + title: this.state.json['paybill-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 });; + } + } + }); + } +} + +function afterTableEvent(that, props, i, pagecode, moduleId, key, changedrows, isCalculateConvert, index, value) { + + ajax({ + url: '/nccloud/arap/confirmpaybill/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); + //编辑公式提示 + formulamsgHint(that, res); + //表体改变表头税率编辑性 + if (i == 0 && key == 'pk_currtype') { + //v2111 汇率控制发生变化,都走编辑前进行控制 currentTypeAfterFormEvents(that.formId, props, 'pk_currtype'); + } + + } + }); +} + +export function headFieldAfterRequest(requestData, key, changedrows) { + ajax({ + url: '/nccloud/arap/confirmpaybill/cardheadafteredit.do', + data: requestData, + async: false, + success: (res) => { + //渲染数据 + headAfterEventRenderData(this, res); + //编辑公式提示 + formulamsgHint(this, res); + }, + error: (res) => { + errorDeal(this, res, changedrows, key); + } + }); +} diff --git a/src/arap/paybill/confirmpaybill/card/events/buttonClick.js b/src/arap/paybill/confirmpaybill/card/events/buttonClick.js new file mode 100644 index 00000000..3839b89d --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/events/buttonClick.js @@ -0,0 +1,210 @@ +import { ajax, toast, cardCache, promptBox } from 'nc-lightapp-front'; +import { headButton, bodyButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { imageScan, imageView } from 'sscrp/rppub/components/image'; +import { dataSource, pkname } from '../constants'; +import { + delLine, + copyLine, + pasteLine, + pasteToEndLine +} from '../../../../public/components/pubUtils/billPubUtil.js'; +import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.js'; +import { moduleEnable, IMAG, SSCIVM } from '../../../../public/components/moduleEnable.js'; + +let { updateCache, deleteCacheById } = cardCache; + +export default function (props, id) { + this.dataInSaga.butncode = id; + switch (id) { + case headButton.Save: + this.saveBill('/nccloud/arap/arappub/save.do'); + break; + case 'SaveAndCommit': + this.saveBill('/nccloud/arap/arappub/saveandcommit.do'); + break; + //确认 + case headButton.Confirm: + ajax({ + url: '/nccloud/arap/arappub/confirm.do', + data: Object.assign({ + pageId: this.getPagecode(), + pk_bill: props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + billType: this.billType + }, this.dataInSaga), + success: (res) => { + if (res.data) { + this.props.beforeUpdatePage();//打开开关 + if (res.data.head) { + 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.setUrlParam({ status: 'edit' }) + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + this.props.updatePage(this.formId, this.tableId);//关闭开关 + this.toggleShow(res) + } + }); + + break; + //取消确认 + case headButton.CancelConfirm: + this.cancelConfirm(); + break; + case headButton.Cancel: + promptBox({ + color: 'warning', + title: this.state.json['paybill-000005'], /* 国际化处理: 取消*/ + content: this.state.json['paybill-000003'], /* 国际化处理: ​确定要取消吗?*/ + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['paybill-000004'], /* 国际化处理: 确定*/ + cancelBtnName: this.state.json['paybill-000005'], /* 国际化处理: 取消*/ + beSureBtnClick: this.cancel + }); + break + case headButton.Delete: + promptBox({ + color: 'warning', + title: this.state.json['paybill-000002'], /* 国际化处理: 删除*/ + content: this.state.json['paybill-000006'], /* 国际化处理: ​确定要删除吗?*/ + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['paybill-000004'], /* 国际化处理: 确定*/ + cancelBtnName: this.state.json['paybill-000005'], /* 国际化处理: 取消*/ + beSureBtnClick: this.delConfirm + }); + 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['paybill-000051'] });/* 国际化处理: 刷新成功*/ + 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); + }, + 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 headButton.ReceiptCheck: //影像查看pk_tradetype + if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用 + return; + } + if (props.getUrlParam('status') == 'add') { + toast({ color: 'warning', content: this.state.json['paybill-000035'] }); /* 国际化处理: 单据未暂存!*/ + 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['paybill-000036'] }); /* 国际化处理: 请先 <暂存> 单据再扫描影像!*/ + return; + } + let tradetype = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + let allData = props.createMasterChildData(tradetype, this.formId, this.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_paybill.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 == undefined ? '' : 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 bodyButton.CopyLine: //复制行 + if (copyLine(this, dataSource)) { + this.setState( + { + buttonfalg: false + }, + () => { + cardBodyControl(props, this.state.buttonfalg); + } + ); + } + 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.onSelected(); + break; + case bodyButton.DelLine: //删除行 + delLine(this); + //删行之后控制肩部按钮 + this.onSelected(); + break; + default: + break + } +} diff --git a/src/arap/paybill/confirmpaybill/card/events/index.js b/src/arap/paybill/confirmpaybill/card/events/index.js new file mode 100644 index 00000000..243c05b8 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/events/index.js @@ -0,0 +1,6 @@ +import buttonClick from './buttonClick'; +import initTemplate from './initTemplate'; +import afterEvent from './afterEvent'; +import pageInfoClick from './pageInfoClick'; +import tableButtonClick from './tableButtonClick'; +export { buttonClick, afterEvent, initTemplate, pageInfoClick,tableButtonClick }; diff --git a/src/arap/paybill/confirmpaybill/card/events/initTemplate.js b/src/arap/paybill/confirmpaybill/card/events/initTemplate.js new file mode 100644 index 00000000..f7627d44 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/events/initTemplate.js @@ -0,0 +1,75 @@ + +import tableButtonClick from './tableButtonClick.js'; +import { tableId, formId } from '../constants'; +import { buttonVisible, getButtonsKey,getInnerButtonkey ,cardBodyAndInnerButtonVisible} from '../../../../public/components/pubUtils/buttonvisible.js'; +import {OperationColumn} from '../../../../public/components/pubUtils/arapConstant'; +export default function(props,callback) { + const that = this; + props.createUIDom( + { + pagecode: that.getPagecode(),//页面id + appcode: props.getSearchParam("c"),//注册按钮的id + reqDataQuerypage: { + rqUrl: '/arap/arappub/querypage.do', + rqJson: `{\n \"pagecode\": \"${that.getPagecode()}\",\n \"appcode\": \"${props.getSearchParam("c")}\"\n}`, + rqCode: 'template' + } + }, + function (data){ + if(data){ + if(!data.template[tableId]){ + return; + } + if(data.template){ + let meta = data.template; + meta = modifierMeta(props, meta,that); + props.meta.setMeta(meta); + } + if (data.button) { + let button = data.button; + getButtonsKey(button, that.Info.allButtonsKey);//保存所有头部和肩部按钮 + props.button.setButtons(button); + } + if(callback){ + callback() + } + }    + } + ) +} + +function modifierMeta(props, meta,that) { + let status = props.getUrlParam('status'); + meta[formId].status = status; + meta[tableId].status = status; + meta[formId].items.map((item,index)=>{ + if(item.attrcode=='startdate'||item.attrcode=='enddate'||item.attrcode=='firstallocdate'){ + item.isconverttimezones="2";//不转时区 + } + }) + meta[tableId].items.map((item,index)=>{ + if(item.attrcode=='subjcode'){ + item.fieldDisplayed='dispname'; + }else if(item.attrcode=='startdate'||item.attrcode=='enddate'||item.attrcode=='firstallocdate'){ + item.isconverttimezones="2";//不转时区 + } + }) + //添加操作列 + meta[tableId].items.push({ + label: that.state.json['paybill-000007'],/* 国际化处理: 操作*/ + itemtype: 'customer', + attrcode: 'opr', + width: OperationColumn, + visible: true, + fixed: 'right', + render: (text, record, index) => { + let trueBtn = cardBodyAndInnerButtonVisible(that, that.state.buttonfalg, record.expandRowStatus, record, index); + return props.button.createOprationButton(trueBtn, { + area: "card_inner", + buttonLimit: 3, + onButtonClick: (props, key) => tableButtonClick(props, key, text, record, index,that) + }); + } + }); + return meta; +} diff --git a/src/arap/paybill/confirmpaybill/card/events/pageInfoClick.js b/src/arap/paybill/confirmpaybill/card/events/pageInfoClick.js new file mode 100644 index 00000000..37a6bae3 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/events/pageInfoClick.js @@ -0,0 +1,61 @@ +import {ajax ,cardCache} from 'nc-lightapp-front'; +import { formId ,dataSource,pkname} from '../constants'; +import initTemplate from './initTemplate'; +import {throwSagaErrorAgency} from '../../../../public/components/pubUtils/MicroServiceSocket.js'; +let { getCacheById, updateCache,deleteCacheById } = cardCache; + +export default function (props, pk) { + if(!pk){//如果刷新了浏览器,那么pk将不会存在,如果pk不存在,return + return; + } + let cardData = getCacheById(pk, dataSource); + let tradeType = this.getPagecode(); + if(cardData){ + let pagecode = cardData.head[this.formId].rows[0].values.pk_tradetype.value; + props.setUrlParam({status:'browse',id:pk,pagecode:pagecode}) + if(tradeType !=pagecode){ + initTemplate.call(this, this.props); + } + 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/confirmpaybill/querycard.do', + data: data, + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId],null, null, true); + } + updateCache(pkname,pk,res.data,this.formId,dataSource); + let pagecode = res.data.head[formId].rows[0].values.pk_tradetype.value; + props.setUrlParam({status:'browse',id:pk,pagecode:pagecode}) + if(tradeType !=pagecode){ + initTemplate.call(this, this.props); + } + this.toggleShow(res); + throwSagaErrorAgency.call(this,res) + }else{ + 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, dataSource); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + } + } + }); + } + +} diff --git a/src/arap/paybill/confirmpaybill/card/events/tableButtonClick.js b/src/arap/paybill/confirmpaybill/card/events/tableButtonClick.js new file mode 100644 index 00000000..102337ba --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/events/tableButtonClick.js @@ -0,0 +1,37 @@ +import { tableId, dataSource, formId } from '../constants'; +import { innerButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { copyInner, deleteInner, pasteInner } from '../../../../public/components/pubUtils/billPubUtil.js'; +import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.js'; + +export default function (props, key, text, record, index,that) { + 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: + props.cardTable.openModel(tableId, 'edit', record, index); + break; + case innerButton.Copy_inner://复制行 + copyInner(record, dataSource,that); + that.setState({ + buttonfalg: false + }, () => { + cardBodyControl(props, that.state.buttonfalg); + }) + 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; + } +}; diff --git a/src/arap/paybill/confirmpaybill/card/index.js b/src/arap/paybill/confirmpaybill/card/index.js new file mode 100644 index 00000000..dc1d342b --- /dev/null +++ b/src/arap/paybill/confirmpaybill/card/index.js @@ -0,0 +1,787 @@ +//主子表卡片 +import React, { Component } from 'react'; +import { createPage, ajax, base, toast, cardCache, getMultiLang, high } from 'nc-lightapp-front'; +import { buttonClick, initTemplate, afterEvent, pageInfoClick } from './events'; +import { buttonVisible, initCardBodyEditControl, onSelectedCardBodyEditControl, } from '../../../public/components/pubUtils/buttonvisible.js'; +import { tableId, formId, billType, dataSource, pkname } from './constants'; +import { bodyBeforeEvent } from '../../../public/components/pubUtils/arapTableRefFilter'; +import { formBeforeEvent } from '../../../public/components/pubUtils/arapFormRefFilter'; +import { dealCardData } from '../../../public/components/pubUtils/dealCardData'; +import { delBlankLine } from '../../../public/components/pubUtils/billPubUtil.js'; +import { cardFieldsEditableWithProxy } from '../../../public/components/pubUtils/billFieldEditableUtil.js'; + +import ApprovalTrans from 'uap/common/components/approvalTrans'; +let { getDefData, addCache, getNextId, deleteCacheById, getCacheById, updateCache } = cardCache; +const { NCDiv, NCAffix } = base; +import {cardSocketConnect,cardSocketErrorFlag,toggleBtnStatus,throwSagaErrorAgency} from '../../../public/components/pubUtils/MicroServiceSocket.js'; +class Card extends Component { + constructor(props) { + super(props); + this.formId = formId; + this.tableId = tableId; + this.billType = billType; + this.pkname = pkname; + this.Info = { + allButtonsKey: [],//保存所有按钮 + isModelSave: false,//是否是整单保存,默认为false + tipContent: null, //提示框Content + tipUrl: null, //提示框二次交互的url + exType: null, //异常类型,现为三种(1,2,3) + flag: false, //提交收回异常交互参数值,默认为false + pk_bill: null, //提示框二次交互时后台传入前台主键 + ts: null, + billCard: null, //保存提交后,返回的保存单据 + compositedata: null, //指派信息数据 + saveflag: false + } + this.state = { + json: {}, + buttonfalg: null, //卡片态点击肩部按钮和表体行按钮改变该值控制按钮状态 + compositedisplay: false, //指派信息弹框 + } + this.dataInSaga = { //用于saga里面的busiinfo + appcode : props.getSearchParam('c') ? props.getSearchParam('c') : null, + pagecode : props.getSearchParam('p') ? props.getSearchParam('p') : null, + butncode : null + } + this.billinfo ={ + billtype:'card', + pagecode:props.getSearchParam('p') ? props.getSearchParam('p') : null, + headcode:formId, + bodycode:tableId} + props.use.cardTable(tableId); + props.use.form(formId); + } + + componentWillReceiveProps(nextProps) { + + } + //卡片表体点击行事件 + onSelected = () => { + onSelectedCardBodyEditControl(this); + }; + //关闭、刷新弹窗时 + componentWillMount() { + + let callback = (json) => { + this.setState({ json: json }, () => { + window.onbeforeunload = () => { + let status = this.props.getUrlParam("status"); + if (status == 'edit' || status == 'add') { + return ''; + } + } + }); + this.props.setRelationItemBillinfo(this.billinfo); + initTemplate.call(this, this.props, this.initShow); + } + getMultiLang({ moduleId: ['paybill', 'public'], domainName: 'arap', currentLocale: 'simpchn', callback }); + } + + componentWillUnmount() { + window.onbeforeunload=null; + } + + getPagecode = () => { + let pagecode = this.props.getUrlParam('pagecode') + if (!pagecode) { + pagecode = this.props.getSearchParam('p') + } + return pagecode + } + + + componentDidMount() { + + } + //页面初始化 + initShow = () => { + if (this.props.getUrlParam('status') == 'browse') { + this.queryCard(this.props.getUrlParam('id'), this.getPagecode()); + } else if (!this.props.getUrlParam('status')) { + this.toggleShow(); + } else { + let data = getDefData('confirm' + this.props.getUrlParam('id'), dataSource) + if (data) { + this.props.form.setAllFormValue({ [this.formId]: data.head[this.formId] }); + this.props.cardTable.setTableData(this.tableId, data.body[this.tableId]); + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + this.state.buttonfalg=this.props.getUrlParam('buttonfalg')?this.props.getUrlParam('buttonfalg'):false; + this.toggleShow(); + } else { + ajax({ + url: '/nccloud/arap/arappub/confirm.do', + data: { + pageId: this.getPagecode(), + pk_bill: this.props.getUrlParam('id'), + billType: this.billType + }, + 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: [] }); + } + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + this.props.updatePage(this.formId, this.tableId);//关闭开关 + this.toggleShow(res); + } + }); + + } + + + } + } + + + queryCard = (id, pageId) => { + 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.toggleShow(cardData); + } else { + ajax({ + url: '/nccloud/arap/confirmpaybill/querycard.do', + data: { + pk_bill: id, + pageId: pageId + }, + success: (res) => { + if (res.data) { + 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.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + throwSagaErrorAgency.call(this,res) + this.props.updatePage(this.formId, this.tableId);//关闭开关 + updateCache(pkname, id, res.data, this.formId, dataSource); + }else{ + 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, id, dataSource); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + } + this.toggleShow(res); + } + }); + } + + } + + dealObjType = (props) => { + let objtype = props.form.getFormItemsValue(this.formId, 'objtype').value; + props.form.setFormItemsDisabled(this.formId, {'objtype':true}); + props.cardTable.setColEditableByKey(this.tableId, ['objtype'], true) + if(objtype == "0"){//客户 + props.form.setFormItemsDisabled(this.formId, {'customer':true, 'customer_v':true}); + props.cardTable.setColEditableByKey(this.tableId, ['customer', 'customer_v'], true) + } else if (objtype == "1"){//供应商 + props.form.setFormItemsDisabled(this.formId, {'supplier':true, 'supplier_v':true}); + props.cardTable.setColEditableByKey(this.tableId, ['supplier', 'supplier_v'], true) + } else if (objtype == "2"){//部门 + props.form.setFormItemsDisabled(this.formId, {'pk_deptid':true, 'pk_deptid_v':true}); + props.cardTable.setColEditableByKey(this.tableId, ['pk_deptid', 'pk_deptid_v'], true) + } else if (objtype == "3"){//人员 + props.form.setFormItemsDisabled(this.formId, {'pu_psndoc':true}); + props.cardTable.setColEditableByKey(this.tableId, ['pu_psndoc'], true) + } + } + + //切换页面状态 + toggleShow = (res) => { + if(res){ + toggleBtnStatus.call(this,res,'card_head'); + } + cardFieldsEditableWithProxy(this); + let status = this.props.getUrlParam('status'); + if (!status) { status = 'browse'; }//如果未定义,默认给值浏览态 + let trueBtn = [];//可见的按钮 + let falseBtn = [];//不可见的按钮 + for (let i = 0; i < this.Info.allButtonsKey.length; i++) { + let flag = buttonVisible(status, + this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId).head[this.formId].rows[0].values, + this.Info.allButtonsKey[i], 'card', this); + if (flag) { + trueBtn.push(this.Info.allButtonsKey[i]); + } else { + falseBtn.push(this.Info.allButtonsKey[i]); + } + } + if (status != 'browse') { + initCardBodyEditControl(this.props, this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value, this); + this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false); + this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: false }); + this.dealObjType(this.props); + } else { + this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', true); + this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: true }); + } + this.props.button.setButtonVisible(trueBtn, true); + this.props.button.setButtonVisible(falseBtn, false); + }; + + //单据删除模态框确定按钮点击事件 + deleteBillSureBtnClick = () => { + let exType = this.Info.exType; + let flag = this.Info.flag; + this.delConfirm(exType, flag); + }; + //删除单据 + delConfirm = (exType, flag) => { + ajax({ + url: '/nccloud/arap/arappub/confirmdelete.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 && 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 { + toast({ color: 'success', content: this.state.json['paybill-000009'] });/* 国际化处理: 删除成功*/ + let id = this.props.getUrlParam("id"); + deleteCacheById(pkname, id, dataSource); + let nextId = getNextId(id, dataSource); + if (nextId) { + this.props.setUrlParam({ id: nextId }); + this.queryCard(nextId, this.getPagecode()); + } else { + this.props.setUrlParam({ id: null }); + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.toggleShow() + } + this.clearExType(); + } + + } + } + }); + }; + //取消确认模态框确定按钮点击事件 + cancelConfirmSureBtnClick = () => { + let exType = this.Info.exType; + let flag = this.Info.flag; + this.cancelConfirm(exType, flag); + }; + + cancelConfirm(extype, flag) { + ajax({ + url: '/nccloud/arap/arappub/cancelconfirm.do', + data: Object.assign({ + pageId: this.getPagecode(), + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + billType: this.billType, + type: 2, + conferExtype: extype, + conferFlag: flag + },this.dataInSaga), + success: (res) => { + if (res.data.exType == '1') { + this.Info.tipContent = res.data.message; + this.Info.exType = '1'; + this.Info.flag = true; + this.props.modal.show('cancelConfirmCheck'); + return; + } else { + toast({ color: 'success', content: this.state.json['paybill-000001'] });/* 国际化处理: 取消确认成功*/ + 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.updateDataByRowId(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.props.setUrlParam({ status: 'browse' }) + this.clearExType(); + this.toggleShow(res) + } + + } + }); + + } + cancel = () => {//取消按钮 + this.props.setUrlParam({ status: 'browse' }) + let id = this.props.getUrlParam('id'); + let cardData = getCacheById(id, dataSource); + if (cardData) { + this.props.beforeUpdatePage();//打开开关 + 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'); + throwSagaErrorAgency.call(this,cardData) + this.props.updatePage(this.formId, this.tableId);//关闭开关 + this.toggleShow(); + } else { + this.queryCard(this.props.getUrlParam('id'), this.getPagecode()); + } + } + //提交and收回公共调用函数 + commitAndUncommit = () => { + let tipUrl = this.Info.tipUrl; + let extype = this.Info.exType; + let flag = this.Info.flag; + let 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, + refNode: 'isCoorcomfirm', + flag: flag, + assignObj: this.Info.compositedata + },this.dataInSaga) + if (this.Info.saveflag == false) { + tipUrl = '/nccloud/arap/arappub/saveandcommit.do'; + this.Info.saveflag = false; + let cardDataold = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + let cardData = dealCardData(this, cardDataold); //去掉空值,减少压缩时间 + data = Object.assign(data,{cardData:cardData,uiState: this.props.getUrlParam('status')}); + } + ajax({ + url: tipUrl, + data:data, + success: (res) => { + if (res.data.exType == '1') { + let content = res.data.message; + this.Info.tipContent = content; + this.Info.tipUrl = tipUrl; + 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'); + } + let pk_bill = this.props.form.getFormItemsValue(this.formId, pkname).value; + if(this.Info.pk_bill){ + pk_bill = this.Info.pk_bill; + }else if(this.props.getUrlParam('id')){ + pk_bill = this.props.getUrlParam('id') + } + + this.props.setUrlParam({ + status: 'browse', + id: pk_bill + }); + if (this.state.compositedisplay) { + this.setState({ compositedisplay: false }); + } + this.clearExType(); + this.toggleShow(res); + toast({ color: 'success', content: this.state.json['receivablebill-000025'] }); /* 国际化处理: 操作成功*/ + } + } + }); + }; + //提交和收回弹框点击取消 + clearExType = () => { + this.Info.tipContent = ''; + this.Info.pk_bill = null; + this.Info.ts = null; + this.Info.tipUrl = null; + this.Info.exType = null; + this.Info.flag = false; + this.Info.compositedata = null; + }; + cancelClick = () => { + if (this.Info.saveflag == true) { + if (this.Info.pk_bill != null) { + if (this.props.getUrlParam('type') && this.props.getUrlParam('type') != 'transfer') { + this.props.delUrlParam('type'); + } + this.props.beforeUpdatePage(); //打开开关 + this.state.buttonfalg = null; + 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); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + addCache(pkname, newCardData, this.formId, dataSource); //新增 + this.Info.saveflag = false; + this.toggleShow(); + } + } + if (this.state.compositedisplay) { + this.setState({ compositedisplay: false }); + } + this.clearExType(); + }; + //保存事件模态框确定按钮点击事件 + saveSureBtnClick = () => { + let tipUrl = this.Info.tipUrl; + let exType = this.Info.exType; + let flag = this.Info.flag; + this.saveBill(tipUrl, exType, flag); + }; + //保存单据 + saveBill = (url, extype, flag, modelIndex) => { + + //删除空白行 + let checkCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + delBlankLine(this, this.tableId, this.billType, checkCardData, modelIndex); + + let result=this.props.validatePageToToast([ + { + name: this.formId, + type: "form", + }, + { + name: this.tableId, + type: "cardTable", + } + ]); + if(result&&!result.allPassed){ + return; + } + let cardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + let newCardData = dealCardData(this, cardData); //去掉空值,减少压缩时间 + let datas = { + cardData: newCardData, + uiState: this.props.getUrlParam('status'), + extype: extype, + refNode: 'isCoorcomfirm', + flag: flag + }; + 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_paybill = 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/commit.do'; + this.Info.exType = '1'; + this.Info.flag = true; + if (res.data.pk_bill == null) { + this.props.modal.show('saveCheck'); + } else { + this.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/commit.do'); + (this.Info.exType = '2'); + this.Info.flag = true; + if (res.data.pk_bill == null) { + this.props.modal.show('saveCheck'); + } 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/commit.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_paybill = res.data.head[this.formId].rows[0].values.pk_paybill.value; + pk_tradetype = res.data.head[this.formId].rows[0].values.pk_tradetype.value; + } + if (res.data.body && res.data.body[this.tableId]) { + this.props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId]); + //this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + + this.state.buttonfalg = null; + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + if (!res.data.message) { + toast({ color: 'success', content: this.state.json['paybill-000010'] }); /* 国际化处理: 保存成功*/ + } else { + toast({ color: 'danger', content: JSON.stringify(res.data.message) }); + } + let newCardData = this.props.createMasterChildData( + this.getPagecode(), + this.formId, + this.tableId + ); + if (this.props.getUrlParam('status') == 'add') { + addCache(pk_paybill, newCardData, this.formId, dataSource); //新增 + let idObj = { id: pk_paybill, status: 1 }//1 修改 2新增 3删除 + this.props.cardPagination.setCardPaginationId(idObj); + } else { + updateCache(pkname, pk_paybill, newCardData, this.formId, dataSource); //修改之后更新缓存 + } + if (this.props.getUrlParam('type')) { + this.props.delUrlParam('type'); + } + if (this.props.getUrlParam('scene')) { + this.props.setUrlParam({ status: 'browse', id: pk_paybill }); + } else { + this.props.setUrlParam({ + status: 'browse', + id: pk_paybill, + pagecode: pk_tradetype + }); + } + } + } + } + if (this.Info.isModelSave) { + this.Info.isModelSave = false; + this.props.cardTable.closeModel(this.tableId); + } + if (this.props.getUrlParam('type') != 'transfer') { + this.toggleShow(res); + } + this.clearExType(); + } + }); + }; + this.props.validateToSave(datas.cardData, callback, { table1: 'cardTable' }, 'card'); + }; + //获取列表肩部信息 + getTableHead = () => { + return ( + + {this.props.button.createButtonApp({ + area: 'card_body', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} + + ); + }; + + //整单保存事件 + modelSaveClick = (modelIndex) => { + this.Info.isModelSave = true; + let saveUrl = '/nccloud/arap/arappub/save.do'; + this.saveBill(saveUrl, null, null, modelIndex); + }; + //返回列表 + backList = () => { + this.props.pushTo('/list', { + pagecode: '20080SPAC_LIST' + }) + } + + + render() { + let { cardTable, form, button, modal, cardPagination } = 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; + return ( +
+ + +
+ {createBillHeadInfo({ + title: this.state.json['paybill-000011'],//国际化处理: 付款单协同确认 + backBtnClick: () => { + this.backList(); + } + })} +
+
+ {cardSocketConnect.call(this,'card_head',dataSource)} + {cardSocketErrorFlag.call(this,'card_head')} + {this.props.button.createButtonApp({ + area: 'card_head', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} +
+
+ {createCardPagination({ + handlePageInfoChange: pageInfoClick.bind(this), + dataSource: dataSource + })} +
+
+
+
+ {createForm(this.formId, { + fieldid: "confirmpaybill", + onBeforeEvent: formBeforeEvent.bind(this), + onAfterEvent: afterEvent.bind(this) + })} +
+ { +
+ {createCardTable(this.tableId, { + fieldid: "confirmpaybill", + tableHead: this.getTableHead.bind(this, buttons), + modelSave: this.modelSaveClick.bind(this), + hideAdd: true, + hideDel: true, + onAfterEvent: afterEvent.bind(this), + onBeforeEvent: bodyBeforeEvent.bind(this), + onSelected: this.onSelected.bind(this), + onSelectedAll: this.onSelected.bind(this), + showCheck: true, + showIndex: true, + adaptionHeight: true, + high_selectable: { + enable: true //默认为true + }, + // 框选 + onBatchSelected: (...params) => { + this.onSelected.call(this) + }, + })} +
+ } + {createModal('saveCheck', { + title: this.state.json['paybill-000043'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + beSureBtnClick: this.saveSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('deleteCheck', { + title: this.state.json['paybill-000043'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + beSureBtnClick: this.deleteBillSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('cancelConfirmCheck', { + title: this.state.json['paybill-000043'], //'预算异常提示信息',//'预算异常提示信息',//this.state.json['10170406-000017'],// 异常提示/* 国际化处理: 异常提示信息*/ + content: this.Info.tipContent, // '预算不通过!',//this.modalContent.call(this), //弹框内容,可以是字符串或dom + beSureBtnClick: this.cancelConfirmSureBtnClick.bind(this) //点击确定按钮事件 + })} + {createModal('commitAndUncommit', { + title: this.state.json['paybill-000044'] /* 国际化处理: 提示信息*/, + content: this.Info.tipContent, + beSureBtnClick: this.commitAndUncommit.bind(this), //点击确定按钮事件 + cancelBtnClick: this.cancelClick.bind(this) //提交和收回取消事件 + })} + {/* 指派信息弹框 */} + {this.state.compositedisplay ? ( + + ) : null} +
+ ); + } +} + +Card = createPage({ + orderOfHotKey: [formId, tableId],//区域快捷键切换支持 + mutiLangCode: '2052', +})(Card); + +export default Card; diff --git a/src/arap/paybill/confirmpaybill/list/constants.js b/src/arap/paybill/confirmpaybill/list/constants.js new file mode 100644 index 00000000..3f91b30b --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/constants.js @@ -0,0 +1,38 @@ + +/** + * 查询区域 + */ +export const searchId = 'query'; + +/** + * 列表区域 + */ +export const tableId = 'list'; + + +/** + * 默认交易类型 + */ +export const tradeType = 'D3'; + +/** + * 单据类型 + */ +export const billType = 'F3'; + +/** + * 单页应用缓存 + */ +export const dataSource = 'fi.arap.confirmpaybill.20080SPAC'; + +/** + * 单页应用缓存主键名字(该名字为表的主键名字) + */ +export const pkname = 'pk_paybill'; + +/** + * 单页查询区缓存主键名字 + */ + +export const searchKey = 'pk_paybill_search'; + diff --git a/src/arap/paybill/confirmpaybill/list/events/buttonClick.js b/src/arap/paybill/confirmpaybill/list/events/buttonClick.js new file mode 100644 index 00000000..78288d98 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/buttonClick.js @@ -0,0 +1,155 @@ +import { ajax, base, toast, cardCache, promptBox } from 'nc-lightapp-front'; +import { imageScan, imageView } from 'sscrp/rppub/components/image'; +import { headButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { billType, tableId, searchId, dataSource,pkname } from '../constants'; +import { moduleEnable, IMAG, SSCIVM } from '../../../../public/components/moduleEnable.js'; +import {getAllCheckedDataNew,deleteTableRowsByRowIds,deleteCachePKAndTS} from '../../../../public/components/updateTableDataTs'; +let { setDefData, getDefData } = cardCache; +export default function buttonClick(props, id) { + this.dataInSaga.butncode = id; + switch (id) { + case headButton.Delete: + promptBox({ + color: 'warning', + title: this.state.json['paybill-000002'], /* 国际化处理: 删除*/ + content: this.state.json['paybill-000052'], /* 国际化处理: ​确定要删除所选数据吗?*/ + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['paybill-000004'], /* 国际化处理: 确定*/ + cancelBtnName: this.state.json['paybill-000005'], /* 国际化处理: 取消*/ + beSureBtnClick: () => { + // let deleteData = getAllCheckedData.call(this, this.props, this.tableId, billType); + let {delObjs ,rowIds}= getAllCheckedDataNew.call(this, this.props, this.tableId, billType,pkname); + if (delObjs.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000012'] });/* 国际化处理: 请选中至少一行数据!*/ + return; + } + ajax({ + url: '/nccloud/arap/arappub/confirmbatchdelete.do', + data: delObjs, + success: (res) => { + let { success, data } = res; + if (success) { + if (data.message) { + toast({ + duration: 'infinity', + color: data.PopupWindowStyle, + content: data.message, + }) + } + // if (data.successIndexs) { + // //删除当前行数据 + // props.table.deleteTableRowsByIndex(tableId, data.successIndexs); + // } + deleteTableRowsByRowIds.call(this,{props,data,rowIds,tableId}); + if (data.successPKs) { + //删除缓存数据 + // props.table.deleteCacheId(tableId, data.successPKs); + deleteCachePKAndTS.call(this,{props,tableId,successPKs:data.successPKs,checkedRows:delObjs,pkId:'pk_bill',pkname}); + } + this.onSelected(); + } + } + }); + } + }); + + + break; + case headButton.Refresh: + let data = getDefData(searchId, dataSource); + if (data) { + ajax({ + url: '/nccloud/arap/confirmpaybill/queryscheme.do', + data: Object.assign(data, this.dataInSaga), + success: (res) => { + let { success, data } = res; + if (success) { + if (data) { + toast({ color: 'success', title: this.state.json['paybill-000051'] });/* 国际化处理: 刷新成功*/ + this.props.table.setAllTableData(this.tableId, data[this.tableId]); + setDefData(this.tableId, dataSource, data);//放入缓存 + this.onSelected(); + } else { + toast({ color: 'success', content: this.state.json['paybill-000013'] });/* 国际化处理: 未查询到数据*/ + this.props.table.setAllTableData(this.tableId, { rows: [] }); + } + + } + } + }); + } else { + toast({ color: 'success', title: this.state.json['paybill-000051'] });/* 国际化处理: 刷新成功*/ + this.props.table.setAllTableData(this.tableId, { rows: [] }); + } + break; + case headButton.ReceiptCheck: //影像查看pk_tradetype + if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用 + return; + } + let CheckInfo = getFirstCheckedData(this.props, this.tableId); + + var billInfoMap = {}; + + //基础字段 单据pk,单据类型,交易类型,单据的组织 + billInfoMap.pk_billid = CheckInfo.data.values.pk_paybill.value; + billInfoMap.pk_billtype = CheckInfo.data.values.pk_billtype.value; + billInfoMap.pk_tradetype = CheckInfo.data.values.pk_tradetype.value; + billInfoMap.pk_org = CheckInfo.data.values.pk_org.value; + imageView(billInfoMap, 'iweb'); + break; + case headButton.ReceiptScan: //影像扫描 + if (!moduleEnable(this, IMAG)) { //校验关联模块是否启用 + return; + } + let ScanInfo = getFirstCheckedData(this.props, this.tableId); + + var billInfoMap = {}; + + //基础字段 单据pk,单据类型,交易类型,单据的组织 + billInfoMap.pk_billid = ScanInfo.data.values.pk_paybill.value; + billInfoMap.pk_billtype = ScanInfo.data.values.pk_billtype.value; + billInfoMap.pk_tradetype = ScanInfo.data.values.pk_tradetype.value; + billInfoMap.pk_org = ScanInfo.data.values.pk_org.value; + + //影像所需 FieldMap + billInfoMap.BillType = ScanInfo.data.values.pk_tradetype.value; + billInfoMap.BillDate = ScanInfo.data.values.creationtime.value; + billInfoMap.Busi_Serial_No = ScanInfo.data.values.pk_paybill.value; + // billInfoMap.pk_billtype = billdata.head.head.rows[0].values.pk_billtype.value; + billInfoMap.OrgNo = ScanInfo.data.values.pk_org.value; + billInfoMap.BillCode = ScanInfo.data.values.billno.value == undefined ? '' : ScanInfo.data.values.billno.value; + billInfoMap.OrgName = ScanInfo.data.values.pk_org_v.display; + billInfoMap.Cash = ScanInfo.data.values.money.value + imageScan(billInfoMap, 'iweb'); + break; + } +} + +//获取选中数据的id和billType +let getAllCheckedData = function (props, tableId, billType) { + let checkedData = props.table.getCheckedRows(tableId); + let checkedObj = []; + checkedData.forEach((val) => { + checkedObj.push(Object.assign({ + pk_bill: val.data.values?val.data.values.pk_paybill.value:val.data.pk, + ts: val.data.values?val.data.values.ts.value:val.data.ts, + billType: billType, + index: val.index + }, this.dataInSaga) + ); + }); + return checkedObj; +} +//获取选中数据的第一行,选中多行的时候只取第一行数据 +let getFirstCheckedData = function (props, tableId) { + let checkedData = props.table.getCheckedRows(tableId,false); + let checkedObj; + if (checkedData.length > 0) { + checkedObj = checkedData[0]; + } else { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + return checkedObj; +}; \ No newline at end of file diff --git a/src/arap/paybill/confirmpaybill/list/events/doubleClick.js b/src/arap/paybill/confirmpaybill/list/events/doubleClick.js new file mode 100644 index 00000000..30fd74e1 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/doubleClick.js @@ -0,0 +1,16 @@ +import { cardCache } from 'nc-lightapp-front'; +let { setDefData } = cardCache; +import { searchId, searchKey, dataSource } from '../constants'; +export default function doubleClick(record, index, e) { + //表页跳转的时候,获取所有查询区条件,并放入缓存 + let searchVal = this.props.search.getAllSearchData(searchId); + if (searchVal) { + setDefData(searchKey, dataSource, searchVal); + } + this.props.pushTo('/card', { + status: 'browse', + id: record.pk_paybill.value, + pagecode: record.pk_tradetype.value + }) + +} diff --git a/src/arap/paybill/confirmpaybill/list/events/index.js b/src/arap/paybill/confirmpaybill/list/events/index.js new file mode 100644 index 00000000..32b91da0 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/index.js @@ -0,0 +1,7 @@ +import searchBtnClick from './searchBtnClick'; +import initTemplate from './initTemplate'; +import pageInfoClick from './pageInfoClick'; +import buttonClick from './buttonClick'; +import doubleClick from './doubleClick'; +import tableButtonClick from './tableButtonClick'; +export { searchBtnClick, pageInfoClick,initTemplate,buttonClick, doubleClick,tableButtonClick}; diff --git a/src/arap/paybill/confirmpaybill/list/events/initTemplate.js b/src/arap/paybill/confirmpaybill/list/events/initTemplate.js new file mode 100644 index 00000000..d0793a71 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/initTemplate.js @@ -0,0 +1,108 @@ +import { createPage, ajax, base, toast, cardCache } from 'nc-lightapp-front'; +let { NCPopconfirm, NCIcon } = base; +import tableButtonClick from './tableButtonClick.js'; +import { buttonVisible, getButtonsKey, getInnerButtonkey } from '../../../../public/components/pubUtils/buttonvisible.js'; +import { tableId, searchId, billType, searchKey, dataSource } from '../constants'; +import { modifierSearchMetas } from '../../../../public/components/pubUtils/arapListSearchRefFilter'; +import { innerButton } from '../../../../public/components/pubUtils/buttonName.js'; +let { setDefData } = cardCache; +import {OperationColumn} from '../../../../public/components/pubUtils/arapConstant'; +import setDefOrgBilldateSrchArea from '../../../../public/components/defOrgBilldateSrchArea.js'; +export default function (props,callback) { + const that = this; + props.createUIDom( + { + pagecode: that.getPagecode(),//页面id + appcode: props.getSearchParam("c"),//注册按钮的id + reqDataQuerypage: { + rqUrl: '/arap/arappub/querypage.do', + rqJson: `{\n \"pagecode\": \"${that.getPagecode()}\",\n \"appcode\": \"${props.getSearchParam("c")}\"\n}`, + rqCode: 'template' + } + }, + function (data) { + if (data) { + if(!data.template[tableId]){ + return; + } + let lineButton = []; + if (data.button) { + let button = data.button; + getButtonsKey(button, that.Info.allButtonsKey);//获取所有按钮 + props.button.setButtons(button); + props.button.setPopContent(innerButton.Delete_Inner, that.state.json['paybill-000006']);/*删除信息提示框*//* 国际化处理: 确定要删除吗?*/ + } + if (data.template) { + //高级查询设置财务组织默认值 + setDefOrgBilldateSrchArea(props, searchId, data); + let meta = data.template; + lineButton = getInnerButtonkey(data.button); + meta = modifierMeta(props, meta, lineButton, that); + modifierSearchMetas(searchId, props, meta, billType, null,that); + props.meta.setMeta(meta); + } + if(callback){ + callback() + } + } + } + ) +} + + + +function modifierMeta(props, meta, lineButton, that) { + + meta[tableId].items = meta[tableId].items.map((item, key) => { + if (item.attrcode == 'billno') { + item.render = (text, record, index) => { + return ( + { + //表页跳转的时候,获取所有查询区条件,并放入缓存 + let searchVal = props.search.getAllSearchData(searchId); + if (searchVal) { + setDefData(searchKey, dataSource, searchVal); + } + props.pushTo('/card', { + status: 'browse', + id: record.pk_paybill.value, + pagecode: record.pk_tradetype.value + }); + }} + > + {record.billno && record.billno.value} + + ); + }; + } + return item; + }); + //添加操作列 + meta[tableId].items.push({ + label: that.state.json['paybill-000007'],/* 国际化处理: 操作*/ + itemtype: 'customer', + attrcode: 'opr', + width: OperationColumn, + visible: true, + fixed: 'right', + render: (text, record, index) => { + let buttonAry = lineButton ? lineButton : []; + let trueBtn = []; + for (let i = 0; i < buttonAry.length; i++) { + let flag = buttonVisible('browse', record, buttonAry[i]); + if (flag) { + trueBtn.push(buttonAry[i]); + } + } + return props.button.createOprationButton(trueBtn, { + area: "list_inner", + buttonLimit: 3, + onButtonClick: (props, key) => tableButtonClick(that, props, key, text, record, index) + }); + + } + }); + return meta; +} diff --git a/src/arap/paybill/confirmpaybill/list/events/pageInfoClick.js b/src/arap/paybill/confirmpaybill/list/events/pageInfoClick.js new file mode 100644 index 00000000..42ccbce6 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/pageInfoClick.js @@ -0,0 +1,27 @@ +import {ajax} from 'nc-lightapp-front'; +import { tableId,searchId} from '../constants'; +export default function (props, config, pks) { + let that = this; + if(!pks || pks.length == 0){ + return ; + } + let data = { + pk_bills: pks, + pageId: props.getSearchParam("p") + }; + ajax({ + url: '/nccloud/arap/confirmpaybill/querygridbyids.do', + data: data, + success: function (res) { + let { success, data } = res; + if (success) { + if (data) { + props.table.setAllTableData(tableId, data[tableId]); + } else { + props.table.setAllTableData(tableId, { rows: [] }); + } + } + that.onSelected(); + } + }); +} diff --git a/src/arap/paybill/confirmpaybill/list/events/searchBtnClick.js b/src/arap/paybill/confirmpaybill/list/events/searchBtnClick.js new file mode 100644 index 00000000..e20ed75d --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/searchBtnClick.js @@ -0,0 +1,38 @@ +import {ajax ,toast,cardCache} from 'nc-lightapp-front'; +import { tableId, searchId,dataSource} from '../constants'; + +let {setDefData, getDefData } = cardCache; + +export default function clickSearchBtn(props,searchVal) { + if(searchVal&&searchVal.conditions&&searchVal.conditions.length>0){ + let pageInfo = props.table.getTablePageInfo(this.tableId); + let queryInfo = props.search.getQueryInfo(this.searchId); + queryInfo.pageInfo = pageInfo; + let data = { + pageId: props.getSearchParam('p'), + queryInfo:queryInfo + }; + setDefData(searchId, dataSource, data);//放入缓存 + ajax({ + url: '/nccloud/arap/confirmpaybill/queryscheme.do', + data: data, + success: (res) => { + let { success, data } = res; + if (success) { + if(data){ + toast({ color: 'success', content: this.state.json['paybill-000015']+data[this.tableId].allpks.length+this.state.json['paybill-000016'] });/* 国际化处理: 查询成功,共,条*/ + this.props.table.setAllTableData(this.tableId, data[this.tableId]); + setDefData(this.tableId, dataSource, data);//放入缓存 + this.props.table.selectAllRows(this.tableId, false) + this.onSelected() + }else{ + toast({ color: 'warning', content: this.state.json['paybill-000017'] });/* 国际化处理: 未查询出符合条件的数据*/ + this.props.table.setAllTableData(this.tableId, {rows:[]}); + } + + } + } + }); + } + +}; diff --git a/src/arap/paybill/confirmpaybill/list/events/tableButtonClick.js b/src/arap/paybill/confirmpaybill/list/events/tableButtonClick.js new file mode 100644 index 00000000..6212b495 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/events/tableButtonClick.js @@ -0,0 +1,75 @@ +import { ajax, base, toast,cardCache } from 'nc-lightapp-front'; +import { billType,tableId ,dataSource} from '../constants'; +import {innerButton} from '../../../../public/components/pubUtils/buttonName.js'; +let {setDefData, getDefData } = cardCache; + +export default function(that,props, key, text, record, index){ + switch (key) { + case innerButton.Confirm_inner:// 表格操确认 + ajax({ + url: '/nccloud/arap/arappub/confirm.do', + data: { + pageId: record.pk_tradetype.value, + pk_bill: record.pk_paybill.value, + ts: record.ts.value, + billType : billType + }, + success: (res) => { + if(res.success){ + setDefData('confirm'+record.pk_paybill.value, dataSource, res.data); + props.pushTo('/card', { + status: 'edit', + id: record.pk_paybill.value, + pagecode:record.pk_tradetype.value, + buttonfalg:true + }) + } + } + }); + break; + case innerButton.CancelConfirm_inner: + ajax({ + url: '/nccloud/arap/arappub/cancelconfirm.do', + data: { + pageId: props.getSearchParam("p"), + pk_bill: record.pk_paybill.value, + ts: record.ts.value, + billType : billType, + type :1 + }, + success: (res) => { + let { success, data } = res; + if (success) { + toast({ color: 'success', content: that.state.json['paybill-000001'] });/* 国际化处理: 取消确认成功*/ + //更新当前行数据 + props.table.updateDataByIndexs(tableId, + [{index:index ,data: {values :data[tableId].rows[0].values}}]); + } + } + }); + break; + case innerButton.Delete_Inner: + ajax({ + url: '/nccloud/arap/arappub/confirmdelete.do', + data:{ + pk_bill: record.pk_paybill.value, + ts: record.ts.value, + billType: billType + }, + success: (res) => { + if (res.success) { + toast({color: 'success', content: that.state.json['paybill-000009']});/* 国际化处理: 删除成功*/ + //删除当前行数据 + props.table.deleteTableRowsByIndex(tableId, index); + let {deleteCacheId} = props.table; + //删除缓存数据 + deleteCacheId(tableId,record.pk_paybill.value); + that.onSelected(); + } + } + }); + break; + default: + break; + } +}; diff --git a/src/arap/paybill/confirmpaybill/list/index.js b/src/arap/paybill/confirmpaybill/list/index.js new file mode 100644 index 00000000..221161e4 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/list/index.js @@ -0,0 +1,192 @@ +//主子表列表 + +import React, { Component } from 'react'; +import { createPage, base,ajax, toast,cardCache,cacheTools, getMultiLang } from 'nc-lightapp-front'; +import { buttonClick, initTemplate, searchBtnClick, pageInfoClick, tableModelConfirm, doubleClick } from './events'; +import { onListButtonControl } from '../../../public/components/pubUtils/buttonvisible.js'; +import { tableId, searchId, billType,pkname, dataSource, searchKey } from './constants'; +import afterEvent from '../../../public/components/searchAreaAfterEvent'//查询区编辑后事件 +let { setDefData, getDefData } = cardCache; +const { NCDiv } = base; +import {listSocketConnect} from '../../../public/components/pubUtils/MicroServiceSocket.js'; +class List extends Component { + constructor(props) { + super(props); + this.searchId = searchId; + this.tableId = tableId; + this.billType = billType; + this.pkname = pkname; + this.pageId = props.getSearchParam("p"); + let { search } = this.props; + let { setSearchValByField, getAllSearchData } = search; + this.setSearchValByField = setSearchValByField;//设置查询区某个字段值 + this.getAllSearchData = getAllSearchData;//获取查询区所有字段数据 + this.Info = { + allButtonsKey: [] + } + this.state = { + json: {} + } + this.dataInSaga = { //用于saga里面的busiinfo + appcode : props.getSearchParam('c') ? props.getSearchParam('c') : null, + pagecode : props.getSearchParam('p') ? props.getSearchParam('p') : null, + butncode : null + } + props.use.table(tableId); + props.use.search(searchId); + } + + componentWillReceiveProps(nextProps) { + + } + + componentWillMount() { + let callback = (json) => { + this.setState({ json: json }, () => { + initTemplate.call(this, this.props, this.initShow); + }); + } + getMultiLang({ moduleId: ['paybill', 'public'], domainName: 'arap', currentLocale: 'simpchn', callback }); + } + + getPagecode = () => { + let pagecode = '20080SPAC_LIST'; + return pagecode; + } + + + componentDidMount() { + + + } + initShow = () => { + if (!this.props.table.hasCacheData(dataSource)&&!this.props.getUrlParam('src')) { + this.onSelected();//缓存不存在,就控制按钮 + } + if (this.props.getUrlParam('src') == 'widgetconfer') { + let PayConferSearchVO = cacheTools.get('20080SPACwidgetconfer'); + let pageInfo = this.props.table.getTablePageInfo(this.tableId); + let queryInfo = { + pageInfo: pageInfo, + queryAreaCode: this.searchId, //查询区编码 + oid: '0001Z31000000005PSYI', + querytype: 'tree' + }; + let data = { + pageId: this.props.getSearchParam('p'), + queryInfo: queryInfo, + arapConferSearchVO: PayConferSearchVO + }; + ajax({ + url: '/nccloud/arap/confirmpaybill/queryconferwidget.do', + data: data, + success: (res) => { + let { data } = res; + if (data) { + this.props.table.setAllTableData(this.tableId, data[this.tableId]); + } else { + toast({ color: 'warning', content: this.state.json['paybill-000017'] }); /* 国际化处理: 未查询到数据*/ + this.props.table.setAllTableData(this.tableId, { rows: [] }); + } + setDefData(this.tableId, dataSource, data); //放入缓存 + } + }); + } + } + + //列表控制按钮 + onSelected = () => { + onListButtonControl(this); + }; + + // 查询区渲染完成回调函数 + renderCompleteEvent = () => { + let cachesearch = getDefData(searchKey, dataSource); + if (cachesearch && cachesearch.conditions) { + // this.props.search.setSearchValue(this.searchId, cachesearch); + for (let item of cachesearch.conditions) { + if (item.field == 'billdate') { + // 时间类型特殊处理 + let time = []; + time.push(item.value.firstvalue); + time.push(item.value.secondvalue); + this.props.search.setSearchValByField(this.searchId, item.field, + { display: item.display, value: time }); + } else { + this.props.search.setSearchValByField(this.searchId, item.field, + { display: item.display, value: item.value.firstvalue }); + } + } + } + } + + render() { + let { table, search } = this.props; + let { createSimpleTable } = table; + let { NCCreateSearch } = search; + const { createBillHeadInfo } = this.props.BillHeadInfo; + return ( +
+ {listSocketConnect.call(this)} + +
+ {createBillHeadInfo({ + title: this.state.json['paybill-000011'],//国际化处理: 付款单协同确认 + initShowBackBtn: false + })} +
+
+ {this.props.button.createButtonApp({ + area: 'list_head', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} +
+
+
+ {NCCreateSearch(this.searchId, { + clickSearchBtn: searchBtnClick.bind(this),// 点击按钮事件 + showAdvBtn: true, // 显示高级按钮 + renderCompleteEvent: this.renderCompleteEvent, // 查询区渲染完成回调函数 + onAfterEvent: afterEvent.bind(this),//编辑后事件 + })} +
+
+ {createSimpleTable(this.tableId, { + fieldid: "confirmpaybill", + dataSource: dataSource, + pkname: pkname, + handlePageInfoChange: pageInfoClick.bind(this), + tableModelConfirm: tableModelConfirm, + showCheck: true, + showIndex: true, + onRowDoubleClick: doubleClick.bind(this), + onSelected: this.onSelected.bind(this), + onSelectedAll: this.onSelected.bind(this), + crossPageSelect:true, + selectedChange:(...params)=>{ + this.onSelected.call(this) + }, + high_selectable: { + enable: true //默认为true + }, + // 框选 + onBatchSelected: (...params) => { + this.onSelected.call(this) + }, + componentInitFinished: () => { + this.onSelected(); + } + })} +
+
+ ); + } +} + +List = createPage({ + mutiLangCode: '2052' +})(List); + +export default List; diff --git a/src/arap/paybill/confirmpaybill/main/config.json b/src/arap/paybill/confirmpaybill/main/config.json new file mode 100644 index 00000000..d1b851e5 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/main/config.json @@ -0,0 +1,22 @@ +{ + "dependjs": [ + "../../../../sscrp/rppub/components/image/index.js", + "../../../../epmp/exports/components/Inspection/index.js", + "../../../../uap/common/components/ApproveDetail/index.js", + "../../../../uap/common/components/excelImportconfig/index.js", + "../../../../uap/common/components/ExcelOutput/index.js", + "../../../../uap/common/components/NCUploader/index.js", + "../../../../uap/common/components/approvalTrans/index.js", + "../../../../uap/common/components/ApproveDetail/index.js" + ], + "dependModuleName": [ + "sscrp/rppub/components/image", + "epmp/exports/components/Inspection", + "uap/common/components/ApproveDetail", + "uap/common/components/ApproveDetail", + "uap/common/components/excelImportconfig", + "uap/common/components/ExcelOutput", + "uap/common/components/NCUploader", + "uap/common/components/approvalTrans" + ] +} diff --git a/src/arap/paybill/confirmpaybill/main/index.js b/src/arap/paybill/confirmpaybill/main/index.js new file mode 100644 index 00000000..11ccdf30 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/main/index.js @@ -0,0 +1,7 @@ +import {RenderRouter} from 'nc-lightapp-front'; +import routes from './router'; + +(function main(routers,htmlTagid){ + RenderRouter(routers,htmlTagid); +})(routes,"app"); + diff --git a/src/arap/paybill/confirmpaybill/main/router.js b/src/arap/paybill/confirmpaybill/main/router.js new file mode 100644 index 00000000..2226bda1 --- /dev/null +++ b/src/arap/paybill/confirmpaybill/main/router.js @@ -0,0 +1,19 @@ +import {asyncComponent} from 'nc-lightapp-front'; +import List from '../list'; + + +const card = asyncComponent(() => import(/* webpackChunkName: "arap/paybill/confirmpaybill/card/card" */ /* webpackMode: "eager" */'../card')); + +const routes = [ + { + path: '/list', + component: List, + exact: true, + }, + { + path: '/card',//定义路由 + component: card, + } +]; + +export default routes; diff --git a/src/arap/paybill/debtransfer/hisrecord/index.js b/src/arap/paybill/debtransfer/hisrecord/index.js new file mode 100644 index 00000000..4ee4cdc6 --- /dev/null +++ b/src/arap/paybill/debtransfer/hisrecord/index.js @@ -0,0 +1,22 @@ +import TransferHisrecordComponent from '../../../public/components/transferComponent/hisrecordComponent'; + +function Hisrecord(props) { + return ( +
+ +
+ ) +} + +export default Hisrecord; + + + + + diff --git a/src/arap/paybill/debtransfer/hisrecordapply/index.js b/src/arap/paybill/debtransfer/hisrecordapply/index.js new file mode 100644 index 00000000..b653028d --- /dev/null +++ b/src/arap/paybill/debtransfer/hisrecordapply/index.js @@ -0,0 +1,21 @@ +import HisrecordapplyComponent from '../../../public/components/transferComponent/hisrecordComponent'; + +function HisrecordApply(props) { + return ( +
+ +
+ ) +} + +ReactDOM.render(, document.querySelector('#app')); + + + + + diff --git a/src/arap/paybill/debtransfer/list/index.js b/src/arap/paybill/debtransfer/list/index.js new file mode 100644 index 00000000..d1def7d7 --- /dev/null +++ b/src/arap/paybill/debtransfer/list/index.js @@ -0,0 +1,20 @@ +import TransferListComponent from '../../../public/components/transferComponent/list'; + +function TransferList(props) { + return ( + + ) +} + +export default TransferList; + + + + + diff --git a/src/arap/paybill/debtransfer/main/index.js b/src/arap/paybill/debtransfer/main/index.js new file mode 100644 index 00000000..2607fc11 --- /dev/null +++ b/src/arap/paybill/debtransfer/main/index.js @@ -0,0 +1,7 @@ +import { RenderRouter } from 'nc-lightapp-front'; +import routes from './router'; + + +(function main(routers, htmlTagid) { + RenderRouter(routers, htmlTagid); +})(routes, "app"); diff --git a/src/arap/paybill/debtransfer/main/router.js b/src/arap/paybill/debtransfer/main/router.js new file mode 100644 index 00000000..f6712147 --- /dev/null +++ b/src/arap/paybill/debtransfer/main/router.js @@ -0,0 +1,26 @@ +import { asyncComponent } from 'nc-lightapp-front'; +import List from '../list'; + +//应收单卡片 +const his = asyncComponent(() => import(/*webpackChunkName:"/arap/receivablebill/debtransfer/hisrecord/his"*/ /* webpackMode: "eager" */ '../hisrecord')); + + +const routes = [ + { + path: '/', + component: List, + exact: true + }, + { + path: '/list', + component: List + }, + { + path: '/his', + component: his + } +]; + +export default routes; + + diff --git a/src/arap/paybill/initpaybill/card/constants.js b/src/arap/paybill/initpaybill/card/constants.js new file mode 100644 index 00000000..76472db5 --- /dev/null +++ b/src/arap/paybill/initpaybill/card/constants.js @@ -0,0 +1,42 @@ + +/** + * 表头区域 + */ +export const formId = 'head'; + +/** + * 表体区域 + */ +export const tableId = 'bodys'; + +/** + * 分摊对象 + */ + export const allocation = 'allocobjrule' + + +/** + * 单据类型 + */ +export const billType = 'F3'; +/** + * 默认交易类型 + */ +export const tradeType = 'D3'; + + +/** + * 默认模板节点标识 + */ +export const nodekey = "card"; + +/** + * 单页应用缓存 + */ +export const dataSource = 'fi.arap.initpaybill.20080PO'; + +/** + * 单页应用缓存主键名字(该名字为表的主键名字) + */ +export const pkname = 'pk_paybill'; + diff --git a/src/arap/paybill/initpaybill/card/events/afterEvent.js b/src/arap/paybill/initpaybill/card/events/afterEvent.js new file mode 100644 index 00000000..f1c0b763 --- /dev/null +++ b/src/arap/paybill/initpaybill/card/events/afterEvent.js @@ -0,0 +1,371 @@ +import { ajax, promptBox, toast } from 'nc-lightapp-front'; +import { currentTypeAfterFormEvents } from '../../../../public/components/pubUtils/currentTypeAfterEvent'; +import { autoAddLineKeys } from '../../../../public/components/pubUtils/billPubInfo'; +import { formulamsgHint, renderData, headAfterEventRenderData, bodyAfterEventRenderData, errorDeal } from '../../../../public/components/afterEventPub/afterEventPubDeal'; +import { getColvalues, getRowIds } from '../../../../public/components/pubUtils/billPubUtil'; +import { moneyAndRateFields } from '../../../../public/components/pubUtils/specialFieldAfterEvent.js'; +import { setAllocField } from '../../../../public/components/allocation.js'; +export default function afterEvent(props, moduleId, key, value, changedrows, i, s, 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 == '') { + //清空财务组织 + promptBox({ + color: 'warning', + title: this.state.json['paybill-000018'] /* 国际化处理: 确认修改*/, + content: this.state.json['paybill-000019'] /* 国际化处理: 确定​修改组织,这样会清空您录入的信息?*/, + beSureBtnName: this.state.json['paybill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['paybill-000005'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + this.props.form.setFormItemsValue("allocobjrule",  { "allocobjrule": { value: '', display: '' } }); + 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 }); + } + }); + } else if (changedrows.value != null && changedrows.value != '') { + //切换组织 + promptBox({ + color: 'warning', + title: this.state.json['paybill-000018'] /* 国际化处理: 确认修改*/, + content: this.state.json['paybill-000019'] /* 国际化处理: 确定​修改组织,这样会清空您录入的信息?*/, + beSureBtnName: this.state.json['paybill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['paybill-000005'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + this.props.form.setFormItemsValue("allocobjrule",  { "allocobjrule": { value: '', display: '' } }); + ajax({ + url: '/nccloud/arap/initpaybill/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 'supplier_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', 'payaccount', 'recaccount', 'pk_currtype', 'supplier', 'supplier_v', 'buysellflag', + 'objtype', "direction", "pk_billtype", "top_billtype",'pk_ratetype','ratedate','ordercubasdoc','ordercubasdoc_v'].concat(moneyAndRateFields)), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + }; + headFieldAfterRequest.call(this, data, key, changedrows) + break; + case 'payaccount': + 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', 'supplier', 'supplier_v', 'buysellflag', + 'objtype', "direction", "pk_billtype"].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', 'supplier', 'supplier_v', 'taxtype', 'buysellflag', 'objtype', "direction",'pk_pcorg','pk_pcorg_v', 'costcenter', 'billdate']), + 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', 'pseudocolumn', 'prepay', 'isdiscount', 'objtype', 'direction', 'agentreceivelocal', 'buysellflag','pk_pcorg','pk_pcorg_v','costcenter']), + 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", + "globaldebit", "globalnotax_de", "globaltax_de", "groupdebit", "groupnotax_de", + "grouptax_de", "local_money_de", "local_notax_de", "local_tax_de", "money_de", "notax_de", "quantity_de", "direction", "pk_ratetype", "ratedate"]), + rowids: getRowIds(this.props, this.tableId), + uiState: this.props.getUrlParam('status') + } + headFieldAfterRequest.call(this, data, key, changedrows) + //币种事件发送完要判断汇率 + //v2111 汇率控制发生变化,都走编辑前进行控制 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; + case 'pk_ratetype': + data = { + pageId: pagecode, + event: this.props.createHeadAfterEventData(pagecode, this.formId, this.tableId, moduleId, key, value), + uiState: this.props.getUrlParam('status') + } + if (value.value == null || value.value == '') { + promptBox({ + color: 'warning', + title: this.state.json['paybill-000058'] /* 国际化处理: 确认清空*/, + content: this.state.json['paybill-000059'] /* 国际化处理: 确定​清空汇率类型,这样会清空金额相关的信息!*/, + beSureBtnName: this.state.json['paybill-000004'] /* 国际化处理: 确定*/, + cancelBtnName: this.state.json['paybill-000005'] /* 国际化处理: 取消*/, + beSureBtnClick: () => { + headFieldAfterRequest.call(this, data, key, changedrows) + }, + cancelBtnClick: () => { + this.props.form.setFormItemsValue(this.formId, { pk_ratetype: changedrows }); + }, + closeByClickBackDrop: false + }); + } else { + headFieldAfterRequest.call(this, data, key, changedrows) + } + break; + case 'pk_periodrule': + 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); + setAllocField(this); + break; + default: + if(key=='startdate'&&value.value){ + value.value = value.value.substr(0, 10)+' 00:00:00'; + this.props.form.setFormItemsValue(this.formId, { key: value }); + }else if(key=='enddate'&&value.value){ + value.value = value.value.substr(0, 10)+' 23:59:59'; + this.props.form.setFormItemsValue(this.formId, { key: value }); + } + 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) { + //科目字段特殊拼接1121\应收票据 + if (key == "subjcode") { + this.props.cardTable.setValByKeyAndIndex(this.tableId, i, 'subjcode', { value: value.refpk, display: value.dispname }) + } + if(key=='startdate'&&value){ + value = value.substr(0, 10)+' 00:00:00'; + this.props.cardTable.setValByKeyAndIndex(this.tableId, i , key , {value: value}); + }else if(key=='enddate'&&value){ + value = value.substr(0, 10)+' 23:59:59'; + this.props.cardTable.setValByKeyAndIndex(this.tableId, i , key , {value: value}); + } + ajax({ + url: '/nccloud/arap/initpaybill/cardbodyafteredit.do', + data: { + rowindex: 0, + editindex: index, + pageId: pagecode, + changedrows: changedrows, + tableId: this.tableId, + 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, index); + //表体改变表头税率编辑性 + if (i == 0 && key == 'pk_currtype') { + //v2111 汇率控制发生变化,都走编辑前进行控制 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['paybill-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 { + if (key == 'startdate' || key == 'enddate'||key=='firstallocdate') { + this.props.cardTable.setValByKeyAndRowId(this.tableId, changedrows[0].rowid, key, { value: changedrows[0].oldvalue.value, display: changedrows[0].oldvalue.display }); + } 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/initpaybill/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 (i == 0 && key == 'pk_currtype') { + //v2111 汇率控制发生变化,都走编辑前进行控制 currentTypeAfterFormEvents(that.formId, props, 'pk_currtype'); + } + //编辑公式提示 + formulamsgHint(that, res); + + } + }); +} + +export function headFieldAfterRequest(requestData, key, changedrows) { + ajax({ + url: '/nccloud/arap/initpaybill/cardheadafteredit.do', + data: requestData, + async: false, + success: (res) => { + //渲染数据 + headAfterEventRenderData(this, res); + //编辑公式提示 + formulamsgHint(this, res); + + if (key == 'pk_org_v') { + let pk_org_v = this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value; + if (pk_org_v) { + this.props.resMetaAfterPkorgEdit(); + this.state.buttonfalg = true; + } else { + this.state.buttonfalg = null; + } + this.toggleShow(); + this.props.cardTable.setColValue(this.tableId,'prepay', { display:this.prepay.display,value: this.prepay.value}); + } + + if (this.props.getUrlParam('type') == 'transfer') { + this.synTransferData(); + } + }, + error: (res) => { + let str = res.message; + if (key == 'pk_org_v') { + this.props.form.setFormItemsValue(this.formId, { 'pk_org_v': { value: null, display: null } }); + }else if(key=='startdate') { + this.props.form.setFormItemsValue(this.formId, { 'startdate' : changedrows}); + }else if(key=='enddate') { + this.props.form.setFormItemsValue(this.formId, { 'enddate': changedrows}); + }else if(key=='firstallocdate'){ + this.props.form.setFormItemsValue(this.formId, { 'firstallocdate': changedrows}); + } + toast({ color: 'danger', content: str });; + } + }); +} + +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) { + let data = this.props.createMasterChildData(pagecode, this.formId, this.tableId); + //清空cardData的表体 + data.body[this.tableId].rows = []; + ajax({ + url: '/nccloud/arap/paybillpub/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); + this.props.cardTable.setValByKeyAndIndex(this.tableId, allRowsNumber, 'prepay', { display:this.prepay.display,value:this.prepay.value}); + } + } + } + }); + } +} \ No newline at end of file diff --git a/src/arap/paybill/initpaybill/card/events/buttonClick.js b/src/arap/paybill/initpaybill/card/events/buttonClick.js new file mode 100644 index 00000000..4a6c2c8c --- /dev/null +++ b/src/arap/paybill/initpaybill/card/events/buttonClick.js @@ -0,0 +1,286 @@ +import { ajax, base, toast, print,cardCache,promptBox } from 'nc-lightapp-front'; +import { calculateHeadMoney, delLine, copyLine, pasteLine, pasteToEndLine } from '../../../../public/components/pubUtils/billPubUtil.js'; +import { headButton, bodyButton } from '../../../../public/components/pubUtils/buttonName'; +import { formId ,dataSource,pkname} from '../constants'; +import {cardBodyControl} from '../../../../public/components/pubUtils/buttonvisible.js'; +import { getTitle } from '../../../../public/components/getCartTableData.js'; +import initTemplate from './initTemplate'; +import arapLinkReport from "../../../../public/components/arapBillLinkReport.js"; +import {copyBill} from '../../../../public/components/pubUtils/CopyBill/arapCopyBill'; +let {getDefData,updateCache ,deleteCacheById} = cardCache; +import { allocperiodruleLinkQuery,showAllocation,setAllocField,ctrAllocBtn} from '../../../../public/components/allocation.js'; +export default function (props, id) { + this.dataInSaga.butncode=id; + switch (id) { + case headButton.Save: + this.saveBill(); + break; + case headButton.Add: + //卡片新增时,将浏览态的单据主键缓存,点击取消时重新查询该主键单据 + let pagecode = getDefData ('sessionTradeType',dataSource); + 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: + ajax({ + url: '/nccloud/arap/init/edit.do', + data: Object.assign({ + pk_bill: this.props.getUrlParam('id'), + billType: this.billType, + ts:this.props.form.getFormItemsValue(this.formId, 'ts')?this.props.form.getFormItemsValue(this.formId, 'ts').value:null + },this.dataInSaga), + success: (res) => { + if (res.success) { + this.props.form.setFormItemsValue(this.formId,{'officialprintuser':{value:null,display:null},'officialprintdate':{display:null,value:null}}) + this.props.cardTable.selectAllRows(this.tableId, false); + this.props.setUrlParam({ status: 'edit' }) + this.state.buttonfalg = true; + this.props.resMetaAfterPkorgEdit(); + this.props.form.setFormItemsDisabled(this.formId, { 'pk_org_v': true }); + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + //设置分摊字段属性 + setAllocField(this); + this.toggleShow() + } + } + }); + break; + case headButton.Copy: + copyBill(this,this.getPagecode()); + break + + case headButton.Delete: + promptBox({ + color: 'warning', + title: this.state.json['paybill-000002'], /* 国际化处理: 删除*/ + content: this.state.json['paybill-000006'], /* 国际化处理: ​确定要删除吗?*/ + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['paybill-000004'], /* 国际化处理: 确定*/ + cancelBtnName: this.state.json['paybill-000005'] , /* 国际化处理: 取消*/ + beSureBtnClick: this.delConfirm + }); + break + case headButton.Cancel: + promptBox({ + color: 'warning', + title: this.state.json['paybill-000005'], /* 国际化处理: 取消*/ + content: this.state.json['paybill-000003'], /* 国际化处理: ​确定要取消吗?*/ + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['paybill-000004'], /* 国际化处理: 确定*/ + cancelBtnName: this.state.json['paybill-000005'] , /* 国际化处理: 取消*/ + 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.BillLinkQuery://联查单据 + this.setState({ showBillTrack: true }) + break; + case headButton.LinkBal://联查余额表 + arapLinkReport( + this.props, + this.props.form.getFormItemsValue(this.formId, 'pk_paybill').value, + this.billType, + this.props.form.getFormItemsValue(this.formId, 'objtype').value, + this.props.form.getFormItemsValue(this.formId, 'pk_org_v') + ); + break; + case headButton.LinkDeal://联查处理情况 + ajax({ + url: '/nccloud/arap/arappub/linkdeal.do', + data: Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_paybill').value, + billType: this.billType + },this.dataInSaga), + success: (res) => { + if (res.success) { + //打开处理情况模态框 + let data = res.data; + this.Info.combinedExaminationData = data; + this.handleCombined(); + } + } + }); + break; + case headButton.LinkTerm://联查收付款协议 + let selectedData = this.props.cardTable.getCheckedRows(this.tableId); + let seletedPks = []; + if (selectedData.length != 0) { + selectedData.forEach((val) => { + seletedPks.push(val.data.values.pk_payitem.value); + }); + } + ajax({ + url: '/nccloud/arap/arappub/linkterm.do', + data: Object.assign({ + pk_bill: this.props.form.getFormItemsValue(this.formId, 'pk_paybill').value, + billType: this.billType, + pk_items: seletedPks, + moduleId: '2008' + },this.dataInSaga), + success: (res) => { + if (res.success) { + //打开收付款协议模态框 + let data = res.data; + this.Info.linkTermData = data; + this.Info.selectedPKS = seletedPks; + this.handleLinkTerm(); + } + } + }); + 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['paybill-000051']});/* 国际化处理: 刷新成功*/ + 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(); + }, + 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 'InitBuild': + this.handlePeriodInformation(); + getTitle("close"); + break; + case 'CancelInitBuild': + this.handlePeriodInformation(); + getTitle("alerdyClose"); + break; + case 'Print'://打印 + this.onPrint(); + break; + case headButton.OfficalPrint://正式打印 + this.officalPrintOutput(); + break; + case headButton.CancelPrint://取消正式打印 + this.cancelPrintOutput(); + break; + case headButton.Output://打印输出 + this.printOutput(); + break; + case headButton.AttachManage://附件管理 + let flag = props.getUrlParam('status'); + if (flag == 'add'||props.getUrlParam('copyFlag')=='copy'||props.getUrlParam('writebackFlag')=='redBack') { + toast({ color: 'warning', content: this.state.json['paybill-000022'] });/* 国际化处理: 请保存后再进行上传附件!*/ + return; + } + this.setState({ + showUploader: true, + target: null + }) + 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 headButton.AllocperiodruleLinkQuery: + allocperiodruleLinkQuery(this); + 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/paybillpub/addline.do', + data: this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId), + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.addRow(this.tableId, rowNum, res.data.body[this.tableId].rows[0].values); + this.props.cardTable.setValByKeyAndIndex(this.tableId, rowNum, 'prepay', { display:this.prepay.display,value:this.prepay.value}) + } + } + } + }); + } + 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); + }) + }; + 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.onSelected(); + break; + case bodyButton.Allocate: + showAllocation(this); + break; + default: + break + } + //控制单据联查期间分摊按钮显示 + ctrAllocBtn(this); +} diff --git a/src/arap/paybill/initpaybill/card/events/index.js b/src/arap/paybill/initpaybill/card/events/index.js new file mode 100644 index 00000000..d3e1b64e --- /dev/null +++ b/src/arap/paybill/initpaybill/card/events/index.js @@ -0,0 +1,5 @@ +import buttonClick from './buttonClick'; +import initTemplate from './initTemplate'; +import afterEvent from './afterEvent'; +import pageInfoClick from './pageInfoClick' +export { buttonClick, afterEvent, initTemplate, pageInfoClick }; diff --git a/src/arap/paybill/initpaybill/card/events/initTemplate.js b/src/arap/paybill/initpaybill/card/events/initTemplate.js new file mode 100644 index 00000000..a37516ca --- /dev/null +++ b/src/arap/paybill/initpaybill/card/events/initTemplate.js @@ -0,0 +1,96 @@ +import excelImportconfig from 'uap/common/components/excelImportconfig'; +import tableButtonClick from './tableButtonClick'; +import { tableId, formId,tradeType,billType } from '../constants'; +import { buttonVisible, getButtonsKey,getInnerButtonkey ,cardBodyAndInnerButtonVisible} from '../../../../public/components/pubUtils/buttonvisible.js'; +import { toast } from 'nc-lightapp-front'; +import { loginContext, getContext, loginContextKeys } from '../../../../public/components/arapInitInfo/loginContext'; +import {OperationColumn} from '../../../../public/components/pubUtils/arapConstant'; +export default function (props,callback) { + const that= this; + let appcode = props.getSearchParam('c'); + let pagecode = that.getPagecode(); + let excelimportconfig = excelImportconfig(props, "arap", billType,true,'',{isinit: 'true',"appcode":appcode,"pagecode":"20080PO_CARD"}); + + props.createUIDom( + { + pagecode: pagecode,//页面id + appcode: appcode,//注册按钮的id + 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) { + let button = data.button; + getButtonsKey(button, that.Info.allButtonsKey);//保存所有头部和肩部按钮 + 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[formId].items.map((item,index)=>{ + if(item.attrcode=='startdate'||item.attrcode=='enddate'||item.attrcode=='firstallocdate'){ + item.isconverttimezones="2";//不转时区 + } + }) + meta[tableId].items.map((item,index)=>{ + if(item.attrcode=='subjcode'){ + item.fieldDisplayed='dispname'; + }else if(item.attrcode=='startdate'||item.attrcode=='enddate'||item.attrcode=='firstallocdate'){ + item.isconverttimezones="2";//不转时区 + }else if(item.attrcode=='prepay'&&item.initialvalue){ + that.prepay.display= item.initialvalue.display; + that.prepay.value= item.initialvalue.value; + } + }) + //添加操作列 + meta[tableId].items.push({ + label: that.state.json['paybill-000007'],/* 国际化处理: 操作*/ + itemtype: 'customer', + attrcode: 'opr', + width: OperationColumn, + visible: true, + fixed: 'right', + render: (text, record, index) => { + let trueBtn = cardBodyAndInnerButtonVisible(that, that.state.buttonfalg, record.expandRowStatus, record, index); + return props.button.createOprationButton(trueBtn, { + area: "card_inner", + buttonLimit: 3, + onButtonClick: (props, key) => tableButtonClick(that,props, key, text, record, index) + }); + } + }); + + return meta; +} diff --git a/src/arap/paybill/initpaybill/card/events/pageInfoClick.js b/src/arap/paybill/initpaybill/card/events/pageInfoClick.js new file mode 100644 index 00000000..d0265410 --- /dev/null +++ b/src/arap/paybill/initpaybill/card/events/pageInfoClick.js @@ -0,0 +1,56 @@ +import { ajax, cardCache } from 'nc-lightapp-front'; +import { formId, dataSource, pkname } from '../constants'; +import initTemplate from './initTemplate'; +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) { + let pagecode = cardData.head[this.formId].rows[0].values.pk_tradetype.value; + props.setUrlParam({ status: 'browse', id: pk, pagecode: pagecode }) + //点击上一张下一张单据时,要将单据的交易类型放入缓存(和切换交易类型一致),下次点击新增自制时,取缓存中的交易类型 + setDefData('sessionTradeType', dataSource, pagecode); + if (tradeType != pagecode) { + initTemplate.call(this, this.props); + } + props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] }); + props.cardTable.setTableData(this.tableId, cardData.body[this.tableId],null, null, true); + + this.toggleShow(); + + } else { + let data = { + pk_bill: pk + }; + ajax({ + url: '/nccloud/arap/initpaybill/querycard.do', + data: data, + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId],null, null, true); + } + updateCache(pkname, pk, res.data, this.formId, dataSource); + let pagecode = res.data.head[formId].rows[0].values.pk_tradetype.value; + props.setUrlParam({ status: 'browse', id: pk, pagecode: pagecode }) + setDefData('sessionTradeType', dataSource, pagecode); + if (tradeType != pagecode) { + initTemplate.call(this, this.props); + } + this.toggleShow(); + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + } + } + }); + } + +} diff --git a/src/arap/paybill/initpaybill/card/events/tableButtonClick.js b/src/arap/paybill/initpaybill/card/events/tableButtonClick.js new file mode 100644 index 00000000..f3f8950b --- /dev/null +++ b/src/arap/paybill/initpaybill/card/events/tableButtonClick.js @@ -0,0 +1,58 @@ +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, deleteInner, pasteInner } from '../../../../public/components/pubUtils/billPubUtil.js'; +import { cardBodyControl } from '../../../../public/components/pubUtils/buttonvisible.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: + props.cardTable.openModel(tableId, 'edit', record, index); + break; + case innerButton.Copy_inner://复制行 + copyInner(record, dataSource,that); + that.setState({ + buttonfalg: false + }, () => { + 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/paybillpub/addline.do', + data: data, + success: (res) => { + let rowindex = index; + if (res.data && res.data.body) { + props.cardTable.addRow(tableId, index, res.data.body.bodys.rows[0].values); + } else { + props.cardTable.addRow(tableId); + rowindex = that.props.cardTable.getNumberOfRows(that.tableId); + } + that.props.cardTable.setValByKeyAndIndex(that.tableId, rowindex, 'prepay', { display:that.prepay.display,value:that.prepay.value}) + } + }); + + 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; + } +}; diff --git a/src/arap/paybill/initpaybill/card/index.js b/src/arap/paybill/initpaybill/card/index.js new file mode 100644 index 00000000..93aed6f8 --- /dev/null +++ b/src/arap/paybill/initpaybill/card/index.js @@ -0,0 +1,1053 @@ +//主子表卡片 +import React, { Component } from 'react'; +import { createPage, ajax, base, toast, high, print, cardCache, getMultiLang } from 'nc-lightapp-front'; +import { buttonClick, initTemplate, afterEvent, pageInfoClick } from './events'; +import { + buttonVisible, + initCardBodyEditControl, + onSelectedCardBodyEditControl, + initCardBodybrowseControl +} from '../../../public/components/pubUtils/buttonvisible.js'; +import { tableId, formId, billType, dataSource, pkname,allocation} from './constants'; +import CombinedExaminationModel from '../../../public/components/combinedExaminationModel'; //联查处理情况 +import LinkTerm from '../../../public/components/linkTerm'; //联查收付款协议 +import PeriodModal from '../../../public/components/periodModel'; +import { bodyBeforeEvent } from '../../../public/components/pubUtils/arapTableRefFilter'; +import { formBeforeEvent } from '../../../public/components/pubUtils/arapFormRefFilter'; +import { calculateHeadMoney, delBlankLine } from '../../../public/components/pubUtils/billPubUtil.js'; +import { getContext, loginContextKeys } from '../../../public/components/arapInitInfo/loginContext'; +import ExcelOutput from 'uap/common/components/ExcelOutput'; +const { BillTrack, PrintOutput } = high; +import { dealCardData,checkScommet } from '../../../public/components/pubUtils/dealCardData'; +import { onBatchChange } from '../../../public/components/pubUtils/onBatchChange'; +import { cardFieldsEditableWithProxy } from '../../../public/components/pubUtils/billFieldEditableUtil.js'; +import NCUploader from 'uap/common/components/NCUploader'; +import {cancelAllocation,beSureAllocation,setAllocField,ctrAllocBtn} from '../../../public/components/allocation.js'; +let { + addCache, + getNextId, + deleteCacheById, + getCacheById, + updateCache, + getCurrentLastId +} = cardCache; +import TradeTypeButton from '../../../public/components/tradetype'; //交易类型按钮 +import '../../../public/less/tradetype.less'; +import { setBillDef } from '../../../public/components/pubUtils/CopyBill/arapCopyBill'; +const { NCDiv, NCAffix } = base; +import poc from 'uap/common/components/printOnClient'; +const {printPreview, printOnClient, PubSub, printerView, printOnClientByMoreTem} = poc; + +class Card extends Component { + constructor(props) { + super(props); + this.state = { + isCombinedExaminationModelShow: false, //联查处理情况模态框 + isLinkTermModelShow: false, //联查收付款协议模态框 + isPeriodModelShow: false, //期初建账 + showBillTrack: false, //单据追溯模态框显示的状态 + showUploader: false, //附件 + target: null, + buttonfalg: null, //卡片态点击肩部按钮和表体行按钮改变该值控制按钮状态 + forceRender: true,//导出模板懒加载,true为不加载,false为加载 + json: {} + }; + this.printData = { + billtype: billType, //单据类型 + appcode: this.props.getSearchParam('c'), //功能节点编码,即模板编码 + funcode: this.props.getSearchParam('c'), + nodekey: props.getSearchParam('p'), //模板节点标识 =交易类型 + oids: [this.props.getUrlParam('id')], // 功能节点的数据主键 oids含有多个元素(['1001A41000000000A9LR','1001A410000000009JDD'])时为批量打印, + userjson: billType //单据类型,billtype不是必需字段,后台没有设置接收字段,以userjson代替 + }; + this.outputData = { + billtype: billType, //单据类型 + appcode: this.props.getSearchParam('c'), + funcode: this.props.getSearchParam('c'), + nodekey: props.getSearchParam('p'), //模板节点标识 =交易类型 + oids: [this.props.getUrlParam('id')], // 功能节点的数据主键 + userjson: billType, //单据类型 + outputType: 'output' + }; + this.formId = formId; + this.tableId = tableId; + this.allocation = allocation; + this.billType = billType; + this.pkname = pkname; + this.Info = { + allButtonsKey: [], //保存所有的表体头部按钮 + combinedExaminationData: [], //联查处理情况模态框表格数据 + linkTermData: [], //联查收付款协议模态框表格数据 + selectedPKS: [], //导出数据的主键pk,收付款协议选中子表行 + isModelSave: false //是否是整单保存,默认为false + }; + this.dataInSaga = { //用于saga里面的busiinfo + appcode: props.getSearchParam('c') ? props.getSearchParam('c') : null, + pagecode: props.getSearchParam('p') ? props.getSearchParam('p') : null, + butncode: null + } + this.billinfo ={ + billtype:'card', + pagecode:props.getSearchParam('p') ? props.getSearchParam('p') : null, + headcode:formId, + bodycode:tableId} + this.prepay = {display:null,value:null}; + props.use.cardTable(tableId); + props.use.form(formId); + props.use.form(allocation); + } + + //关闭、刷新弹窗时 + componentWillMount() { + let callback = (json) => { + this.setState({ json: json }, () => { + window.onbeforeunload = () => { + let status = this.props.getUrlParam('status'); + if (status == 'edit' || status == 'add') { + return ''; + } + }; + this.props.setRelationItemBillinfo(this.billinfo); + initTemplate.call(this, this.props, this.initShow); + }); + }; + getMultiLang({ moduleId: ['paybill', 'public'], domainName: 'arap', currentLocale: 'simpchn', callback }); + } + + componentWillUnmount() { + window.onbeforeunload=null; + } + + getPagecode = () => { + let pagecode = this.props.getUrlParam('pagecode'); + if (!pagecode) { + pagecode = this.props.getSearchParam('p'); + } + return pagecode; + }; + + componentWillReceiveProps(nextProps) { } + // 附件的关闭点击 + onHideUploader = () => { + this.setState({ + showUploader: false + }); + }; + componentDidMount() { } + initShow = () => { + if (this.props.getUrlParam('type') == 'copy') { + ajax({ + url: '/nccloud/arap/arappub/copy.do', + data: Object.assign({ + pk_bill: this.props.getUrlParam('id'), + pageId: this.getPagecode(), + billType: this.billType, + type: 1, + tradeType: this.getPagecode() + },this.dataInSaga), + success: (res) => { + this.props.beforeUpdatePage(); //打开开关 + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } + setBillDef(this, this.getPagecode());//设置挂起字段默认值 + this.props.resMetaAfterPkorgEdit(); + this.state.buttonfalg = true; + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.form.setFormStatus(this.formId, 'edit'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + //设置分摊字段属性 + setAllocField(this); + this.toggleShow(); + }, + error: (res) => { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.props.setUrlParam({ status: 'browse' }); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.toggleShow(); + let str = res.message; + toast({ color: 'danger', content: str});; + } + }); + } else if (this.props.getUrlParam('status') == 'edit' || this.props.getUrlParam('status') == 'browse') { + ajax({ + url: '/nccloud/arap/initpaybill/querycard.do', + data: Object.assign({ pk_bill: this.props.getUrlParam('id') },this.dataInSaga), + success: (res) => { + this.props.beforeUpdatePage(); //打开开关 + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } + if (this.props.getUrlParam('status') == 'edit') { + this.props.resMetaAfterPkorgEdit(); + this.state.buttonfalg = true; + this.props.form.setFormItemsValue(this.formId,{'officialprintuser':{value:null,display:null},'officialprintdate':{display:null,value:null}}) + this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: true }); + } else { + this.state.buttonfalg = null; + } + let status = this.props.getUrlParam('status'); + this.props.cardTable.setStatus(this.tableId, status); + this.props.form.setFormStatus(this.formId, status); + + this.props.updatePage(this.formId, this.tableId); //关闭开关 + updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); + this.props.setUrlParam({ pagecode: res.data.head[this.formId].rows[0].values.pk_tradetype.value }); + //设置分摊字段属性 + if (this.props.getUrlParam('status') == 'edit'){ + setAllocField(this); + } + //控制联查分摊期间按钮 + ctrAllocBtn(this); + this.toggleShow(); + }, + error: (res) => { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.props.setUrlParam({ status: 'browse' }); + this.props.setUrlParam({ id: null}); + deleteCacheById(pkname, this.props.getUrlParam('id'), dataSource); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.toggleShow(); + let str = res.message; + toast({ color: 'danger', content: str});; + } + }); + } else if (this.props.getUrlParam('status') == 'add') { + this.initAdd(); + //设置分摊字段属性 + setAllocField(this); + } else { + this.toggleShow(); + } + }; + + //初始化新增,新增时默认值 + initAdd = (isClearPKorg) => { + if (!isClearPKorg) { + //isClearPKorg如果未未定义等,就取值为false + isClearPKorg = false; + } + ajax({ + url: '/nccloud/arap/initpaybill/defvalue.do', + data: Object.assign({ + isClearPKorg: isClearPKorg, + appcode: this.props.getSearchParam('c'), + pageId: this.getPagecode(), + tradeType: this.getPagecode() + },this.dataInSaga), + async:false, + success: (res) => { + if (res.data) { + this.props.beforeUpdatePage(); //打开开关 + this.props.form.EmptyAllFormValue(this.formId); + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + let cell_pk_org_v = res.data.head[this.formId].rows[0].values.pk_org_v; + if (cell_pk_org_v&&cell_pk_org_v.value) { + this.props.resMetaAfterPkorgEdit(); + this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: false }); + this.state.buttonfalg = true; + } else { + this.state.buttonfalg = null; + this.props.initMetaByPkorg('pk_org_v'); + } + this.props.form.setFormStatus(this.formId, 'edit'); + this.props.cardTable.setStatus(this.tableId, 'edit'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + this.props.cardTable.setColValue(this.tableId,'prepay', { display:this.prepay.display,value: this.prepay.value}); + } + //设置分摊字段属性 + setAllocField(this); + this.toggleShow(); + }, + error: (res) => {//主要控制列表进卡片抛出错误 + let str = res.message; + let status = this.props.getUrlParam('status'); + if (status != 'browse') { + this.props.setUrlParam({ status: 'browse' }); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.toggleShow(); + } + ; + toast({ color: 'danger', content: str});; + } + }); + }; + + //切换页面状态 + toggleShow = () => { + let status = this.props.getUrlParam('status'); + if (!status) { + status = 'browse'; + } //如果未定义,默认给值浏览态 + cardFieldsEditableWithProxy(this); + let cardhead = {}; + let head = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId).head[this.formId]; + if (head) { + cardhead = head.rows[0].values; + } + if (status != 'browse') { + this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false); + this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: false }); + if (this.refs.tradetypeBtn && !getContext(loginContextKeys.transtype)) { + this.refs.tradetypeBtn.setVisible(false); //设置交易类型是否显示 + } + } else { + if (!(cardhead.pk_tradetype ? cardhead.pk_tradetype.value : null)) { + this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', false); + } else { + this.props.cardPagination.setCardPaginationVisible('cardPaginationBtn', true); + } + this.props.BillHeadInfo.setBillHeadInfoVisible({ showBackBtn: true }); + if (this.refs.tradetypeBtn && !getContext(loginContextKeys.transtype)) { + this.refs.tradetypeBtn.setVisible(true); //设置交易类型是否显示 + } + } + let trueBtn = []; //可见的按钮 + let falseBtn = []; //不可见的按钮 + for (let i = 0; i < this.Info.allButtonsKey.length; i++) { + let flag = buttonVisible(status, cardhead, this.Info.allButtonsKey[i], 'card', this); + if (flag) { + trueBtn.push(this.Info.allButtonsKey[i]); + } else { + falseBtn.push(this.Info.allButtonsKey[i]); + } + } + //初始化肩部按钮信息增行等按钮的控制 + if (status == 'browse') { + initCardBodybrowseControl(this); + } else { + initCardBodyEditControl(this.props, cardhead.pk_org_v ? cardhead.pk_org_v.value : null, this); + } + this.props.button.setButtonVisible(trueBtn, true); + this.props.button.setButtonVisible(falseBtn, false); + //控制单据联查期间分摊按钮显示 + ctrAllocBtn(this); + }; + //卡片表体点击行事件 + onSelected = () => { + onSelectedCardBodyEditControl(this); + }; + + //删除单据 + delConfirm = () => { + let id = this.props.getUrlParam('id'); + let nextId = getNextId(id, dataSource); + ajax({ + url: '/nccloud/arap/initpaybill/delete.do', + data: [ + Object.assign({ + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value + },this.dataInSaga) + ], + success: (res) => { + //删除单据后,卡片界面显示该单据的下一个单据 + //如果是最后一个单据,删除后返回list界面 + if (res.success) { + toast({ color: 'success', content: this.state.json['paybill-000009'] }); /* 国际化处理: 删除成功*/ + deleteCacheById(pkname, id, dataSource); + if (nextId) { + this.props.setUrlParam({ id: nextId }); + this.initShow(); + } else { + this.props.setUrlParam({ id: null }); + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.toggleShow(); + } + } + } + }); + }; + + cancel = () => { + //取消按钮 + this.props.form.setFormItemsValue("allocobjrule",  { "allocobjrule": { value: '', display: '' } }); + if (this.props.getUrlParam('type')) { + //如果type存在就删除 + this.props.delUrlParam('type'); + } + let pk_org_v = this.props.form.getFormItemsValue(this.formId, 'pk_org_v'); + if (!pk_org_v || !pk_org_v.value || pk_org_v.value == '') { + this.props.resMetaAfterPkorgEdit(); + } + this.props.beforeUpdatePage(); //打开开关 + this.state.buttonfalg = null; + if (this.props.getUrlParam('status') === 'edit') { + this.props.setUrlParam({ status: 'browse' }); + let id = this.props.getUrlParam('id'); + let cardData = getCacheById(id, dataSource); + if (cardData) { + this.props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] }); + this.props.cardTable.setTableData(this.tableId, cardData.body[this.tableId]); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + this.toggleShow(); + } else { + this.initShow(); + } + } else if (this.props.getUrlParam('status') === 'add') { + let id = this.props.getUrlParam('id'); + if (!id) { + id = getCurrentLastId(dataSource); + } + if (id) { + this.props.setUrlParam({ status: 'browse', id: id }); + let cardData = getCacheById(id, dataSource); + if (cardData) { + this.props.form.setAllFormValue({ [this.formId]: cardData.head[this.formId] }); + this.props.cardTable.setTableData(this.tableId, cardData.body[this.tableId]); + let pagecode = cardData.head[this.formId].rows[0].values.pk_tradetype.value; + if (this.getPagecode() != pagecode) { + this.props.setUrlParam({ pagecode: pagecode }); + initTemplate.call(this, this.props); + } + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + this.toggleShow(); + } else { + this.initShow(); + } + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + this.props.setUrlParam({ status: 'browse' }); + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + this.toggleShow(); + } + } + this.props.cardTable.selectAllRows(this.tableId, false); + this.setState({}); + }; + + //挂起操作和取消挂起操作 + pause = (url) => { + let selectedData = this.props.cardTable.getCheckedRows(this.tableId); + if (selectedData.length == 0) { + toast({ color: 'success', content: this.state.json['paybill-000025'] }); /* 国际化处理: 请选择至少一条子表数据*/ + return; + } + let pauseObj = []; + selectedData.forEach((val) => { + pauseObj.push(val.data.values.pk_payitem.value); + }); + let data = Object.assign({ + pk_items: pauseObj, + pk_bill: this.props.getUrlParam('id'), + ts: this.props.form.getFormItemsValue(this.formId, 'ts').value, + pageId: this.getPagecode(), + billType: this.billType + },this.dataInSaga); + ajax({ + url: url, + data: data, + success: (res) => { + if (res.data.message) { + toast({ + duration: 'infinity', + color: res.data.PopupWindowStyle, + content: res.data.message + }); + } else { + toast({ color: 'success', content: this.state.json['paybill-000026'] }); /* 国际化处理: 操作成功*/ + } + if (res.data.billCard) { + if (res.data.billCard.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.billCard.head[this.formId] }); + } + if (res.data.billCard.body) { + this.props.cardTable.setTableData(this.tableId, res.data.billCard.body[this.tableId]); + } + let newCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + updateCache(pkname, this.props.getUrlParam('id'), newCardData, this.formId, dataSource); + } + this.onSelected(); + } + }); + }; + + //保存单据 + saveBill = (modelIndex) => { + //删除空白行 + let checkCardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + delBlankLine(this, this.tableId, this.billType, checkCardData, modelIndex); + this.props.form.setFormItemsValue("allocobjrule", { "allocobjrule": { value: '', display: '' } }); + let result=this.props.validatePageToToast([ + { + name: this.formId, + type: "form", + }, + { + name: this.tableId, + type: "cardTable", + } + ]); + if(result&&!result.allPassed){ + return; + } + let cardData = this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId); + let newCardData = dealCardData(this, cardData); //去掉空值,减少压缩时间 + if(checkScommet(this, cardData)) { + return; + } + let datas = Object.assign({ + cardData: newCardData, + uiState: this.props.getUrlParam('status') + },this.dataInSaga); + let callback = () => { + ajax({ + url: '/nccloud/arap/initpaybill/save.do', + data: datas, + success: (res) => { + let pk_paybill = null; + let pk_tradetype = null; + if (res.success) { + if (res.data) { + toast({ color: 'success', content: this.state.json['paybill-000010'] }); /* 国际化处理: 保存成功*/ + this.props.beforeUpdatePage(); //打开开关 + if (res.data.head && res.data.head[this.formId]) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + pk_paybill = res.data.head[this.formId].rows[0].values.pk_paybill.value; + pk_tradetype = res.data.head[this.formId].rows[0].values.pk_tradetype.value; + } + if (res.data.body && res.data.body[this.tableId]) { + this.props.cardTable.updateDataByRowId(this.tableId, res.data.body[this.tableId]); + //this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + + this.state.buttonfalg = null; + this.props.cardTable.setStatus(this.tableId, 'browse'); + this.props.form.setFormStatus(this.formId, 'browse'); + this.props.updatePage(this.formId, this.tableId); //关闭开关 + let newCardData = this.props.createMasterChildData( + this.getPagecode(), + this.formId, + this.tableId + ); + if (this.props.getUrlParam('status') == 'add') { + addCache(pk_paybill, newCardData, this.formId, dataSource); //新增 + let idObj = { id: pk_paybill, status: 1 }//1 修改 2新增 3删除 + this.props.cardPagination.setCardPaginationId(idObj); + } else { + updateCache(pkname, pk_paybill, newCardData, this.formId, dataSource); //修改之后更新缓存 + } + if (this.props.getUrlParam('type')) { + this.props.delUrlParam('type'); + } + this.props.setUrlParam({ status: 'browse', id: pk_paybill, pagecode: pk_tradetype }); + this.props.cardTable.selectAllRows(this.tableId, false); + } + } + + if (this.Info.isModelSave) { + this.Info.isModelSave = false; + this.props.cardTable.closeModel(this.tableId); + } + //控制联查分摊期间按钮 + ctrAllocBtn(this); + this.toggleShow(); + } + }); + }; + + this.props.validateToSave(datas.cardData, callback, { table1: 'cardTable' }, 'card'); + }; + + //获取列表肩部信息 + getTableHead = () => { + return ( + + {this.props.button.createButtonApp({ + area: 'card_body', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} + + ); + }; + + //联查处理情况按钮 + handleCombined = () => { + this.setState({ + isCombinedExaminationModelShow: true + }, () => { + if (this.state.isCombinedExaminationModelShow) { + this.child.modalOpen(); + } else { + this.child.modalClose(); + } + }); + }; + onRender = (ref) => { + this.child = ref; + }; + + //联查收付款协议 + handleLinkTerm = () => { + this.setState({ + isLinkTermModelShow: true + },() => { + if (this.state.isLinkTermModelShow) { + this.child2.modalOpen(); + } else { + this.child2.modalClose(); + } + }); + }; + onRenderTerm =(ref)=>{ + this.child2 = ref; + } + //设置form表单ts的值 + setFormTsVal = (ts) => { + this.props.form.setFormItemsValue(this.formId, { ts: { value: ts } }); + }; + + //期初弹窗控制 + handlePeriodInformation = () => { + this.setState({ + isPeriodModelShow: !this.state.isPeriodModelShow + }); + this.childper.modalOpen(); + + }; + onRenderPer = (ref) => { + this.childper = ref; + }; + + //打印 + onPrint = () => { + this.printData.oids = [this.props.getUrlParam('id')]; + this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + // print( + // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 + // '/nccloud/arap/arappub/print.do', //后台服务url + // this.printData + // // false 去掉后支持弹出选择打印模板 + // ); + this.printPreviewBill(); + }; + + //正式打印 + officalPrintOutput = () => { + this.printData.oids = [this.props.getUrlParam('id')]; + this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + this.printData.userjson = billType+","+this.props.getSearchParam('p'); + ajax({ + url: '/nccloud/arap/arappub/officialPrint.do', + data: this.printData, + async: false, + success: (res) => { + if (res.success) { + // print( + // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 + // '/nccloud/arap/arappub/print.do', //后台服务url + // this.printData, + // false + // ); + this.printPreviewBill(); + if (res.data) { + updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + } + this.toggleShow(); + } + } + }); + }; + + //预览打印 + printPreviewBill = () => { + printPreview( + this.props, + '/nccloud/arap/arappub/print.do', + { + //billType:"F3", + billtype:this.printData.billtype, + funcode: this.printData.funcode, + appcode: this.printData.appcode, //⼩应⽤编码 + pageCode:this.props.getSearchParam('p'), + nodekey: this.printData.nodekey, //模板节点标识 + oids: this.printData.oids, + //userjson: encodeURI(JSON.stringify({numFrom: 1,numEnd: 2})), + //controlPrintNum: true, + type :'1', + sysType: '1', + //suffx:['pdf'], + realData:true, + //新增项 + //hideTemplate: true,//是否需要打印模板切换 + //printSetting:JSON.stringify({currentNccloudPaper:{paperHeight: 210,paperId: "",paperName: this.state.json['paybill-000028'],paperWidth: 297}}), + //⾃定义内容项 + //formulaConfig: null, + //userjson: this.printData.billtype //单据类型` + }, + true + ) + } + + //取消正式打印 + cancelPrintOutput = () => { + this.printData.oids = [this.props.getUrlParam('id')]; + this.printData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + this.printData.userjson = billType+","+this.props.getSearchParam('p'); + ajax({ + url: '/nccloud/arap/arappub/cancelPrint.do', + data: this.printData, + async: false, + success: (res) => { + if (res.success) { + if (res.data) { + updateCache(pkname, this.props.getUrlParam('id'), res.data, this.formId, dataSource); + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + } + this.toggleShow(); + //取消正式打印提示框 + toast({ color: 'success', content: this.state.json['paybill-000072'] }); + } + } + }); + }; + + //打印输出 + printOutput = () => { + this.outputData.oids = [this.props.getUrlParam('id')]; + this.outputData.nodekey = this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value; + this.refs.printOutput.open(); + }; + //输出成功回调函数 + onSubmit() { } + /** + * 刷新 + * @param + */ + refresh = () => { + let data = Object.assign({ pk_bill: this.props.getUrlParam('id'), pageId: this.getPagecode() },this.dataInSaga); + ajax({ + url: '/nccloud/arap/initpaybill/querycard.do', + data: data, + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.setTableData(this.tableId, res.data.body[this.tableId]); + } + } else { + this.props.form.EmptyAllFormValue(this.formId); + this.props.cardTable.setTableData(this.tableId, { rows: [] }); + } + this.props.form.setFormItemsDisabled(this.formId, { pk_org_v: true }); + this.toggleShow(); + } + }); + }; + + //返回列表 + backList = () => { + this.props.pushTo('/list', { + pagecode: '20080PO_LIST' + }); + }; + + //侧拉删行 + modelDelRow = () => { + calculateHeadMoney(this); + let allVisibleRows = this.props.cardTable.getVisibleRows(this.tableId); + if (!allVisibleRows || allVisibleRows.length == 0) { + this.props.cardTable.closeModel(this.tableId); + } + }; + + //侧拉增行 + modelAddRow = () => { + if (this.props.form.getFormItemsValue(this.formId, 'pk_org_v').value != null) { + let allRowsNumber = this.props.cardTable.getNumberOfRows(this.tableId); + ajax({ + url: '/nccloud/arap/paybillpub/addline.do', + data: this.props.createMasterChildData(this.getPagecode(), this.formId, this.tableId), + success: (res) => { + if (res.data) { + if (res.data.head) { + this.props.form.setAllFormValue({ [this.formId]: res.data.head[this.formId] }); + } + if (res.data.body) { + this.props.cardTable.updateDataByIndexs(this.tableId, [ + { + index: allRowsNumber - 1, + data: { + status: 2, + values: res.data.body[this.tableId].rows[0].values + } + } + ]); + } + } + } + }); + } else { + toast({ color: 'warning', content: this.state.json['paybill-000027'] }); /* 国际化处理: 请先选择财务组织*/ + } + }; + //整单保存事件 + modelSaveClick = (a, modelIndex) => { + this.dataInSaga.butncode='save'; + this.Info.isModelSave = true; + this.saveBill(modelIndex); + }; + + render() { + let { cardTable, form, button, modal, cardPagination } = this.props; + const { createBillHeadInfo } = this.props.BillHeadInfo; + let buttons = this.props.button.getButtons(); + let multiLang = this.props.MutiInit.getIntl(this.moduleId); + let { createForm } = form; + let { createCardTable } = cardTable; + const { createCardPagination } = cardPagination; + let { createModal } = modal; + let { showUploader, target } = this.state; + return ( +
+
+ + +
+ {createBillHeadInfo({ + title: this.state.json['paybill-000028'],//国际化处理: 付款期初 + backBtnClick: () => { + this.backList(); + } + })} +
+
+ {!getContext(loginContextKeys.transtype)?( +
+ {TradeTypeButton({ + ref: 'tradetypeBtn', + billtype: 'F3', + dataSource: dataSource, + propschil:this.props, + appcode: this.props.getSearchParam('c') ? this.props.getSearchParam('c') : this.props.getUrlParam('c'), + pagecode: this.props.getSearchParam('p') ? this.props.getSearchParam('p') : null + })} +
+ ) : null} + {this.props.button.createButtonApp({ + area: 'card_head', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + popContainer: document.querySelector('.header-button-area') + })} +
+
+ {createCardPagination({ + handlePageInfoChange: pageInfoClick.bind(this), + dataSource: dataSource + })} +
+
+
+
+ {createForm(this.formId, { + fieldid: "initpaybill", + onBeforeEvent: formBeforeEvent.bind(this), + onAfterEvent: afterEvent.bind(this) + })} +
+
+
+
+ {createCardTable(this.tableId, { + tableHead: this.getTableHead.bind(this, buttons), + modelSave: this.modelSaveClick.bind(this), + onAfterEvent: afterEvent.bind(this), + onBeforeEvent: bodyBeforeEvent.bind(this), + modelAddRow: this.modelAddRow.bind(this), + modelDelRow: this.modelDelRow.bind(this), + onSelected: this.onSelected.bind(this), + onSelectedAll: this.onSelected.bind(this), + showCheck: true, + showIndex: true, + adaptionHeight: true, + high_selectable: { + enable: true //默认为true + }, + // 框选 + onBatchSelected: (...params) => { + this.onSelected.call(this) + }, + onBatchChange: onBatchChange.bind(this) + })} +
+
+ + {createModal('delete', { + title: multiLang && multiLang.get('20521030-0020'), + content: multiLang && multiLang.get('20521030-0006'), + beSureBtnClick: this.delConfirm + })} + + {/* {联查处理情况} */} + + {/* {联查收付款协议} */} + + + {/* 单据追溯组件 */} + { + this.setState({ showBillTrack: false }); + }} + pk={this.props.getUrlParam('id')} //单据id + type={ + this.props.form.getFormItemsValue(this.formId, 'pk_tradetype') ? ( + this.props.form.getFormItemsValue(this.formId, 'pk_tradetype').value + ) : null + } //单据类型 + /> + {showUploader && ( + + )} + + {/* {打印输出} */} + + + {/* {导入} */} + {createModal('importModal', { + noFooter: true, + className: 'import-modal', + hasBackDrop: false + })} + + {/**分摊模态框 */} +
+ {createModal("allocobjrule", { + fieldid: "allocobjrule", + title: this.state.json['paybill-000071'],//对象分摊 + size: 'sm', + zIndex:270, + content: +
+
+ {createForm("allocobjrule", { + fieldid: "allocobjrule", + onAfterEvent: afterEvent.bind(this), + onBeforeEvent: formBeforeEvent.bind(this) + })} +
+
, + beSureBtnClick: beSureAllocation.bind(this), + cancelBtnClick: cancelAllocation.bind(this) + })} +
+
+ ); + } +} + +Card = createPage({ + orderOfHotKey: [formId, tableId],//区域快捷键切换支持 + mutiLangCode: '2052', +})(Card); + +export default Card; diff --git a/src/arap/paybill/initpaybill/list/constants.js b/src/arap/paybill/initpaybill/list/constants.js new file mode 100644 index 00000000..1e1d807a --- /dev/null +++ b/src/arap/paybill/initpaybill/list/constants.js @@ -0,0 +1,41 @@ + +/** + * 查询区域 + */ +export const searchId = 'query'; + +/** + * 列表区域 + */ +export const tableId = 'list'; + + +/** + * 单据类型 + */ +export const billType = 'F3'; +/** + * 默认交易类型 + */ +export const tradeType = 'D3'; + +/** + * 默认模板节点标识 + */ +export const nodekey = "list"; + +/** + * 单页应用缓存 + */ +export const dataSource = 'fi.arap.initpaybill.20080PO'; + +/** + * 单页应用缓存主键名字(该名字为表的主键名字) + */ +export const pkname = 'pk_paybill'; + +/** + * 单页应用缓存查询区主键名字 + */ +export const searchKey = 'pk_paybill_search'; + diff --git a/src/arap/paybill/initpaybill/list/events/buttonClick.js b/src/arap/paybill/initpaybill/list/events/buttonClick.js new file mode 100644 index 00000000..254323c0 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/buttonClick.js @@ -0,0 +1,338 @@ +import { ajax, base, toast, printer, cardCache, promptBox } from 'nc-lightapp-front'; +import { headButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { tradeType, billType, dataSource, searchId, tableId,pkname } from '../constants'; +import { getTitle } from '../../../../public/components/getCartTableData.js'; +import arapLinkReport from "../../../../public/components/arapBillLinkReport.js"; +let { setDefData, getDefData } = cardCache; +import {ListAllocperiodruleLinkQuery} from '../../../../public/components/allocation.js'; +import {getAllCheckedDataNew,deleteTableRowsByRowIds,deleteCachePKAndTS} from '../../../../public/components/updateTableDataTs'; +export default function buttonClick(props, id) { + let appcode = props.getSearchParam("c"); + this.dataInSaga.butncode=id; + switch (id) { + case headButton.Add: + /** + /** + * 新增---->根据交易类型----->加载模版 + */ + let pagecode = getDefData('sessionTradeType', dataSource) + if (!pagecode) { + pagecode = tradeType; + } + props.pushTo('/card', { + status: 'add', + pagecode: pagecode + }) + break; + case headButton.Delete: + promptBox({ + color: 'warning', + title: this.state.json['paybill-000002'], /* 国际化处理: 删除*/ + content: this.state.json['paybill-000052'], /* 国际化处理: ​确定要删除所选数据吗?*/ + noFooter: false, + noCancelBtn: false, + beSureBtnName: this.state.json['paybill-000004'], /* 国际化处理: 确定*/ + cancelBtnName: this.state.json['paybill-000005'], /* 国际化处理: 取消*/ + beSureBtnClick: () => { + // let deleteData = getAllCheckedData.call(this,this.props, this.tableId, billType); + let {delObjs ,rowIds}= getAllCheckedDataNew.call(this, this.props, this.tableId, billType,pkname); + if (delObjs.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000012'] });/* 国际化处理: 请选中至少一行数据!*/ + return; + } + ajax({ + url: '/nccloud/arap/init/batchdelete.do', + data: delObjs, + success: (res) => { + let { success, data } = res; + if (success) { + if (data.message) { + toast({ + duration: 'infinity', + color: data.PopupWindowStyle, + content: data.message, + }) + } + // if (data.successIndexs) { + // //删除当前行数据 + // props.table.deleteTableRowsByIndex(tableId, data.successIndexs); + // } + deleteTableRowsByRowIds.call(this,{props,data,rowIds,tableId}); + if (data.successPKs) { + //删除缓存数据 + // props.table.deleteCacheId(tableId, data.successPKs); + deleteCachePKAndTS.call(this,{props,tableId,successPKs:data.successPKs,checkedRows:delObjs,pkId:'pk_bill',pkname}); + } + this.onSelected(); + } + } + }); + } + }); + + break; + case headButton.BillLinkQuery://联查单据 + let billInfo = getFirstCheckedData(this.props, this.tableId); + this.Info.pk_bill = billInfo.data.values.pk_paybill.value; + this.Info.pk_tradetype = billInfo.data.values.pk_tradetype.value; + this.setState({ + showBillTrack: true, + }) + break; + case headButton.LinkBal://联查余额表 + arapLinkReport( + this.props, + getFirstCheckedData(this.props, this.tableId).data.values.pk_paybill.value, + billType, + getFirstCheckedData(this.props, this.tableId).data.values.objtype.value, + getFirstCheckedData(this.props, this.tableId).data.values.pk_org_v + ); + break; + case headButton.LinkDeal://联查处理情况 + let dealInfo = getFirstCheckedData(this.props, this.tableId); + ajax({ + url: '/nccloud/arap/arappub/linkdeal.do', + data: Object.assign({ + pk_bill: dealInfo.data.values.pk_paybill.value, + ts: dealInfo.data.values.ts.value, + billType: billType + },this.dataInSaga), + success: (res) => { + if (res.success) { + //打开处理情况模态框 + let data = res.data; + //当前选中数据的第一行的交易类型和单据号,用于联查处理情况的模态框上面的显示 + let checkedData = this.props.table.getCheckedRows(this.tableId,false)[0].data.values; + + this.Info.combinedExaminationData = data; + this.Info.pk_tradetypeid = checkedData.pk_tradetypeid ? checkedData.pk_tradetypeid.display : null; + this.Info.billno = checkedData.billno ? checkedData.billno.value : null; + this.handleCombined(); + } + } + }); + break; + case headButton.LinkTerm://联查收付款协议 + let linkTermInfo = getFirstCheckedData(this.props, this.tableId); + ajax({ + url: '/nccloud/arap/arappub/linkterm.do', + data: Object.assign({ + pk_bill: linkTermInfo.data.values.pk_paybill.value, + billType: billType, + moduleId: '2008' + },this.dataInSaga), + success: (res) => { + if (res.success) { + //打开收付款协议模态框 + let data = res.data; + let checkedData = this.props.table.getCheckedRows(this.tableId,false)[0]; + + this.Info.index = checkedData.index; + this.Info.linkTermData = data; + this.Info.pk_bill = checkedData.data.values.pk_paybill ? checkedData.data.values.pk_paybill.value : null; + this.handleLinkTerm(); + } + } + }); + break; + case 'InitBuild': + var context = getDefData('default', 'default'); + getTitle("close"); + this.Info.orgInfo = { + pk_org: context.pk_org, + org_name: context.org_Name + } + this.handlePeriodInformation(); + + break; + case 'CancelInitBuild': + var context = getDefData('default', 'default'); + getTitle("alerdyClose"); + this.Info.orgInfo = { + pk_org: context.pk_org, + org_name: context.org_Name + } + this.handlePeriodInformation(); + + break; + case 'Print'://打印 + let printData = this.props.table.getCheckedRows(this.tableId); + if (printData.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + let pk_bills = []; + printData.forEach((val) => { + pk_bills.push(val.data.values?val.data.values.pk_paybill.value:val.data.pk); + }); + this.printData.oids = pk_bills; + this.printData.nodekey = "card"; + this.onPrint(); + break; + case headButton.PrintList://打印清单 + printData = this.props.table.getCheckedRows(this.tableId); + pk_bills = []; + printData.forEach((val) => { + pk_bills.push(val.data.values?val.data.values.pk_paybill.value:val.data.pk); + }); + if (pk_bills.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + this.printData.oids = pk_bills; + this.printData.nodekey = "list"; + // printer( + // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 + // '/nccloud/arap/arappub/print.do', //后台服务url + // this.printData + // ); + this.printPreviewBill(true); + break; + case headButton.Output://打印输出 + printData = this.props.table.getCheckedRows(this.tableId); + if (printData.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + pk_bills = []; + printData.forEach((val) => { + pk_bills.push(val.data.values?val.data.values.pk_paybill.value:val.data.pk); + }); + this.outputData.oids = pk_bills; + this.outputData.nodekey = "card"; + this.printOutput(); + break; + case headButton.OutputList: //输出清单 + printData = this.props.table.getCheckedRows(this.tableId); + if (printData.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] }); /* 国际化处理: 请选中一行数据!*/ + return; + } + pk_bills = []; + printData.forEach((val) => { + pk_bills.push(val.data.values?val.data.values.pk_paybill.value:val.data.pk); + }); + this.outputData.oids = pk_bills; + this.outputData.nodekey = 'list'; + this.printOutput(); + break; + case headButton.OfficalPrint://正式打印 + printData = this.props.table.getCheckedRows(this.tableId); + if (printData.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + pk_bills = []; + printData.forEach((val) => { + let pkBill = val.data.values?val.data.values.pk_paybill.value:val.data.pk; + pk_bills.push(pkBill+"_"+val.index); + }); + this.printData.oids = pk_bills; + this.printData.nodekey = "card"; + this.officalPrintOutput(); + break; + case headButton.CancelPrint://取消正式打印 + printData = this.props.table.getCheckedRows(this.tableId); + if (printData.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + pk_bills = []; + printData.forEach((val) => { + let pkBill = val.data.values?val.data.values.pk_paybill.value:val.data.pk; + pk_bills.push(pkBill+"_"+val.index); + }); + this.printData.oids = pk_bills; + this.printData.nodekey = "card"; + this.cancelPrintOutput(); + break; + case headButton.ExportData://导出 + if(this.state.forceRender){ + this.setState({forceRender: false}) + } + printData = this.props.table.getCheckedRows(this.tableId); + pk_bills = []; + printData.forEach((val) => { + pk_bills.push(val.data.values?val.data.values.pk_paybill.value:val.data.pk); + }); + if (pk_bills.length == 0) { + toast({ color: 'warning', content: this.state.json['paybill-000029'] });/* 国际化处理: 请选中一行数据!*/ + return; + } + this.Info.selectedPKS = pk_bills; //传递主键数组,之前nc需要导出的加主键 + this.props.modal.show('exportFileModal');//不需要导出的只执行这行代码 + break; + case headButton.Refresh://刷新 + let data = getDefData(searchId, dataSource); + if (data) { + ajax({ + url: '/nccloud/arap/initpaybill/queryscheme.do', + data: Object.assign(data,this.dataInSaga), + success: (res) => { + let { success, data } = res; + if (success) { + if (data) { + toast({ color: 'success', title: this.state.json['paybill-000051'] });/* 国际化处理: 刷新成功*/ + this.props.table.setAllTableData(this.tableId, data[this.tableId]); + setDefData(this.tableId, dataSource, data);//放入缓存 + this.onSelected(); + } else { + toast({ color: 'success', title: this.state.json['paybill-000051'] });/* 国际化处理: 刷新成功*/ + this.props.table.setAllTableData(this.tableId, { rows: [] }); + } + + } + } + }); + } else { + toast({ color: 'success', title: this.state.json['paybill-000051'] });/* 国际化处理: 刷新成功*/ + this.props.table.setAllTableData(this.tableId, { rows: [] }); + } + break; + case headButton.AttachManage: + let AttachInfo = getFirstCheckedData(this.props, this.tableId); + this.Info.pk_bill = AttachInfo.data.values.pk_paybill.value; + this.Info.billno = AttachInfo.data.values.billno.value; + this.setState({ + showUploader: true, + target: null + }) + break; + case headButton.AllocperiodruleLinkQuery: + ListAllocperiodruleLinkQuery(this); + break; + default: + break; + } +} + + +//获取选中数据的第一行,选中多行的时候只取第一行数据 +let getFirstCheckedData = function (props, tableId) { + let checkedData = props.table.getCheckedRows(tableId,false); + let checkedObj; + if (checkedData.length > 0) { + checkedObj = checkedData[0] + } else { + toast({ content: this.state.json['paybill-000030'], color: 'warning' });/* 国际化处理: 请至少选择一条数据*/ + return; + } + return checkedObj; +} + + +//获取选中数据的id和billType +let getAllCheckedData = function (props, tableId, billType) { + let checkedData = props.table.getCheckedRows(tableId); + let checkedObj = []; + checkedData.forEach((val) => { + checkedObj.push(Object.assign({ + pk_bill: val.data.values?val.data.values.pk_paybill.value:val.data.pk, + ts: val.data.values?val.data.values.ts.value:val.data.ts, + billType: billType, + index: val.index, + },this.dataInSaga) + ); + }); + return checkedObj; +} diff --git a/src/arap/paybill/initpaybill/list/events/doubleClick.js b/src/arap/paybill/initpaybill/list/events/doubleClick.js new file mode 100644 index 00000000..30fd74e1 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/doubleClick.js @@ -0,0 +1,16 @@ +import { cardCache } from 'nc-lightapp-front'; +let { setDefData } = cardCache; +import { searchId, searchKey, dataSource } from '../constants'; +export default function doubleClick(record, index, e) { + //表页跳转的时候,获取所有查询区条件,并放入缓存 + let searchVal = this.props.search.getAllSearchData(searchId); + if (searchVal) { + setDefData(searchKey, dataSource, searchVal); + } + this.props.pushTo('/card', { + status: 'browse', + id: record.pk_paybill.value, + pagecode: record.pk_tradetype.value + }) + +} diff --git a/src/arap/paybill/initpaybill/list/events/index.js b/src/arap/paybill/initpaybill/list/events/index.js new file mode 100644 index 00000000..af959cb8 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/index.js @@ -0,0 +1,7 @@ +import searchBtnClick from './searchBtnClick'; +import initTemplate from './initTemplate'; +import pageInfoClick from './pageInfoClick'; +import buttonClick from './buttonClick'; +import tableButtonClick from './tableButtonClick'; +import doubleClick from './doubleClick'; +export { searchBtnClick, pageInfoClick,initTemplate,buttonClick ,tableButtonClick,doubleClick}; diff --git a/src/arap/paybill/initpaybill/list/events/initTemplate.js b/src/arap/paybill/initpaybill/list/events/initTemplate.js new file mode 100644 index 00000000..d5a78909 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/initTemplate.js @@ -0,0 +1,119 @@ +import { createPage, ajax, base, toast, cacheTools, cardCache } from 'nc-lightapp-front'; +import excelImportconfig from 'uap/common/components/excelImportconfig'; +import tableButtonClick from './tableButtonClick.js'; +import { buttonVisible, getButtonsKey, getInnerButtonkey } from '../../../../public/components/pubUtils/buttonvisible.js'; +import { tableId, tradeType, searchId, billType, searchKey, dataSource } from '../constants'; +import { modifierSearchMetas } from '../../../../public/components/pubUtils/arapListSearchRefFilter'; +import { headButton, innerButton } from '../../../../public/components/pubUtils/buttonName.js'; +import { loginContext, getContext, loginContextKeys } from '../../../../public/components/arapInitInfo/loginContext'; +import {OperationColumn} from '../../../../public/components/pubUtils/arapConstant'; +let { setDefData } = cardCache; +import setDefOrgBilldateSrchArea from '../../../../public/components/defOrgBilldateSrchArea.js'; +export default function (props, callback) { + const that = this; + let excelimportconfig = excelImportconfig(props, "arap", billType, true, '', { isinit: 'true',"appcode":props.getSearchParam("c"),"pagecode":"20080PO_CARD" }); + props.createUIDom( + { + pagecode: that.getPagecode(),//页面id + appcode: props.getSearchParam("c"),//注册按钮的id + reqDataQuerypage: { + rqUrl: '/arap/arappub/querypage.do', + rqJson: `{\n \"pagecode\": \"${that.getPagecode()}\",\n \"appcode\": \"${props.getSearchParam("c")}\"\n}`, + rqCode: 'template' + } + }, + function (data) { + if (data) { + if(!data.template[tableId]){ + return; + } + let lineButton = []; + if (data.button) { + let button = data.button; + getButtonsKey(button, that.Info.allButtonsKey);//获取所有按钮 + props.button.setButtons(button); + props.button.setUploadConfig("ImportData", excelimportconfig); + props.button.setPopContent(innerButton.Delete_Inner, that.state.json['paybill-000006']);/*删除信息提示框*//* 国际化处理: 确定要删除吗?*/ + } + if (data.template) { + //高级查询设置财务组织默认值 + setDefOrgBilldateSrchArea(props, searchId, data); + let meta = data.template; + lineButton = getInnerButtonkey(data.button); + meta = modifierMeta(props, meta, lineButton, that); + modifierSearchMetas(searchId, props, meta, billType, null, that); + props.meta.setMeta(meta); + } + if (data.context) { + // 初始化上下文变量 + loginContext(data.context); + if (getContext(loginContextKeys.transtype)) { + if (that.refs.tradetypeBtn) { + that.refs.tradetypeBtn.setVisible(false); + } + } + } + if (callback) { + callback() + } + } + } + ) +} + + + +function modifierMeta(props, meta, lineButton, that) { + + meta[tableId].items = meta[tableId].items.map((item, key) => { + if (item.attrcode == 'billno') { + item.render = (text, record, index) => { + return ( + { + //表页跳转的时候,获取所有查询区条件,并放入缓存 + let searchVal = props.search.getAllSearchData(searchId); + if (searchVal) { + setDefData(searchKey, dataSource, searchVal); + } + props.pushTo('/card', { + status: 'browse', + id: record.pk_paybill.value, + pagecode: record.pk_tradetype.value + }); + }} + > + {record.billno && record.billno.value} + + ); + }; + } + return item; + }); + //添加操作列 + meta[tableId].items.push({ + label: that.state.json['paybill-000007'],/* 国际化处理: 操作*/ + itemtype: 'customer', + attrcode: 'opr', + width: OperationColumn, + visible: true, + fixed: 'right', + render: (text, record, index) => { + let buttonAry = lineButton ? lineButton : []; + let trueBtn = []; + for (let i = 0; i < buttonAry.length; i++) { + let flag = buttonVisible('browse', record, buttonAry[i]); + if (flag) { + trueBtn.push(buttonAry[i]); + } + } + return props.button.createOprationButton(trueBtn, { + area: "list_inner", + buttonLimit: 3, + onButtonClick: (props, key) => tableButtonClick(that, props, key, text, record, index) + }); + } + }); + return meta; +} diff --git a/src/arap/paybill/initpaybill/list/events/pageInfoClick.js b/src/arap/paybill/initpaybill/list/events/pageInfoClick.js new file mode 100644 index 00000000..c02535a9 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/pageInfoClick.js @@ -0,0 +1,28 @@ +import {ajax} from 'nc-lightapp-front'; +import { tableId } from '../constants'; + +export default function (props, config, pks) { + let that = this; + if(!pks || pks.length == 0){ + return ; + } + let data = { + pk_bills: pks, + pageId: props.getSearchParam("p") + }; + ajax({ + url: '/nccloud/arap/initpaybill/querygridbyids.do', + data: data, + success: function (res) { + let { success, data } = res; + if (success) { + if (data) { + props.table.setAllTableData(tableId, data[tableId]); + } else { + props.table.setAllTableData(tableId, { rows: [] }); + } + } + that.onSelected(); + } + }); +} diff --git a/src/arap/paybill/initpaybill/list/events/searchBtnClick.js b/src/arap/paybill/initpaybill/list/events/searchBtnClick.js new file mode 100644 index 00000000..46fb6044 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/searchBtnClick.js @@ -0,0 +1,37 @@ +import {ajax,toast,cardCache} from 'nc-lightapp-front'; +import { tableId, searchId,dataSource} from '../constants'; +let {setDefData, getDefData } = cardCache; + +export default function clickSearchBtn(props,searchVal) { + if(searchVal&&searchVal.conditions&&searchVal.conditions.length>0){ + let pageInfo = props.table.getTablePageInfo(this.tableId); + let queryInfo = props.search.getQueryInfo(this.searchId); + queryInfo.pageInfo = pageInfo; + let data = { + pageId: props.getSearchParam('p'), + queryInfo:queryInfo + }; + setDefData(searchId, dataSource, data);//放入缓存 + ajax({ + url: '/nccloud/arap/initpaybill/queryscheme.do', + data: data, + success: (res) => { + let { success, data } = res; + if (success) { + if(data){ + toast({ color: 'success', content: this.state.json['paybill-000015']+data[this.tableId].allpks.length+this.state.json['paybill-000016'] });/* 国际化处理: 查询成功,共,条*/ + this.props.table.setAllTableData(this.tableId, data[this.tableId]); + setDefData(this.tableId, dataSource, data);//放入缓存 + this.props.table.selectAllRows(this.tableId, false) + this.onSelected() + }else{ + toast({ color: 'warning', content: this.state.json['paybill-000017'] });/* 国际化处理: 未查询出符合条件的数据*/ + this.props.table.setAllTableData(this.tableId, {rows:[]}); + } + + } + } + }); + } + +}; diff --git a/src/arap/paybill/initpaybill/list/events/tableButtonClick.js b/src/arap/paybill/initpaybill/list/events/tableButtonClick.js new file mode 100644 index 00000000..c496b228 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/events/tableButtonClick.js @@ -0,0 +1,59 @@ +import { ajax, base, toast,cardCache } from 'nc-lightapp-front'; +import { billType,tableId ,dataSource} from '../constants'; +import {innerButton} from '../../../../public/components/pubUtils/buttonName.js'; + +export default function(that,props, key, text, record, index){ + switch (key) { + case innerButton.Edit_inner://修改 + ajax({ + url: '/nccloud/arap/init/edit.do', + data: { + pk_bill: record.pk_paybill.value, + billType: billType + }, + success: (res) => { + if (res.success) { + props.pushTo('/card', { + status: 'edit', + id: record.pk_paybill.value, + pagecode:record.pk_tradetype.value, + }) + } + } + }); + break; + case innerButton.Delete_Inner://删除 + ajax({ + url: '/nccloud/arap/initpaybill/delete.do', + data: [ + { + pk_bill: record.pk_paybill.value, + ts: record.ts.value, + billType: billType + } + ], + success: (res) => { + if (res.success) { + toast({color: 'success', content: that.state.json['paybill-000009']});/* 国际化处理: 删除成功*/ + //删除当前行数据 + props.table.deleteTableRowsByIndex(tableId, index); + let {deleteCacheId} = props.table; + //删除缓存数据 + deleteCacheId(tableId,record.pk_paybill.value); + that.onSelected(); + } + } + }); + break; + case innerButton.Copy_inner://复制 + props.pushTo('/card', { + status: 'add', + id: record.pk_paybill.value, + type: 'copy', + pagecode:record.pk_tradetype.value + }) + break; + default: + break; + } +}; diff --git a/src/arap/paybill/initpaybill/list/index.js b/src/arap/paybill/initpaybill/list/index.js new file mode 100644 index 00000000..7e524912 --- /dev/null +++ b/src/arap/paybill/initpaybill/list/index.js @@ -0,0 +1,478 @@ +//主子表列表 + +import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; +import { createPage, ajax, base, high, print, toast, cardCache, getMultiLang, createPageIcon } from 'nc-lightapp-front'; +import { + buttonClick, + initTemplate, + searchBtnClick, + pageInfoClick, + tableModelConfirm, + tableButtonClick, + doubleClick +} from './events'; +import { tableId, searchId, nodekey, billType, pkname, dataSource, searchKey } from './constants'; +import { + buttonVisible, + getButtonsKey, + onListButtonControl +} from '../../../public/components/pubUtils/buttonvisible.js'; +import CombinedExaminationModel from '../../../public/components/combinedExaminationModel'; //联查处理情况 +import LinkTerm from '../../../public/components/linkTerm'; //联查收付款协议 +import PeriodModal from '../../../public/components/periodModel'; //建账 +import ExcelOutput from 'uap/common/components/ExcelOutput'; +import NCUploader from 'uap/common/components/NCUploader'; +import { loginContext, getContext, loginContextKeys } from '../../../public/components/arapInitInfo/loginContext'; +const { BillTrack, PrintOutput } = high; +let { NCButton } = base; +let { setDefData, getDefData } = cardCache; +import TradeTypeButton from '../../../public/components/tradetype'; //交易类型按钮组件 +import '../../../public/less/tradetype.less'; +import afterEvent from '../../../public/components/searchAreaAfterEvent'; //查询区编辑后事件 +const { NCDiv } = base; +import poc from 'uap/common/components/printOnClient'; +const {printPreview, printOnClient, PubSub, printerView, printOnClientByMoreTem} = poc; + +class List extends Component { + constructor(props) { + super(props); + this.state = { + isCombinedExaminationModelShow: false, //联查处理情况模态框 + isLinkTermModelShow: false, //联查收付款协议模态框 + isPeriodModelShow: false, + showBillTrack: false, //单据追溯模态框显示的状态 + showUploader: false, //附件管理 + target: null, //附件管理 + forceRender: true,//导出模板懒加载,true为不加载,false为加载 + json: {} + }; + this.printData = { + billtype: billType, //单据类型 + appcode: props.getSearchParam('c') ? props.getSearchParam('c') : props.getUrlParam('c'), //功能节点编码,即模板编码 + funcode: props.getSearchParam('c') ? props.getSearchParam('c') : props.getUrlParam('c'), + nodekey: nodekey, //模板节点标识 + oids: null, // 功能节点的数据主键 + userjson: billType //单据类型,billtype不是必需字段,后台没有设置接收字段,以userjson代替 + }; + this.outputData = { + billtype: billType, //单据类型 + appcode: props.getSearchParam('c') ? props.getSearchParam('c') : props.getUrlParam('c'), //功能节点编码,即模板编码 + funcode: props.getSearchParam('c') ? props.getSearchParam('c') : props.getUrlParam('c'), + nodekey: nodekey, //模板节点标识 + oids: null, // 功能节点的数据主键 + userjson: billType, //单据类型,billtype不是必需字段,后台没有设置接收字段,以userjson代 + outputType: 'output' + }; + this.searchId = searchId; + this.tableId = tableId; + this.billType = billType; + this.pkname = pkname; + this.pageId = props.getSearchParam('p'); + let { form, button, table, insertTable, search } = this.props; + let { setSearchValue, setSearchValByField, getAllSearchData } = search; + this.setSearchValByField = setSearchValByField; //设置查询区某个字段值 + this.getAllSearchData = getAllSearchData; //获取查询区所有字段数据 + this.Info = { + allButtonsKey: [], //保存所有头部按钮 + combinedExaminationData: [], //联查处理情况模态框表格数据 + pk_tradetypeid: null, //当前选中第一行行的交易类型 + billno: null, //当前选中第一行的单据号 + linkTermData: [], //联查收付款协议模态框表格数据 + pk_bill: null, //当前选中第一行的主键pk + approvestatus: null, //当前选中第一行的审批状态 + index: null, //保存当前选中第一行的行号index + pk_tradetype: null, //当前选中第一行行的交易类型code + selectedPKS: [], //导出数据的主键pk + orgInfo:{},//保存logincontext组织信息,用于期初建账设置默认值 + }; + this.dataInSaga = { //用于saga里面的busiinfo + appcode: props.getSearchParam('c') ? props.getSearchParam('c') : null, + pagecode: props.getSearchParam('p') ? props.getSearchParam('p') : null, + butncode: null + } + props.use.table(tableId); + props.use.search(searchId); + } + componentDidMount() { } + + componentWillMount() { + let callback = (json) => { + this.setState({ json: json }, () => { + initTemplate.call(this, this.props, this.initShow); + }); + }; + getMultiLang({ moduleId: ['paybill', 'public'], domainName: 'arap', currentLocale: 'simpchn', callback }); + } + + initShow = () => { + if (!this.props.table.hasCacheData(dataSource)) { + this.onSelected(); //缓存不存在,就控制按钮 + } + }; + + getPagecode = () => { + let pagecode = '20080PO_LIST'; + return pagecode; + }; + + //联查处理情况按钮 + handleCombined = () => { + this.setState({ + isCombinedExaminationModelShow: true + }, () => { + if (this.state.isCombinedExaminationModelShow) { + this.child.modalOpen(); + } else { + this.child.modalClose(); + } + }); + }; + onRender = (ref) => { + this.child = ref; + }; + + //联查收付款协议 + handleLinkTerm = () => { + this.setState({ + isLinkTermModelShow: true + },() => { + if (this.state.isLinkTermModelShow) { + this.child2.modalOpen(); + } else { + this.child2.modalClose(); + } + }); + }; + onRenderTerm =(ref)=>{ + this.child2 = ref; + } + //设置当前选中行数据的ts的值 + setFormTsVal = (ts) => { + if (this.Info.index) { + let tsCell = { value: ts, display: '', scale: -1 }; + this.props.table.setValByKeyAndIndex(this.tableId, this.Info.index, 'ts', tsCell); + } + }; + //期初弹窗控制 + handlePeriodInformation = () => { + this.setState({ + isPeriodModelShow: !this.state.isPeriodModelShow + }); + this.childper.modalOpen(); + + }; + onRenderPer = (ref) => { + this.childper = ref; + }; + + //打印 + onPrint = () => { + // print( + // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 + // '/nccloud/arap/arappub/print.do', //后台服务url + // this.printData + // ); + this.printPreviewBill(); + }; + //正式打印 + officalPrintOutput = () => { + this.printData.userjson = billType+","+this.props.getSearchParam('p'); + ajax({ + url: '/nccloud/arap/arappub/officialPrint.do', + data: this.printData, + async: false, + success: (res) => { + if (res.success) { + // print( + // 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 + // '/nccloud/arap/arappub/print.do', //后台服务url + // this.printData, + // false + // ); + this.printPreviewBill(); + if (res.data.grid) { + let grid = res.data.grid; + let updateValue = []; + for (let key in grid) { + updateValue.push({ index: key, data: { values: grid[key].values } }); + } + this.props.table.updateDataByIndexs(tableId, updateValue); + this.props.table.selectAllRows(tableId, false) //由于平台没支持跨页 操作后updateDataByIndexs 取消跨页勾选,此处自己调一次全部取消勾选 + this.onSelected(); + } + } + } + }); + }; + + //预览打印 + printPreviewBill = (islist) => { + if(islist){ + print( + 'pdf', //支持两类: 'html'为模板打印, 'pdf'为pdf打印 + '/nccloud/arap/arappub/print.do', + { + billtype:this.printData.billtype, + funcode: this.printData.funcode, + appcode: this.printData.appcode, //⼩应⽤编码 + pageCode:this.props.getSearchParam('p'), + nodekey: this.printData.nodekey, //模板节点标识 + oids: this.printData.oids, + type :'1', + sysType: '2' + }, + false + ); + }else{ + printPreview( + this.props, + '/nccloud/arap/arappub/print.do', + { + billtype:this.printData.billtype, + funcode: this.printData.funcode, + appcode: this.printData.appcode, //⼩应⽤编码 + pageCode:this.props.getSearchParam('p'), + nodekey: this.printData.nodekey, //模板节点标识 + oids: this.printData.oids, + type :'1', + sysType: '1', + realData:'true_part' + }, + true + ) + } + } + + //取消正式打印 + cancelPrintOutput = () => { + this.printData.userjson = billType+","+this.props.getSearchParam('p'); + ajax({ + url: '/nccloud/arap/arappub/cancelPrint.do', + data: this.printData, + async: false, + success: (res) => { + if (res.success) { + if (res.data.grid) { + let grid = res.data.grid; + let updateValue = []; + for (let key in grid) { + updateValue.push({ index: key, data: { values: grid[key].values } }); + } + this.props.table.updateDataByIndexs(tableId, updateValue); + this.props.table.selectAllRows(tableId, false) //由于平台没支持跨页 操作后updateDataByIndexs 取消跨页勾选,此处自己调一次全部取消勾选 + } + //取消正式打印提示框 + toast({ color: 'success', content: this.state.json['paybill-000072'] }); + this.onSelected(); + } + } + }); + }; + + //打印输出 + printOutput = () => { + this.refs.printOutput.open(); + }; + //输出成功回调函数 + onSubmit() { } + // 附件的关闭点击 + onHideUploader = () => { + this.setState({ + showUploader: false + }); + }; + //列表控制按钮 + onSelected = () => { + onListButtonControl(this); + }; + + // 查询区渲染完成回调函数 + renderCompleteEvent = () => { + let cachesearch = getDefData(searchKey, dataSource); + if (cachesearch && cachesearch.conditions) { + // this.props.search.setSearchValue(this.searchId, cachesearch); + for (let item of cachesearch.conditions) { + if (item.field == 'billdate') { + // 时间类型特殊处理 + let time = []; + time.push(item.value.firstvalue); + time.push(item.value.secondvalue); + this.props.search.setSearchValByField(this.searchId, item.field, { + display: item.display, + value: time + }); + } else { + this.props.search.setSearchValByField(this.searchId, item.field, { + display: item.display, + value: item.value.firstvalue + }); + } + } + } + }; + + render() { + let { table, button, search, modal } = this.props; + let buttons = this.props.button.getButtons(); + let multiLang = this.props.MutiInit.getIntl(this.moduleId); + let { createSimpleTable } = table; + let { NCCreateSearch } = search; + let { createButton, getButtons } = button; + let { showUploader, target } = this.state; + let { createModal } = modal; + const { createBillHeadInfo } = this.props.BillHeadInfo; + return ( +
+ +
+ {createBillHeadInfo({ + title: this.state.json['paybill-000028'],//国际化处理: 付款期初 + initShowBackBtn: false + })} +
+
+ {!getContext(loginContextKeys.transtype) ? ( +
+ {TradeTypeButton({ + ref: 'tradetypeBtn', + billtype: 'F3', + dataSource: dataSource, + propschil:this.props, + type:'list', + appcode: this.props.getSearchParam('c') ? this.props.getSearchParam('c') : this.props.getUrlParam('c'), + pagecode: this.props.getSearchParam('p') ? this.props.getSearchParam('p') : null + })} +
+ ) : null} + {this.props.button.createButtonApp({ + area: 'list_head', + buttonLimit: 3, + onButtonClick: buttonClick.bind(this), + onAfterEvent: afterEvent.bind(this), //编辑后事件 + popContainer: document.querySelector('.header-button-area') + })} +
+
+
+ {NCCreateSearch( + this.searchId, //模块id + { + clickSearchBtn: searchBtnClick.bind(this), // 点击按钮事件 + showAdvBtn: true, // 显示高级按钮 + renderCompleteEvent: this.renderCompleteEvent, // 查询区渲染完成回调函数 + onAfterEvent: afterEvent.bind(this) //编辑后事件 + } + )} +
+
+ {createSimpleTable(this.tableId, { + fieldid: "initpaybill", + dataSource: dataSource, + pkname: pkname, + handlePageInfoChange: pageInfoClick.bind(this), + tableModelConfirm: tableModelConfirm, + onRowDoubleClick: doubleClick.bind(this), + onSelected: this.onSelected.bind(this), + onSelectedAll: this.onSelected.bind(this), + showCheck: true, + showIndex: true, + crossPageSelect:true, + selectedChange:(...params)=>{ + this.onSelected.call(this) + }, + high_selectable: { + enable: true //默认为true + }, + // 框选 + onBatchSelected: (...params) => { + this.onSelected.call(this) + }, + componentInitFinished: () => { + this.onSelected(); + } + })} +
+ {/* {联查处理情况} */} + + {/* {联查收付款协议} */} + + + + {/* 单据追溯组件 */} + { + this.setState({ showBillTrack: false }); + }} + pk={this.Info.pk_bill} //单据id + type={this.Info.pk_tradetype} //单据类型 + /> + + {/* {打印输出} */} + + {showUploader && ( + + )} + {/* {导入} */} + {createModal('importModal', { + noFooter: true, + className: 'import-modal', + hasBackDrop: false + })} + +
+ ); + } +} + +List = createPage({ + mutiLangCode: '2052' +})(List); + +export default List; diff --git a/src/arap/paybill/initpaybill/main/config.json b/src/arap/paybill/initpaybill/main/config.json new file mode 100644 index 00000000..94ea163b --- /dev/null +++ b/src/arap/paybill/initpaybill/main/config.json @@ -0,0 +1,23 @@ +{ + "dependjs": [ + + "../../../../epmp/exports/components/Inspection/index.js", + "../../../../uap/common/components/ApproveDetail/index.js", + "../../../../uap/common/components/excelImportconfig/index.js", + "../../../../uap/common/components/ExcelOutput/index.js", + "../../../../uap/common/components/NCUploader/index.js", + "../../../../uap/common/components/approvalTrans/index.js", + "../../../../uap/common/components/ApproveDetail/index.js", + "../../../../uap/common/components/printOnClient/index.js" + ], + "dependModuleName": [ + "epmp/exports/components/Inspection", + "uap/common/components/ApproveDetail", + "uap/common/components/ApproveDetail", + "uap/common/components/excelImportconfig", + "uap/common/components/ExcelOutput", + "uap/common/components/NCUploader", + "uap/common/components/approvalTrans", + "uap/common/components/printOnClient" + ] +} \ No newline at end of file diff --git a/src/arap/paybill/initpaybill/main/index.js b/src/arap/paybill/initpaybill/main/index.js new file mode 100644 index 00000000..11ccdf30 --- /dev/null +++ b/src/arap/paybill/initpaybill/main/index.js @@ -0,0 +1,7 @@ +import {RenderRouter} from 'nc-lightapp-front'; +import routes from './router'; + +(function main(routers,htmlTagid){ + RenderRouter(routers,htmlTagid); +})(routes,"app"); + diff --git a/src/arap/paybill/initpaybill/main/router.js b/src/arap/paybill/initpaybill/main/router.js new file mode 100644 index 00000000..f09bdcc1 --- /dev/null +++ b/src/arap/paybill/initpaybill/main/router.js @@ -0,0 +1,19 @@ +import {asyncComponent} from 'nc-lightapp-front'; +import List from '../list'; + + +const card = asyncComponent(() => import(/* webpackChunkName: "arap/paybill/initpaybill/card/card" */ /* webpackMode: "eager" */'../card')); + +const routes = [ + { + path: '/list', + component: List, + exact: true, + }, + { + path: '/card',//定义路由 + component: card, + } +]; + +export default routes; diff --git a/src/arap/paybill/paybill/transfer/config.json b/src/arap/paybill/paybill/transfer/config.json new file mode 100644 index 00000000..61fbf4bf --- /dev/null +++ b/src/arap/paybill/paybill/transfer/config.json @@ -0,0 +1,3 @@ +{ + "hash":false +} \ No newline at end of file