From 6101d36b888d8067a6408cbcbcb8ce330b381dfa Mon Sep 17 00:00:00 2001 From: chenxt <10125295+chen-xintao97@user.noreply.gitee.com> Date: Mon, 22 Dec 2025 15:08:12 +0800 Subject: [PATCH] 根据配置增加行数据 --- src/components/Common/CommonHooks/useCommonBase.js | 1 - src/mes/common/commonModelComponent/index.js | 36 ++++++++++-------------------------- src/mes/common/commonOperationBarComponent/MesToolbar.js | 4 +++- src/mes/scheduledTasks/machineTasks/index.js | 1 - 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/src/components/Common/CommonHooks/useCommonBase.js b/src/components/Common/CommonHooks/useCommonBase.js index b4542d2..16970a9 100644 --- a/src/components/Common/CommonHooks/useCommonBase.js +++ b/src/components/Common/CommonHooks/useCommonBase.js @@ -3070,7 +3070,6 @@ const useCommonBase = props => { formRoute, slaveSelectedRowKeys, } = props; - console.log("🚀 ~ handleCopyTo ~ props:", props, nextProps) const { sActiveName } = nextProps.config; let sParentConditions = {}; props.onOpenCommonModal({ diff --git a/src/mes/common/commonModelComponent/index.js b/src/mes/common/commonModelComponent/index.js index 55f7714..1505116 100644 --- a/src/mes/common/commonModelComponent/index.js +++ b/src/mes/common/commonModelComponent/index.js @@ -83,8 +83,6 @@ const useCommonModelEvent = props => { }; } }); - console.log('界面addstate', addState); - return addState; }; @@ -418,24 +416,8 @@ const useCommonModelEvent = props => { sFormId: sModelsId, ...masterDataCopyTo }; - const addState = {}; // 始终初始化为对象 - // if (Array.isArray(copyToConfig) && copyToConfig.length > 0) { - // copyToConfig.forEach(item => { - // if (item?.sControlName) { - // const name = item.sControlName.split('.').pop(); - // if (name && name.includes('slave')) { - // addState[`${name}Data`] = { - // ...commonFunc.getDefaultData(`${name}Config`), - // handleType: "add", - // sId: commonUtils.createSid(), - // sFormId: sModelsId, - // ...commonFunc.getAssignFieldValue(item.sAssignField, record) - // }; - // } - // } - // }); - // } - props.onSaveState({ masterData: masterDataNew, enabled: true, ...addState }); + + props.onSaveState({ masterData: masterDataNew, enabled: true, }); }, [props.bFinish] ); @@ -455,6 +437,7 @@ const useCommonModelEvent = props => { ...commonFunc.getDefaultData(`${name}Config`), handleType: "add", sId: commonUtils.createSid(), + sParentId: props.masterData.sId, ...commonFunc.getAssignFieldValue(item.sAssignField, record) }]; } @@ -1306,7 +1289,6 @@ const CommonModelComponent = props => { tableBtnsConfig, // 表格按钮配置 bFirstComponent: level === 0 && index === -1 }; - console.log("🚀 ~ getComponent ~ componentProps:", componentProps) const commonDivHeight = useComputedCommonDivHeight(componentProps); return (
{ ); } }); - + const operationBarProps = { ...props, sName, @@ -1875,10 +1857,12 @@ const CommonTableComponent = props => { sName }; if (tableProps.data && tableProps.data.length === 0) { - props.onMesTableLineAdd({ - tableName: tableProps.name, - // tableClassName: state.tableClassName - }) + const bEmptyAddLine = tableProps.config.gdsconfigformslave.find(x => x.sControlName.includes('bEmptyAddLine')) + if ((commonUtils.isNotEmptyObject(bEmptyAddLine) && bEmptyAddLine.bVisible)) { + props.onMesTableLineAdd({ + tableName: tableProps.name, + }) + } } return ( diff --git a/src/mes/common/commonOperationBarComponent/MesToolbar.js b/src/mes/common/commonOperationBarComponent/MesToolbar.js index 30c1b70..395698f 100644 --- a/src/mes/common/commonOperationBarComponent/MesToolbar.js +++ b/src/mes/common/commonOperationBarComponent/MesToolbar.js @@ -134,15 +134,17 @@ const handleScanFace = (props) => { const { [`${addData}Data`]: tableData = [], [`${addData}Config`]: config = {} } = props; const copyConfig = config?.gdsconfigformslave?.find(item => item.sControlName.toLowerCase().includes('btnscanface')) proData.forEach(item => { - const data = commonFunc.getAssignFieldValue(copyConfig?.sAssignField, item) + const data = commonFunc.getAssignFieldValue(copyConfig?.sAssignField, item) tableData.push({ ...item, ...data, sId: commonUtils.createSid(), handleType: "add", sParentId: props.masterData.sId, + slaveId: props?.slaveData ? props?.slaveData[0].sId : '' }) }); + props.onSaveState({ [`${addData}Data`]: tableData }); diff --git a/src/mes/scheduledTasks/machineTasks/index.js b/src/mes/scheduledTasks/machineTasks/index.js index d1c0f64..baefa63 100644 --- a/src/mes/scheduledTasks/machineTasks/index.js +++ b/src/mes/scheduledTasks/machineTasks/index.js @@ -494,7 +494,6 @@ const MachineTasks = baseProps => { slave2Column, slave2Data = [] } = props; - console.log("🚀 ~ MachineTasks ~ props:", props) const bStartWork = commonUtils.getAppData("userinfo", "bStartWork"); -- libgit2 0.22.2