Commit 14d9a6bc70fd2dcb76ca5bf87c5bdb699d67e70a

Authored by 陈鑫涛
1 parent 766b9b79

快速报价app

src/components/Common/BoxShowImgMaterial/indexNew.js
... ... @@ -191,7 +191,6 @@ const BoxShowImgMaterial = props => {
191 191  
192 192 const isShow =
193 193 isDPartsLength && slaveDataDetail && slaveDataDetail.dMachineLength && slaveDataDetail.dMaxWidth && slaveDataDetail.dMaxLength && isMax;
194   - console.log(slaveDataDetail?.dMaxWidth,slaveDataDetail?.dMaxLength,slaveDataDetail?.dMachineLength,slaveDataDetail?.dMachineWidth,'dropDownData');
195 194  
196 195 return (
197 196 <>
... ...
src/mobile/components/SelectInput.jsx
... ... @@ -22,7 +22,7 @@ const SelectInput = props =&gt; {
22 22 if (!itemDetail) return;
23 23 const viewRowNew = itemDetail.sName ? viewRow?.[itemDetail.sName] : "";
24 24 if (itemDetail.sDropDownType === "const") {
25   - return
  25 + return;
26 26 }
27 27 if (tableName.includes("slaveDown")) {
28 28 if (!viewRow.sBackProcessData) return;
... ... @@ -46,7 +46,7 @@ const SelectInput = props =&gt; {
46 46 };
47 47 commonServices.postValueService(props.app.token, body, url).then(res => {
48 48 if (res.data.code === 1) {
49   - const list = res.data.dataset.rows?.map((item,i) => ({
  49 + const list = res.data.dataset.rows?.map((item, i) => ({
50 50 label: item.sCustomerName || item.sName || item.sProcessName || item.sColorName || item.sMaterialsName,
51 51 value: item.sId || item.sSlaveId,
52 52 ...item,
... ... @@ -57,6 +57,11 @@ const SelectInput = props =&gt; {
57 57 });
58 58 };
59 59 const handleConfirm = () => {
  60 + if (!values[0]) {
  61 + setVisible(false);
  62 +
  63 + return;
  64 + }
60 65 const index = columns.findIndex(item => item.value === values[0]);
61 66 const data = coplyColumns[index];
62 67 data[itemDetail.sName] = data[itemDetail.sName] ? data[itemDetail.sName] : data.label || data.sName || data.sProcessName || data.sColorName;
... ...
src/mobile/quotation/detailNew.jsx
... ... @@ -16,11 +16,9 @@ import CommonBase from &quot;@/components/Common/CommonBase&quot;;
16 16 import { cloneDeep } from "lodash";
17 17 import moment from "moment";
18 18 const QuickQuoteEvent = props => {
19   - const { location } = props;
20   - const selectedNode = JSON.parse(location.state).quotationData;
  19 + const { location, selectedNode, sModelsId } = props;
  20 + // const selectedNode = JSON.parse(location.state).quotationData;
21 21 const addState = {};
22   - const [masterConfig, setMasterConfig] = useState(null);
23   - const { sModelsId } = props;
24 22  
25 23 addState.onGetFilterState = (state, bInit) => {
26 24 const result = Object.keys(state).reduce((pre, cur) => {
... ... @@ -84,74 +82,24 @@ const QuickQuoteEvent = props =&gt; {
84 82  
85 83 const [state, setState] = useState(addState.onGetFilterState(sQuoConfig, true));
86 84  
87   - const { formData = [] } = state;
  85 + const { formData = [], masterConfig } = state;
88 86 const { bLinkFieledClick } = props;
89 87 const [hideBackBtn, setHideBackBtn] = useState(false);
90 88 const [enabled, setEnabled] = useState(props.enabled);
91   -
92   - useEffect(() => {
93   - const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}`;
94   - commonServices
95   - .getService(props.token, configUrl)
96   - .then(async ({ data: masterReturn }) => {
97   - if (masterReturn.code === 1) {
98   - const formData = masterReturn.dataset.rows[0].formData;
99   - const masterConfig = formData.find(x => x.sTbName === "QuoQuotationmaster");
100   - const processConfig = formData.find(x => x.sTbName === "QuoQuotationprocess");
101   - const materialsConfig = formData.find(x => x.sTbName === "QuoQuotationmaterials");
102   - const slaveConfig = formData.find(x => x.sTbName === "QuoQuotationslave");
103   - const controlConfig = formData.find(x => x.sTbName === "QuoQuotationcontrol");
104   - let colorConfigGrdVisible;
105   - const colorConfigTrue = formData.find(item => item.sTbName === "quoquotationparam");
106   - if (commonUtils.isNotEmptyObject(colorConfigTrue)) {
107   - colorConfigGrdVisible = colorConfigTrue.bGrdVisible;
108   - if (colorConfigGrdVisible) {
109   - colorColumn = commonFunc.getHeaderConfig(colorConfigTrue, colorColumn);
110   - }
111   - }
112   - const colorConfig = colorConfigGrdVisible ? colorConfigTrue : "";
113   - /* 合版信息表 */
114   - const packConfig = formData.find(item => item.sTbName === "quoquotationcontrolcombine");
115   - let checkConfig = {};
116   - let checkColumn = {};
117   - if (commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === "sysbillcheckresult"))) {
118   - checkConfig = formData.find(item => item.bGrd && item.sTbName === "sysbillcheckresult");
119   - checkColumn = commonFunc.getHeaderConfig(checkConfig);
120   - }
121   - props.onSaveState(pre => ({
122   - ...pre,
123   - formData,
124   - masterConfig,
125   - processConfig,
126   - materialsConfig,
127   - slaveConfig,
128   - controlConfig,
129   - colorConfig,
130   - packConfig,
131   - checkConfig,
132   - }));
133   - //setState(pre => ({ ...pre, selectedNode ,formData, masterConfig, processConfig, materialsConfig, slaveConfig}));
134   - }
135   - })
136   - .catch(error => {});
137   - setState(pre => ({ ...pre, selectedNode }));
138   - }, []);
139   -
140 89 useEffect(() => {
141 90 setHideBackBtn(!bLinkFieledClick);
142 91 setEnabled(!bLinkFieledClick || props.enabled);
143 92 }, [bLinkFieledClick, props.enabled]);
144 93 useEffect(() => {
145 94 // 获取 masterConfig
146   -
147 95 const { masterConfig, token } = props;
148 96 const quickQuoteConfig = masterConfig?.gdsconfigformslave.find(item => item.sControlName === "BtnQuickQuote") || {};
149   - const { sActiveId = "172129113112117428019179600" } = quickQuoteConfig;
  97 + const { sActiveId } = quickQuoteConfig;
150 98 const configUrls = `${commonConfig.server_host}business/getModelBysId/${sActiveId}?sModelsId=${sActiveId}`;
151 99 commonServices.getService(props.app.token, configUrls).then(async ({ data: configReturn }) => {
152 100 if (configReturn.code === 1) {
153 101 const formData = configReturn.dataset.rows[0].formData;
154   - setState(pre => ({ ...pre, formData, masterConfig: formData[0] }));
  102 + setState(pre => ({ ...pre, formData, selectedNode, masterConfig: formData[0] }));
155 103 }
156 104 });
157 105 }, []);
... ... @@ -326,16 +274,12 @@ const QuickQuoteEvent = props =&gt; {
326 274 dMaxWidth: Number(selectedNode.sMachineStyle.split("*")[1]),
327 275 };
328 276 }
  277 +
329 278 if (sFieldName === "sPrint") {
330 279 slaveData[saveIndex] = {
331 280 ...slaveData[saveIndex],
332 281 sProcessId: changeValue.sId,
333 282 sPrintProcessId: changeValue.sId,
334   - };
335   - }
336   - if (sFieldName === "sPrint") {
337   - slaveData[saveIndex] = {
338   - ...slaveData[saveIndex],
339 283 dMachineWidth: slaveData[saveIndex].dWlkd,
340 284 dMachineLength: slaveData[saveIndex].dWlcd,
341 285 };
... ... @@ -343,7 +287,7 @@ const QuickQuoteEvent = props =&gt; {
343 287 setState(pre => ({ ...pre, slaveData, ...extraState }));
344 288 } else if (name === "finished") {
345 289 const { productProcessInfo = [] } = masterData;
346   - const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue[sFieldName]);
  290 + const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue.sId);
347 291 dropDownDataSelected && (dropDownDataSelected[sFieldName] = dropDownDataSelected.sProcessName);
348 292 const iIndex = productProcessInfo.findIndex(item => item.sProductClassifyId === dropDownData[0].sProductClassifyId);
349 293 if (iIndex === -1) {
... ... @@ -394,6 +338,8 @@ const QuickQuoteEvent = props =&gt; {
394 338  
395 339 // 存草稿
396 340 const onSaveDraft = (nextState = state, nextProps = props) => {
  341 + console.log(nextProps,'stateNew');
  342 +
397 343 const { masterData = {} } = nextState;
398 344 const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData;
399 345 if (!sProductName || !sCustomerName) {
... ... @@ -403,7 +349,6 @@ const QuickQuoteEvent = props =&gt; {
403 349 });
404 350 return;
405 351 }
406   -
407 352 props.onSaveState(
408 353 {
409 354 ...addState.onGetAllDelData(),
... ... @@ -458,8 +403,10 @@ const QuickQuoteEvent = props =&gt; {
458 403 }),
459 404 loading: true,
460 405 },
461   - () => {
462   - props.onButtonClick("BtnDraft", { ...props });
  406 + (newState) => {
  407 + console.log(newState,'newState');
  408 +
  409 + props.onButtonClick("BtnDraft", { ...props,...newState });
463 410 }
464 411 );
465 412 };
... ... @@ -551,8 +498,6 @@ const QuickQuoteEvent = props =&gt; {
551 498 })
552 499 .filter(item => commonUtils.isNotEmptyObject(item) && item.materialsInfo && item.materialsInfo.length)
553 500 .map(item => {
554   - // slaveData里的sMaterialRate sMaterialsStyle
555   -
556 501 return {
557 502 ...Object.keys(item).reduce((pre, cur) => {
558 503 if (typeof item[cur] !== "object") {
... ... @@ -929,8 +874,10 @@ const QuickQuoteEvent = props =&gt; {
929 874 const preNew = { ...pre, manyData: result.manyqtysData, calcPriceLoading: false, calcPriceFinished: true };
930 875 const stateNew = { ...newState, ...result };
931 876 props.onSaveState(stateNew, () => {
  877 + // stateNew nextProps
932 878 onSaveDraft(preNew, stateNew);
933 879 });
  880 + console.log("🚀 ~ addState.handleCalcPrice= ~ stateNew:", stateNew)
934 881 return preNew;
935 882 });
936 883 } else {
... ... @@ -974,745 +921,12 @@ const QuickQuoteEvent = props =&gt; {
974 921 enabled,
975 922 state,
976 923 setState,
977   - masterConfig: masterConfig && masterConfig.length ? masterConfig[0] : {},
978   - };
979   -};
980   -const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models) => {
981   - const { sComputeId, sConversionComputeId, sReConversionComputeId } = tableDataRow;
982   - if (
983   - sFieldName === "sMaterialsNo" ||
984   - sFieldName === "sMaterialsName" ||
985   - sFieldName === "dAuxiliaryQty" ||
986   - sFieldName === "dReelAuxiliaryQty" ||
987   - sFieldName === "dConversionQty" ||
988   - sFieldName === "sMaterialsStyle" ||
989   - sFieldName === "dProductQty"
990   - ) {
991   - if (sFieldName === "dReelAuxiliaryQty") {
992   - if (tableDataRow.sMaterialsUnit === "吨" && tableDataRow.bReel && tableDataRow.dGramWeight > 0) {
993   - tableDataRow = commonBusiness.getMaterialsQty(
994   - app,
995   - { ...tableDataRow, sMaterialsStyle: tableDataRow.sReelMaterialsStyle },
996   - "dReelAuxiliaryQty",
997   - "dMaterialsQty"
998   - );
999   - tableDataRow.dAuxiliaryQty = tableDataRow.dMaterialsQty;
1000   - tableDataRow.sMaterialsStyle =
1001   - tableDataRow.sMaterialsStyle !== undefined && tableDataRow.sMaterialsStyle.split("*").length > 1
1002   - ? tableDataRow.sMaterialsStyle.split("*")[0]
1003   - : tableDataRow.sMaterialsStyle;
1004   - tableDataRow.sAuxiliaryUnit = tableDataRow.sMaterialsUnit;
1005   - } else if (tableDataRow.sMaterialsUnit.toUpper() === "M2" && tableDataRow.bReel) {
1006   - tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, "dReelAuxiliaryQty", "dMaterialsQty");
1007   - tableDataRow.dAuxiliaryQty = tableDataRow.dReelAuxiliaryQty;
1008   - } else {
1009   - tableDataRow.dAuxiliaryQty = tableDataRow.dReelAuxiliaryQty;
1010   - }
1011   - }
1012   - if (commonUtils.isEmpty(sComputeId) && sFieldName !== "dConversionQty") {
1013   - if (sFieldName === "dProductQty") {
1014   - tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, "dProductQty", "dMaterialsQty");
1015   - } else {
1016   - tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, "dAuxiliaryQty", "dMaterialsQty");
1017   - }
1018   - } else if (!commonUtils.isEmpty(sComputeId)) {
1019   - tableDataRow.dMaterialsQty = await commonBusiness.getFormulaValue({
1020   - token,
1021   - sModelsId,
1022   - masterData,
1023   - tableDataRow,
1024   - sComputeId,
1025   - });
1026   - }
1027   - if (sFieldName !== "dConversionQty" && !commonUtils.isEmpty(sConversionComputeId)) {
1028   - tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({
1029   - token,
1030   - sModelsId,
1031   - masterData,
1032   - tableDataRow,
1033   - sComputeId: sConversionComputeId,
1034   - });
1035   - }
1036   - } else if (sFieldName === "dMaterialsQty") {
1037   - const { sReComputeId } = tableDataRow;
1038   - if (commonUtils.isEmpty(sReComputeId) && tableDataRow.bInverse) {
1039   - tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, "dAuxiliaryQty");
1040   - } else if (tableDataRow.bInverse) {
1041   - tableDataRow.dAuxiliaryQty = await commonBusiness.getFormulaValue({
1042   - token,
1043   - sModelsId,
1044   - masterData,
1045   - tableDataRow,
1046   - sComputeId: sReComputeId,
1047   - });
1048   - if (commonUtils.isNotEmptyArr(tableDataRow.dAuxiliaryQty) && tableDataRow.dAuxiliaryQty !== 0) {
1049   - tableDataRow.dProductQty = tableDataRow.dAuxiliaryQty;
1050   - }
1051   - }
1052   - if (!commonUtils.isEmpty(sReConversionComputeId)) {
1053   - tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({
1054   - token,
1055   - sModelsId,
1056   - masterData,
1057   - tableDataRow,
1058   - sComputeId: sReConversionComputeId,
1059   - });
1060   - }
1061   - } else if (sFieldName === "dAuxiliaryLossQty") {
1062   - if (commonUtils.isEmpty(sComputeId)) {
1063   - tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, sFieldName, "dLossQty");
1064   - } else {
1065   - tableDataRow.dLossQty = await commonBusiness.getFormulaValue({
1066   - token,
1067   - sModelsId,
1068   - masterData,
1069   - tableDataRow,
1070   - sComputeId,
1071   - });
1072   - }
1073   - if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) {
1074   - tableDataRow.dAuxiliaryQty = tableDataRow.dSrcSurplusAuxiliaryQty - tableDataRow.dAuxiliaryLossQty;
1075   - tableDataRow.dMaterialsQty = commonUtils.convertFixNum(tableDataRow.dSrcSurplusQty - tableDataRow.dLossQty, 6);
1076   - }
1077   - } else if (sFieldName === "dLossQty") {
1078   - const { sReComputeId } = tableDataRow;
1079   - if (commonUtils.isEmpty(sReComputeId)) {
1080   - tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, "dAuxiliaryLossQty");
1081   - } else {
1082   - tableDataRow.dAuxiliaryLossQty = await commonBusiness.getFormulaValue({
1083   - token,
1084   - sModelsId,
1085   - masterData,
1086   - tableDataRow,
1087   - sComputeId: sReComputeId,
1088   - });
1089   - }
1090   - if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) {
1091   - tableDataRow.dAuxiliaryQty = tableDataRow.dSrcSurplusAuxiliaryQty - tableDataRow.dAuxiliaryLossQty;
1092   - tableDataRow.dMaterialsQty = tableDataRow.dSrcSurplusQty - tableDataRow.dLossQty;
1093   - }
1094   - } else if (sFieldName === "sProcessId" || sFieldName === "sProcessNo" || sFieldName === "sProcessName") {
1095   - const sProcessId = changeValue.sProcessId;
1096   - const url = `${commonConfig.server_host}process/outsideprocess?sModelsId=${sModelsId}&sProcessId=${sProcessId}`;
1097   - const dataReturn = (await commonServices.getService(token, url)).data;
1098   - if (dataReturn.code === 1) {
1099   - if (commonUtils.isNotEmptyArr(dataReturn.dataset.rows)) {
1100   - tableDataRow.dMaterialsPrice = dataReturn.dataset.rows[0].dMaterialsPrice;
1101   - }
1102   - tableDataRow = commonBusiness.getCalculateAllMoney(app, models, "dMaterialsPrice", masterData, tableDataRow);
1103   - }
1104   - }
1105   - return tableDataRow;
1106   -};
1107   -const sortData = (tableData, processData) => {
1108   - processData.sort((g1, g2) => {
1109   - const iIndex1 = tableData.findIndex(item => item.sId === g1.sControlId) === -1 ? 999 : tableData.findIndex(item => item.sId === g1.sControlId);
1110   - let sPartOrder1 = `0000${iIndex1}`;
1111   - sPartOrder1 = sPartOrder1.substring(sPartOrder1.length - 3);
1112   - let sOrder1 = `000${g1.iOrder}`;
1113   - sOrder1 = sOrder1.substring(sOrder1.length - 3);
1114   -
1115   - const iIndex2 = tableData.findIndex(item => item.sId === g2.sControlId) === -1 ? 999 : tableData.findIndex(item => item.sId === g2.sControlId);
1116   - let sPartOrder2 = `0000${iIndex2}`;
1117   - sPartOrder2 = sPartOrder2.substring(sPartOrder2.length - 3);
1118   - let sOrder2 = `000${g2.iOrder}`;
1119   - sOrder2 = sOrder2.substring(sOrder2.length - 3);
1120   - return parseInt(sPartOrder1 + g1.sType + sOrder1, 10) - parseInt(sPartOrder2 + g2.sType + sOrder2, 10);
1121   - });
1122   - return processData;
1123   -};
1124   -// 计算数量
1125   -const handleCalculation = async (bSave, nextProps, isWait, props) => {
1126   - const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`;
1127   - const {
1128   - masterConfig,
1129   - slaveConfig,
1130   - slaveDelData,
1131   - controlConfig,
1132   - controlDelData,
1133   - colorConfig,
1134   - colorData,
1135   - colorDelData,
1136   - materialsConfig,
1137   - materialsDelData,
1138   - processConfig,
1139   - processDelData,
1140   - app,
1141   - manyqtysConfig,
1142   - manyqtysDelData,
1143   - packConfig,
1144   - packDelData,
1145   - manyDataCache = [],
1146   - dQuickQuoteProductQty,
1147   - } = nextProps;
1148   - let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps;
1149   - const sMakePerson = masterData.sMakePerson;
1150   - const data = [];
1151   - data.push(commonBusiness.mergeData("master", `${masterConfig.sTbName.toLowerCase()}_Tmp`, [masterData], [], true));
1152   - data.push(commonBusiness.mergeData("slave", `${slaveConfig.sTbName.toLowerCase()}_tmp`, slaveData, [], true));
1153   - data.push(commonBusiness.mergeData("control", `${controlConfig.sTbName.toLowerCase()}_tmp`, controlData, [], true));
1154   - data.push(commonBusiness.mergeData("materials", `${materialsConfig.sTbName.toLowerCase()}_tmp`, materialsData, [], true));
1155   - data.push(commonBusiness.mergeData("process", `${processConfig.sTbName.toLowerCase()}_tmp`, processData, [], true));
1156   - if (commonUtils.isNotEmptyObject(manyqtysConfig)) {
1157   - data.push(
1158   - commonBusiness.mergeData(
1159   - "manyqtys",
1160   - `${manyqtysConfig.sTbName.toLowerCase()}_tmp`,
1161   - manyqtysData?.map(item => {
1162   - delete item.manyData;
1163   - return item;
1164   - }),
1165   - [],
1166   - true
1167   - )
1168   - );
1169   - }
1170   -
1171   - data.push(commonBusiness.mergeData("pack", `${packConfig.sTbName.toLowerCase()}_tmp`, packData, [], true));
1172   - const value = { data, sClientType: "1", sGuid: masterData.sId };
1173   -
1174   - const cacheIndex = dQuickQuoteProductQty === undefined ? -1 : manyDataCache.findIndex(item => item.dManyQty === dQuickQuoteProductQty);
1175   - if (cacheIndex === -1) {
1176   - // message.warning("自动计算中,请稍后再试。");
1177   - Toast.show({
1178   - content: "自动计算中,请稍后再试。",
1179   - });
1180   - }
1181   - const dataReturn = cacheIndex === -1 ? (await commonServices.postValueService(props.app.token, value, dataUrl)).data : manyDataCache[cacheIndex];
1182   - if (dataReturn.code === 1) {
1183   - /* 成功 */
1184   - const valueReturn = dataReturn.dataset.rows[0];
1185   - const masterDataArr = valueReturn[`${masterConfig.sTbName.toLowerCase()}_tmp`];
1186   - if (commonUtils.isNotEmptyArr(masterDataArr)) {
1187   - masterData = masterDataArr[0];
1188   - }
1189   - if (cacheIndex !== -1) {
1190   - // masterData.handleType = nextProps.masterData.handleType || "update";
1191   - masterData.sQuoConfig = nextProps.masterData.sQuoConfig;
1192   - masterData.sFormId = nextProps.masterData.sFormId;
1193   - masterData.sBillNo = nextProps.masterData.sBillNo;
1194   - }
1195   - masterData.handleType = masterData.sBillNo ? "update" : "add";
1196   - if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) {
1197   - masterData.sMakePerson = sMakePerson;
1198   - }
1199   - slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`].map(item => {
1200   - item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
1201   - return item;
1202   - });
1203   - controlData = valueReturn[`${controlConfig.sTbName.toLowerCase()}_tmp`].map(item => {
1204   - item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
1205   - return item;
1206   - });
1207   - materialsData = valueReturn[`${materialsConfig.sTbName.toLowerCase()}_tmp`].map(item => {
1208   - item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
1209   - return item;
1210   - });
1211   - processData = valueReturn[`${processConfig.sTbName.toLowerCase()}_tmp`].map(item => {
1212   - item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
1213   - return item;
1214   - });
1215   - processData = props.sortData(controlData, processData);
1216   - const addState = {};
1217   - if (commonUtils.isNotEmptyObject(manyqtysConfig)) {
1218   - manyqtysData = valueReturn[`${manyqtysConfig.sTbName.toLowerCase()}_tmp`]?.map((item, index) => {
1219   - return {
1220   - ...item,
1221   - sId: manyqtysData[index] ? manyqtysData[index].sId : item.sId,
1222   - handleType: dQuickQuoteProductQty ? "add" : item.handleType,
1223   - };
1224   - });
1225   - if (cacheIndex === -1 && manyqtysData?.some(item => item.manyData)) {
1226   - addState.manyDataCache = manyqtysData.map((item, index) => {
1227   - let result = {};
1228   - if (index === 0) {
1229   - result = Object.keys(valueReturn).reduce((pre, cur) => {
1230   - if (cur !== `${manyqtysConfig.sTbName.toLowerCase()}_tmp`) {
1231   - pre[cur] = valueReturn[cur];
1232   - }
1233   - return pre;
1234   - }, {});
1235   - } else {
1236   - result = commonUtils.convertStrToObj(item.manyData);
1237   - }
1238   -
1239   - result[`${manyqtysConfig.sTbName.toLowerCase()}_tmp`] = cloneDeep(manyqtysData).map(item => {
1240   - delete item.manyData;
1241   - return item;
1242   - });
1243   -
1244   - const { sId, sBillNo, sFormId } = masterData;
1245   - const row = Object.keys(result).reduce((pre, cur) => {
1246   - if (cur === `${masterConfig.sTbName.toLowerCase()}_tmp`) {
1247   - pre[cur] = result[cur].map(item => ({
1248   - ...item,
1249   - sId,
1250   - sBillNo: sBillNo || item.sBillNo,
1251   - sFormId,
1252   - }));
1253   - } else if (cur.includes("_tmp")) {
1254   - pre[cur] = result[cur].map(item => ({
1255   - ...item,
1256   - sParentId: sId,
1257   - handleType: "add",
1258   - }));
1259   - } else {
1260   - pre[cur] = result[cur];
1261   - }
1262   - return pre;
1263   - }, {});
1264   -
1265   - return {
1266   - code: 1,
1267   - dManyQty: item.dManyQty,
1268   - dataset: {
1269   - rows: [row],
1270   - },
1271   - };
1272   - });
1273   - }
1274   - }
1275   -
1276   - packData = valueReturn[`${packConfig.sTbName.toLowerCase()}_tmp`];
1277   - /* 计算成功后自动调用保存 */
1278   - if (bSave) {
1279   - const data = [];
1280   - data.push(commonBusiness.mergeData("master", masterConfig.sTbName, [masterData]));
1281   - data.push(commonBusiness.mergeData("slave", slaveConfig.sTbName, slaveData, slaveDelData));
1282   - data.push(commonBusiness.mergeData("control", controlConfig.sTbName, controlData, controlDelData));
1283   - data.push(commonBusiness.mergeData("materials", materialsConfig.sTbName, materialsData, materialsDelData));
1284   - data.push(commonBusiness.mergeData("process", processConfig.sTbName, processData, processDelData));
1285   -
1286   - if (commonUtils.isNotEmptyObject(manyqtysConfig)) {
1287   - data.push(commonBusiness.mergeData("manyqtys", manyqtysConfig.sTbName, manyqtysData, manyqtysDelData));
1288   - }
1289   -
1290   - data.push(commonBusiness.mergeData("color", colorConfig.sTbName, colorData, colorDelData));
1291   - data.push(commonBusiness.mergeData("pack", packConfig.sTbName, packData, packDelData));
1292   - props.onSaveData({
1293   - data,
1294   - sClientType: "1",
1295   - loading: false,
1296   - sSysLogSrcId: masterData.sId,
1297   - },props);
1298   - props.onSaveState({
1299   - slaveData,
1300   - packData,
1301   - controlData,
1302   - materialsData,
1303   - processData,
1304   - masterData,
1305   - manyqtysData,
1306   - ...addState,
1307   - });
1308   - } else {
1309   - if (isWait) {
1310   - return {
1311   - slaveData,
1312   - controlData,
1313   - materialsData,
1314   - processData,
1315   - masterData,
1316   - manyqtysData,
1317   - loading: false,
1318   - packData,
1319   - ...addState,
1320   - };
1321   - } else {
1322   - props.onSaveState({
1323   - slaveData,
1324   - controlData,
1325   - materialsData,
1326   - processData,
1327   - masterData,
1328   - manyqtysData,
1329   - loading: false,
1330   - packData,
1331   - ...addState,
1332   - });
1333   - }
1334   - // message.success(commonFunc.getConfigShowName(masterConfig, "BtnCalculation") + commonFunc.showMessage(app.commonConst, "handleSuccess"));
1335   - }
1336   - } else {
1337   - /* 失败 */
1338   - props.onSaveState({
1339   - loading: false,
1340   - });
1341   - // this.props.getServiceError(dataReturn);
1342   - }
1343   -};
1344   -/** 按钮操作事件 */
1345   -const handleButtonClick = async (name, props) => {
1346   - console.log("🚀 ~ handleButtonClick ~ props:", props)
1347   - if (name === "BtnDraft") {
1348   - const {
1349   - masterConfig,
1350   - masterData,
1351   - slaveConfig,
1352   - slaveData,
1353   - slaveDelData,
1354   - controlConfig,
1355   - controlData, // 需要
1356   - controlDelData,
1357   - materialsConfig,
1358   - materialsData,
1359   - materialsDelData,
1360   - processConfig,
1361   - processData,
1362   - processDelData,
1363   - colorConfig,
1364   - colorData,
1365   - colorDelData,
1366   - packConfig,
1367   - packData, // 需要
1368   - packDelData,
1369   - } = props;
1370   - const data = [];
1371   - slaveConfig.gdsconfigformslave.forEach(itemConfig => {
1372   - slaveData
1373   - .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
1374   - .forEach(itemData => {
1375   - itemData.NoVerify = "NoVerify";
1376   - const firstDataIndex = itemConfig.sName.substring(0, 1);
1377   - if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
1378   - itemData[itemConfig.sName] =
1379   - firstDataIndex === "s"
1380   - ? ""
1381   - : firstDataIndex === "d" || firstDataIndex === "i"
1382   - ? 0
1383   - : firstDataIndex === "b"
1384   - ? false
1385   - : firstDataIndex === "t"
1386   - ? moment(new Date()).format(props.app.dateFormat)
1387   - : undefined;
1388   - }
1389   - });
1390   - });
1391   - controlConfig.gdsconfigformslave.forEach(itemConfig => {
1392   - controlData
1393   - .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
1394   - .forEach(itemData => {
1395   - itemData.NoVerify = "NoVerify";
1396   - const firstDataIndex = itemConfig.sName.substring(0, 1);
1397   - if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
1398   - itemData[itemConfig.sName] =
1399   - firstDataIndex === "s"
1400   - ? ""
1401   - : firstDataIndex === "d" || firstDataIndex === "i"
1402   - ? 0
1403   - : firstDataIndex === "b"
1404   - ? false
1405   - : firstDataIndex === "t"
1406   - ? moment(new Date()).format(props.app.dateFormat)
1407   - : undefined;
1408   - }
1409   - });
1410   - });
1411   -
1412   - materialsConfig.gdsconfigformslave.forEach(itemConfig => {
1413   - materialsData
1414   - .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
1415   - .forEach(itemData => {
1416   - itemData.NoVerify = "NoVerify";
1417   - const firstDataIndex = itemConfig.sName.substring(0, 1);
1418   - if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
1419   - itemData[itemConfig.sName] =
1420   - firstDataIndex === "s"
1421   - ? ""
1422   - : firstDataIndex === "d" || firstDataIndex === "i"
1423   - ? 0
1424   - : firstDataIndex === "b"
1425   - ? false
1426   - : firstDataIndex === "t"
1427   - ? moment(new Date()).format(props.app.dateFormat)
1428   - : undefined;
1429   - }
1430   - });
1431   - });
1432   -
1433   - processConfig.gdsconfigformslave.forEach(itemConfig => {
1434   - processData
1435   - .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
1436   - .forEach(itemData => {
1437   - itemData.NoVerify = "NoVerify";
1438   - const firstDataIndex = itemConfig.sName.substring(0, 1);
1439   - if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
1440   - itemData[itemConfig.sName] =
1441   - firstDataIndex === "s"
1442   - ? ""
1443   - : firstDataIndex === "d" || firstDataIndex === "i"
1444   - ? 0
1445   - : firstDataIndex === "b"
1446   - ? false
1447   - : firstDataIndex === "t"
1448   - ? moment(new Date()).format(props.app.dateFormat)
1449   - : undefined;
1450   - }
1451   - });
1452   - });
1453   -
1454   - if (commonUtils.isNotEmptyObject(packConfig)) {
1455   - packConfig.gdsconfigformslave.forEach(itemConfig => {
1456   - packData
1457   - .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
1458   - .forEach(itemData => {
1459   - itemData.NoVerify = "NoVerify";
1460   - const firstDataIndex = itemConfig.sName.substring(0, 1);
1461   - if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
1462   - itemData[itemConfig.sName] =
1463   - firstDataIndex === "s"
1464   - ? ""
1465   - : firstDataIndex === "d" || firstDataIndex === "i"
1466   - ? 0
1467   - : firstDataIndex === "b"
1468   - ? false
1469   - : firstDataIndex === "t"
1470   - ? moment(new Date()).format(props.app.dateFormat)
1471   - : undefined;
1472   - }
1473   - });
1474   - });
1475   - }
1476   -
1477   - if (commonUtils.isNotEmptyObject(colorConfig)) {
1478   - colorConfig.gdsconfigformslave.forEach(itemConfig => {
1479   - colorData
1480   - .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
1481   - .forEach(itemData => {
1482   - itemData.NoVerify = "NoVerify";
1483   - const firstDataIndex = itemConfig.sName.substring(0, 1);
1484   - if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
1485   - itemData[itemConfig.sName] =
1486   - firstDataIndex === "s"
1487   - ? ""
1488   - : firstDataIndex === "d" || firstDataIndex === "i"
1489   - ? 0
1490   - : firstDataIndex === "b"
1491   - ? false
1492   - : firstDataIndex === "t"
1493   - ? moment(new Date()).format(props.app.dateFormat)
1494   - : undefined;
1495   - }
1496   - });
1497   - });
1498   - }
1499   -
1500   - data.push(commonBusiness.mergeData("master", masterConfig.sTbName, [masterData]));
1501   - data.push(commonBusiness.mergeData("slave", slaveConfig.sTbName, slaveData, slaveDelData));
1502   - data.push(commonBusiness.mergeData("control", controlConfig.sTbName, controlData, controlDelData));
1503   - data.push(commonBusiness.mergeData("materials", materialsConfig.sTbName, materialsData, materialsDelData));
1504   - data.push(commonBusiness.mergeData("process", processConfig.sTbName, processData, processDelData));
1505   - if (commonUtils.isNotEmptyObject(colorConfig)) {
1506   - data.push(commonBusiness.mergeData("color", colorConfig.sTbName, colorData, colorDelData));
1507   - }
1508   - if (commonUtils.isNotEmptyObject(packConfig)) {
1509   - data.push(commonBusiness.mergeData("pack", packConfig.sTbName, packData, packDelData));
1510   - }
1511   - // 核价后保存
1512   - props.onSaveData({
1513   - data,
1514   - sClientType: "1",
1515   - loading: false,
1516   - sSysLogSrcId: masterData.sId,
1517   - bIsUnCcg: false,
1518   - },props);
1519   - }
1520   -};
1521   -const handleSaveData = async (params, props) => {
1522   - const {
1523   - token,
1524   - sModelsId,
1525   - currentId,
1526   - masterData,
1527   - masterConfig,
1528   - slaveConfig,
1529   - checkConfig,
1530   - billnosetting,
1531   - app,
1532   - sModelsType,
1533   - controlConfig,
1534   - materialsConfig,
1535   - processConfig,
1536   - colorConfig,
1537   - packConfig,
1538   - orderDetailConfig,
1539   - dispatch,
1540   - slaveChildConfig,
1541   - } = props;
1542   - const { userinfo } = app;
1543   - const { copyTo } = app.currentPane;
1544   - const onSendSocketMessage = props.handleSendSocketMessage;
1545   - const BtnSave = commonFunc.showMessage(app.commonConst, "BtnSave"); /* 保存 */
1546   - params.optName = BtnSave;
1547   - const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
1548   - if (commonUtils.isNotEmptyObject(returnData)) {
1549   - if (commonUtils.isNotEmptyObject(copyTo)) {
1550   - const { slaveData } = copyTo;
1551   - const sIdArray = [];
1552   - slaveData.forEach(item => {
1553   - const redisKey = item.sSlaveId;
1554   - sIdArray.push(redisKey);
1555   - });
1556   - const sId = sIdArray.toString();
1557   - onSendSocketMessage("copyfinish", "noAction", sId, userinfo.sId, null, null);
1558   - }
1559   - onSendSocketMessage("release", "noAction", currentId, userinfo.sId, null, null);
1560   - props.onSaveState({
1561   - enabled: false,
1562   - currentId: masterData.sId,
1563   - });
1564   - // 保存后更新panes,currentPane的checkedId,防止浏览器刷新时重新又变成新增。
1565   - const iPaneIndex = app.panes.findIndex(item => item.key === app.currentPane.key);
1566   - app.panes[iPaneIndex].checkedId = masterData.sId;
1567   - app.currentPane.checkedId = masterData.sId;
1568   - // dispatch({ type: "app/savePanesAndCurrentPane", payload: { panes: app.panes, currentPane: app.currentPane } });
1569   -
1570   - // if (billnosetting.bAutoCheck) {
1571   - // await this.handleAudit(1);
1572   - // } else {
1573   - // await this.handleGetData(masterConfig, slaveConfig, checkConfig);
1574   - // if ((sModelsType.includes("sales/salesOrder") || sModelsType.includes("manufacture/workOrder")) && !commonUtils.isEmpty(controlConfig)) {
1575   - // await this.handleGetMemoData(controlConfig, materialsConfig, processConfig, colorConfig, packConfig);
1576   - // } else if (sModelsType === "purchase/purchaseOrder") {
1577   - // await this.handleGetOneMemoData("orderDetail", orderDetailConfig);
1578   - // } else if (sModelsType === "sales/salesSgoods" && !commonUtils.isEmpty(slaveChildConfig)) {
1579   - // await this.handleGetOneMemoData("slaveChild", slaveChildConfig);
1580   - // }
1581   - // if (this.props.app.currentPane.refresh !== undefined) {
1582   - // this.props.app.currentPane.refresh();
1583   - // }
1584   - // }
1585   - props.onSaveState({
1586   - loading: false,
1587   - });
1588   - return true;
1589   - } else {
1590   - props.onSaveState({
1591   - loading: false,
1592   - });
1593   - return false;
1594   - }
1595   -};
1596   -const getProps = baseProps => {
1597   - const { location, quotationData, app, sModelsId } = baseProps;
1598   - const { token } = app;
1599   - const [state, setState] = useState(null);
1600   - const [isInitialized, setIsInitialized] = useState(false);
1601   - const getSqlDropDownData = async (formId, name, showConfig, record, sKeyUpFilterName, pageNum) => {
1602   - const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${sModelsId}`;
1603   - const body = {
1604   - sSqlCondition: {
1605   - sSqlCondition: "",
1606   - },
1607   - sKeyUpFilterName: "",
1608   - pageNum: 1,
1609   - pageSize: 20,
1610   - };
1611   - const retrunData = await commonServices.postValueService(token, body, url);
1612   - if (retrunData.data.code === 1) {
1613   - /* 获取数据集 */
1614   - const { rows, totalPageCount, currentPageNo, totalCount } = retrunData.data.dataset;
1615   - return {
1616   - dropDownData: rows,
1617   - totalPageCount,
1618   - currentPageNo,
1619   - totalCount,
1620   - };
1621   - }
1622   - };
1623   - // 定义 onSaveState 函数
1624   - const onSaveState = (updateFunction, callback) => {
1625   - setState(prevState => {
1626   - let newState = prevState; // 初始状态下不修改状态
1627   - // 确保 updateFunction 是一个函数
1628   - if (typeof updateFunction === "function") {
1629   - newState = updateFunction(prevState);
1630   - }
1631   -
1632   - // 执行回调函数(如果存在)
1633   - if (typeof callback === "function") {
1634   - callback();
1635   - }
1636   -
1637   - return newState; // 返回新的状态,可能未修改
1638   - });
1639   - };
1640   - const { slaveData = [], packData = [], colorData = [], controlData = [], processData = [], materialsData = [] } = baseProps;
1641   -
1642   - // 在组件挂载时初始化数据
1643   - useEffect(() => {
1644   - if (!isInitialized) {
1645   - const slaveRow = {
1646   - handleType: "add",
1647   - sId: commonUtils.createSid(),
1648   - key: commonUtils.createSid(),
1649   - sParentId: commonUtils.createSid(),
1650   - sNodeId: commonUtils.createSid(),
1651   - bDefault: false,
1652   - iOrder: 1,
1653   - };
1654   - slaveData.push(slaveRow);
1655   -
1656   - const packRow = {
1657   - sId: commonUtils.createSid(),
1658   - handleType: "add",
1659   - sSlaveId: commonUtils.createSid(),
1660   - iOrder: 1,
1661   - sParentId: commonUtils.createSid(),
1662   - sControlId: commonUtils.createSid(),
1663   - dProductQty: 0,
1664   - dCombineQty: 1,
1665   - };
1666   - packData.push(packRow);
1667   - const controlRow = {
1668   - dSumPQty: 2,
1669   - iPrintMode: 0,
1670   - iPositiveColor: 4,
1671   - iOppositeColor: 4,
1672   - sSlaveId: " ",
1673   - iPrintModePo: 2,
1674   - handleType: "add",
1675   - sId: commonUtils.createSid(),
1676   - sParentId: commonUtils.createSid(),
1677   - key: commonUtils.createSid(),
1678   - bDefault: false,
1679   - iOrder: 1,
1680   - sCombinedMemo: "合版信息",
1681   - sAllId: commonUtils.createSid(),
1682   - dPartsQty: 0,
1683   - };
1684   - controlData.push(controlRow);
1685   - setState(prevState => ({
1686   - ...prevState,
1687   - slaveData,
1688   - packData,
1689   - controlData,
1690   - colorData,
1691   - processData,
1692   - materialsData,
1693   - }));
1694   -
1695   - setIsInitialized(true);
1696   - }
1697   - }, [isInitialized]);
1698   - return {
1699   - ...baseProps,
1700   - selectedNode: quotationData,
1701   - manyDataCache: [],
1702   - token: baseProps.app.token,
1703   - getSqlDropDownData,
1704   - onMaterialsChange: handleMaterialsChange,
1705   - sortData,
1706   - handleCalculation,
1707   - onSaveState,
1708   - onSaveData: handleSaveData,
1709   - onButtonClick: handleButtonClick,
1710   - ...state,
1711 924 };
1712 925 };
  926 +// 入口
1713 927 const QuotationAllprogressDetail = baseProps => {
1714   - const masterProps = getProps(baseProps);
1715   - const props = QuickQuoteEvent(masterProps);
  928 + // const masterProps = getProps(baseProps);
  929 + const props = QuickQuoteEvent(baseProps);
1716 930 const { selectedNode, location, quotationData, app, sModelsId } = props;
1717 931 const { showName, sUnit } = quotationData;
1718 932 const timeRef = useRef(0);
... ... @@ -2431,25 +1645,25 @@ const BoxComponent = props =&gt; {
2431 1645 ...props.onGetAllDelData(),
2432 1646 manyDataCache: [],
2433 1647 };
2434   - const data = {
2435   - masterData: { ...props.masterData, handleType: props.masterData.handleType || "update" },
2436   - ...addState,
2437   - };
  1648 + // const data = {
  1649 + // masterData: { ...props.masterData, handleType: props.masterData.handleType || "update" },
  1650 + // ...addState,
  1651 + // };
  1652 + // props.onSaveState(
  1653 + // pre => ({ ...pre, ...data }),
  1654 + // (newState) => {
  1655 + // props.handleCalcPrice();
  1656 + // }
  1657 + // );
2438 1658 props.onSaveState(
2439   - pre => ({ ...pre, ...data }),
  1659 + {
  1660 + masterData: { ...props.masterData, handleType: props.masterData.handleType || "update" },
  1661 + ...addState,
  1662 + },
2440 1663 () => {
2441 1664 props.handleCalcPrice();
2442 1665 }
2443 1666 );
2444   - // props.onSaveState(
2445   - // {
2446   - // masterData: { ...props.masterData, handleType: props.masterData.handleType || "update" },
2447   - // ...addState,
2448   - // },
2449   - // () => {
2450   - // props.handleCalcPrice();
2451   - // }
2452   - // );
2453 1667 };
2454 1668 return (
2455 1669 <div>
... ... @@ -2664,7 +1878,7 @@ const MaterialsComponent = props =&gt; {
2664 1878 let viewRow = { ...materialsInfo[index], sProductClassifyId: selectedNode.sId };
2665 1879 viewRow = { ...viewRow, sMaterialsName0: viewRow.showName || "" };
2666 1880 if (!materialsConfig) return;
2667   - let materialsConfigNew = JSON.parse(JSON.stringify(materialsConfig));
  1881 + let materialsConfigNew = cloneDeep(materialsConfig);
2668 1882 if (viewRow.showName) {
2669 1883 const iIndex = materialsConfigNew.findIndex(item => item.sName === "sMaterialsName");
2670 1884 if (iIndex !== -1) {
... ... @@ -2813,6 +2027,26 @@ const ManyComponent = props =&gt; {
2813 2027 manyDataCache: [],
2814 2028 });
2815 2029 }, [masterData.dProductQty, manyData.length]);
  2030 + useEffect(() => {
  2031 + if (calcPriceLoading) {
  2032 + setProcessPercent(0);
  2033 + // window.tempWsAction = ({ data } = {}) => {
  2034 + // const { action, msg } = commonUtils.convertStrToObj(data, {});
  2035 + // if (action === "quotationAllprogress") {
  2036 + // setProcessPercent(msg);
  2037 + // }
  2038 + // };
  2039 + } else {
  2040 + // window.tempWsAction = null;
  2041 + }
  2042 + }, [calcPriceLoading]);
  2043 +
  2044 + // 监听确认下单数量结束
  2045 + useEffect(() => {
  2046 + if (!loading && submitLoading) {
  2047 + setSubmitLoading(false);
  2048 + }
  2049 + }, [loading]);
2816 2050 const tableProps = {
2817 2051 ...commonBusiness.getTableTypes("many", { ...props, ...state }),
2818 2052 fixedHeight: 185,
... ...
src/mobile/quotation/master.jsx
1 1 import React, { useEffect, useState } from "react";
2   -const QuotationAllMaster = baseProps =>{
  2 +import QuotationAllprogressDetail from "./detailNew";
  3 +import commonConfig from "@/utils/config";
  4 +import { Toast, Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog } from "antd-mobile";
  5 +import * as commonServices from "@/services/services";
  6 +import * as commonFunc from "@/components/Common/commonFunc";
  7 +import * as commonBusiness from "@/components/Common/commonBusiness";
  8 +import * as commonUtils from "@/utils/utils";
  9 +import { cloneDeep } from "lodash";
  10 +import moment from "moment";
3 11  
4   -}
5   -export default QuotationAllMaster;
6 12 \ No newline at end of file
  13 +const masterEvent = props => {
  14 + const { location, quotationData, app, sModelsId } = props;
  15 + const selectedNode = quotationData;
  16 + const { token } = app;
  17 + const [state, setState] = useState(null);
  18 + const [isInitialized, setIsInitialized] = useState(false);
  19 +
  20 + const getSqlDropDownData = async (formId, name, showConfig, record, sKeyUpFilterName, pageNum) => {
  21 + const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${sModelsId}`;
  22 + const body = {
  23 + sSqlCondition: {
  24 + sSqlCondition: "",
  25 + },
  26 + sKeyUpFilterName: "",
  27 + pageNum: 1,
  28 + pageSize: 20,
  29 + };
  30 + const retrunData = await commonServices.postValueService(token, body, url);
  31 + if (retrunData.data.code === 1) {
  32 + const { rows, totalPageCount, currentPageNo, totalCount } = retrunData.data.dataset;
  33 + return {
  34 + dropDownData: rows,
  35 + totalPageCount,
  36 + currentPageNo,
  37 + totalCount,
  38 + };
  39 + }
  40 + };
  41 +
  42 + // 获取主表信息
  43 + useEffect(() => {
  44 + const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}`;
  45 + commonServices
  46 + .getService(token, configUrl)
  47 + .then(async ({ data: masterReturn }) => {
  48 + if (masterReturn.code === 1) {
  49 + const formData = masterReturn.dataset.rows[0].formData;
  50 + const masterConfig = formData.find(x => x.sTbName === "QuoQuotationmaster");
  51 + const processConfig = formData.find(x => x.sTbName === "QuoQuotationprocess");
  52 + const materialsConfig = formData.find(x => x.sTbName === "QuoQuotationmaterials");
  53 + const slaveConfig = formData.find(x => x.sTbName === "QuoQuotationslave");
  54 + const controlConfig = formData.find(x => x.sTbName === "QuoQuotationcontrol");
  55 +
  56 + let colorConfig = {};
  57 + const colorConfigTrue = formData.find(item => item.sTbName === "quoquotationparam");
  58 + if (commonUtils.isNotEmptyObject(colorConfigTrue)) {
  59 + colorConfig = { ...colorConfigTrue };
  60 + }
  61 +
  62 + const packConfig = formData.find(item => item.sTbName === "quoquotationcontrolcombine");
  63 +
  64 + let checkConfig = {};
  65 + let checkColumn = {};
  66 + if (commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === "sysbillcheckresult"))) {
  67 + checkConfig = formData.find(item => item.bGrd && item.sTbName === "sysbillcheckresult");
  68 + checkColumn = commonFunc.getHeaderConfig(checkConfig);
  69 + }
  70 + setState(prevState => ({
  71 + ...prevState,
  72 + formData,
  73 + masterConfig,
  74 + processConfig,
  75 + materialsConfig,
  76 + slaveConfig,
  77 + controlConfig,
  78 + colorConfig,
  79 + packConfig,
  80 + checkConfig,
  81 + selectedNode,
  82 + }));
  83 + }
  84 + })
  85 + .catch(error => {
  86 + console.error("获取主表信息失败:", error);
  87 + });
  88 + }, []);
  89 +
  90 + const onSaveState = (updateFunction, callback) => {
  91 + setState(prevState => {
  92 + let newState = prevState;
  93 + if (typeof updateFunction === "function") {
  94 + newState = updateFunction(prevState);
  95 + }
  96 + if (typeof callback === "function") {
  97 + callback(newState);
  98 + }
  99 + return { ...newState };
  100 + });
  101 + };
  102 +
  103 + const { slaveData = [], packData = [], colorData = [], controlData = [], processData = [], materialsData = [] } = props;
  104 +
  105 + // 初始化数据
  106 + useEffect(() => {
  107 + if (!isInitialized) {
  108 + const slaveRow = {
  109 + handleType: "add",
  110 + sId: commonUtils.createSid(),
  111 + key: commonUtils.createSid(),
  112 + sParentId: commonUtils.createSid(),
  113 + sNodeId: commonUtils.createSid(),
  114 + bDefault: false,
  115 + iOrder: 1,
  116 + };
  117 + slaveData.push(slaveRow);
  118 +
  119 + const packRow = {
  120 + sId: commonUtils.createSid(),
  121 + handleType: "add",
  122 + sSlaveId: commonUtils.createSid(),
  123 + iOrder: 1,
  124 + sParentId: commonUtils.createSid(),
  125 + sControlId: commonUtils.createSid(),
  126 + dProductQty: 0,
  127 + dCombineQty: 1,
  128 + };
  129 + packData.push(packRow);
  130 +
  131 + const controlRow = {
  132 + dSumPQty: 2,
  133 + iPrintMode: 0,
  134 + iPositiveColor: 4,
  135 + iOppositeColor: 4,
  136 + sSlaveId: " ",
  137 + iPrintModePo: 2,
  138 + handleType: "add",
  139 + sId: commonUtils.createSid(),
  140 + sParentId: commonUtils.createSid(),
  141 + key: commonUtils.createSid(),
  142 + bDefault: false,
  143 + iOrder: 1,
  144 + sCombinedMemo: "合版信息",
  145 + sAllId: commonUtils.createSid(),
  146 + dPartsQty: 0,
  147 + };
  148 + controlData.push(controlRow);
  149 + const masterData = {
  150 + handleType: "add",
  151 + iPositiveColor: 4,
  152 + maxBillNo: "sBillNo",
  153 + sFormId: sModelsId,
  154 + sId: commonUtils.createSid(),
  155 + };
  156 + setState(prevState => ({
  157 + ...prevState,
  158 + slaveData,
  159 + packData,
  160 + controlData,
  161 + colorData,
  162 + processData,
  163 + materialsData,
  164 + masterData,
  165 + }));
  166 +
  167 + setIsInitialized(true);
  168 + }
  169 + }, [isInitialized, slaveData, packData, controlData, colorData, processData, materialsData]);
  170 +
  171 + // 确保 state 数据已加载
  172 + if (!state) {
  173 + return null; // 或者加载状态组件
  174 + }
  175 +
  176 + return {
  177 + ...props,
  178 + selectedNode: quotationData,
  179 + manyDataCache: [],
  180 + token,
  181 + getSqlDropDownData,
  182 + onMaterialsChange: handleMaterialsChange,
  183 + sortData,
  184 + handleCalculation,
  185 + onSaveState,
  186 + onSaveData: handleSaveData,
  187 + onButtonClick: handleButtonClick,
  188 + ...state,
  189 + };
  190 +};
  191 +
  192 +const sortData = (tableData, processData) => {
  193 + processData.sort((g1, g2) => {
  194 + const iIndex1 = tableData.findIndex(item => item.sId === g1.sControlId) === -1 ? 999 : tableData.findIndex(item => item.sId === g1.sControlId);
  195 + let sPartOrder1 = `0000${iIndex1}`;
  196 + sPartOrder1 = sPartOrder1.substring(sPartOrder1.length - 3);
  197 + let sOrder1 = `000${g1.iOrder}`;
  198 + sOrder1 = sOrder1.substring(sOrder1.length - 3);
  199 +
  200 + const iIndex2 = tableData.findIndex(item => item.sId === g2.sControlId) === -1 ? 999 : tableData.findIndex(item => item.sId === g2.sControlId);
  201 + let sPartOrder2 = `0000${iIndex2}`;
  202 + sPartOrder2 = sPartOrder2.substring(sPartOrder2.length - 3);
  203 + let sOrder2 = `000${g2.iOrder}`;
  204 + sOrder2 = sOrder2.substring(sOrder2.length - 3);
  205 + return parseInt(sPartOrder1 + g1.sType + sOrder1, 10) - parseInt(sPartOrder2 + g2.sType + sOrder2, 10);
  206 + });
  207 + return processData;
  208 +};
  209 +const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models) => {
  210 + const { sComputeId, sConversionComputeId, sReConversionComputeId } = tableDataRow;
  211 + if (
  212 + sFieldName === "sMaterialsNo" ||
  213 + sFieldName === "sMaterialsName" ||
  214 + sFieldName === "dAuxiliaryQty" ||
  215 + sFieldName === "dReelAuxiliaryQty" ||
  216 + sFieldName === "dConversionQty" ||
  217 + sFieldName === "sMaterialsStyle" ||
  218 + sFieldName === "dProductQty"
  219 + ) {
  220 + if (sFieldName === "dReelAuxiliaryQty") {
  221 + if (tableDataRow.sMaterialsUnit === "吨" && tableDataRow.bReel && tableDataRow.dGramWeight > 0) {
  222 + tableDataRow = commonBusiness.getMaterialsQty(
  223 + app,
  224 + { ...tableDataRow, sMaterialsStyle: tableDataRow.sReelMaterialsStyle },
  225 + "dReelAuxiliaryQty",
  226 + "dMaterialsQty"
  227 + );
  228 + tableDataRow.dAuxiliaryQty = tableDataRow.dMaterialsQty;
  229 + tableDataRow.sMaterialsStyle =
  230 + tableDataRow.sMaterialsStyle !== undefined && tableDataRow.sMaterialsStyle.split("*").length > 1
  231 + ? tableDataRow.sMaterialsStyle.split("*")[0]
  232 + : tableDataRow.sMaterialsStyle;
  233 + tableDataRow.sAuxiliaryUnit = tableDataRow.sMaterialsUnit;
  234 + } else if (tableDataRow.sMaterialsUnit.toUpper() === "M2" && tableDataRow.bReel) {
  235 + tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, "dReelAuxiliaryQty", "dMaterialsQty");
  236 + tableDataRow.dAuxiliaryQty = tableDataRow.dReelAuxiliaryQty;
  237 + } else {
  238 + tableDataRow.dAuxiliaryQty = tableDataRow.dReelAuxiliaryQty;
  239 + }
  240 + }
  241 + if (commonUtils.isEmpty(sComputeId) && sFieldName !== "dConversionQty") {
  242 + if (sFieldName === "dProductQty") {
  243 + tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, "dProductQty", "dMaterialsQty");
  244 + } else {
  245 + tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, "dAuxiliaryQty", "dMaterialsQty");
  246 + }
  247 + } else if (!commonUtils.isEmpty(sComputeId)) {
  248 + tableDataRow.dMaterialsQty = await commonBusiness.getFormulaValue({
  249 + token,
  250 + sModelsId,
  251 + masterData,
  252 + tableDataRow,
  253 + sComputeId,
  254 + });
  255 + }
  256 + if (sFieldName !== "dConversionQty" && !commonUtils.isEmpty(sConversionComputeId)) {
  257 + tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({
  258 + token,
  259 + sModelsId,
  260 + masterData,
  261 + tableDataRow,
  262 + sComputeId: sConversionComputeId,
  263 + });
  264 + }
  265 + } else if (sFieldName === "dMaterialsQty") {
  266 + const { sReComputeId } = tableDataRow;
  267 + if (commonUtils.isEmpty(sReComputeId) && tableDataRow.bInverse) {
  268 + tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, "dAuxiliaryQty");
  269 + } else if (tableDataRow.bInverse) {
  270 + tableDataRow.dAuxiliaryQty = await commonBusiness.getFormulaValue({
  271 + token,
  272 + sModelsId,
  273 + masterData,
  274 + tableDataRow,
  275 + sComputeId: sReComputeId,
  276 + });
  277 + if (commonUtils.isNotEmptyArr(tableDataRow.dAuxiliaryQty) && tableDataRow.dAuxiliaryQty !== 0) {
  278 + tableDataRow.dProductQty = tableDataRow.dAuxiliaryQty;
  279 + }
  280 + }
  281 + if (!commonUtils.isEmpty(sReConversionComputeId)) {
  282 + tableDataRow.dConversionQty = await commonBusiness.getFormulaValue({
  283 + token,
  284 + sModelsId,
  285 + masterData,
  286 + tableDataRow,
  287 + sComputeId: sReConversionComputeId,
  288 + });
  289 + }
  290 + } else if (sFieldName === "dAuxiliaryLossQty") {
  291 + if (commonUtils.isEmpty(sComputeId)) {
  292 + tableDataRow = commonBusiness.getMaterialsQty(app, tableDataRow, sFieldName, "dLossQty");
  293 + } else {
  294 + tableDataRow.dLossQty = await commonBusiness.getFormulaValue({
  295 + token,
  296 + sModelsId,
  297 + masterData,
  298 + tableDataRow,
  299 + sComputeId,
  300 + });
  301 + }
  302 + if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) {
  303 + tableDataRow.dAuxiliaryQty = tableDataRow.dSrcSurplusAuxiliaryQty - tableDataRow.dAuxiliaryLossQty;
  304 + tableDataRow.dMaterialsQty = commonUtils.convertFixNum(tableDataRow.dSrcSurplusQty - tableDataRow.dLossQty, 6);
  305 + }
  306 + } else if (sFieldName === "dLossQty") {
  307 + const { sReComputeId } = tableDataRow;
  308 + if (commonUtils.isEmpty(sReComputeId)) {
  309 + tableDataRow = commonBusiness.getAuxiliaryQty(app, tableDataRow, sFieldName, "dAuxiliaryLossQty");
  310 + } else {
  311 + tableDataRow.dAuxiliaryLossQty = await commonBusiness.getFormulaValue({
  312 + token,
  313 + sModelsId,
  314 + masterData,
  315 + tableDataRow,
  316 + sComputeId: sReComputeId,
  317 + });
  318 + }
  319 + if (!commonUtils.isEmpty(tableDataRow.dSrcSurplusAuxiliaryQty)) {
  320 + tableDataRow.dAuxiliaryQty = tableDataRow.dSrcSurplusAuxiliaryQty - tableDataRow.dAuxiliaryLossQty;
  321 + tableDataRow.dMaterialsQty = tableDataRow.dSrcSurplusQty - tableDataRow.dLossQty;
  322 + }
  323 + } else if (sFieldName === "sProcessId" || sFieldName === "sProcessNo" || sFieldName === "sProcessName") {
  324 + const sProcessId = changeValue.sProcessId;
  325 + const url = `${commonConfig.server_host}process/outsideprocess?sModelsId=${sModelsId}&sProcessId=${sProcessId}`;
  326 + const dataReturn = (await commonServices.getService(token, url)).data;
  327 + if (dataReturn.code === 1) {
  328 + if (commonUtils.isNotEmptyArr(dataReturn.dataset.rows)) {
  329 + tableDataRow.dMaterialsPrice = dataReturn.dataset.rows[0].dMaterialsPrice;
  330 + }
  331 + tableDataRow = commonBusiness.getCalculateAllMoney(app, models, "dMaterialsPrice", masterData, tableDataRow);
  332 + }
  333 + }
  334 + return tableDataRow;
  335 +};
  336 +// 计算数量
  337 +const handleCalculation = async (bSave, nextProps, isWait, props) => {
  338 + const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`;
  339 + const {
  340 + masterConfig,
  341 + slaveConfig,
  342 + slaveDelData,
  343 + controlConfig,
  344 + controlDelData,
  345 + colorConfig,
  346 + colorData,
  347 + colorDelData,
  348 + materialsConfig,
  349 + materialsDelData,
  350 + processConfig,
  351 + processDelData,
  352 + app,
  353 + manyqtysConfig,
  354 + manyqtysDelData,
  355 + packConfig,
  356 + packDelData,
  357 + manyDataCache = [],
  358 + dQuickQuoteProductQty,
  359 + } = nextProps;
  360 + let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps;
  361 + const sMakePerson = masterData.sMakePerson;
  362 + const data = [];
  363 + data.push(commonBusiness.mergeData("master", `${masterConfig.sTbName.toLowerCase()}_Tmp`, [masterData], [], true));
  364 + data.push(commonBusiness.mergeData("slave", `${slaveConfig.sTbName.toLowerCase()}_tmp`, slaveData, [], true));
  365 + data.push(commonBusiness.mergeData("control", `${controlConfig.sTbName.toLowerCase()}_tmp`, controlData, [], true));
  366 + data.push(commonBusiness.mergeData("materials", `${materialsConfig.sTbName.toLowerCase()}_tmp`, materialsData, [], true));
  367 + data.push(commonBusiness.mergeData("process", `${processConfig.sTbName.toLowerCase()}_tmp`, processData, [], true));
  368 + if (commonUtils.isNotEmptyObject(manyqtysConfig)) {
  369 + data.push(
  370 + commonBusiness.mergeData(
  371 + "manyqtys",
  372 + `${manyqtysConfig.sTbName.toLowerCase()}_tmp`,
  373 + manyqtysData?.map(item => {
  374 + delete item.manyData;
  375 + return item;
  376 + }),
  377 + [],
  378 + true
  379 + )
  380 + );
  381 + }
  382 +
  383 + data.push(commonBusiness.mergeData("pack", `${packConfig.sTbName.toLowerCase()}_tmp`, packData, [], true));
  384 + const value = { data, sClientType: "1", sGuid: masterData.sId };
  385 +
  386 + const cacheIndex = dQuickQuoteProductQty === undefined ? -1 : manyDataCache.findIndex(item => item.dManyQty === dQuickQuoteProductQty);
  387 + if (cacheIndex === -1) {
  388 + // message.warning("自动计算中,请稍后再试。");
  389 + Toast.show({
  390 + content: "自动计算中,请稍后再试。",
  391 + });
  392 + }
  393 + const dataReturn = cacheIndex === -1 ? (await commonServices.postValueService(props.app.token, value, dataUrl)).data : manyDataCache[cacheIndex];
  394 + if (dataReturn.code === 1) {
  395 + /* 成功 */
  396 + const valueReturn = dataReturn.dataset.rows[0];
  397 + const masterDataArr = valueReturn[`${masterConfig.sTbName.toLowerCase()}_tmp`];
  398 + if (commonUtils.isNotEmptyArr(masterDataArr)) {
  399 + masterData = masterDataArr[0];
  400 + }
  401 + if (cacheIndex !== -1) {
  402 + // masterData.handleType = nextProps.masterData.handleType || "update";
  403 + masterData.sQuoConfig = nextProps.masterData.sQuoConfig;
  404 + masterData.sFormId = nextProps.masterData.sFormId;
  405 + masterData.sBillNo = nextProps.masterData.sBillNo;
  406 + }
  407 + masterData.handleType = masterData.sBillNo ? "update" : "add";
  408 + if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) {
  409 + masterData.sMakePerson = sMakePerson;
  410 + }
  411 + slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`].map(item => {
  412 + item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  413 + return item;
  414 + });
  415 + controlData = valueReturn[`${controlConfig.sTbName.toLowerCase()}_tmp`].map(item => {
  416 + item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  417 + return item;
  418 + });
  419 + materialsData = valueReturn[`${materialsConfig.sTbName.toLowerCase()}_tmp`].map(item => {
  420 + item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  421 + return item;
  422 + });
  423 + processData = valueReturn[`${processConfig.sTbName.toLowerCase()}_tmp`].map(item => {
  424 + item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  425 + return item;
  426 + });
  427 + processData = props.sortData(controlData, processData);
  428 + const addState = {};
  429 + if (commonUtils.isNotEmptyObject(manyqtysConfig)) {
  430 + manyqtysData = valueReturn[`${manyqtysConfig.sTbName.toLowerCase()}_tmp`]?.map((item, index) => {
  431 + return {
  432 + ...item,
  433 + sId: manyqtysData[index] ? manyqtysData[index].sId : item.sId,
  434 + handleType: dQuickQuoteProductQty ? "add" : item.handleType,
  435 + };
  436 + });
  437 + if (cacheIndex === -1 && manyqtysData?.some(item => item.manyData)) {
  438 + addState.manyDataCache = manyqtysData.map((item, index) => {
  439 + let result = {};
  440 + if (index === 0) {
  441 + result = Object.keys(valueReturn).reduce((pre, cur) => {
  442 + if (cur !== `${manyqtysConfig.sTbName.toLowerCase()}_tmp`) {
  443 + pre[cur] = valueReturn[cur];
  444 + }
  445 + return pre;
  446 + }, {});
  447 + } else {
  448 + result = commonUtils.convertStrToObj(item.manyData);
  449 + }
  450 +
  451 + result[`${manyqtysConfig.sTbName.toLowerCase()}_tmp`] = cloneDeep(manyqtysData).map(item => {
  452 + delete item.manyData;
  453 + return item;
  454 + });
  455 +
  456 + const { sId, sBillNo, sFormId } = masterData;
  457 + const row = Object.keys(result).reduce((pre, cur) => {
  458 + if (cur === `${masterConfig.sTbName.toLowerCase()}_tmp`) {
  459 + pre[cur] = result[cur].map(item => ({
  460 + ...item,
  461 + sId,
  462 + sBillNo: sBillNo || item.sBillNo,
  463 + sFormId,
  464 + }));
  465 + } else if (cur.includes("_tmp")) {
  466 + pre[cur] = result[cur].map(item => ({
  467 + ...item,
  468 + sParentId: sId,
  469 + handleType: "add",
  470 + }));
  471 + } else {
  472 + pre[cur] = result[cur];
  473 + }
  474 + return pre;
  475 + }, {});
  476 +
  477 + return {
  478 + code: 1,
  479 + dManyQty: item.dManyQty,
  480 + dataset: {
  481 + rows: [row],
  482 + },
  483 + };
  484 + });
  485 + }
  486 + }
  487 +
  488 + packData = valueReturn[`${packConfig.sTbName.toLowerCase()}_tmp`];
  489 + /* 计算成功后自动调用保存 */
  490 + if (bSave) {
  491 + const data = [];
  492 + data.push(commonBusiness.mergeData("master", masterConfig.sTbName, [masterData]));
  493 + data.push(commonBusiness.mergeData("slave", slaveConfig.sTbName, slaveData, slaveDelData));
  494 + data.push(commonBusiness.mergeData("control", controlConfig.sTbName, controlData, controlDelData));
  495 + data.push(commonBusiness.mergeData("materials", materialsConfig.sTbName, materialsData, materialsDelData));
  496 + data.push(commonBusiness.mergeData("process", processConfig.sTbName, processData, processDelData));
  497 +
  498 + if (commonUtils.isNotEmptyObject(manyqtysConfig)) {
  499 + data.push(commonBusiness.mergeData("manyqtys", manyqtysConfig.sTbName, manyqtysData, manyqtysDelData));
  500 + }
  501 +
  502 + data.push(commonBusiness.mergeData("color", colorConfig.sTbName, colorData, colorDelData));
  503 + data.push(commonBusiness.mergeData("pack", packConfig.sTbName, packData, packDelData));
  504 + props.onSaveData(
  505 + {
  506 + data,
  507 + sClientType: "1",
  508 + loading: false,
  509 + sSysLogSrcId: masterData.sId,
  510 + },
  511 + props
  512 + );
  513 + props.onSaveState({
  514 + slaveData,
  515 + packData,
  516 + controlData,
  517 + materialsData,
  518 + processData,
  519 + masterData,
  520 + manyqtysData,
  521 + ...addState,
  522 + });
  523 + } else {
  524 + if (isWait) {
  525 + return {
  526 + slaveData,
  527 + controlData,
  528 + materialsData,
  529 + processData,
  530 + masterData,
  531 + manyqtysData,
  532 + loading: false,
  533 + packData,
  534 + ...addState,
  535 + };
  536 + } else {
  537 + props.onSaveState({
  538 + slaveData,
  539 + controlData,
  540 + materialsData,
  541 + processData,
  542 + masterData,
  543 + manyqtysData,
  544 + loading: false,
  545 + packData,
  546 + ...addState,
  547 + });
  548 + }
  549 + // message.success(commonFunc.getConfigShowName(masterConfig, "BtnCalculation") + commonFunc.showMessage(app.commonConst, "handleSuccess"));
  550 + }
  551 + } else {
  552 + /* 失败 */
  553 + props.onSaveState({
  554 + loading: false,
  555 + });
  556 + // this.props.getServiceError(dataReturn);
  557 + }
  558 +};
  559 +/** 按钮操作事件 */
  560 +const handleButtonClick = async (name, props) => {
  561 + if (name === "BtnDraft") {
  562 + const {
  563 + masterConfig,
  564 + masterData,
  565 + slaveConfig,
  566 + slaveData,
  567 + slaveDelData,
  568 + controlConfig,
  569 + controlData, // 需要
  570 + controlDelData,
  571 + materialsConfig,
  572 + materialsData,
  573 + materialsDelData,
  574 + processConfig,
  575 + processData,
  576 + processDelData,
  577 + colorConfig,
  578 + colorData,
  579 + colorDelData,
  580 + packConfig,
  581 + packData, // 需要
  582 + packDelData,
  583 + } = props;
  584 + const data = [];
  585 + slaveConfig.gdsconfigformslave.forEach(itemConfig => {
  586 + slaveData
  587 + .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
  588 + .forEach(itemData => {
  589 + itemData.NoVerify = "NoVerify";
  590 + const firstDataIndex = itemConfig.sName.substring(0, 1);
  591 + if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
  592 + itemData[itemConfig.sName] =
  593 + firstDataIndex === "s"
  594 + ? ""
  595 + : firstDataIndex === "d" || firstDataIndex === "i"
  596 + ? 0
  597 + : firstDataIndex === "b"
  598 + ? false
  599 + : firstDataIndex === "t"
  600 + ? moment(new Date()).format(props.app.dateFormat)
  601 + : undefined;
  602 + }
  603 + });
  604 + });
  605 + controlConfig.gdsconfigformslave.forEach(itemConfig => {
  606 + controlData
  607 + .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
  608 + .forEach(itemData => {
  609 + itemData.NoVerify = "NoVerify";
  610 + const firstDataIndex = itemConfig.sName.substring(0, 1);
  611 + if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
  612 + itemData[itemConfig.sName] =
  613 + firstDataIndex === "s"
  614 + ? ""
  615 + : firstDataIndex === "d" || firstDataIndex === "i"
  616 + ? 0
  617 + : firstDataIndex === "b"
  618 + ? false
  619 + : firstDataIndex === "t"
  620 + ? moment(new Date()).format(props.app.dateFormat)
  621 + : undefined;
  622 + }
  623 + });
  624 + });
  625 +
  626 + materialsConfig.gdsconfigformslave.forEach(itemConfig => {
  627 + materialsData
  628 + .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
  629 + .forEach(itemData => {
  630 + itemData.NoVerify = "NoVerify";
  631 + const firstDataIndex = itemConfig.sName.substring(0, 1);
  632 + if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
  633 + itemData[itemConfig.sName] =
  634 + firstDataIndex === "s"
  635 + ? ""
  636 + : firstDataIndex === "d" || firstDataIndex === "i"
  637 + ? 0
  638 + : firstDataIndex === "b"
  639 + ? false
  640 + : firstDataIndex === "t"
  641 + ? moment(new Date()).format(props.app.dateFormat)
  642 + : undefined;
  643 + }
  644 + });
  645 + });
  646 +
  647 + processConfig.gdsconfigformslave.forEach(itemConfig => {
  648 + processData
  649 + .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
  650 + .forEach(itemData => {
  651 + itemData.NoVerify = "NoVerify";
  652 + const firstDataIndex = itemConfig.sName.substring(0, 1);
  653 + if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
  654 + itemData[itemConfig.sName] =
  655 + firstDataIndex === "s"
  656 + ? ""
  657 + : firstDataIndex === "d" || firstDataIndex === "i"
  658 + ? 0
  659 + : firstDataIndex === "b"
  660 + ? false
  661 + : firstDataIndex === "t"
  662 + ? moment(new Date()).format(props.app.dateFormat)
  663 + : undefined;
  664 + }
  665 + });
  666 + });
  667 +
  668 + if (commonUtils.isNotEmptyObject(packConfig)) {
  669 + packConfig.gdsconfigformslave.forEach(itemConfig => {
  670 + packData
  671 + .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
  672 + .forEach(itemData => {
  673 + itemData.NoVerify = "NoVerify";
  674 + const firstDataIndex = itemConfig.sName.substring(0, 1);
  675 + if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
  676 + itemData[itemConfig.sName] =
  677 + firstDataIndex === "s"
  678 + ? ""
  679 + : firstDataIndex === "d" || firstDataIndex === "i"
  680 + ? 0
  681 + : firstDataIndex === "b"
  682 + ? false
  683 + : firstDataIndex === "t"
  684 + ? moment(new Date()).format(props.app.dateFormat)
  685 + : undefined;
  686 + }
  687 + });
  688 + });
  689 + }
  690 +
  691 + if (commonUtils.isNotEmptyObject(colorConfig)) {
  692 + colorConfig.gdsconfigformslave.forEach(itemConfig => {
  693 + colorData
  694 + .filter(itemData => itemData.handleType === "add" || itemData.handleType === "update")
  695 + .forEach(itemData => {
  696 + itemData.NoVerify = "NoVerify";
  697 + const firstDataIndex = itemConfig.sName.substring(0, 1);
  698 + if (commonUtils.isEmpty(itemData[itemConfig.sName])) {
  699 + itemData[itemConfig.sName] =
  700 + firstDataIndex === "s"
  701 + ? ""
  702 + : firstDataIndex === "d" || firstDataIndex === "i"
  703 + ? 0
  704 + : firstDataIndex === "b"
  705 + ? false
  706 + : firstDataIndex === "t"
  707 + ? moment(new Date()).format(props.app.dateFormat)
  708 + : undefined;
  709 + }
  710 + });
  711 + });
  712 + }
  713 +
  714 + data.push(commonBusiness.mergeData("master", masterConfig.sTbName, [masterData]));
  715 + data.push(commonBusiness.mergeData("slave", slaveConfig.sTbName, slaveData, slaveDelData));
  716 + data.push(commonBusiness.mergeData("control", controlConfig.sTbName, controlData, controlDelData));
  717 + data.push(commonBusiness.mergeData("materials", materialsConfig.sTbName, materialsData, materialsDelData));
  718 + data.push(commonBusiness.mergeData("process", processConfig.sTbName, processData, processDelData));
  719 + if (commonUtils.isNotEmptyObject(colorConfig)) {
  720 + data.push(commonBusiness.mergeData("color", colorConfig.sTbName, colorData, colorDelData));
  721 + }
  722 + if (commonUtils.isNotEmptyObject(packConfig)) {
  723 + data.push(commonBusiness.mergeData("pack", packConfig.sTbName, packData, packDelData));
  724 + }
  725 + console.log(data,props, "onSaveData");
  726 +
  727 + return;
  728 + // 核价后保存
  729 + props.onSaveData(
  730 + {
  731 + data,
  732 + sClientType: "1",
  733 + loading: false,
  734 + sSysLogSrcId: masterData.sId,
  735 + bIsUnCcg: false,
  736 + },
  737 + props
  738 + );
  739 + }
  740 +};
  741 +const handleSaveData = async (params, props) => {
  742 + const {
  743 + token,
  744 + sModelsId,
  745 + currentId,
  746 + masterData,
  747 + masterConfig,
  748 + slaveConfig,
  749 + checkConfig,
  750 + billnosetting,
  751 + app,
  752 + sModelsType,
  753 + controlConfig,
  754 + materialsConfig,
  755 + processConfig,
  756 + colorConfig,
  757 + packConfig,
  758 + orderDetailConfig,
  759 + dispatch,
  760 + slaveChildConfig,
  761 + } = props;
  762 + const { userinfo } = app;
  763 + const { copyTo } = app.currentPane;
  764 + const onSendSocketMessage = props.handleSendSocketMessage;
  765 + const BtnSave = commonFunc.showMessage(app.commonConst, "BtnSave"); /* 保存 */
  766 + params.optName = BtnSave;
  767 + const returnData = await commonBusiness.saveData({ token, value: params, sModelsId });
  768 + if (commonUtils.isNotEmptyObject(returnData)) {
  769 + if (commonUtils.isNotEmptyObject(copyTo)) {
  770 + const { slaveData } = copyTo;
  771 + const sIdArray = [];
  772 + slaveData.forEach(item => {
  773 + const redisKey = item.sSlaveId;
  774 + sIdArray.push(redisKey);
  775 + });
  776 + const sId = sIdArray.toString();
  777 + onSendSocketMessage("copyfinish", "noAction", sId, userinfo.sId, null, null);
  778 + }
  779 + onSendSocketMessage("release", "noAction", currentId, userinfo.sId, null, null);
  780 + props.onSaveState({
  781 + enabled: false,
  782 + currentId: masterData.sId,
  783 + });
  784 + // 保存后更新panes,currentPane的checkedId,防止浏览器刷新时重新又变成新增。
  785 + const iPaneIndex = app.panes.findIndex(item => item.key === app.currentPane.key);
  786 + app.panes[iPaneIndex].checkedId = masterData.sId;
  787 + app.currentPane.checkedId = masterData.sId;
  788 + // dispatch({ type: "app/savePanesAndCurrentPane", payload: { panes: app.panes, currentPane: app.currentPane } });
  789 +
  790 + // if (billnosetting.bAutoCheck) {
  791 + // await this.handleAudit(1);
  792 + // } else {
  793 + // await this.handleGetData(masterConfig, slaveConfig, checkConfig);
  794 + // if ((sModelsType.includes("sales/salesOrder") || sModelsType.includes("manufacture/workOrder")) && !commonUtils.isEmpty(controlConfig)) {
  795 + // await this.handleGetMemoData(controlConfig, materialsConfig, processConfig, colorConfig, packConfig);
  796 + // } else if (sModelsType === "purchase/purchaseOrder") {
  797 + // await this.handleGetOneMemoData("orderDetail", orderDetailConfig);
  798 + // } else if (sModelsType === "sales/salesSgoods" && !commonUtils.isEmpty(slaveChildConfig)) {
  799 + // await this.handleGetOneMemoData("slaveChild", slaveChildConfig);
  800 + // }
  801 + // if (this.props.app.currentPane.refresh !== undefined) {
  802 + // this.props.app.currentPane.refresh();
  803 + // }
  804 + // }
  805 + props.onSaveState({
  806 + loading: false,
  807 + });
  808 + return true;
  809 + } else {
  810 + props.onSaveState({
  811 + loading: false,
  812 + });
  813 + return false;
  814 + }
  815 +};
  816 +const QuotationAllMaster = baseProps => {
  817 + const props = masterEvent(baseProps);
  818 + if (!props) {
  819 + return null; // 或者加载状态组件
  820 + }
  821 + if (props && !props.masterConfig) {
  822 + return null;
  823 + }
  824 +
  825 + return <QuotationAllprogressDetail {...props} />;
  826 +};
  827 +export default QuotationAllMaster;
... ...
src/routes/mobile/quotation/detail.js
1 1 import { connect } from "umi";
2   -import QuotationAllprogressDetail from "@/mobile/quotation/detailNew";
  2 +import QuotationAllMaster from "@/mobile/quotation/master";
3 3 import * as commonUtils from "@/utils/utils";
4 4 function quotationDetail({ dispatch, app, content, location, sModelsId, }) {
5   -
6   - const masterData = {
7   - handleType: "add",
8   - iPositiveColor: 4,
9   - maxBillNo: "sBillNo",
10   - sFormId: sModelsId,
11   - sId: commonUtils.createSid(),
12   - };
13 5 const quotationProps = {
14 6 app,
15 7 content,
16 8 dispatch,
17 9 location, // 只传递需要的部分
18 10 sModelsId,
19   - masterData,
20 11 quotationData:JSON.parse(location.state).quotationData
21 12 };
22   - return <QuotationAllprogressDetail {...quotationProps} />;
  13 + return <QuotationAllMaster {...quotationProps} />;
23 14 }
24 15  
25 16 const mapStateToProps = ({ app, content }) => ({
... ...