From 6722a5af50ff7aced8701ed798837d1d8d84c199 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 23 Jan 2025 15:36:47 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E9=A2=86=E6=82=A6=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/custom-apis/lingyue/index.js | 9 ++ .../custom-pages/lingyue/components/list.js | 124 ++++++++++++------ .../pages/custom-pages/lingyue/layout.js | 7 +- 3 files changed, 96 insertions(+), 44 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js index b4056d31..6217fba0 100644 --- a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js +++ b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js @@ -13,6 +13,9 @@ export const getLYSalaryReportListSum = (params) => { export const batchDeleteSalaryReport = (params) => { return postFetch("/api/bs/hrmsalary/ly/salaryReport/batchDelete", params); }; +export const deleteAllSalaryReport = (params) => { + return postFetch("/api/bs/hrmsalary/ly/salaryReport/deleteAll", params); +}; export const getLYPermission = (params) => { return postFetch("/api/bs/hrmsalary/ly/salaryReport/lyPermission", params); }; @@ -40,9 +43,15 @@ export const getLYFundReportGenerateListSum = (params) => { export const batchDeleteSIReport = (params) => { return postFetch("/api/bs/hrmsalary/ly/SIReport/batchDelete", params); }; +export const deleteAllSIReport = (params) => { + return postFetch("/api/bs/hrmsalary/ly/SIReport/deleteAll", params); +}; export const batchDeleteFundReport = (params) => { return postFetch("/api/bs/hrmsalary/ly/FundReport/batchDelete", params); }; +export const deleteAllFundReport = (params) => { + return postFetch("/api/bs/hrmsalary/ly/FundReport/deleteAll", params); +}; export const exportSIReport = (params) => { return postExportFetch("/api/bs/hrmsalary/ly/socialReport/export", params); }; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js index ff0bf12e..2de53e80 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js @@ -20,19 +20,20 @@ const interfaceType = { list: API.getLYSalaryReportList, sum: API.getLYSalaryReportListSum, export: API.exportSalaryReport, - batchDel: API.batchDeleteSalaryReport - }, - "socialFundSum": { + batchDel: API.batchDeleteSalaryReport, + allDel: API.deleteAllSalaryReport + }, "socialFundSum": { list: API.getLYSIReportList, sum: API.getLYSIReportGenerateListSum, export: API.exportSIReport, - batchDel: API.batchDeleteSIReport - }, - "fundSum": { + batchDel: API.batchDeleteSIReport, + allDel: API.deleteAllSIReport + }, "fundSum": { list: API.getLYFundReportList, sum: API.getLYFundReportGenerateListSum, export: API.exportFundReport, - batchDel: API.batchDeleteFundReport + batchDel: API.batchDeleteFundReport, + allDel: API.deleteAllFundReport } }; @@ -40,8 +41,14 @@ class List extends Component { constructor(props) { super(props); this.state = { - dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, - selectedRowKeys: [], sumDataSource: {}, payload: {}, visible: false, + dataSource: [], + columns: [], + pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false, + selectedRowKeys: [], + sumDataSource: {}, + payload: {}, + visible: false, voucherDialog: { visible: false, ffgsqcLabel: props.ffgsqcLabel, type: props.type } }; this.handleDebounce = null; @@ -82,8 +89,7 @@ class List extends Component { }; postMessageToChild = (payload = {}) => { const i18n = { - "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), - "总计": getLabel(523, "总计") + "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), "总计": getLabel(523, "总计") }; const childFrameObj = document.getElementById("unitTable"); childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); @@ -96,20 +102,27 @@ class List extends Component { interfaceType[type]["list"](payload).then(async ({ status, data, errormsg }) => { this.setState({ loading: false }); if (status) { - const { data: { sumRow: sumDataSource } } = isSum ? - await interfaceType[type]["sum"](payload) : { data: { sumRow: this.state.sumDataSource } }; + const { data: { sumRow: sumDataSource } } = isSum ? await interfaceType[type]["sum"](payload) : { data: { sumRow: this.state.sumDataSource } }; const { columns, data: result } = data; const { list: dataSource, pageNum: current, pageSize, total } = result; this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, voucherDialog: { ...this.state.voucherDialog, ...query }, - dataSource, columns, sumDataSource, payload + dataSource, + columns, + sumDataSource, + payload }, () => { onInit(); this.postMessageToChild({ - dataSource, pageInfo: this.state.pageInfo, selectedRowKeys, - unitTableType: "custom_lingyue", columns: traverseCols(columns), showTotalCell: true, - sumDataSource: this.state.sumDataSource, scrollHeight: !_.isEmpty(dataSource) ? 195 : 0 + dataSource, + pageInfo: this.state.pageInfo, + selectedRowKeys, + unitTableType: "custom_lingyue", + columns: traverseCols(columns), + showTotalCell: true, + sumDataSource: this.state.sumDataSource, + scrollHeight: !_.isEmpty(dataSource) ? 195 : 0 }); }); } else { @@ -136,18 +149,39 @@ class List extends Component { WeaLoadingGlobal.start(); const promise = interfaceType[type]["export"](payload); break; + case "ALLDEL": + const { salaryMonth } = query; + Modal.confirm({ + title: getLabel(111, "确认信息"), content: getLabel(111, "确认全部删除吗?"), onOk: () => { + interfaceType[type]["allDel"]({ salaryMonth }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.setState({ + selectedRowKeys: [], pageInfo: { ...this.state.pageInfo, current: 1 } + }, () => this.getLYList()); + } else { + message.error(errormsg); + } + }); + } + }); + break; case "BATCHDEL": if (_.isEmpty(selectedRowKeys)) { message.warning("未勾选数据!"); return; } Modal.confirm({ - title: getLabel(111, "确认信息"), content: getLabel(388758, "确认要删除吗?"), - onOk: () => { + title: getLabel(111, "确认信息"), content: getLabel(388758, "确认要删除吗?"), onOk: () => { interfaceType[type]["batchDel"]({ ids: selectedRowKeys }).then(({ status, errormsg }) => { if (status) { message.success(getLabel(111, "操作成功!")); - this.setState({ selectedRowKeys: [] }, () => this.getLYList()); + const { pageInfo } = this.state, { current, pageSize, total } = pageInfo; + const totalPage = Math.ceil((total - selectedRowKeys.length) / pageSize); + this.setState({ + selectedRowKeys: [], + pageInfo: { ...this.state.pageInfo, current: current > totalPage ? totalPage : current } + }, () => this.getLYList()); } else { message.error(errormsg); } @@ -168,23 +202,21 @@ class List extends Component { if (dom && dataSource.length > 0) { height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 47 + 204.53 : dataSource.length < 10 ? dataSource.length * 47 + 204.53 : parseFloat(dom.style.height) - 32; } - return ( -