Commit 2301ee406eb50dd09fd2fd07ca848ea89d937fe1
1 parent
10463348
1.增加项目资料一键下载功能,项目合同、项目实施 都有可能传附件,需要将项目相关上传的文件 一键下载成一个压缩包
2.消息点击待办跳转到研发工单,发现研发工单审批流没有右边 转办 同意 这个栏 3.系统修改按钮返回-1时,代表禁止修改,则按钮状态返回修改前的状态,界面不可编辑 4.修复keyUp调用extractTableNames报错
Showing
5 changed files
with
142 additions
and
42 deletions
src/components/Common/ToolBar/ToolBarNew.js
| ... | ... | @@ -400,7 +400,7 @@ class ToolBarComponent extends Component { |
| 400 | 400 | bShown = statusObj.bShown; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - let { masterData, formRoute } = this.props; | |
| 403 | + let { masterData, formRoute, enabled } = this.props; | |
| 404 | 404 | |
| 405 | 405 | // 主表数据是当前表格已选中数据 |
| 406 | 406 | if (formRoute === "/indexPage/commonListLeft") { |
| ... | ... | @@ -411,7 +411,8 @@ class ToolBarComponent extends Component { |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | const { sortEnabled } = this.props; |
| 414 | - const { enabled, adDisabled, sModelsType, masterConfig, activeKey, sModelsId } = this.props; | |
| 414 | + const { sUseInfo, adDisabled, sModelsType, masterConfig, activeKey, sModelsId } = this.props; | |
| 415 | + | |
| 415 | 416 | if (commonUtils.isEmptyObject(masterData)) { |
| 416 | 417 | masterData = {}; |
| 417 | 418 | } |
| ... | ... | @@ -425,6 +426,9 @@ class ToolBarComponent extends Component { |
| 425 | 426 | } else { |
| 426 | 427 | bBtnCheck = false; |
| 427 | 428 | } |
| 429 | + if(commonUtils.isNotEmptyObject(sUseInfo)) { | |
| 430 | + enabled = false; | |
| 431 | + } | |
| 428 | 432 | if (location.pathname === "/indexPage/commonClassify") { |
| 429 | 433 | /* 通用分类 若配置没有审核按钮 则默认bCheck不为空 */ |
| 430 | 434 | if (iIndex === -1) { |
| ... | ... | @@ -2254,6 +2258,45 @@ class ToolBarComponent extends Component { |
| 2254 | 2258 | this.props.onSaveState({ |
| 2255 | 2259 | visibleFilfile: true, |
| 2256 | 2260 | }); |
| 2261 | + }else if (key.indexOf("BtnDownloadBacth") > -1) { | |
| 2262 | + /* 一键下载功能 */ | |
| 2263 | + const { slaveSelectedRowKeys, slaveData, app } = this.props; | |
| 2264 | + | |
| 2265 | + // 检查是否选中数据 | |
| 2266 | + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) { | |
| 2267 | + message.warning("请先选择数据"); | |
| 2268 | + return; | |
| 2269 | + } | |
| 2270 | + | |
| 2271 | + // 获取选中数据的文件路径 | |
| 2272 | + const savePathArr = []; | |
| 2273 | + const dataSelect = slaveData.filter(item => slaveSelectedRowKeys.includes(item.sSlaveId) || slaveSelectedRowKeys.includes(item.sId)); | |
| 2274 | + | |
| 2275 | + if (commonUtils.isNotEmptyArr(dataSelect)) { | |
| 2276 | + dataSelect.forEach(item => { | |
| 2277 | + // 假设文件路径字段为sFilePath,根据实际数据结构调整 | |
| 2278 | + if (item.sPicturePath) { | |
| 2279 | + savePathArr.push(item.sPicturePath); | |
| 2280 | + } | |
| 2281 | + }); | |
| 2282 | + } | |
| 2283 | + | |
| 2284 | + // 如果没有找到文件路径,提示用户 | |
| 2285 | + if (commonUtils.isEmptyArr(savePathArr)) { | |
| 2286 | + message.warning("选中的数据没有文件路径"); | |
| 2287 | + return; | |
| 2288 | + } | |
| 2289 | + | |
| 2290 | + // 获取菜单名称作为压缩包文件名 | |
| 2291 | + const menuName = commonUtils.isNotEmptyArr(dataSelect) ? dataSelect[0].sZipFileName : '下载文件'; | |
| 2292 | + const savePathStr = savePathArr.join(","); | |
| 2293 | + // savePathStr = 'D:/xlyweberp/printPreviewPdf/192116811110017394976081060_采购订单_标准A4_CGDD25020036.xlsx,D:/xlyweberp/printPreviewPdf/19211681211917497873921861_估价单.pdf'; | |
| 2294 | + const zipFileName = `${menuName}`; | |
| 2295 | + | |
| 2296 | + // 调用下载接口 | |
| 2297 | + const downloadUrl = `${commonConfig.file_host}file/downloadBacth`; | |
| 2298 | + this.handleOpenPostBatch(downloadUrl, savePathStr, zipFileName); | |
| 2299 | + | |
| 2257 | 2300 | } else if (key.indexOf("BtnEvent") > -1 || key.indexOf("BtnBatchSubmit") > -1 || key.indexOf("BtnSubmit") > -1) { |
| 2258 | 2301 | const { |
| 2259 | 2302 | slaveSelectedRowKeys, |
| ... | ... | @@ -2691,7 +2734,20 @@ class ToolBarComponent extends Component { |
| 2691 | 2734 | callback(); |
| 2692 | 2735 | } |
| 2693 | 2736 | }; |
| 2694 | - | |
| 2737 | +// 在handleOpenPost方法后添加批量下载方法 | |
| 2738 | + handleOpenPostBatch = (url, savePathStr, zipFileName) => { | |
| 2739 | + console.log('222', {url, savePathStr, zipFileName}) | |
| 2740 | + const newWin = window.open(); | |
| 2741 | + let formStr = ""; | |
| 2742 | + formStr = | |
| 2743 | + `<form style="visibility:hidden;" method="POST" action="${url}">` + | |
| 2744 | + `<input type="hidden" name="savePathStr" value='${savePathStr}' />` + | |
| 2745 | + `<input type="hidden" name="zipFileName" value='${zipFileName}' />` + | |
| 2746 | + "</form>"; | |
| 2747 | + newWin.document.body.innerHTML = formStr; | |
| 2748 | + newWin.document.forms[0].submit(); | |
| 2749 | + return newWin; | |
| 2750 | + }; | |
| 2695 | 2751 | handleSubmit = () => { |
| 2696 | 2752 | // 保存前手机号、邮箱校验 |
| 2697 | 2753 | let checkResult = true; | ... | ... |
src/components/Common/commonBusiness.js
| ... | ... | @@ -994,7 +994,7 @@ export function getCalculateMoneyByLossMoney(app, type, masterData, tableDataRow |
| 994 | 994 | return tableDataRow; |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | -export function extractTableNames(expression) { | |
| 997 | +export function extractTableNames1(expression) { | |
| 998 | 998 | // 1. 定义需要识别的表名列表(与tableSelectedData的key一一对应) |
| 999 | 999 | const targetTables = ['master', 'slave', 'control', 'materialsRow', 'processRow', 'slaveChildRow']; |
| 1000 | 1000 | |
| ... | ... | @@ -1040,6 +1040,37 @@ function formatTableData(originObj) { |
| 1040 | 1040 | return newObj; |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | + | |
| 1044 | +/** | |
| 1045 | + * 从字段表达式中提取表名 | |
| 1046 | + * @param {string} sAssignField - 字段表达式,如 "control.dSumMachineQty" | |
| 1047 | + * @returns {string[]} 提取的表名数组 | |
| 1048 | + */ | |
| 1049 | +export function extractTableNames(sAssignField) { | |
| 1050 | + const targetTables = ['master', 'slave', 'control', 'materialsRow', 'processRow', 'slaveChildRow']; | |
| 1051 | + | |
| 1052 | + // 入参校验:非字符串直接返回空数组 | |
| 1053 | + if (typeof sAssignField !== 'string' || sAssignField.trim() === '') { | |
| 1054 | + return []; | |
| 1055 | + } | |
| 1056 | + | |
| 1057 | + // 2. 构建正则:匹配「表名.任意属性」的格式(仅捕获表名) | |
| 1058 | + const tableNamePattern = targetTables.join('|'); | |
| 1059 | + // \b 确保表名是独立单词(避免匹配control123这种) | |
| 1060 | + // 正则匹配:master/slave/control等 + 点号 + 任意属性名 | |
| 1061 | + const regex = new RegExp (`\\b(${tableNamePattern})\\.\\w+`, 'g'); | |
| 1062 | + | |
| 1063 | + // 3. 匹配所有符合规则的片段,提取表名 | |
| 1064 | + const matches = sAssignField.match(regex) || []; | |
| 1065 | + const tableNames = matches.map(match => { | |
| 1066 | + // 拆分 "control.dSumMachineQty" → 取前面的表名部分 | |
| 1067 | + return match.split('.')[0]; | |
| 1068 | + }); | |
| 1069 | + | |
| 1070 | + // 4. 去重并返回纯表名数组 | |
| 1071 | + return [...new Set (tableNames)]; | |
| 1072 | +} | |
| 1073 | + | |
| 1043 | 1074 | /* 自定义onChange事件 */ |
| 1044 | 1075 | export function getKeyUpEvent(name, sFieldName, tableConfig, masterData, tableDataRow, isWait, dataCollection, dataSelected, app) { |
| 1045 | 1076 | let tableDataRowNew = {}; |
| ... | ... | @@ -1500,7 +1531,7 @@ export function getKeyUpEvent(name, sFieldName, tableConfig, masterData, tableDa |
| 1500 | 1531 | || sAssignField?.includes('process.') |
| 1501 | 1532 | || sAssignField?.includes('master.')); |
| 1502 | 1533 | |
| 1503 | - const tableNames = this.extractTableNames(sAssignField); | |
| 1534 | + const tableNames = extractTableNames(sAssignField); | |
| 1504 | 1535 | // 生成新的tableSelectedData |
| 1505 | 1536 | const newTableSelectedMap = formatTableData(dataSelected); |
| 1506 | 1537 | const datasetMap = bCrossTable ? newTableSelectedMap : newCopyTo; | ... | ... |
src/components/IndexCenter/IndexCenter.js
| ... | ... | @@ -810,16 +810,20 @@ class IndexCenter extends Component { |
| 810 | 810 | <div> |
| 811 | 811 | <Button id="btnOpenDetail" style={{ display: 'none' }} type="primary" icon={<BankOutlined />} loading={loadings} onClick={() => this.handleOpenTab('', '')}>待办</Button> |
| 812 | 812 | <Button id="btnOpenDetailHand" style={{ display: 'none' }} type="primary" icon={<BankOutlined />} loading={loadings} onClick={() => this.handleOpenTab('', '')}>办理</Button> |
| 813 | - {/*<input id="sFormId" value="12710101117015057281870" style={{ width:'300px', display: ' block' }} />*/} | |
| 814 | - {/*<input id="sBillId" value="17363836790006274411376581212000" style={{ width:'300px', display: 'block' }} />*/} | |
| 815 | - {/*<Input id="sFormId" placeholder="12710101117015057281870" style={{ width:'300px', display: ' block' }} />*/} | |
| 816 | - {/*<Input id="sBillId" placeholder="17363836790006274411376581212000" style={{ width:'300px', display: 'block' }} />*/} | |
| 817 | 813 | <input id="sFormId" value="" style={{ display: ' none' }} /> |
| 818 | 814 | <input id="sBillId" value="" style={{ display: ' none' }} /> |
| 819 | - {/*<input id="sFormId" value="12012615914116395420093200" style={{ width:'300px', display: ' block' }} />*/} | |
| 820 | - {/*<input id="sBillId" value="17349248560001229998153008542200" style={{ width:'300px', display: ' block' }} />*/} | |
| 821 | 815 | <input id="bFlow" value="" style={{ width: '300px', display: 'none' }} /> |
| 822 | 816 | <textarea id='sFlowData' rows="10" cols="30" style={{ width: '300px', display: 'none' }} /> |
| 817 | + | |
| 818 | + {/*<Button id="btnOpenDetail" style={{ display: 'block' }} type="primary" icon={<BankOutlined />} loading={loadings} onClick={() => this.handleOpenTab('', '')}>待办</Button>*/} | |
| 819 | + {/*<Button id="btnOpenDetailHand" style={{ display: 'block' }} type="primary" icon={<BankOutlined />} loading={loadings} onClick={() => this.handleOpenTab('', '')}>办理</Button>*/} | |
| 820 | + | |
| 821 | + {/*<input id="sFormId" value="12710101117014147688950" style={{ display: ' block' }} />*/} | |
| 822 | + {/*<input id="sBillId" value="17657164930008384898449554260000" style={{ display: ' block' }} />*/} | |
| 823 | + | |
| 824 | + {/*<input id="bFlow" value="true" style={{ width: '300px', display: 'block' }} />*/} | |
| 825 | + {/*<textarea id='sFlowData' rows="10" cols="30" style={{ width: '300px', display: 'block' }} />*/} | |
| 826 | + | |
| 823 | 827 | {/* eslint-disable-next-line jsx-a11y/iframe-has-title */} |
| 824 | 828 | <iframe id="iframe1" src={iframeUrl} style={{ width: '100%', height: '85vh' }} frameBorder="0" /> |
| 825 | 829 | </div> : | ... | ... |
src/components/Manufacture/CommonPackEvent.js
| ... | ... | @@ -1231,34 +1231,34 @@ const CommonPackEvent = props => { |
| 1231 | 1231 | |
| 1232 | 1232 | const CommonModal = props => { |
| 1233 | 1233 | return ( |
| 1234 | - <> | |
| 1235 | - /** 工艺指导书弹窗组件 */ | |
| 1236 | - <PartsInfoModal {...props} /> | |
| 1237 | - /** 选择工序弹窗组件 */ | |
| 1238 | - <ProcessChooseModal {...props} /> | |
| 1239 | - /** 选择成品工序弹窗组件 */ | |
| 1240 | - <ProductProcessChooseModal {...props} /> | |
| 1241 | - /** 选择成品材料弹窗组件 */ | |
| 1242 | - <ProductMaterialsChooseModal {...props} /> | |
| 1243 | - /** 选择材料弹窗组件 */ | |
| 1244 | - <MaterialsChooseModal {...props} /> | |
| 1245 | - /** 选择工艺参数弹窗(旧) */ | |
| 1246 | - <ParamsChooseModal {...props} /> | |
| 1247 | - /** 选择工艺参数弹窗(新) */ | |
| 1248 | - <ParamsChooseNewModal {...props} /> | |
| 1249 | - /* 选择合版部件弹窗 */ | |
| 1250 | - <CombinePartsChooseModal {...props} /> | |
| 1251 | - /* 部件行选择合版信息弹窗 */ | |
| 1252 | - <ProductCombinationModal {...props} /> | |
| 1253 | - /* 复制从弹窗 */ | |
| 1254 | - <CopyFromModal {...props} /> | |
| 1255 | - /* Ctrl+R全部更新弹窗 */ | |
| 1256 | - <ModifyAllModal {...props} /> | |
| 1257 | - /* 工作流弹窗 */ | |
| 1258 | - <WorkFlowModal {...props} /> | |
| 1259 | - /* 选择色序弹窗 */ | |
| 1260 | - <SisColorModal {...props} /> | |
| 1261 | - </> | |
| 1234 | + <div> | |
| 1235 | + {/* 工艺指导书弹窗组件 */} | |
| 1236 | + <PartsInfoModal {...props} /> | |
| 1237 | + {/* 选择工序弹窗组件 */} | |
| 1238 | + <ProcessChooseModal {...props} /> | |
| 1239 | + {/* 选择成品工序弹窗组件 */} | |
| 1240 | + <ProductProcessChooseModal {...props} /> | |
| 1241 | + {/* 选择成品材料弹窗组件 */} | |
| 1242 | + <ProductMaterialsChooseModal {...props} /> | |
| 1243 | + {/* 选择材料弹窗组件 */} | |
| 1244 | + <MaterialsChooseModal {...props} /> | |
| 1245 | + {/* 选择工艺参数弹窗(旧) */} | |
| 1246 | + <ParamsChooseModal {...props} /> | |
| 1247 | + {/* 选择工艺参数弹窗(新) */} | |
| 1248 | + <ParamsChooseNewModal {...props} /> | |
| 1249 | + {/* 选择合版部件弹窗 */} | |
| 1250 | + <CombinePartsChooseModal {...props} /> | |
| 1251 | + {/* 部件行选择合版信息弹窗 */} | |
| 1252 | + <ProductCombinationModal {...props} /> | |
| 1253 | + {/* 复制从弹窗 */} | |
| 1254 | + <CopyFromModal {...props} /> | |
| 1255 | + {/* Ctrl+R全部更新弹窗 */} | |
| 1256 | + <ModifyAllModal {...props} /> | |
| 1257 | + {/* 工作流弹窗 */} | |
| 1258 | + <WorkFlowModal {...props} /> | |
| 1259 | + {/* 选择色序弹窗 */} | |
| 1260 | + <SisColorModal {...props} /> | |
| 1261 | + </div> | |
| 1262 | 1262 | ); |
| 1263 | 1263 | }; |
| 1264 | 1264 | ... | ... |
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js
| ... | ... | @@ -18,6 +18,7 @@ import StaticEditTable from "@/components/Common/CommonTable"; |
| 18 | 18 | import CommonViewDragable from "@/components/Common/CommonViewDragable"; |
| 19 | 19 | import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; |
| 20 | 20 | import styles from "./index.less"; |
| 21 | +import CommonExamInfo from "../../Common/CommonExamInfo"; | |
| 21 | 22 | |
| 22 | 23 | const { Panel } = Collapse; |
| 23 | 24 | |
| ... | ... | @@ -4081,17 +4082,25 @@ const WorkOrderPackTableTreeNewComponent = Form.create({ |
| 4081 | 4082 | if (!props.currentForm) { |
| 4082 | 4083 | props.setForm(props.form); |
| 4083 | 4084 | } |
| 4084 | - | |
| 4085 | + const { currentPane } = props.app; | |
| 4086 | + const bFlow = true ; /* 是否需要展示审批流程信息 */ | |
| 4085 | 4087 | return ( |
| 4086 | - <div className={`xly-workorder-list ${styles.WorkOrderPackTableTreeNew}`}> | |
| 4088 | + <div className={`xly-workorder-list ${styles.WorkOrderPackTableTreeNew}`} style={{ display: bFlow ? 'flex':'block' }} > | |
| 4087 | 4089 | <ToolBarComponent {...props} /> |
| 4088 | - <div className={styles.content}> | |
| 4090 | + <div className={styles.content} style={{ width: bFlow ? '75%':'100%' }}> | |
| 4089 | 4091 | <AvatarComponent {...props} /> |
| 4090 | 4092 | <MasterComponent {...props} /> |
| 4091 | 4093 | <SlaveComponent {...props} /> |
| 4092 | 4094 | <ControlComponent {...props} /> |
| 4093 | 4095 | <OtherComponent {...props} /> |
| 4094 | 4096 | </div> |
| 4097 | + { | |
| 4098 | + bFlow ? | |
| 4099 | + <div id='examInfo' style={{ float:'left', width:'25%', textAlign:'center', height:'900px', maxHeight: 'calc(100vh - 130px)' , backgroundColor:'#f0f0f0'}}> | |
| 4100 | + <CommonExamInfo {...props} /> | |
| 4101 | + </div> | |
| 4102 | + : '' | |
| 4103 | + } | |
| 4095 | 4104 | <CommonModal {...props} /> |
| 4096 | 4105 | </div> |
| 4097 | 4106 | ); | ... | ... |