Commit 6101d36b888d8067a6408cbcbcb8ce330b381dfa

Authored by chenxt
1 parent 396cf7cd

根据配置增加行数据

src/components/Common/CommonHooks/useCommonBase.js
@@ -3070,7 +3070,6 @@ const useCommonBase = props => { @@ -3070,7 +3070,6 @@ const useCommonBase = props => {
3070 formRoute, 3070 formRoute,
3071 slaveSelectedRowKeys, 3071 slaveSelectedRowKeys,
3072 } = props; 3072 } = props;
3073 - console.log("🚀 ~ handleCopyTo ~ props:", props, nextProps)  
3074 const { sActiveName } = nextProps.config; 3073 const { sActiveName } = nextProps.config;
3075 let sParentConditions = {}; 3074 let sParentConditions = {};
3076 props.onOpenCommonModal({ 3075 props.onOpenCommonModal({
src/mes/common/commonModelComponent/index.js
@@ -83,8 +83,6 @@ const useCommonModelEvent = props => { @@ -83,8 +83,6 @@ const useCommonModelEvent = props => {
83 }; 83 };
84 } 84 }
85 }); 85 });
86 - console.log('界面addstate', addState);  
87 -  
88 return addState; 86 return addState;
89 }; 87 };
90 88
@@ -418,24 +416,8 @@ const useCommonModelEvent = props => { @@ -418,24 +416,8 @@ const useCommonModelEvent = props => {
418 sFormId: sModelsId, 416 sFormId: sModelsId,
419 ...masterDataCopyTo 417 ...masterDataCopyTo
420 }; 418 };
421 - const addState = {}; // 始终初始化为对象  
422 - // if (Array.isArray(copyToConfig) && copyToConfig.length > 0) {  
423 - // copyToConfig.forEach(item => {  
424 - // if (item?.sControlName) {  
425 - // const name = item.sControlName.split('.').pop();  
426 - // if (name && name.includes('slave')) {  
427 - // addState[`${name}Data`] = {  
428 - // ...commonFunc.getDefaultData(`${name}Config`),  
429 - // handleType: "add",  
430 - // sId: commonUtils.createSid(),  
431 - // sFormId: sModelsId,  
432 - // ...commonFunc.getAssignFieldValue(item.sAssignField, record)  
433 - // };  
434 - // }  
435 - // }  
436 - // });  
437 - // }  
438 - props.onSaveState({ masterData: masterDataNew, enabled: true, ...addState }); 419 +
  420 + props.onSaveState({ masterData: masterDataNew, enabled: true, });
439 }, 421 },
440 [props.bFinish] 422 [props.bFinish]
441 ); 423 );
@@ -455,6 +437,7 @@ const useCommonModelEvent = props => { @@ -455,6 +437,7 @@ const useCommonModelEvent = props => {
455 ...commonFunc.getDefaultData(`${name}Config`), 437 ...commonFunc.getDefaultData(`${name}Config`),
456 handleType: "add", 438 handleType: "add",
457 sId: commonUtils.createSid(), 439 sId: commonUtils.createSid(),
  440 + sParentId: props.masterData.sId,
458 ...commonFunc.getAssignFieldValue(item.sAssignField, record) 441 ...commonFunc.getAssignFieldValue(item.sAssignField, record)
459 }]; 442 }];
460 } 443 }
@@ -1306,7 +1289,6 @@ const CommonModelComponent = props => { @@ -1306,7 +1289,6 @@ const CommonModelComponent = props => {
1306 tableBtnsConfig, // 表格按钮配置 1289 tableBtnsConfig, // 表格按钮配置
1307 bFirstComponent: level === 0 && index === -1 1290 bFirstComponent: level === 0 && index === -1
1308 }; 1291 };
1309 - console.log("🚀 ~ getComponent ~ componentProps:", componentProps)  
1310 const commonDivHeight = useComputedCommonDivHeight(componentProps); 1292 const commonDivHeight = useComputedCommonDivHeight(componentProps);
1311 return ( 1293 return (
1312 <div 1294 <div
@@ -1610,7 +1592,7 @@ const CommonViewTableComponent = props =&gt; { @@ -1610,7 +1592,7 @@ const CommonViewTableComponent = props =&gt; {
1610 ); 1592 );
1611 } 1593 }
1612 }); 1594 });
1613 - 1595 +
1614 const operationBarProps = { 1596 const operationBarProps = {
1615 ...props, 1597 ...props,
1616 sName, 1598 sName,
@@ -1875,10 +1857,12 @@ const CommonTableComponent = props =&gt; { @@ -1875,10 +1857,12 @@ const CommonTableComponent = props =&gt; {
1875 sName 1857 sName
1876 }; 1858 };
1877 if (tableProps.data && tableProps.data.length === 0) { 1859 if (tableProps.data && tableProps.data.length === 0) {
1878 - props.onMesTableLineAdd({  
1879 - tableName: tableProps.name,  
1880 - // tableClassName: state.tableClassName  
1881 - }) 1860 + const bEmptyAddLine = tableProps.config.gdsconfigformslave.find(x => x.sControlName.includes('bEmptyAddLine'))
  1861 + if ((commonUtils.isNotEmptyObject(bEmptyAddLine) && bEmptyAddLine.bVisible)) {
  1862 + props.onMesTableLineAdd({
  1863 + tableName: tableProps.name,
  1864 + })
  1865 + }
1882 } 1866 }
1883 1867
1884 return ( 1868 return (
src/mes/common/commonOperationBarComponent/MesToolbar.js
@@ -134,15 +134,17 @@ const handleScanFace = (props) =&gt; { @@ -134,15 +134,17 @@ const handleScanFace = (props) =&gt; {
134 const { [`${addData}Data`]: tableData = [], [`${addData}Config`]: config = {} } = props; 134 const { [`${addData}Data`]: tableData = [], [`${addData}Config`]: config = {} } = props;
135 const copyConfig = config?.gdsconfigformslave?.find(item => item.sControlName.toLowerCase().includes('btnscanface')) 135 const copyConfig = config?.gdsconfigformslave?.find(item => item.sControlName.toLowerCase().includes('btnscanface'))
136 proData.forEach(item => { 136 proData.forEach(item => {
137 - const data = commonFunc.getAssignFieldValue(copyConfig?.sAssignField, item) 137 + const data = commonFunc.getAssignFieldValue(copyConfig?.sAssignField, item)
138 tableData.push({ 138 tableData.push({
139 ...item, 139 ...item,
140 ...data, 140 ...data,
141 sId: commonUtils.createSid(), 141 sId: commonUtils.createSid(),
142 handleType: "add", 142 handleType: "add",
143 sParentId: props.masterData.sId, 143 sParentId: props.masterData.sId,
  144 + slaveId: props?.slaveData ? props?.slaveData[0].sId : ''
144 }) 145 })
145 }); 146 });
  147 +
146 props.onSaveState({ 148 props.onSaveState({
147 [`${addData}Data`]: tableData 149 [`${addData}Data`]: tableData
148 }); 150 });
src/mes/scheduledTasks/machineTasks/index.js
@@ -494,7 +494,6 @@ const MachineTasks = baseProps =&gt; { @@ -494,7 +494,6 @@ const MachineTasks = baseProps =&gt; {
494 slave2Column, 494 slave2Column,
495 slave2Data = [] 495 slave2Data = []
496 } = props; 496 } = props;
497 - console.log("🚀 ~ MachineTasks ~ props:", props)  
498 497
499 const bStartWork = commonUtils.getAppData("userinfo", "bStartWork"); 498 const bStartWork = commonUtils.getAppData("userinfo", "bStartWork");
500 499