Commit f4b743f75d8b18c8c3ec28c56981d9c31a8c2314

Authored by Min
2 parents 11745b93 f5344d4f

Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi

src/components/QuickQuote/index.jsx
@@ -30,7 +30,7 @@ const QuickQuoteEvent = props => { @@ -30,7 +30,7 @@ const QuickQuoteEvent = props => {
30 return pre; 30 return pre;
31 }, {}); 31 }, {});
32 32
33 - const { slaveData = [], manyData = [] } = result; 33 + const { slaveData = [], manyData = [], masterData = {} } = result;
34 const materialInfoFields = [ 34 const materialInfoFields = [
35 "sMaterialsName", 35 "sMaterialsName",
36 "sMaterialsNo", 36 "sMaterialsNo",
@@ -75,7 +75,14 @@ const QuickQuoteEvent = props => { @@ -75,7 +75,14 @@ const QuickQuoteEvent = props => {
75 return item; 75 return item;
76 }); 76 });
77 77
78 - return { ...result, slaveData: slaveDataNew, manyData: manyDataNew }; 78 + const { sType, sCustomerId, sCustomerName } = props.app.userinfo;
  79 + const bCustomer = sType === "Customer";
  80 + if (bCustomer && !masterData.sCustomerId) {
  81 + masterData.sCustomerName = sCustomerName;
  82 + masterData.sCustomerId = sCustomerId;
  83 + }
  84 +
  85 + return { ...result, masterData, slaveData: slaveDataNew, manyData: manyDataNew };
79 }; 86 };
80 87
81 const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {}); 88 const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {});
@@ -1233,12 +1240,25 @@ const QuickQuoteEvent = props => { @@ -1233,12 +1240,25 @@ const QuickQuoteEvent = props => {
1233 sParentId: newState.masterData.sId, 1240 sParentId: newState.masterData.sId,
1234 })); 1241 }));
1235 1242
  1243 + let hasCalled = false;
  1244 +
1236 setState(pre => { 1245 setState(pre => {
1237 - const preNew = { ...pre, manyData: result.manyqtysData, calcPriceLoading: false, calcPriceFinished: true }; 1246 + const preNew = {
  1247 + ...pre,
  1248 + manyData: result.manyqtysData,
  1249 + calcPriceLoading: false,
  1250 + calcPriceFinished: true,
  1251 + };
  1252 +
1238 const stateNew = { ...newState, ...result }; 1253 const stateNew = { ...newState, ...result };
  1254 +
  1255 + if (hasCalled) return preNew; // 防止重复执行
  1256 + hasCalled = true;
  1257 +
1239 props.onSaveState(stateNew, () => { 1258 props.onSaveState(stateNew, () => {
1240 onSaveDraft(preNew, stateNew); 1259 onSaveDraft(preNew, stateNew);
1241 }); 1260 });
  1261 +
1242 return preNew; 1262 return preNew;
1243 }); 1263 });
1244 } else { 1264 } else {
@@ -1640,7 +1660,22 @@ const MasterComponent = props => { @@ -1640,7 +1660,22 @@ const MasterComponent = props => {
1640 const { app } = props; 1660 const { app } = props;
1641 if (!masterConfig) return ""; 1661 if (!masterConfig) return "";
1642 1662
1643 - const ableConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName && item.bVisible); 1663 + const { userinfo } = app;
  1664 + const { sType } = userinfo;
  1665 + const bCustomer = sType === "Customer";
  1666 +
  1667 + const ableConfigs = masterConfig.gdsconfigformslave
  1668 + .filter(item => item.sName && item.bVisible)
  1669 + .map(item => {
  1670 + if (item.sName === "sCustomerName" && bCustomer) {
  1671 + return {
  1672 + ...item,
  1673 + iTag: 1,
  1674 + };
  1675 + } else {
  1676 + return item;
  1677 + }
  1678 + });
1644 const JosnAbleConfigs = JSON.parse(JSON.stringify(ableConfigs)); 1679 const JosnAbleConfigs = JSON.parse(JSON.stringify(ableConfigs));
1645 // 处理长宽样式 1680 // 处理长宽样式
1646 // selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sProductType !== "不干胶" 1681 // selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sProductType !== "不干胶"