From f13007a6f5ff06c3104e8ec83f548a470f9285d9 Mon Sep 17 00:00:00 2001 From: zhangzhen <525765282@qq.com> Date: Wed, 18 Jun 2025 15:38:44 +0800 Subject: [PATCH] 优化sisformulaInfo查询; 自定义列名新增sDropDownData下拉配置; --- src/components/Common/CommonElementEvent.js | 85 +++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/src/components/Common/CommonElementEvent.js b/src/components/Common/CommonElementEvent.js index 97ae34c..5c27c66 100644 --- a/src/components/Common/CommonElementEvent.js +++ b/src/components/Common/CommonElementEvent.js @@ -34,7 +34,7 @@ export default (ChildComponent) => { eleknifemouldproductConfig: eleknifemouldOldproductConfig, eleteststandarditemConfig: eleteststandardOlditemConfig, } = nextProps; if (commonUtils.isEmptyObject(contactOldConfig) && (sModelsType === 'element/supplyInfo' || sModelsType === 'element/customerInfo') && formData.length > 0) { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; if (sModelsType === 'element/customerInfo') { @@ -90,7 +90,7 @@ export default (ChildComponent) => { } } if (commonUtils.isEmptyObject(supplyOldConfig) && formData.length > 0 && sModelsType === 'element/materialsInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -121,7 +121,7 @@ export default (ChildComponent) => { } /* 印件分类 */ if (commonUtils.isEmptyObject(sisproductclassifyProcessClassifyConfig) && formData.length > 0 && sModelsType === 'element/sisproductclassify') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -146,7 +146,7 @@ export default (ChildComponent) => { }); } if (commonUtils.isEmptyObject(masterConfig) && formData.length > 0 && sModelsType === 'element/processInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -213,7 +213,7 @@ export default (ChildComponent) => { }); } if (commonUtils.isEmptyObject(picFileOldConfig) && formData.length > 0 && sModelsType === 'element/printInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -249,7 +249,7 @@ export default (ChildComponent) => { } // 常用规格信息 commonUtils.isEmptyArr(siscommonstyleproductclassifyColumn) if (commonUtils.isEmptyObject(siscommonstyleproductclassifyConfig) && formData.length > 0 && sModelsType === 'element/siscommonstyle') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -275,7 +275,7 @@ export default (ChildComponent) => { } // 班组信息 if (commonUtils.isEmptyObject(eleemployeeOldConfig) && formData.length > 0 && sModelsType === 'element/teamInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'eleteam')[0]; const eleemployeeConfig = formData.filter(item => item.bGrd && item.sTbName === 'eleteamemployee')[0]; const eleemployeeColumn = commonFunc.getHeaderConfig(eleemployeeConfig); @@ -305,7 +305,7 @@ export default (ChildComponent) => { }); } if (commonUtils.isEmptyObject(jurgroupOldConfig) && formData.length > 0 && sModelsType === 'element/sftloginInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -381,7 +381,7 @@ export default (ChildComponent) => { }); } if ((bReceived === undefined || !bReceived) && formData.length > 0 && sModelsType === 'system/sisformulaInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'sisformula')[0]; const paramConfig = formData.filter(item => item.bGrd && item.sTbName === 'sisformulaparam')[0]; let customizeParamConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'sisformulacustomizeparam')) ? formData.filter(item => item.bGrd && item.sTbName === 'sisformulacustomizeparam')[0] : {}; @@ -552,7 +552,7 @@ export default (ChildComponent) => { }); } if ((bReceived === undefined || !bReceived) && formData.length > 0 && sModelsType === 'element/machineInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'elemachine')[0]; let addState = {}; let slaveConfig = {}; @@ -626,7 +626,7 @@ export default (ChildComponent) => { }); } if (commonUtils.isEmptyObject(userOldConfig) && formData.length > 0 && sModelsType === 'element/checkModelInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'elecheckmodel')[0]; /* bGrd代表是否是表格 */ @@ -661,7 +661,7 @@ export default (ChildComponent) => { }); } if (commonUtils.isEmptyObject(sischeckphaselogininfoOldConfig) && formData.length > 0 && sModelsType === 'element/checkPhaseInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'sischeckphase')[0]; /* bGrd代表是否是表格 */ @@ -686,7 +686,7 @@ export default (ChildComponent) => { }); } if ((bReceived === undefined || !bReceived) && formData.length > 0 && sModelsType === 'sis/paymentTerms') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const masterConfig = formData.filter(item => !item.bGrd && item.sTbName === 'sispayment')[0]; const firstRow = masterConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName === 'sName'); @@ -712,7 +712,7 @@ export default (ChildComponent) => { }); } if (commonUtils.isEmptyObject(employeeConfig) && formData.length > 0 && sModelsType === 'element/employeeInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -734,7 +734,7 @@ export default (ChildComponent) => { }); } if (formData.length > 0 && commonUtils.isEmptyObject(sysmsguserOldConfig) && sModelsType === 'smg/sendMailMsg') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; @@ -761,7 +761,7 @@ export default (ChildComponent) => { }); } if (formData.length > 0 && commonUtils.isEmptyObject(masterConfig) && sModelsType === 'sis/monthEndingClosing') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; masterConfig = formData.filter(item => !item.bGrd)[0]; const firstRow = masterConfig.gdsconfigformslave[0]; @@ -783,7 +783,7 @@ export default (ChildComponent) => { } /* 刀模信息 */ if (commonUtils.isEmptyObject(eleknifemouldOldproductConfig) && formData.length > 0 && sModelsType === 'element/knifemouldInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -820,7 +820,7 @@ export default (ChildComponent) => { } /* 检验标准 */ if (commonUtils.isEmptyObject(eleteststandardOlditemConfig) && formData.length > 0 && sModelsType === 'element/eleteststandInfo') { - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; /* 数据Id */ const masterConfig = formData.filter(item => !item.bGrd)[0]; /* bGrd代表是否是表格 */ @@ -1096,7 +1096,7 @@ export default (ChildComponent) => { handleGetData = (masterConfig, contactConfig, addressConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1117,7 +1117,7 @@ export default (ChildComponent) => { handleGetProductclassifyData = async (masterConfig, sisproductclassifyProcessClassifyConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const addState = await this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, isWait: true, bEditClick, }); @@ -1137,7 +1137,7 @@ export default (ChildComponent) => { handleGetPrintData = (masterConfig, picFileConfig, stockConfig, customerInfoConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1155,7 +1155,7 @@ export default (ChildComponent) => { handleGetStyleData = (masterConfig, siscommonstyleproductclassifyConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1167,7 +1167,7 @@ export default (ChildComponent) => { handleGetCheckModelData = (masterConfig, userConfig, phaseConfig, conditionConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1185,7 +1185,7 @@ export default (ChildComponent) => { handleGetEleemployeeData = (masterConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1194,7 +1194,7 @@ export default (ChildComponent) => { handleGetSisproductclassifyData = (masterConfig, sisproductclassifyProcessClassifyConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1206,7 +1206,7 @@ export default (ChildComponent) => { handleGetCheckPhaseData = (masterConfig, sischeckphaselogininfoConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1219,7 +1219,7 @@ export default (ChildComponent) => { handleGetMaterialsData = (masterConfig, supplyConfig, stockConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1235,7 +1235,7 @@ export default (ChildComponent) => { handleGetSflLoginData = async (masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, bEditClick, { approveGroupConfig, brandgroupConfig }) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const masterAddState = await this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, isWait, }); @@ -1460,7 +1460,7 @@ export default (ChildComponent) => { handleGetProcessData = (masterConfig, machineConfig, assortConfig, outsideConfig, processstyleConfig, processApsRuleConfig, dynamicParamConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1498,7 +1498,7 @@ export default (ChildComponent) => { handleGetTeamData = (masterConfig, eleemployeeConfig, elemachineConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1513,7 +1513,7 @@ export default (ChildComponent) => { handleGetEleKnifeMouldData = (masterConfig, knifemouldproductConfig, knifemouldfileConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1528,7 +1528,7 @@ export default (ChildComponent) => { handleGetTestStandData = (masterConfig, eleteststandarditemConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1540,7 +1540,7 @@ export default (ChildComponent) => { handleGetSysMsgData = (masterConfig, sysmsguserConfig, bEditClick) => { const { currentId } = this.props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; this.props.handleGetDataOne({ name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, }); @@ -1557,7 +1557,7 @@ export default (ChildComponent) => { const { currentId, sModelsType } = this.props; /* 当前页签数据 */ let addState = {}; - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; if (getType === 'One') { if(sModelsType === 'system/sisformulaInfo') { const addMaster = await this.props.handleGetDataOne({ @@ -1643,8 +1643,9 @@ export default (ChildComponent) => { const configObj = sColTitleNameIndex === undefined ? JSON.parse(sColTitleName) : JSON.parse(sColTitleName)[sColTitleNameIndex]; const gdsconfigformslaveNew = []; if (commonUtils.isNotEmptyObject(configObj)) { + const { sDropDownData = {} } = configObj; for (const key of Object.keys(configObj)) { - if (key !== 'panelName') { + if (!['panelName', 'sDropDownData'].includes(key)) { const configNew = {}; configNew.sName = key; configNew.sChinese = configObj[key]; @@ -1652,6 +1653,14 @@ export default (ChildComponent) => { configNew.iFitWidth = 80; configNew.showName = configObj[key]; configNew.bReadonly = false; + if (sDropDownData[key]) { + configNew.sDropDownType = 'const'; + configNew.showDropDown = JSON.stringify(sDropDownData[key].split(',').reduce((pre, item) => { + pre[item] = item; + return pre; + }, {})); + console.log('=====configNew', configNew); + } gdsconfigformslaveNew.push(configNew); } } @@ -1978,7 +1987,7 @@ export default (ChildComponent) => { // const { // app, currentId, token, masterConfig, sModelsId, // } = this.props; - // const sId = currentId !== undefined ? currentId : ''; + // const sId = currentId || this.props.masterData?.sId || ''; // const { userinfo } = app; // const value = { // tableName: masterConfig.sTbName, @@ -2064,7 +2073,7 @@ export default (ChildComponent) => { approveGroupConfig, brandgroupConfig, } = props; /* 当前页签数据 */ - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; let value = {}; if (sModelsType === 'element/customerInfo' || sModelsType === 'element/supplyInfo') { value = { @@ -3072,7 +3081,7 @@ export default (ChildComponent) => { const { currentId, sModelsId, masterData, masterConfig, handleType, } = props; - const sId = currentId !== undefined ? currentId : ''; + const sId = currentId || this.props.masterData?.sId || ''; const value = { sClientType: '1', sId: [sId], -- libgit2 0.22.2