diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 1f3d260..fef922e 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -30,7 +30,7 @@ const QuickQuoteEvent = props => { return pre; }, {}); - const { slaveData = [], manyData = [] } = result; + const { slaveData = [], manyData = [], masterData = {} } = result; const materialInfoFields = [ "sMaterialsName", "sMaterialsNo", @@ -75,7 +75,14 @@ const QuickQuoteEvent = props => { return item; }); - return { ...result, slaveData: slaveDataNew, manyData: manyDataNew }; + const { sType, sCustomerId, sCustomerName } = props.app.userinfo; + const bCustomer = sType === "Customer"; + if (bCustomer && !masterData.sCustomerId) { + masterData.sCustomerName = sCustomerName; + masterData.sCustomerId = sCustomerId; + } + + return { ...result, masterData, slaveData: slaveDataNew, manyData: manyDataNew }; }; const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {}); @@ -1233,12 +1240,25 @@ const QuickQuoteEvent = props => { sParentId: newState.masterData.sId, })); + let hasCalled = false; + setState(pre => { - const preNew = { ...pre, manyData: result.manyqtysData, calcPriceLoading: false, calcPriceFinished: true }; + const preNew = { + ...pre, + manyData: result.manyqtysData, + calcPriceLoading: false, + calcPriceFinished: true, + }; + const stateNew = { ...newState, ...result }; + + if (hasCalled) return preNew; // 防止重复执行 + hasCalled = true; + props.onSaveState(stateNew, () => { onSaveDraft(preNew, stateNew); }); + return preNew; }); } else { @@ -1640,7 +1660,22 @@ const MasterComponent = props => { const { app } = props; if (!masterConfig) return ""; - const ableConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName && item.bVisible); + const { userinfo } = app; + const { sType } = userinfo; + const bCustomer = sType === "Customer"; + + const ableConfigs = masterConfig.gdsconfigformslave + .filter(item => item.sName && item.bVisible) + .map(item => { + if (item.sName === "sCustomerName" && bCustomer) { + return { + ...item, + iTag: 1, + }; + } else { + return item; + } + }); const JosnAbleConfigs = JSON.parse(JSON.stringify(ableConfigs)); // 处理长宽样式 // selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sProductType !== "不干胶"