From 2301ee406eb50dd09fd2fd07ca848ea89d937fe1 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Thu, 18 Dec 2025 11:28:11 +0800 Subject: [PATCH] 1.增加项目资料一键下载功能,项目合同、项目实施 都有可能传附件,需要将项目相关上传的文件 一键下载成一个压缩包 2.消息点击待办跳转到研发工单,发现研发工单审批流没有右边 转办 同意 这个栏 3.系统修改按钮返回-1时,代表禁止修改,则按钮状态返回修改前的状态,界面不可编辑 4.修复keyUp调用extractTableNames报错 --- src/components/Common/ToolBar/ToolBarNew.js | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/components/Common/commonBusiness.js | 35 +++++++++++++++++++++++++++++++++-- src/components/IndexCenter/IndexCenter.js | 16 ++++++++++------ src/components/Manufacture/CommonPackEvent.js | 56 ++++++++++++++++++++++++++++---------------------------- src/components/Manufacture/WorkOrderPackTableTreeNew/index.js | 15 ++++++++++++--- 5 files changed, 142 insertions(+), 42 deletions(-) diff --git a/src/components/Common/ToolBar/ToolBarNew.js b/src/components/Common/ToolBar/ToolBarNew.js index 821088d..d9144f0 100644 --- a/src/components/Common/ToolBar/ToolBarNew.js +++ b/src/components/Common/ToolBar/ToolBarNew.js @@ -400,7 +400,7 @@ class ToolBarComponent extends Component { bShown = statusObj.bShown; } - let { masterData, formRoute } = this.props; + let { masterData, formRoute, enabled } = this.props; // 主表数据是当前表格已选中数据 if (formRoute === "/indexPage/commonListLeft") { @@ -411,7 +411,8 @@ class ToolBarComponent extends Component { } const { sortEnabled } = this.props; - const { enabled, adDisabled, sModelsType, masterConfig, activeKey, sModelsId } = this.props; + const { sUseInfo, adDisabled, sModelsType, masterConfig, activeKey, sModelsId } = this.props; + if (commonUtils.isEmptyObject(masterData)) { masterData = {}; } @@ -425,6 +426,9 @@ class ToolBarComponent extends Component { } else { bBtnCheck = false; } + if(commonUtils.isNotEmptyObject(sUseInfo)) { + enabled = false; + } if (location.pathname === "/indexPage/commonClassify") { /* 通用分类 若配置没有审核按钮 则默认bCheck不为空 */ if (iIndex === -1) { @@ -2254,6 +2258,45 @@ class ToolBarComponent extends Component { this.props.onSaveState({ visibleFilfile: true, }); + }else if (key.indexOf("BtnDownloadBacth") > -1) { + /* 一键下载功能 */ + const { slaveSelectedRowKeys, slaveData, app } = this.props; + + // 检查是否选中数据 + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) { + message.warning("请先选择数据"); + return; + } + + // 获取选中数据的文件路径 + const savePathArr = []; + const dataSelect = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) || slaveSelectedRowKeys.includes(item.sId)); + + if (commonUtils.isNotEmptyArr(dataSelect)) { + dataSelect.forEach(item => { + // 假设文件路径字段为sFilePath,根据实际数据结构调整 + if (item.sPicturePath) { + savePathArr.push(item.sPicturePath); + } + }); + } + + // 如果没有找到文件路径,提示用户 + if (commonUtils.isEmptyArr(savePathArr)) { + message.warning("选中的数据没有文件路径"); + return; + } + + // 获取菜单名称作为压缩包文件名 + const menuName = commonUtils.isNotEmptyArr(dataSelect) ? dataSelect[0].sZipFileName : '下载文件'; + const savePathStr = savePathArr.join(","); + // savePathStr = 'D:/xlyweberp/printPreviewPdf/192116811110017394976081060_采购订单_标准A4_CGDD25020036.xlsx,D:/xlyweberp/printPreviewPdf/19211681211917497873921861_估价单.pdf'; + const zipFileName = `${menuName}`; + + // 调用下载接口 + const downloadUrl = `${commonConfig.file_host}file/downloadBacth`; + this.handleOpenPostBatch(downloadUrl, savePathStr, zipFileName); + } else if (key.indexOf("BtnEvent") > -1 || key.indexOf("BtnBatchSubmit") > -1 || key.indexOf("BtnSubmit") > -1) { const { slaveSelectedRowKeys, @@ -2691,7 +2734,20 @@ class ToolBarComponent extends Component { callback(); } }; - +// 在handleOpenPost方法后添加批量下载方法 + handleOpenPostBatch = (url, savePathStr, zipFileName) => { + console.log('222', {url, savePathStr, zipFileName}) + const newWin = window.open(); + let formStr = ""; + formStr = + `
` + + `` + + `` + + "
"; + newWin.document.body.innerHTML = formStr; + newWin.document.forms[0].submit(); + return newWin; + }; handleSubmit = () => { // 保存前手机号、邮箱校验 let checkResult = true; diff --git a/src/components/Common/commonBusiness.js b/src/components/Common/commonBusiness.js index 8ae36cc..bfe6a84 100644 --- a/src/components/Common/commonBusiness.js +++ b/src/components/Common/commonBusiness.js @@ -994,7 +994,7 @@ export function getCalculateMoneyByLossMoney(app, type, masterData, tableDataRow return tableDataRow; } -export function extractTableNames(expression) { +export function extractTableNames1(expression) { // 1. 定义需要识别的表名列表(与tableSelectedData的key一一对应) const targetTables = ['master', 'slave', 'control', 'materialsRow', 'processRow', 'slaveChildRow']; @@ -1040,6 +1040,37 @@ function formatTableData(originObj) { return newObj; } + +/** + * 从字段表达式中提取表名 + * @param {string} sAssignField - 字段表达式,如 "control.dSumMachineQty" + * @returns {string[]} 提取的表名数组 + */ +export function extractTableNames(sAssignField) { + const targetTables = ['master', 'slave', 'control', 'materialsRow', 'processRow', 'slaveChildRow']; + + // 入参校验:非字符串直接返回空数组 + if (typeof sAssignField !== 'string' || sAssignField.trim() === '') { + return []; + } + + // 2. 构建正则:匹配「表名.任意属性」的格式(仅捕获表名) + const tableNamePattern = targetTables.join('|'); + // \b 确保表名是独立单词(避免匹配control123这种) + // 正则匹配:master/slave/control等 + 点号 + 任意属性名 + const regex = new RegExp (`\\b(${tableNamePattern})\\.\\w+`, 'g'); + + // 3. 匹配所有符合规则的片段,提取表名 + const matches = sAssignField.match(regex) || []; + const tableNames = matches.map(match => { + // 拆分 "control.dSumMachineQty" → 取前面的表名部分 + return match.split('.')[0]; + }); + + // 4. 去重并返回纯表名数组 + return [...new Set (tableNames)]; +} + /* 自定义onChange事件 */ export function getKeyUpEvent(name, sFieldName, tableConfig, masterData, tableDataRow, isWait, dataCollection, dataSelected, app) { let tableDataRowNew = {}; @@ -1500,7 +1531,7 @@ export function getKeyUpEvent(name, sFieldName, tableConfig, masterData, tableDa || sAssignField?.includes('process.') || sAssignField?.includes('master.')); - const tableNames = this.extractTableNames(sAssignField); + const tableNames = extractTableNames(sAssignField); // 生成新的tableSelectedData const newTableSelectedMap = formatTableData(dataSelected); const datasetMap = bCrossTable ? newTableSelectedMap : newCopyTo; diff --git a/src/components/IndexCenter/IndexCenter.js b/src/components/IndexCenter/IndexCenter.js index b07c61d..e7f1554 100644 --- a/src/components/IndexCenter/IndexCenter.js +++ b/src/components/IndexCenter/IndexCenter.js @@ -810,16 +810,20 @@ class IndexCenter extends Component {
- {/**/} - {/**/} - {/**/} - {/**/} - {/**/} - {/**/}