Commit cd7d7085255b22f91d0b57d27c6bcd85d4fde964

Authored by 陈鑫涛
1 parent d6aaa099

快速报价app

Too many changes to show.

To preserve performance only 6 of 10 files are displayed.

src/components/Common/BoxShowImgMaterial/indexNew.js
... ... @@ -11,8 +11,9 @@ const BoxShowImgMaterial = props => {
11 11 const nTextRefs = useRef(null);
12 12 const nTextRef = useRef(null);
13 13 const [boxKey, setBoxKey] = useState(new Date().getTime());
14   - const clientWidth = 300;
15   - const clientHeight = 250;
  14 + const { width, height, size } = props;
  15 + const clientWidth = width || 300;
  16 + const clientHeight = height || 250;
16 17 // 找出盒型信息
17 18 const { slaveData, selectedNode } = props.state;
18 19 const { boxModel } = props;
... ... @@ -24,8 +25,8 @@ const BoxShowImgMaterial = props => {
24 25 // 计算可以放置的盒子数量
25 26 const horizontalBoxes = Math.floor(dWlcd / dMachineLength);
26 27 const verticalBoxes = Math.floor(dWlkd / dMachineWidth);
27   - const scaleX = (clientWidth - 70) / (dWlcd);
28   - const scaleY = (clientHeight - 70) / (dWlkd);
  28 + const scaleX = (clientWidth - 100) / dWlcd;
  29 + const scaleY = (clientHeight - 70) / dWlkd;
29 30 // 动态生成多个 materialBox
30 31 const generateMaterialBoxes = () => {
31 32 const boxes = [];
... ... @@ -47,8 +48,8 @@ const BoxShowImgMaterial = props => {
47 48 position: "absolute",
48 49 bottom: "-30px",
49 50 left: "0px",
50   - width: `${(dMachineLength * scaleX)}px`,
51   - fontSize: "11px",
  51 + width: `${dMachineLength * scaleX}px`,
  52 + fontSize: `${size || 11}px`,
52 53 textAlign: "center",
53 54 height: "30px",
54 55 lineHeight: "30px",
... ... @@ -68,7 +69,7 @@ const BoxShowImgMaterial = props => {
68 69 position: "absolute",
69 70 top: "15px",
70 71 left: "5px",
71   - width: `${((dMachineLength * scaleX)) * 0.2}px`,
  72 + width: `${dMachineLength * scaleX * 0.2}px`,
72 73 backgroundColor: "#333",
73 74 height: "1px",
74 75 }}
... ... @@ -93,7 +94,7 @@ const BoxShowImgMaterial = props => {
93 94 position: "absolute",
94 95 top: "15px",
95 96 right: "5px",
96   - width: `${((dMachineLength *scaleX)) * 0.2}px`,
  97 + width: `${dMachineLength * scaleX * 0.2}px`,
97 98 backgroundColor: "#333",
98 99 height: "1px",
99 100 }}
... ... @@ -105,9 +106,9 @@ const BoxShowImgMaterial = props => {
105 106 position: "absolute",
106 107 top: "0",
107 108 right: "-30px",
108   - height: `${(dMachineWidth * scaleY)}px`,
109   - lineHeight: `${(dMachineWidth * scaleY)}px`,
110   - fontSize: "11px",
  109 + height: `${dMachineWidth * scaleY}px`,
  110 + lineHeight: `${dMachineWidth * scaleY}px`,
  111 + fontSize: `${size || 11}px`,
111 112 textAlign: "center",
112 113 width: "30px",
113 114 transform: `scale(${1 / scaleX}, ${1 / scaleY})`,
... ... @@ -127,7 +128,7 @@ const BoxShowImgMaterial = props => {
127 128 position: "absolute",
128 129 top: "5px",
129 130 left: "15px",
130   - height: `${((dMachineWidth * scaleY)) * 0.3}px`,
  131 + height: `${dMachineWidth * scaleY * 0.3}px`,
131 132 backgroundColor: "#333",
132 133 width: "1px",
133 134 }}
... ... @@ -152,7 +153,7 @@ const BoxShowImgMaterial = props => {
152 153 position: "absolute",
153 154 bottom: "5px",
154 155 left: "15px",
155   - height: `${((dMachineWidth * scaleY)) * 0.3}px`,
  156 + height: `${dMachineWidth * scaleY * 0.3}px`,
156 157 backgroundColor: "#333",
157 158 width: "1px",
158 159 }}
... ... @@ -168,26 +169,23 @@ const BoxShowImgMaterial = props => {
168 169 ((horizontalBoxes * verticalBoxes * (Number(dMachineLength) * Number(dMachineWidth))) / (Number(dWlcd) * Number(dWlkd))) *
169 170 100
170 171 ).toFixed(2);
171   - useEffect(
172   - () => {
173   - // setBoxKey(new Date().getTime());
174   - setTimeout(() => {
175   - // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current)
176   - if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) {
177   - // 计算父元素的缩放因子
178   - // 对父元素应用缩放
179   - boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`;
180   - boxRef.current.style.transformOrigin = "top left";
181   - // // 对子元素应用逆缩放
182   - textRef.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`;
183   - textRef.current.style.transformOrigin = "top left";
184   - textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`;
185   - textRefs.current.style.transformOrigin = "top left";
186   - }
187   - }, 0);
188   - },
189   - [slaveDataDetail]
190   - );
  172 + useEffect(() => {
  173 + // setBoxKey(new Date().getTime());
  174 + setTimeout(() => {
  175 + // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current)
  176 + if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) {
  177 + // 计算父元素的缩放因子
  178 + // 对父元素应用缩放
  179 + boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`;
  180 + boxRef.current.style.transformOrigin = "top left";
  181 + // // 对子元素应用逆缩放
  182 + textRef.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`;
  183 + textRef.current.style.transformOrigin = "top left";
  184 + textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`;
  185 + textRefs.current.style.transformOrigin = "top left";
  186 + }
  187 + }, 0);
  188 + }, [slaveDataDetail]);
191 189 const isMax = slaveDataDetail?.dMaxWidth * slaveDataDetail?.dMaxLength > slaveDataDetail?.dMachineLength * slaveDataDetail?.dMachineWidth;
192 190 const isDPartsLength = slaveDataDetail?.dPartsLength < slaveDataDetail?.dMaxLength && slaveDataDetail?.dPartsWidth < slaveDataDetail?.dMaxWidth;
193 191  
... ... @@ -216,8 +214,8 @@ const BoxShowImgMaterial = props =&gt; {
216 214 style={{
217 215 position: "absolute",
218 216 left: "0px",
219   - width: `${(dWlcd * (clientWidth - 50)) / (dWlcd + 60)}px`,
220   - fontSize: "11px",
  217 + width: `${(dWlcd * (clientWidth - 100)) / (dWlcd)}px`,
  218 + fontSize: `${size || 11}px`,
221 219 textAlign: "center",
222 220 height: "30px",
223 221 bottom: `-${100}px`,
... ... @@ -290,9 +288,9 @@ const BoxShowImgMaterial = props =&gt; {
290 288 position: "absolute",
291 289 top: "0",
292 290 right: "-140px",
293   - height: `${(dWlkd * scaleY)}px`,
294   - lineHeight: `${(dWlkd * scaleY)}px`,
295   - fontSize: "11px",
  291 + height: `${dWlkd * scaleY}px`,
  292 + lineHeight: `${dWlkd * scaleY}px`,
  293 + fontSize: `${size || 11}px`,
296 294 textAlign: "center",
297 295 width: "30px",
298 296 }}
... ... @@ -310,7 +308,7 @@ const BoxShowImgMaterial = props =&gt; {
310 308 position: "absolute",
311 309 top: "5px",
312 310 left: "15px",
313   - height: `${((dWlkd * scaleY)) * 0.3}px`,
  311 + height: `${dWlkd * scaleY * 0.3}px`,
314 312 backgroundColor: "#333",
315 313 width: "1px",
316 314 }}
... ... @@ -335,7 +333,7 @@ const BoxShowImgMaterial = props =&gt; {
335 333 position: "absolute",
336 334 bottom: "5px",
337 335 left: "15px",
338   - height: `${((dWlkd * scaleY)) * 0.3}px`,
  336 + height: `${dWlkd * scaleY * 0.3}px`,
339 337 backgroundColor: "#333",
340 338 width: "1px",
341 339 }}
... ...
src/components/Common/Typesetting/typesetting.js
... ... @@ -17,6 +17,9 @@ const Typesetting = props =&gt; {
17 17 slaveRowData,
18 18 state,
19 19 onSaveDPartsLength,
  20 + boxWidth,
  21 + boxHeight,
  22 + textSize,
20 23 } = props;
21 24 console.log("🚀 ~ typesettingsss:", props)
22 25 if (!slaveRowData) return
... ... @@ -56,8 +59,8 @@ const Typesetting = props =&gt; {
56 59 const typesettingBox = useRef(null);
57 60 const typesettingBoxs = useRef(null);
58 61 // 获取外层盒子尺寸
59   - const clientWidth = 400;
60   - const clientHeight = 300;
  62 + const clientWidth = boxWidth || 400;
  63 + const clientHeight = boxHeight || 300;
61 64 // 动态计算边距的总和
62 65 const totalLeftMargin = dZBLB + dYBLB;
63 66 const totalTopMargin = dSBLB + dXBLB;
... ... @@ -548,8 +551,9 @@ const Typesetting = props =&gt; {
548 551 }, 0); // 使用 0 延迟,将任务放入事件队列
549 552 }
550 553 const isMax = slaveDataDetail?.dMaxLength && Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength);
  554 + console.log("🚀 ~ isMax:", isMax,slaveDataDetail,slaveRowData)
551 555 const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length;
552   - console.log(innerDivs,'innerDivs');
  556 + console.log(innerDivs,cols,rows,'innerDivs');
553 557  
554 558 const onClick = () => {
555 559 setIsModalOpen(true);
... ... @@ -609,7 +613,7 @@ const Typesetting = props =&gt; {
609 613 position: "absolute",
610 614 bottom: "-32px",
611 615 left: 0,
612   - fontSize: "11px",
  616 + fontSize: `${textSize || 11}px`,
613 617 textAlign: "center",
614 618 color: "#333",
615 619 transform: `scale(${1 / scaleXD}, ${1 / scaleYD})`,
... ... @@ -653,7 +657,7 @@ const Typesetting = props =&gt; {
653 657 position: "absolute",
654 658 top: 0,
655 659 right: "-15px",
656   - fontSize: "11px",
  660 + fontSize: `${textSize || 11}px`,
657 661 lineHeight: `${materialWidth * scaleYD}px`,
658 662 color: "#333",
659 663 transform: `scale(${1 / scaleXD}, ${1 / scaleYD})`,
... ... @@ -729,7 +733,7 @@ const Typesetting = props =&gt; {
729 733 width: `${maxWidth * scaleXD}px`,
730 734 height: "30px",
731 735 lineHeight: "30px",
732   - fontSize: "11px",
  736 + fontSize: `${textSize || 11}px`,
733 737 transform: `scale(${1 / scaleXD}, ${1 / scaleYD})`,
734 738 transformOrigin: "top left",
735 739 }}
... ... @@ -783,7 +787,7 @@ const Typesetting = props =&gt; {
783 787 width: `${30}px`,
784 788 height: `${maxHeight * scaleYD}px`,
785 789 lineHeight: `${maxHeight * scaleYD}px`,
786   - fontSize: "11px",
  790 + fontSize: `${textSize || 11}px`,
787 791 transform: `scale(${1 / scaleXD}, ${1 / scaleYD})`,
788 792 transformOrigin: "top left",
789 793 }}
... ...
src/components/QuickQuote/index.jsx
... ... @@ -81,7 +81,6 @@ const QuickQuoteEvent = props =&gt; {
81 81  
82 82 const [state, setState] = useState(addState.onGetFilterState(sQuoConfig, true));
83 83 const { formData = [], masterConfig } = state;
84   -
85 84 const { bLinkFieledClick } = props;
86 85 const [hideBackBtn, setHideBackBtn] = useState(false);
87 86 const [enabled, setEnabled] = useState(props.enabled);
... ... @@ -94,7 +93,6 @@ const QuickQuoteEvent = props =&gt; {
94 93 useEffect(() => {
95 94 const { masterConfig, token } = props;
96 95 const quickQuoteConfig = masterConfig.gdsconfigformslave.find(item => item.sControlName === "BtnQuickQuote") || {};
97   - console.log("🚀 ~ useEffect ~ masterConfig:", masterConfig)
98 96 const { sActiveId } = quickQuoteConfig;
99 97  
100 98 const configUrl = `${commonConfig.server_host}business/getModelBysId/${sActiveId}?sModelsId=${sActiveId}`;
... ... @@ -211,7 +209,6 @@ const QuickQuoteEvent = props =&gt; {
211 209 }
212 210  
213 211 const { selectedNode = {}, slaveConfig } = state;
214   - console.log("🚀 ~ slaveConfig:", slaveConfig)
215 212 const { showName: sTreeNodeName } = selectedNode;
216 213 const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel);
217 214 if (name.includes("slaveDown")) {
... ... @@ -909,6 +906,7 @@ const QuickQuoteEvent = props =&gt; {
909 906 // 入口
910 907 const QuickQuote = baseProps => {
911 908 const props = QuickQuoteEvent(baseProps);
  909 + console.log("🚀 ~ QuickQuote:", props)
912 910  
913 911 const [treeClassName, setTreeClassName] = useState("");
914 912  
... ... @@ -921,6 +919,7 @@ const QuickQuote = baseProps =&gt; {
921 919 }, []);
922 920  
923 921 return (
  922 +
924 923 <div className={styles.quickQuote}>
925 924 <div className={styles.content}>
926 925 {!props.hideBackBtn && (
... ... @@ -1075,7 +1074,10 @@ const TreeComponent = props =&gt; {
1075 1074 selectedNode: select.selectedNodes[0]?.treeNode || {},
1076 1075 masterData: { ...masterData, sProductName: sProductName || select.node.title, sProductUnit: sProductUnit || select.node.treeNode.sUnit },
1077 1076 };
  1077 +
1078 1078 });
  1079 + console.log(props,'Tree');
  1080 +
1079 1081 }}
1080 1082 // defaultSelectedKeys={[activeTree]}
1081 1083 defaultExpandAll={true}
... ... @@ -1238,7 +1240,6 @@ const MasterComponent = props =&gt; {
1238 1240 const BoxComponent = props => {
1239 1241 const { dividerProps, state, boxModel } = props;
1240 1242 const { masterData = {}, slaveConfig, slaveData = [], selectedNode = {}, downAbleConfigs = [], finishedConfigs = [], boxConfig = {} } = state;
1241   - console.log("🚀 ~ slaveConfig333:", slaveConfig)
1242 1243 if (!slaveConfig) return "";
1243 1244  
1244 1245 const { bBox } = selectedNode;
... ...
src/mobile/components/SelectInput.jsx
... ... @@ -10,12 +10,16 @@ import debounce from &quot;lodash/debounce&quot;;
10 10  
11 11 const SelectInput = props => {
12 12 console.log("🚀 ~ selectInputValue:", props);
13   - const [value, setValue] = useState("");
  13 + const [value, setValue] = useState(props.name || ""); // 如果存在 name 属性,将其值赋值给 value
14 14 const [values, setValues] = useState("");
15 15 const [searchValue, setSearchValue] = useState("");
16 16 const [visible, setVisible] = useState(false);
17 17 const { sId } = props.formData || {};
18   - const { sModelsId, bCanInput, sValue } = props || {};
  18 + const { sModelsId, bCanInput, sValue, name, id, No } = props || {};
  19 +
  20 + useEffect(() => {
  21 + setValue(props.name || ""); // 动态更新 value
  22 + }, [props.name]);
19 23  
20 24 const [columns, setColumns] = useState([]);
21 25 const [coplyColumns, setCopyColumns] = useState(columns);
... ... @@ -29,8 +33,9 @@ const SelectInput = props =&gt; {
29 33 };
30 34 commonServices.postValueService(props.app.token, body, url).then(res => {
31 35 if (res.data.code === 1) {
  36 + console.log("🚀 ~ commonServices.postValueService ~ res.data:", res.data)
32 37 const list = res.data.dataset.rows?.map(item => ({
33   - label: item.sCustomerName,
  38 + label: item.sCustomerName || item.sName,
34 39 value: item.sId,
35 40 }));
36 41 setColumns(list);
... ... @@ -74,7 +79,7 @@ const SelectInput = props =&gt; {
74 79 useCallback;
75 80 useEffect(() => {
76 81 if (!sValue) return;
77   - setValue(sValue)
  82 + setValue(sValue);
78 83 }, [sValue]);
79 84 useCallback;
80 85  
... ...
src/mobile/quotation/detail.jsx
... ... @@ -23,10 +23,68 @@ const QuotationAllprogressDetail = props =&gt; {
23 23 };
24 24  
25 25 const QuotationDetail = props => {
26   - console.log("🚀 ~ propssss:", JsonData);
27 26 const { location, app, sModelsId } = props;
28 27 const { token } = app;
29 28 const [state, setState] = useState(null);
  29 + const addState = {};
  30 +
  31 + // addState.onGetFilterState = (state, bInit) => {
  32 + // const result = Object.keys(state).reduce((pre, cur) => {
  33 + // if (cur.endsWith("Column") || cur.endsWith("Config") || ["formData", "treeData", "downAbleConfigs", "finishedConfigs"].includes(cur)) {
  34 + // return pre;
  35 + // }
  36 +
  37 + // pre[cur] = state[cur];
  38 + // return pre;
  39 + // }, {});
  40 +
  41 + // const { slaveData = [], manyData = [] } = result;
  42 + // const materialInfoFields = [
  43 + // "sMaterialsName",
  44 + // "sMaterialsNo",
  45 + // "sMaterialsId",
  46 + // "sAuxiliaryUnit",
  47 + // "sMaterialsUnit",
  48 + // "bReel",
  49 + // "dCoefficient",
  50 + // "bInverse",
  51 + // "sMaterialsStyle",
  52 + // "sComputeId",
  53 + // "sReComputeId",
  54 + // "dGramWeight",
  55 + // "sReConversionComputeId",
  56 + // "sConversionComputeId",
  57 + // "sMaterialsType",
  58 + // "bComMaterials",
  59 + // "dWlcd",
  60 + // "dWlkd",
  61 + // ];
  62 + // const slaveDataNew = bInit
  63 + // ? slaveData.map(item => {
  64 + // const { materialsInfo = [], sMaterialsName } = item;
  65 + // if (!materialsInfo.length && sMaterialsName) {
  66 + // return {
  67 + // ...item,
  68 + // materialsInfo: [
  69 + // materialInfoFields.reduce((pre, cur) => {
  70 + // pre[cur] = item[cur];
  71 + // return pre;
  72 + // }, {}),
  73 + // ],
  74 + // };
  75 + // } else {
  76 + // return item;
  77 + // }
  78 + // })
  79 + // : slaveData;
  80 +
  81 + // const manyDataNew = manyData.map(item => {
  82 + // delete item.manyData;
  83 + // return item;
  84 + // });
  85 +
  86 + // return { ...result, slaveData: slaveDataNew, manyData: manyDataNew };
  87 + // };
30 88  
31 89 // 初始化状态
32 90 const { formData = [] } = state || {};
... ... @@ -43,7 +101,6 @@ const QuotationDetail = props =&gt; {
43 101 // setState(pre => ({ ...pre, formData }));
44 102 // }
45 103 // });
46   - // console.log("🚀 ~ commonServices.getService ~ formData:", formData);
47 104 // }, []);
48 105 // useEffect(() => {
49 106 // // 安全地解析 state
... ... @@ -69,6 +126,9 @@ const QuotationDetail = props =&gt; {
69 126 // console.error("Error fetching data:", error);
70 127 // });
71 128 // }, [location, app]);
  129 +
  130 + // const sQuoConfig = commonUtils.convertStrToObj(JsonData.masterData.sQuoConfig, {});
  131 + // const [state, setState] = useState(addState.onGetFilterState(sQuoConfig, true));
72 132 // 主表
73 133 const list = JsonData.state?.masterConfig?.gdsconfigformslave.filter(item => item.sName && item.bVisible);
74 134 // 客户
... ... @@ -93,7 +153,7 @@ const QuotationDetail = props =&gt; {
93 153 // state,
94 154 // masterConfig,
95 155 };
96   - console.log("🚀 ~ baseProps:", baseProps);
  156 +
97 157 return (
98 158 <div>
99 159 <div>{quotationData?.showName || "Loading..."}</div>
... ... @@ -186,13 +246,12 @@ const QuotationTabs = props =&gt; {
186 246 };
187 247  
188 248 const BoxComponent = props => {
189   - console.log("🚀 ~ BoxComponent:", props);
190 249 const { state, boxModel } = props;
191 250 const { activeKey, slaveConfig, masterData, selectedNode, boxConfig, slaveData } = state || {};
192 251 const { sModelsId } = props;
193 252 const [selectList, setSelectList] = useState([]);
194 253 const [searchValue, setSearchValue] = useState("");
195   - const [slaveRowData, setSlaveRowData] = useState(null);
  254 +
196 255 useEffect(() => {
197 256 // 17428091410008594700322758474000
198 257 const sId = "17428091410008594700322758474000";
... ... @@ -217,12 +276,8 @@ const BoxComponent = props =&gt; {
217 276 }
218 277 });
219 278 // 获取盒型
220   - }, [activeKey]);
221   - //
222   - useEffect(() => {
223   - props.setState(pre => ({ ...pre, slaveRowData }));
224   - }, [slaveRowData]);
225   -
  279 + }, [boxModel]);
  280 + const slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {};
226 281 const { sColumnNameConfig } = slaveRowData || {};
227 282 const upAbleConfigsExtra = commonUtils.convertStrToObj(sColumnNameConfig, []).map(item => ({
228 283 ...item,
... ... @@ -343,7 +398,6 @@ const BoxComponent = props =&gt; {
343 398 boxConfigList = boxConfig?.gdsconfigformslave?.filter(item => item.bVisible && showNameKeyList.includes(item.sName)) || [];
344 399 }
345 400 const newConfig = [...boxConfigList, ...config];
346   - console.log("🚀 ~ newConfig:", newConfig);
347 401  
348 402 return {
349 403 ...props,
... ... @@ -358,19 +412,9 @@ const BoxComponent = props =&gt; {
358 412 const upViewProps12 = getUpViewPropsByITag(12);
359 413 // 拼板信息表单
360 414 const upViewProps20 = getUpViewPropsByITag(20);
361   - const slaveRowDatas = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {};
362 415 // const { calcMethodData = [], boxPicData = [], radioValue = calcMethodData[0]?.sCode } = slaveRowData;
363 416 const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []);
364 417 const radioValue = calcMethodData[0]?.sCode;
365   - console.log("🚀 ~ slaveRowDatas:", boxModel);
366   - const boxProps = {
367   - ...props,
368   - slaveRowData,
369   - dSBJJ: slaveRowDatas.dXBJJ,
370   - dZBJJ: slaveRowDatas.dYBJJ,
371   - radioValue: calcMethodData?.find(item => item.sCode === radioValue),
372   - // boxPicData,
373   - };
374 418 const [materialLength, setMaterialLength] = useState(0);
375 419 const [materialWidth, setMaterialWidth] = useState(0);
376 420 // 使用 useCallback 确保回调函数的稳定性
... ... @@ -455,7 +499,14 @@ const BoxComponent = props =&gt; {
455 499 }));
456 500 }
457 501 }, []);
458   - console.log("🚀 ~ upViewProps12:", boxProps);
  502 + const boxProps = {
  503 + ...props,
  504 + slaveRowData,
  505 + dSBJJ: slaveRowData.dXBJJ,
  506 + dZBJJ: slaveRowData.dYBJJ,
  507 + radioValue: calcMethodData?.find(item => item.sCode === radioValue),
  508 + // boxPicData,
  509 + };
459 510 return (
460 511 <div>
461 512 <Selector
... ... @@ -475,8 +526,10 @@ const BoxComponent = props =&gt; {
475 526 ...data,
476 527 ...Object.assign({}, ...slaveNewData),
477 528 };
478   -
479   - setSlaveRowData(rowData);
  529 + props.setState(prevState => ({
  530 + ...prevState,
  531 + slaveRowData: rowData,
  532 + }));
480 533 }
481 534 }}
482 535 />
... ... @@ -525,8 +578,7 @@ const BoxComponent = props =&gt; {
525 578 </Grid>
526 579 </div>
527 580 <div>
528   - 55555555
529   - <div style={{ width: "9.375rem", height: "9.375rem" }}>
  581 + <div style={{ width: "9.375rem", height: "9.375rem", position: "relative" }}>
530 582 <Typesetting {...boxProps} onSaveStates={handleSaveState} onSaveDPartsLength={onSaveDPartsLength} />
531 583 </div>
532 584 <div>{/* <ShowImgM {...showImgMProps} /> */}</div>
... ...
src/mobile/quotation/detailNew.jsx 0 → 100644
  1 +import { useRef, useEffect, useState, useCallback, useMemo } from "react";
  2 +import { history } from "umi";
  3 +import { Tabs, Selector, Grid, Image, Button, Checkbox, Switch } from "antd-mobile";
  4 +import { AddOutline, MinusOutline } from "antd-mobile-icons";
  5 +import commonConfig from "@/utils/config";
  6 +import * as commonServices from "@/services/services";
  7 +import * as commonFunc from "@/components/Common/commonFunc";
  8 +import * as commonBusiness from "@/components/Common/commonBusiness";
  9 +import styles from "./quotationDetail.less";
  10 +import SelectInput from "../components/SelectInput";
  11 +import JsonData from "./index.json";
  12 +import * as commonUtils from "@/utils/utils";
  13 +import Typesetting from "@/components/Common/Typesetting/typesetting";
  14 +import DynamicSVG from "@/components/Common/BoxDesignCompontent/svg";
  15 +import ShowImgM from "@/components/Common/BoxShowImgMaterial/indexNew";
  16 +const QuickQuoteEvent = props => {
  17 + console.log("🚀 ~ QuickQuoteEvent:", props);
  18 + const { location } = props;
  19 + const selectedNode = JSON.parse(location.state).quotationData;
  20 + const addState = {};
  21 + const [masterConfig, setMasterConfig] = useState(null);
  22 + const { sModelsId } = props;
  23 +
  24 + addState.onGetFilterState = (state, bInit) => {
  25 + const result = Object.keys(state).reduce((pre, cur) => {
  26 + if (cur.endsWith("Column") || cur.endsWith("Config") || ["formData", "treeData", "downAbleConfigs", "finishedConfigs"].includes(cur)) {
  27 + return pre;
  28 + }
  29 +
  30 + pre[cur] = state[cur];
  31 + return pre;
  32 + }, {});
  33 +
  34 + const { slaveData = [], manyData = [] } = result;
  35 + const materialInfoFields = [
  36 + "sMaterialsName",
  37 + "sMaterialsNo",
  38 + "sMaterialsId",
  39 + "sAuxiliaryUnit",
  40 + "sMaterialsUnit",
  41 + "bReel",
  42 + "dCoefficient",
  43 + "bInverse",
  44 + "sMaterialsStyle",
  45 + "sComputeId",
  46 + "sReComputeId",
  47 + "dGramWeight",
  48 + "sReConversionComputeId",
  49 + "sConversionComputeId",
  50 + "sMaterialsType",
  51 + "bComMaterials",
  52 + "dWlcd",
  53 + "dWlkd",
  54 + ];
  55 + const slaveDataNew = bInit
  56 + ? slaveData.map(item => {
  57 + const { materialsInfo = [], sMaterialsName } = item;
  58 + if (!materialsInfo.length && sMaterialsName) {
  59 + return {
  60 + ...item,
  61 + materialsInfo: [
  62 + materialInfoFields.reduce((pre, cur) => {
  63 + pre[cur] = item[cur];
  64 + return pre;
  65 + }, {}),
  66 + ],
  67 + };
  68 + } else {
  69 + return item;
  70 + }
  71 + })
  72 + : slaveData;
  73 +
  74 + const manyDataNew = manyData.map(item => {
  75 + delete item.manyData;
  76 + return item;
  77 + });
  78 +
  79 + return { ...result, slaveData: slaveDataNew, manyData: manyDataNew };
  80 + };
  81 +
  82 + const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {});
  83 +
  84 + const [state, setState] = useState(addState.onGetFilterState(sQuoConfig, true));
  85 +
  86 + const { formData = [] } = state;
  87 + const { bLinkFieledClick } = props;
  88 + const [hideBackBtn, setHideBackBtn] = useState(false);
  89 + const [enabled, setEnabled] = useState(props.enabled);
  90 + useEffect(() => {
  91 + setState(pre => ({ ...pre, selectedNode }));
  92 + }, []);
  93 + useEffect(() => {
  94 + setHideBackBtn(!bLinkFieledClick);
  95 + setEnabled(!bLinkFieledClick || props.enabled);
  96 + }, [bLinkFieledClick, props.enabled]);
  97 + useEffect(() => {
  98 + // 获取 masterConfig
  99 + const configUrl = `${commonConfig.server_host}business/getModelBysId/${"172129113112117428019179600"}?sModelsId=${"172129113112117428019179600"}`;
  100 + commonServices
  101 + .getService(props.app.token, configUrl)
  102 + .then(({ data: configReturn }) => {
  103 + if (configReturn.code === 1) {
  104 + const formData = configReturn.dataset.rows[0]?.formData;
  105 + setMasterConfig(formData);
  106 + setState(pre => ({ ...pre, masterConfig: formData, slaveConfig: formData[1] }));
  107 + }
  108 + })
  109 + .catch(error => {});
  110 + const formDataUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}`;
  111 + commonServices
  112 + .getService(props.app.token, formDataUrl)
  113 + .then(({ data: formDataReturn }) => {
  114 + if (formDataReturn.code === 1) {
  115 + const formDatas = formDataReturn.dataset.rows[0]?.formData;
  116 + setState(pre => ({ ...pre, formData: formDatas }));
  117 + }
  118 + })
  119 + .catch(error => {});
  120 + }, []);
  121 +
  122 + // 获取盒型定义配置
  123 + useEffect(() => {
  124 + if (!formData.length) return;
  125 + const sBoxActiveId = formData.find(item => item.sGrd === "slave")?.gdsconfigformslave?.find(item => item.sName === "sName")?.sActiveId;
  126 + if (!sBoxActiveId) return;
  127 + const { token } = props;
  128 + const configUrl = `${commonConfig.server_host}business/getModelBysId/${sBoxActiveId}?sModelsId=${sBoxActiveId}`;
  129 + commonServices.getService(token, configUrl).then(({ data: configReturn }) => {
  130 + if (configReturn.code === 1) {
  131 + const formData = configReturn.dataset.rows[0].formData;
  132 + setState(pre => ({ ...pre, boxConfig: formData[0] }));
  133 + }
  134 + });
  135 + }, [formData.length]);
  136 +
  137 + // 获取column
  138 + useEffect(() => {
  139 + if (!formData.length) return;
  140 +
  141 + let result = {};
  142 + for (let i = 0; i < formData.length; i++) {
  143 + const tableConfig = formData[i];
  144 + const { sGrd } = tableConfig;
  145 + if (!sGrd) continue;
  146 + const column = commonFunc.getHeaderConfig(tableConfig);
  147 + result = {
  148 + ...result,
  149 + [`${sGrd}Column`]: column,
  150 + [`${sGrd}Config`]: tableConfig,
  151 + };
  152 + }
  153 + setState(pre => ({ ...pre, ...result }));
  154 + }, [formData.length]);
  155 +
  156 + addState.onBackClick = () => {
  157 + props.onSaveState({ masterData: { ...props.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(state)) }, quickQuoteModel: false });
  158 + };
  159 +
  160 + addState.onDataChange = (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
  161 + const { masterData = {}, slaveData = [], selectedNode = {} } = state;
  162 +
  163 + const extraState = {
  164 + calcPriceFinished: false,
  165 + manyData: [],
  166 + };
  167 +
  168 + if (name === "master") {
  169 + const masterDataNew = { ...masterData, ...changeValue };
  170 + masterDataNew.handleType = masterDataNew.handleType || "update";
  171 + masterDataNew.sId = masterDataNew.sId || commonUtils.createSid();
  172 + if (sFieldName === "dProductQty") {
  173 + setState(pre => ({
  174 + ...pre,
  175 + dProductQty: changeValue.dProductQty,
  176 + }));
  177 + }
  178 +
  179 + setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
  180 + } else if (name.includes("slave")) {
  181 + const boxModel = name.replace("slaveUp", "").replace("slaveDown", "");
  182 + if (sFieldName === "sName") {
  183 + if (!changeValue.sName) return;
  184 + const dropDownDataSelected = dropDownData.find(item => item.sName === changeValue.sName);
  185 + const { sColumnNameConfig, sColumnNameConfigExclusion, sColumnNameConfigPic } = dropDownDataSelected;
  186 + const upAbleConfigsExtra = commonUtils.convertStrToObj(sColumnNameConfig, []).map(item => ({
  187 + ...item,
  188 + iColValue: item.iColValue || 6,
  189 + }));
  190 + const defaultData = commonFunc.getDefaultData({ gdsconfigformslave: upAbleConfigsExtra });
  191 + delete defaultData.sId;
  192 + delete dropDownDataSelected.sId;
  193 + changeValue = {
  194 + ...changeValue,
  195 + ...defaultData,
  196 + ...dropDownDataSelected,
  197 + upAbleConfigsExtra,
  198 + calcMethodData: commonUtils.convertStrToObj(sColumnNameConfigExclusion, []),
  199 + boxPicData: commonUtils.convertStrToObj(sColumnNameConfigPic, []),
  200 + };
  201 + }
  202 +
  203 + const { selectedNode = {}, slaveConfig } = state;
  204 + const { showName: sTreeNodeName } = selectedNode;
  205 + const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel);
  206 + if (name.includes("slaveDown")) {
  207 + const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue[sFieldName]);
  208 + dropDownDataSelected && (dropDownDataSelected[sFieldName] = dropDownDataSelected.sProcessName);
  209 + const extraRowData = {};
  210 + // if (dropDownDataSelected.sProcessName === "胶印") {
  211 + // extraRowData.sPrintProcessId = dropDownDataSelected.sId;
  212 + // }
  213 + if (iIndex === -1) {
  214 + slaveData.push({
  215 + sId: commonUtils.createSid(),
  216 + handleType: "add",
  217 + sBoxModel: boxModel,
  218 + sTreeNodeName,
  219 + sBackProcessData: dropDownDataSelected === undefined ? [] : [dropDownDataSelected],
  220 + ...extraRowData,
  221 + });
  222 + } else {
  223 + const sBackProcessData = slaveData[iIndex].sBackProcessData || [];
  224 + const iIndex1 = sBackProcessData.findIndex(item => item.sProductClassifyId === dropDownData[0].sProductClassifyId);
  225 + if (iIndex1 === -1) {
  226 + dropDownDataSelected !== undefined && sBackProcessData.push(dropDownDataSelected);
  227 + } else {
  228 + if (dropDownDataSelected === undefined) {
  229 + sBackProcessData.splice(iIndex1, 1);
  230 + } else {
  231 + sBackProcessData[iIndex1] = dropDownDataSelected;
  232 + }
  233 + }
  234 + slaveData[iIndex].sBackProcessData = sBackProcessData;
  235 +
  236 + slaveData[iIndex] = {
  237 + ...slaveData[iIndex],
  238 + ...extraRowData,
  239 + handleType: slaveData[iIndex].handleType || "update",
  240 + };
  241 + }
  242 + } else {
  243 + if (iIndex === -1) {
  244 + slaveData.push({
  245 + ...changeValue,
  246 + sId: commonUtils.createSid(),
  247 + handleType: "add",
  248 + sBoxModel: boxModel,
  249 + sTreeNodeName,
  250 + });
  251 + } else {
  252 + slaveData[iIndex] = {
  253 + ...(sFieldName === "sName"
  254 + ? {
  255 + sId: slaveData[iIndex].sId,
  256 + sBoxModel: boxModel,
  257 + sTreeNodeName,
  258 + ...commonFunc.getDefaultData(slaveConfig),
  259 + }
  260 + : slaveData[iIndex]),
  261 + ...changeValue,
  262 + handleType: slaveData[iIndex].handleType || "update",
  263 + };
  264 + }
  265 + }
  266 + const saveIndex = slaveData.findIndex(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel);
  267 + const materialStyleLength = slaveData[saveIndex].materialLength || 0;
  268 + const materialStyleWidth = slaveData[saveIndex].materialWidth || 0;
  269 + slaveData[saveIndex] = {
  270 + ...slaveData[saveIndex],
  271 + sMachineStyle: materialStyleLength + "*" + materialStyleWidth,
  272 + dMachineQty: slaveData[saveIndex].dProductQty ? slaveData[saveIndex].dProductQty : masterData.dProductQty,
  273 + };
  274 + if (sFieldName === "dWlcd" || sFieldName === "dWlkd") {
  275 + const horizontalBoxes = Math.floor(slaveData[saveIndex]?.dWlkd / slaveData[saveIndex]?.materialWidth);
  276 + const verticalBoxes = Math.floor(slaveData[saveIndex]?.dWlcd / slaveData[saveIndex]?.materialLength);
  277 + const newDMaterialsKQty = horizontalBoxes * verticalBoxes;
  278 + slaveData[saveIndex] = {
  279 + ...slaveData[saveIndex],
  280 + dMachineQty: Math.floor(slaveData[saveIndex].dMachineQty / slaveData[saveIndex].dSinglePQty),
  281 + dMaterialsKQty: newDMaterialsKQty,
  282 + };
  283 + }
  284 +
  285 + if (sFieldName === "sName") {
  286 + slaveData[saveIndex] = {
  287 + ...slaveData[saveIndex],
  288 + dMaxLength: Number(selectedNode.sMachineStyle.split("*")[0]),
  289 + dMaxWidth: Number(selectedNode.sMachineStyle.split("*")[1]),
  290 + };
  291 + }
  292 +
  293 + setState(pre => ({ ...pre, slaveData, ...extraState }));
  294 + } else if (name === "finished") {
  295 + const { productProcessInfo = [] } = masterData;
  296 + const dropDownDataSelected = dropDownData.find(item => item.sId === changeValue[sFieldName]);
  297 + dropDownDataSelected && (dropDownDataSelected[sFieldName] = dropDownDataSelected.sProcessName);
  298 + const iIndex = productProcessInfo.findIndex(item => item.sProductClassifyId === dropDownData[0].sProductClassifyId);
  299 + if (iIndex === -1) {
  300 + dropDownDataSelected !== undefined && productProcessInfo.push(dropDownDataSelected);
  301 + } else {
  302 + if (dropDownDataSelected === undefined) {
  303 + productProcessInfo.splice(iIndex, 1);
  304 + } else {
  305 + productProcessInfo[iIndex] = dropDownDataSelected;
  306 + }
  307 + }
  308 + const cpProcessName = productProcessInfo.map(item => item.sProcessName).join(",");
  309 + const masterDataNew = { ...masterData, cpProcessName, productProcessInfo };
  310 + masterDataNew.handleType = masterDataNew.handleType || "update";
  311 + masterDataNew.sId = masterDataNew.sId || commonUtils.createSid();
  312 + setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
  313 + }
  314 + };
  315 +
  316 + addState.onGetAllDelData = () => {
  317 + const {
  318 + slaveData = [],
  319 + slaveDelData: slaveDelDataOld = [],
  320 + controlData = [],
  321 + controlDelData: controlDelDataOld = [],
  322 + materialsData = [],
  323 + materialsDelData: materialsDelDataOld = [],
  324 + processData = [],
  325 + processDelData: processDelDataOld = [],
  326 + manyqtysData = [],
  327 + manyqtysDelData: manyqtysDelDataOld = [],
  328 + colorData = [],
  329 + colorDelData: colorDelDataOld = [],
  330 + packData = [],
  331 + packDelData: packDelDataOld = [],
  332 + } = props;
  333 + const addState = {
  334 + slaveDelData: [...slaveDelDataOld, ...slaveData.map(item => ({ ...item, handleType: "del" }))],
  335 + controlDelData: [...controlDelDataOld, ...controlData.map(item => ({ ...item, handleType: "del" }))],
  336 + materialsDelData: [...materialsDelDataOld, ...materialsData.map(item => ({ ...item, handleType: "del" }))],
  337 + processDelData: [...processDelDataOld, ...processData.map(item => ({ ...item, handleType: "del" }))],
  338 + manyqtysDelData: [...manyqtysDelDataOld, ...manyqtysData.map(item => ({ ...item, handleType: "del" }))],
  339 + colorDelData: [...colorDelDataOld, ...colorData.map(item => ({ ...item, handleType: "del" }))],
  340 + packDelData: [...packDelDataOld, ...packData.map(item => ({ ...item, handleType: "del" }))],
  341 + };
  342 + return addState;
  343 + };
  344 +
  345 + // 存草稿
  346 + const onSaveDraft = (nextState = state, nextProps = props) => {
  347 + const { masterData = {} } = nextState;
  348 + const { sProductName, sProductNo, sCustomerName, sCustomerId, sCustomerNo } = masterData;
  349 + if (!sProductName || !sCustomerName) {
  350 + message.info("请先填写客户名称和产品名称");
  351 + return;
  352 + }
  353 +
  354 + props.onSaveState(
  355 + {
  356 + ...addState.onGetAllDelData(),
  357 + masterData: { ...nextProps.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(nextState)) },
  358 + slaveData: nextProps.slaveData.map(item => {
  359 + return {
  360 + ...item,
  361 + sProductName: sProductName,
  362 + sProductNo: sProductNo,
  363 + sCustomerName: sCustomerName,
  364 + sCustomerId: sCustomerId,
  365 + sCustomerNo: sCustomerNo,
  366 + handleType: "add",
  367 + };
  368 + }),
  369 + controlData: nextProps.controlData.map(item => {
  370 + return {
  371 + ...item,
  372 + // sPartsName: sProductName,
  373 + handleType: "add",
  374 + };
  375 + }),
  376 + materialsData: nextProps.materialsData?.map(item => {
  377 + return {
  378 + ...item,
  379 + handleType: "add",
  380 + };
  381 + }),
  382 + processData: nextProps.processData?.map(item => {
  383 + return {
  384 + ...item,
  385 + handleType: "add",
  386 + };
  387 + }),
  388 + manyqtysData: nextProps.manyqtysData?.map(item => {
  389 + return {
  390 + ...item,
  391 + handleType: "add",
  392 + };
  393 + }),
  394 + colorData: nextProps.colorData?.map(item => {
  395 + return {
  396 + ...item,
  397 + handleType: "add",
  398 + };
  399 + }),
  400 + packData: nextProps.packData?.map(item => {
  401 + return {
  402 + ...item,
  403 + handleType: "add",
  404 + };
  405 + }),
  406 + loading: true,
  407 + },
  408 + () => {
  409 + props.onButtonClick("BtnDraft");
  410 + }
  411 + );
  412 + };
  413 +
  414 + addState.onSaveDraft = onSaveDraft;
  415 +
  416 + // 核价按钮
  417 + addState.handleCalcPrice = async () => {
  418 + const { masterData = {}, slaveData = [], selectedNode = {}, extraParts = {} } = state;
  419 +
  420 + if (commonUtils.isEmptyObject(selectedNode)) {
  421 + message.error("请先选择产品");
  422 + return;
  423 + }
  424 + const mustFieldsMap = {
  425 + sCustomerName: "请先选择客户名称",
  426 + sProductName: "请先输入产品名称",
  427 + sProductUnit: "请先输入产品单位",
  428 + dLength: "请先输入长度",
  429 + dWidth: "请先输入宽度",
  430 + dProductQty: "请先输入数量",
  431 + };
  432 +
  433 + const checkResult = Object.keys(mustFieldsMap).find(item => masterData[item] === undefined);
  434 + if (checkResult) {
  435 + message.error(mustFieldsMap[checkResult]);
  436 + return;
  437 + }
  438 +
  439 + const { bBox, showName, sId } = selectedNode;
  440 + let { sAllPartsName } = selectedNode;
  441 + if (!sAllPartsName) {
  442 + sAllPartsName = showName;
  443 + }
  444 +
  445 + const slaveRowDataList =
  446 + slaveData
  447 + .filter(item => item.sTreeNodeName === showName && item.materialsInfo && !item.materialsInfo.some(x => !x.sMaterialsName))
  448 + .filter(item => (bBox ? item.sName : true))
  449 + .filter(item => item.sPrint !== undefined && item.sColor !== undefined && item.iPrintModePo !== undefined) || [];
  450 + if (!slaveRowDataList.length) {
  451 + message.error("请至少保证一个部件的材料信息填写完整");
  452 + return;
  453 + }
  454 +
  455 + setState(pre => ({ ...pre, calcPriceLoading: true, calcPriceFinished: false }));
  456 +
  457 + const { sModelsId, token, sBoxModel } = props;
  458 + const extraPartsList = extraParts[showName] || [];
  459 + const sAllPartsNameList = [...sAllPartsName.split(","), ...extraPartsList];
  460 +
  461 + const masterDataNew = {
  462 + ...masterData,
  463 + cpProcessName: masterData.cpProcessName || "",
  464 + productProcessInfo: masterData.productProcessInfo?.map(item => ({ ...item, sProcessId: item.sId })) || [],
  465 + sProductClassifyId: sId,
  466 + sProductName1: masterData.sProductName,
  467 + dProductWidth: masterData.dWidth,
  468 + dProductLength: masterData.dLength,
  469 + dProductHeight: masterData.dHeight,
  470 + sProductStyle:
  471 + masterData.dHeight !== undefined
  472 + ? `${masterData.dLength}*${masterData.dWidth}*${masterData.dHeight}`
  473 + : `${masterData.dLength}*${masterData.dWidth}`,
  474 + };
  475 + const paramMap = {
  476 + bQuotation: true,
  477 + ...masterDataNew,
  478 + product: masterDataNew,
  479 + sPartsStyle: "",
  480 + partsInfo: sAllPartsNameList
  481 + .map(partName => {
  482 + const temp = {
  483 + ...slaveData.find(item => item.sTreeNodeName === showName && item.sBoxModel === partName),
  484 + };
  485 + return temp;
  486 + })
  487 + .filter(item => commonUtils.isNotEmptyObject(item) && item.materialsInfo && item.materialsInfo.length)
  488 + .map(item => {
  489 + return {
  490 + ...Object.keys(item).reduce((pre, cur) => {
  491 + if (typeof item[cur] !== "object") {
  492 + pre[cur] = item[cur];
  493 + }
  494 + return pre;
  495 + }, {}),
  496 + dPartsQty: masterData.dProductQty,
  497 + iPositiveColor: Number(item.sColor),
  498 + sPartsName: item.sBoxModel,
  499 + materialsInfo: item.materialsInfo?.filter(x => commonUtils.isNotEmptyObject(x)),
  500 + processInfo:
  501 + item.sBackProcessData?.map(item => ({
  502 + ...item,
  503 + sProcessId: item.sId,
  504 + })) || [],
  505 + };
  506 + }),
  507 + };
  508 + paramMap.sPartsStyle = (paramMap.partsInfo[0].dPartsLength || 0) + "*" + (paramMap.partsInfo[0].dPartsWidth || 0);
  509 + if (paramMap.sPartsStyle === "0*0") {
  510 + delete paramMap.sPartsStyle;
  511 + }
  512 + const url = `${commonConfig.server_host}calculationStd/countMoney?sModelsId=${sModelsId}`;
  513 + const dataReturn = (await commonServices.postValueService(token, paramMap, url)).data;
  514 +
  515 + if (dataReturn.code === 1) {
  516 + const { slaveConfig, masterData: masterData1, materialsConfig, processConfig, sModelsId, app } = props;
  517 + const { productClassify, partsNewInfo = [], productProcessInfo, partsInfo: partsOldInfo } = dataReturn.dataset.rows[0];
  518 +
  519 + const slaveData = [];
  520 + const controlData = [];
  521 + const materialsData = [];
  522 + let processData = [];
  523 + let tableDataRow = {};
  524 + for (const item of slaveConfig.gdsconfigformslave) {
  525 + tableDataRow[item.sName] = masterData[item.sName];
  526 + }
  527 + tableDataRow.sId = commonUtils.createSid();
  528 + tableDataRow.handleType = "add";
  529 + tableDataRow.iOrder = 1;
  530 + tableDataRow.sParentId = masterData.sId;
  531 + // const productIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'slave', 'sProductName');
  532 + let productIdDropDown;
  533 + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === "sProductName");
  534 + if (slaveIndex > -1) {
  535 + const sqlDropDownData = await props.getSqlDropDownData(sModelsId, "slave", slaveConfig.gdsconfigformslave[slaveIndex], tableDataRow);
  536 + productIdDropDown = sqlDropDownData.dropDownData;
  537 + }
  538 + const iProductIdIndex = commonUtils.isEmptyArr(productIdDropDown)
  539 + ? -1
  540 + : productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId);
  541 + if (iProductIdIndex === -1) {
  542 + tableDataRow.sProductId = tableDataRow.sProductName;
  543 + const tableDataRowNew = { ...tableDataRow, ...masterDataNew };
  544 + const extraProps = {
  545 + sProductId: tableDataRowNew.sProductName,
  546 + sProductName: tableDataRowNew.sProductName,
  547 + sProductStyle: tableDataRowNew.sProductStyle,
  548 + sProductUnit: tableDataRowNew.sProductUnit,
  549 + sProductNo: tableDataRowNew.sProductNo,
  550 + sCustomerProductNo: tableDataRowNew.sCustomerProductNo,
  551 + sProductClassifyId: tableDataRowNew.sProductClassifyId,
  552 + sProductClassifyName: tableDataRowNew.sProductClassifyName,
  553 + };
  554 + tableDataRow = { ...tableDataRow, ...extraProps };
  555 + tableDataRow.sProductInfo = JSON.stringify(extraProps);
  556 + } else {
  557 + tableDataRow.sProductInfo = "";
  558 + }
  559 + slaveData.push(tableDataRow);
  560 + const sInfoArr = [];
  561 + let errorFlag = false;
  562 + if (!commonUtils.isEmptyArr(partsOldInfo)) {
  563 + partsOldInfo.forEach(item => {
  564 + if (commonUtils.isNotEmptyObject(item) && !commonUtils.isEmpty(item.errorFlag)) {
  565 + errorFlag = true;
  566 + props.getServiceError({ msg: `${item.sPartsName} ${item.errorFlag}` });
  567 + }
  568 + });
  569 + }
  570 + if (errorFlag) {
  571 + setState(pre => ({ ...pre, calcPriceLoading: false }));
  572 + return;
  573 + }
  574 +
  575 + // 返回数据赋值
  576 + const { slaveData: stateSlaveData = [] } = state;
  577 + partsNewInfo.forEach(item => {
  578 + const slaveRowData = stateSlaveData.find(row => item.sTreeNodeName === row.sTreeNodeName && item.sBoxModel === row.sBoxModel);
  579 + slaveRowData.dMachineQty = item.dMachineQty;
  580 + slaveRowData.dAuxiliaryQty = item.materialsInfo?.[0]?.dAuxiliaryQty;
  581 + slaveRowData.sPrint = item.sProcessName;
  582 + setState(pre => ({ ...pre, slaveData: stateSlaveData }));
  583 + });
  584 +
  585 + if (props.app.userinfo.sType === "sysadmin") {
  586 + /* 超级管理员,弹窗显示接口返回的sInfo */
  587 + partsNewInfo.forEach(item => {
  588 + const { sPartsName, sInfo } = item;
  589 + const sInfoObj = {};
  590 + sInfoObj.sPartsName = sPartsName;
  591 + sInfoObj.sInfo = sInfo;
  592 + sInfoArr.push(sInfoObj);
  593 + });
  594 + }
  595 +
  596 + const bProcessAssort = true;
  597 + let returnProcessAssort = [];
  598 + let processAssignAssort = "";
  599 + let dropDownDataProcessName;
  600 + if (bProcessAssort) {
  601 + const dataUrl = `${commonConfig.server_host}salesorder/getProcessAssort?sModelsId=${sModelsId}`;
  602 + const dataProcessAssort = (await commonServices.postValueService(token, {}, dataUrl)).data;
  603 + if (dataProcessAssort.code === 1) {
  604 + returnProcessAssort = dataProcessAssort.dataset.rows[0].processassort;
  605 + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === "sProcessName");
  606 + if (iIndex > -1) {
  607 + const sqlDropDownData = await props.getSqlDropDownData(sModelsId, "slave", processConfig.gdsconfigformslave[iIndex]);
  608 + dropDownDataProcessName = sqlDropDownData.dropDownData;
  609 + processAssignAssort = processConfig.gdsconfigformslave[iIndex].sAssignField;
  610 + }
  611 + }
  612 + }
  613 + const newCopyTo = {};
  614 + newCopyTo.master = masterData;
  615 + newCopyTo.slave = commonUtils.isEmptyArr(slaveData) ? {} : slaveData[0];
  616 + for (let i = 0; i < partsNewInfo.length; i++) {
  617 + const partInfo = partsNewInfo[i];
  618 + const iIndex = i;
  619 + const partsDataRow = {};
  620 + for (const child of Object.keys(partInfo)) {
  621 + partsDataRow[child] = partInfo[child];
  622 + }
  623 + partsDataRow.handleType = "add";
  624 + partsDataRow.iOrder = iIndex + 1; /* 快速下单编号从1开始 */
  625 + partsDataRow.sId = commonUtils.createSid();
  626 + partsDataRow.sParentId = masterData.sId;
  627 + // partsDataRow.sSlaveId = ' ';
  628 + if (partsDataRow.iPrintMode !== 3) {
  629 + partsDataRow.iOppositeColor = partsDataRow.iPositiveColor;
  630 + }
  631 + delete partsDataRow.dMaterialsKQty;
  632 + delete partsDataRow.dMaterialsLength;
  633 + delete partsDataRow.dMaterialsWidth;
  634 + if (productClassify.bSpecialRules) {
  635 + partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
  636 + partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
  637 + }
  638 + controlData.push(partsDataRow);
  639 + // 材料信息
  640 + for (let i = 0; i < partInfo.materialsInfo.length; i++) {
  641 + const materialInfo = partInfo.materialsInfo[i];
  642 + const iOrder = i;
  643 + let materialDataRow = {};
  644 + for (const item of materialsConfig.gdsconfigformslave) {
  645 + materialDataRow[item.sName] = materialInfo[item.sName];
  646 + }
  647 + materialDataRow.handleType = "add";
  648 + materialDataRow.sType = "0";
  649 + materialDataRow.iPartOrder = iIndex;
  650 + materialDataRow.iOrder = iOrder + 1;
  651 + materialDataRow.sPartsName = partsDataRow.sPartsName;
  652 + materialDataRow.sId = commonUtils.createSid();
  653 + materialDataRow.sParentId = masterData.sId;
  654 + materialDataRow.sControlId = partsDataRow.sId;
  655 + // materialDataRow.sSlaveId = ' ';
  656 + materialDataRow.dMaterialsKQty = partsDataRow.iNumberofMaterial;
  657 + const models = "Materials";
  658 + materialDataRow = await props.onMaterialsChange(materialDataRow, sModelsId, masterData, [], "dAuxiliaryQty", app, token, models);
  659 + materialDataRow = commonBusiness.getCalculateAllMoney(app, models, "dAuxiliaryQty", masterData, materialDataRow);
  660 + materialsData.push(materialDataRow);
  661 + }
  662 +
  663 + // 工序信息
  664 + let processPrintDataRow = {};
  665 + processPrintDataRow.handleType = "add";
  666 + processPrintDataRow.sProcessId = partInfo.sProcessId;
  667 + const iProcessPrintIndex = dropDownDataProcessName.findIndex(item => item.sId === processPrintDataRow.sProcessId);
  668 + if (iProcessPrintIndex > -1) {
  669 + processPrintDataRow = {
  670 + ...processPrintDataRow,
  671 + ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessPrintIndex], newCopyTo),
  672 + }; // 取赋值字段
  673 + }
  674 + processPrintDataRow.sType = partInfo.sType;
  675 + processPrintDataRow.iPartOrder = iIndex;
  676 + processPrintDataRow.iOrder = 1;
  677 + processPrintDataRow.sProcessName = partInfo.sProcessName;
  678 + processPrintDataRow.sPartsName = partsDataRow.sPartsName;
  679 + processPrintDataRow.dProcessInQty = partInfo.dProcessInQty;
  680 + processPrintDataRow.dLossQty = partInfo.dLossQty;
  681 + processPrintDataRow.dProcessOutQty = partInfo.dProcessOutQty;
  682 + processPrintDataRow.sId = commonUtils.createSid();
  683 + processPrintDataRow.sParentId = masterData.sId;
  684 + processPrintDataRow.sControlId = partsDataRow.sId;
  685 + // processPrintDataRow.sSlaveId = ' ';
  686 + processData.push(processPrintDataRow);
  687 + // 配套工序
  688 + if (bProcessAssort) {
  689 + returnProcessAssort
  690 + .filter(item => item.sParentId === processPrintDataRow.sProcessId)
  691 + .forEach(itemProcessAssort => {
  692 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  693 + const iProcessIndex = -1;
  694 + const iNewProcessIndex = processData.findIndex(
  695 + item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId
  696 + );
  697 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  698 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  699 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  700 + processRow.handleType = "add";
  701 + processRow.sId = commonUtils.createSid();
  702 + processRow.sParentId = masterData.sId;
  703 + processRow.sControlId = partsDataRow.sId;
  704 + processRow.sPartsName = partsDataRow.sPartsName;
  705 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  706 + // processRow.sSlaveId = ' ';
  707 + processData.push(processRow);
  708 + }
  709 + });
  710 + }
  711 +
  712 + partInfo.processInfo.forEach((process, iOrder) => {
  713 + let processAfterDataRow = {};
  714 + for (const item of processConfig.gdsconfigformslave) {
  715 + processAfterDataRow[item.sName] = process[item.sName];
  716 + }
  717 + for (const child of Object.keys(process)) {
  718 + processAfterDataRow[child] = process[child];
  719 + }
  720 + processAfterDataRow.handleType = "add";
  721 + processAfterDataRow.sProcessId = process.sProcessId;
  722 + const iProcessAfterIndex = dropDownDataProcessName.findIndex(item => item.sId === processAfterDataRow.sProcessId);
  723 + if (iProcessAfterIndex > -1) {
  724 + processAfterDataRow = {
  725 + ...processAfterDataRow,
  726 + ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProcessAfterIndex], newCopyTo),
  727 + }; // 取赋值字段
  728 + }
  729 + processAfterDataRow.sType = process.sType;
  730 + processAfterDataRow.iPartOrder = iIndex;
  731 + processAfterDataRow.iOrder = iOrder + 1;
  732 + processAfterDataRow.sPartsName = partsDataRow.sPartsName;
  733 + processAfterDataRow.sId = commonUtils.createSid();
  734 + processAfterDataRow.sParentId = masterData.sId;
  735 + processAfterDataRow.sControlId = partsDataRow.sId;
  736 + // processAfterDataRow.sSlaveId = ' ';
  737 + processData.push(processAfterDataRow);
  738 + // 配套工序
  739 + if (bProcessAssort) {
  740 + returnProcessAssort
  741 + .filter(item => item.sParentId === processPrintDataRow.sProcessId)
  742 + .forEach(itemProcessAssort => {
  743 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  744 + const iProcessIndex = -1;
  745 + const iNewProcessIndex = processData.findIndex(
  746 + item => item.sProcessId === itemProcessAssort.sProcessId && item.sControlId === partsDataRow.sId
  747 + );
  748 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  749 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  750 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  751 + processRow.handleType = "add";
  752 + processRow.sId = commonUtils.createSid();
  753 + processRow.sParentId = masterData.sId;
  754 + processRow.sControlId = partsDataRow.sId;
  755 + processRow.sPartsName = partsDataRow.sPartsName;
  756 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  757 + // processRow.sSlaveId = ' ';
  758 + processData.push(processRow);
  759 + }
  760 + });
  761 + }
  762 + });
  763 + }
  764 + productProcessInfo.forEach((process, iOrder) => {
  765 + let processProductDataRow = {};
  766 + for (const item of processConfig.gdsconfigformslave) {
  767 + processProductDataRow[item.sName] = process[item.sName];
  768 + }
  769 + for (const child of Object.keys(process)) {
  770 + processProductDataRow[child] = process[child];
  771 + }
  772 + const iProductProcessIndex = dropDownDataProcessName.findIndex(item => item.sId === processProductDataRow.sProcessId);
  773 + if (iProductProcessIndex > -1) {
  774 + processProductDataRow = {
  775 + ...processProductDataRow,
  776 + ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iProductProcessIndex], newCopyTo),
  777 + }; // 取赋值字段
  778 + }
  779 + processProductDataRow.handleType = "add";
  780 + processProductDataRow.sType = "3";
  781 + processProductDataRow.sPartsName = "";
  782 + processProductDataRow.iPartOrder = 999;
  783 + processProductDataRow.iOrder = iOrder + 1;
  784 + processProductDataRow.sId = commonUtils.createSid();
  785 + processProductDataRow.sParentId = masterData.sId;
  786 + // processProductDataRow.sSlaveId = ' ';
  787 + processData.push(processProductDataRow);
  788 + // 配套工序
  789 + if (bProcessAssort) {
  790 + returnProcessAssort
  791 + .filter(item => item.sParentId === processProductDataRow.sProcessId)
  792 + .forEach(itemProcessAssort => {
  793 + const iIndex = dropDownDataProcessName.findIndex(item => item.sId === itemProcessAssort.sProcessId);
  794 + const iProcessIndex = -1;
  795 + const iNewProcessIndex = processData.findIndex(item => item.sProcessId === itemProcessAssort.sProcessId);
  796 + if (iIndex > -1 && iProcessIndex < 0 && iNewProcessIndex < 0) {
  797 + let processRow = commonFunc.getDefaultData(processConfig, newCopyTo); // 取默认值
  798 + processRow = { ...processRow, ...commonFunc.getAssignFieldValue(processAssignAssort, dropDownDataProcessName[iIndex], newCopyTo) }; // 取赋值字段
  799 + processRow.handleType = "add";
  800 + processRow.sId = commonUtils.createSid();
  801 + processRow.sParentId = masterData.sId;
  802 + processRow.sType = dropDownDataProcessName[iIndex].sType;
  803 + // processRow.sSlaveId = ' ';
  804 + processData.push(processRow);
  805 + }
  806 + });
  807 + }
  808 + });
  809 + processData = props.sortData(controlData, processData);
  810 + const addState = { controlSelectedRowKeys: ["0000000"] };
  811 + if (!commonUtils.isEmptyArr(slaveData)) {
  812 + addState.slaveSelectedRowKeys = [slaveData[0].sId];
  813 + }
  814 +
  815 + const newState = {
  816 + materialsConfig,
  817 + masterData: { ...masterData1, ...masterData },
  818 + slaveData,
  819 + controlData,
  820 + materialsData,
  821 + processData,
  822 + fastOrderModalVisible: false,
  823 + quotationAllprogress: 0,
  824 + materialsSelectedRowKeys: [],
  825 + ...addState,
  826 + sInfoArr,
  827 + // bVisiblesInfo: !!commonUtils.isNotEmptyArr(sInfoArr),
  828 + Loading: false,
  829 + // quickQuoteModel: false,
  830 + };
  831 +
  832 + delete newState.masterData.sQuoConfig;
  833 +
  834 + const result = await props.handleCalculation(
  835 + false,
  836 + { ...props, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData },
  837 + true
  838 + );
  839 +
  840 + if (commonUtils.isEmptyObject(result)) {
  841 + setState(pre => ({ ...pre, calcPriceLoading: false }));
  842 + return;
  843 + }
  844 +
  845 + const { manyqtysData = [] } = result;
  846 + result.manyqtysData = manyqtysData.map(item => ({
  847 + ...item,
  848 + sParentId: newState.masterData.sId,
  849 + }));
  850 +
  851 + setState(pre => {
  852 + const preNew = { ...pre, manyData: result.manyqtysData, calcPriceLoading: false, calcPriceFinished: true };
  853 + const stateNew = { ...newState, ...result };
  854 + props.onSaveState(stateNew, () => {
  855 + onSaveDraft(preNew, stateNew);
  856 + });
  857 + return preNew;
  858 + });
  859 + } else {
  860 + message.error(dataReturn.erroMsg || dataReturn.msg);
  861 + setState(pre => ({ ...pre, calcPriceLoading: false }));
  862 + }
  863 + };
  864 +
  865 + // 新报价
  866 + addState.onAdd = () => {
  867 + const restList = ["formData", "manyColumn", "manyConfig", "masterConfig", "slaveConfig", "slaveColumn", "treeData"];
  868 + const stateNew = {
  869 + ...restList.reduce((pre, cur) => {
  870 + pre[cur] = state[cur];
  871 + return pre;
  872 + }, {}),
  873 + masterData: {},
  874 + slaveData: [],
  875 + manyData: [],
  876 + };
  877 + setState(stateNew);
  878 + props.onAdd();
  879 + };
  880 +
  881 + // 选择盒型弹窗
  882 + addState.onFieldPopupModal = (showConfig, name) => {
  883 + if (showConfig.sName === "sName") {
  884 + props.onSaveState({ boxModelSelectedModalVisible: true, currentBoxModel: name });
  885 + }
  886 + };
  887 +
  888 + return {
  889 + ...props,
  890 + onDataChange0: props.onDataChange,
  891 + ...addState,
  892 + hideBackBtn,
  893 + enabled,
  894 + state,
  895 + setState,
  896 + masterConfig: masterConfig && masterConfig.length ? masterConfig[0] : {},
  897 + };
  898 +};
  899 +
  900 +const QuotationAllprogressDetail = baseProps => {
  901 + // const props = QuickQuoteEvent(baseProps);
  902 + const [state, setState] = useState(JsonData.state);
  903 + const props = {
  904 + ...baseProps,
  905 + ...JsonData,
  906 + setState,
  907 + state,
  908 + };
  909 + return (
  910 + <div className={styles.quotationDetailBox}>
  911 + <QuotationDetail {...props} />
  912 + </div>
  913 + );
  914 +};
  915 +
  916 +const QuotationDetail = props => {
  917 + const { location, app, sModelsId, state, masterData, selectedNode = {} } = props;
  918 + console.log("🚀 ~ QuotationDetail:", props);
  919 + const { token } = app;
  920 + const { formData = [], masterConfig } = state || {};
  921 + const { quotationData } = JSON.parse(location.state) || {};
  922 + if (!masterConfig) return;
  923 + //masterData 主表数据
  924 + // 获取主表信息
  925 + const viewConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName && item.bVisible);
  926 + const viewProps = {
  927 + ...props,
  928 + viewConfigs: viewConfigs,
  929 + tableConfig: masterConfig,
  930 + iColValueView: 24,
  931 + viewRow: { ...masterData, sProductClassifyId: selectedNode.sId },
  932 + tableName: "master",
  933 + };
  934 + console.log("🚀 ~ viewProps:", viewProps);
  935 +
  936 + return (
  937 + <div>
  938 + <div>{quotationData?.showName || "Loading..."}</div>
  939 +
  940 + <div>
  941 + <MasterComponent {...viewProps} />
  942 + </div>
  943 + <div>
  944 + <QuotationTabs {...props} />
  945 + </div>
  946 + </div>
  947 + );
  948 +};
  949 +const MasterComponent = props => {
  950 + console.log("🚀 ~ MasterComponent:", props);
  951 + const { viewConfigs, masterData } = props;
  952 + const customer = viewConfigs?.find(x => x.sName === "sCustomerName") || {};
  953 + const customerProps = {
  954 + ...props,
  955 + formData: customer,
  956 + name: masterData.sCustomerName,
  957 + id: masterData.sCustomerId,
  958 + No: masterData.sCustomerNo,
  959 + };
  960 + const product = viewConfigs?.find(x => x.sName === "sProductName") || {};
  961 + const productProps = {
  962 + ...props,
  963 + formData: product,
  964 + bCanInput: true,
  965 + name: masterData.sProductName,
  966 + };
  967 + const dLength = viewConfigs?.find(x => x.sName === "dLength") || {};
  968 +
  969 + const dLengthProps = {
  970 + ...props,
  971 + formData: dLength,
  972 + bCanInput: true,
  973 + name: masterData.dLength,
  974 + };
  975 + const dWidth = viewConfigs?.find(x => x.sName === "dWidth") || {};
  976 + const dWidthProps = {
  977 + ...props,
  978 + formData: dWidth,
  979 + bCanInput: true,
  980 + name: masterData.dWidth,
  981 + };
  982 + const dHeight = viewConfigs?.find(x => x.sName === "dHeight") || {};
  983 + const dHeightProps = {
  984 + ...props,
  985 + formData: dHeight,
  986 + bCanInput: true,
  987 + name: masterData.dHeight,
  988 + };
  989 + const dProductQty = viewConfigs?.find(x => x.sName === "dProductQty") || {};
  990 + const dProductQtyProps = {
  991 + ...props,
  992 + formData: dProductQty,
  993 + bCanInput: true,
  994 + name: masterData.dProductQty,
  995 + };
  996 + const sProductUnit = viewConfigs?.find(x => x.sName === "sProductUnit") || {};
  997 + const sProductUnitProps = {
  998 + ...props,
  999 + formData: sProductUnit,
  1000 + name: masterData.sProductUnit,
  1001 + };
  1002 + const sDeliverName = viewConfigs?.find(x => x.sName === "sDeliverName") || {};
  1003 + const sDeliverNameProps = {
  1004 + ...props,
  1005 + formData: sDeliverName,
  1006 + name: masterData.sDeliverName,
  1007 + };
  1008 + const baseProps = {
  1009 + ...props,
  1010 + };
  1011 + return (
  1012 + <div>
  1013 + <div className={styles.customer}>
  1014 + <div>{customerProps.formData.showName}</div>
  1015 + <SelectInput {...customerProps} />
  1016 + </div>
  1017 + <div className={styles.customer}>
  1018 + <div>{productProps.formData.showName}</div>
  1019 + <SelectInput {...productProps} />
  1020 + </div>
  1021 + <div className={styles.customer}>
  1022 + <div>尺寸(长*宽*高)</div>
  1023 + <div className={styles.sizeBox}>
  1024 + <div className={styles.sizeItem}>
  1025 + <div style={{ width: "70%" }}>
  1026 + <SelectInput {...dLengthProps} />
  1027 + </div>
  1028 + <div style={{ width: "30%", textAlign: "center" }}>X</div>
  1029 + </div>
  1030 + <div className={styles.sizeItem}>
  1031 + <div style={{ width: "70%" }}>
  1032 + <SelectInput {...dWidthProps} />
  1033 + </div>{" "}
  1034 + <div style={{ width: "30%", textAlign: "center" }}>X</div>
  1035 + </div>
  1036 + <div className={styles.sizeItem}>
  1037 + <div style={{ width: "70%" }}>
  1038 + <SelectInput {...dHeightProps} />
  1039 + </div>
  1040 + <div style={{ width: "30%", textAlign: "center" }}>mm</div>
  1041 + </div>
  1042 + </div>
  1043 + </div>
  1044 + <div className={styles.sizeBox}>
  1045 + <div className={styles.customer}>
  1046 + <div>数量</div>
  1047 + <SelectInput {...dProductQtyProps} />
  1048 + </div>
  1049 + <div className={styles.customer}>
  1050 + <div>单位</div>
  1051 + <SelectInput {...sProductUnitProps} />
  1052 + </div>
  1053 + <div className={styles.customer}>
  1054 + <div>收货方式</div>
  1055 + <SelectInput {...sDeliverNameProps} />
  1056 + </div>
  1057 + </div>
  1058 + </div>
  1059 + );
  1060 +};
  1061 +const QuotationTabs = props => {
  1062 + const { state } = props;
  1063 + const { selectedNode } = state;
  1064 + const sAllPartsName = selectedNode?.sAllPartsName;
  1065 + const sAllPartsNameList = sAllPartsName?.split(",");
  1066 + const [activeKey, setActiveKey] = useState(sAllPartsNameList && sAllPartsNameList.length ? sAllPartsNameList[0] : null);
  1067 +
  1068 + useEffect(() => {
  1069 + // 更新父组件的状态
  1070 + props.setState(pre => ({ ...pre, boxModel: activeKey }));
  1071 + }, [activeKey]);
  1072 +
  1073 + const tabsProps = {
  1074 + ...props,
  1075 + boxModel: activeKey,
  1076 + };
  1077 + return (
  1078 + <Tabs
  1079 + activeKey={activeKey}
  1080 + onChange={key => {
  1081 + setActiveKey(key);
  1082 + }}
  1083 + >
  1084 + {sAllPartsNameList && sAllPartsNameList.length
  1085 + ? sAllPartsNameList.map((pane, index) => (
  1086 + <Tabs.Tab key={pane} title={pane}>
  1087 + <BoxComponent {...tabsProps} paneKey={pane} />
  1088 + </Tabs.Tab>
  1089 + ))
  1090 + : ""}
  1091 + </Tabs>
  1092 + );
  1093 +};
  1094 +
  1095 +// 内容
  1096 +const BoxComponent = props => {
  1097 + const { state, boxModel } = props;
  1098 + const { activeKey, slaveConfig, masterData, selectedNode, boxConfig, downAbleConfigs = [], slaveData } = state || {};
  1099 + console.log("🚀 ~ BoxComponent:", slaveConfig);
  1100 + const { sModelsId } = props;
  1101 + const [selectList, setSelectList] = useState([]);
  1102 + const [searchValue, setSearchValue] = useState("");
  1103 + const [slaveRowData, setSlaveRowData] = useState(null);
  1104 + // 获取盒型信息
  1105 + useEffect(() => {
  1106 + const sId = "17428091410008594700322758474000";
  1107 + const url = `${commonConfig.server_host}business/getSelectLimit/${sId}?sModelsId=${sModelsId}&sName=${""}`;
  1108 + const body = {
  1109 + sSqlCondition: "",
  1110 + sKeyUpFilterName: searchValue,
  1111 + pageNum: 1,
  1112 + pageSize: 20,
  1113 + };
  1114 + commonServices.postValueService(props.app.token, body, url).then(res => {
  1115 + if (res.data.code === 1) {
  1116 + const list = res.data.dataset.rows.map(x => {
  1117 + return {
  1118 + ...x,
  1119 + label: x.sName,
  1120 + value: x.sId,
  1121 + };
  1122 + });
  1123 + setSelectList(list);
  1124 + }
  1125 + });
  1126 + // 获取盒型
  1127 + }, []);
  1128 +
  1129 + useEffect(() => {
  1130 + props.setState(prevState => ({
  1131 + ...prevState,
  1132 + slaveRowData,
  1133 + }));
  1134 + }, [slaveRowData]);
  1135 +
  1136 + const { sColumnNameConfig } = slaveRowData || {};
  1137 + const upAbleConfigsExtra = commonUtils.convertStrToObj(sColumnNameConfig, []).map(item => ({
  1138 + ...item,
  1139 + sValue: item.sDefault,
  1140 + iColValue: item.iColValue || 6,
  1141 + }));
  1142 + const showUpAbleConfigsExtra = upAbleConfigsExtra.filter(x => x.bVisible === 1);
  1143 + let boxList = [];
  1144 + if (slaveRowData && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) {
  1145 + const slaveNewData = JSON.parse(slaveRowData.sColumnNameConfig);
  1146 + const tables = [
  1147 + { name: "盒型类别", value: slaveRowData.sBoxType, type: null },
  1148 + { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes },
  1149 + { name: "盒长", value: masterData.dLength ? Number(masterData.dLength) : 0, type: null },
  1150 + { name: "盒宽", value: masterData.dWidth ? Number(masterData.dWidth) : 0, type: null },
  1151 + { name: "盒高", value: masterData.dHeight ? Number(masterData.dHeight) : 0, type: null },
  1152 + ];
  1153 + const titleList1 = [
  1154 + { name: "上方盒舌", value: "dSFHS" },
  1155 + { name: "盒底组件", value: "dHDC" },
  1156 + { name: "下方盒舌", value: "dXFHS" },
  1157 + { name: "左(上)插位组件", value: "dZSCW" },
  1158 + { name: "左贴边位", value: "dZTBW" },
  1159 + { name: "左(下)插位组件", value: "dZXCW" },
  1160 + { name: "右(上)插位组件", value: "dYSCW" },
  1161 + { name: "右贴边位", value: "dYTBW" },
  1162 + { name: "右(下)插位组件", value: "dYXCW" },
  1163 + ];
  1164 + const evaluateFormula = (formula, variables) => {
  1165 + if (!formula) return 0; // 如果公式为空,返回0
  1166 + try {
  1167 + // 提取公式中的变量名
  1168 + const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || [];
  1169 + // 构建函数参数
  1170 + const params = variableNames.join(",");
  1171 + // 替换公式中的变量为实际值
  1172 + const func = new Function(params, `return ${formula}`);
  1173 + // 提取变量值
  1174 + const args = variableNames.map(name => Number(variables[name]) || 0);
  1175 + // 执行函数并返回结果
  1176 + return func(...args);
  1177 + } catch (error) {
  1178 + return 0;
  1179 + }
  1180 + };
  1181 +
  1182 + // 确认是竖向排列还是横向排列
  1183 + const L = masterData?.dLength;
  1184 + const W = masterData?.dWidth;
  1185 + const H = masterData?.dWidth;
  1186 + const D = masterData?.dHeight;
  1187 + const variables = {
  1188 + L,
  1189 + W,
  1190 + H,
  1191 + D,
  1192 + ...slaveRowData,
  1193 + };
  1194 + slaveNewData.forEach(x => {
  1195 + let key = 0;
  1196 + if (x.sAssignFormula) {
  1197 + key = evaluateFormula(x.sAssignFormula, variables);
  1198 + } else {
  1199 + key = slaveRowData[x.sName];
  1200 + }
  1201 +
  1202 + boxList.push({
  1203 + value: key,
  1204 + sName: titleList1.find(item => item.value === x.sName)?.name || "",
  1205 + isEditable: true,
  1206 + isSelect: false,
  1207 + selectValue: null,
  1208 + selectLabel: "",
  1209 + selectImage: null,
  1210 + type: x.sTypes || null,
  1211 + show: true,
  1212 + showName: x.showName, // 参数名称
  1213 + });
  1214 + });
  1215 + tables.forEach(x => {
  1216 + boxList.push({
  1217 + value: x.value,
  1218 + sName: x.name,
  1219 + isEditable: true,
  1220 + isSelect: false,
  1221 + selectValue: null,
  1222 + selectLabel: "",
  1223 + selectImage: null,
  1224 + type: x.type || null,
  1225 + show: true,
  1226 + showName: x.name, // 参数名称
  1227 + });
  1228 + });
  1229 + }
  1230 +
  1231 + const svgProps = {
  1232 + ...props,
  1233 + boxList,
  1234 + dSvgBoxWidth: 125,
  1235 + dSvgBoxHeight: 125,
  1236 + showNew: 1,
  1237 + isMobile: true,
  1238 + };
  1239 + // 印刷参数
  1240 + // if (!slaveConfig) return;
  1241 + const getUpViewPropsByITag = iTag => {
  1242 + if (!slaveConfig) return;
  1243 + const config = slaveConfig.gdsconfigformslave.filter(item => {
  1244 + if (item.sName === "dSumPQty" && selectedNode.sTypeKey !== "huace") {
  1245 + return false;
  1246 + }
  1247 +
  1248 + return item.iTag === iTag;
  1249 + });
  1250 + let boxConfigList = [];
  1251 + if (iTag === 20) {
  1252 + const showNameKeyList = ["dZBLB", "dSBLB", "dYBLB", "dXBLB", "dZBJJ", "dYBJJ", "dSBJJ", "dXBJJ"];
  1253 + boxConfigList = boxConfig?.gdsconfigformslave?.filter(item => item.bVisible && showNameKeyList.includes(item.sName)) || [];
  1254 + }
  1255 + const newConfig = [...boxConfigList, ...config];
  1256 +
  1257 + return {
  1258 + ...props,
  1259 + viewConfigs: newConfig,
  1260 + tableConfig: { ...slaveConfig, gdsconfigformslave: newConfig },
  1261 + iColValueView: 24,
  1262 + viewRow: slaveRowData,
  1263 + tableName: `slaveUp${boxModel}`,
  1264 + };
  1265 + };
  1266 + // 印刷参数表单
  1267 + const upViewProps12 = getUpViewPropsByITag(12);
  1268 + // 拼板信息表单
  1269 + const upViewProps20 = getUpViewPropsByITag(20);
  1270 +
  1271 + // 后道参数
  1272 + const downViewProps = {
  1273 + ...props,
  1274 + viewConfigs: downAbleConfigs
  1275 + .filter(item => item.sPartsName === boxModel || !item.sPartsName)
  1276 + .map(item => {
  1277 + return {
  1278 + ...item,
  1279 + isSelect: false,
  1280 + };
  1281 + }),
  1282 + tableConfig: { ...slaveConfig, gdsconfigformslave: downAbleConfigs },
  1283 + iColValueView: 24,
  1284 + viewRow: slaveRowData,
  1285 + tableName: `slaveDown${boxModel}`,
  1286 + };
  1287 + const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []);
  1288 + const radioValue = calcMethodData[0]?.sCode;
  1289 + const [materialLength, setMaterialLength] = useState(0);
  1290 + const [materialWidth, setMaterialWidth] = useState(0);
  1291 + // 使用 useCallback 确保回调函数的稳定性
  1292 + const handleSaveState = useCallback(
  1293 + (length, width, slaveData, masterData, dSinglePQty, dMaterialsKQty, dProductQty, scale, dWlcd, dWlkd, innerWidth, innerHeight) => {
  1294 + // 查找符合条件的索引
  1295 + const { selectedNode } = props.state;
  1296 +
  1297 + const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel);
  1298 + // 判断展长展宽是否可以放下原纸
  1299 + const isDPartsLength =
  1300 + slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth;
  1301 +
  1302 + if (index !== undefined && index !== -1) {
  1303 + // 计算开数
  1304 +
  1305 + // 获取原始对象并创建一个新的对象进行更新
  1306 + const updatedProduct = {
  1307 + ...slaveData[index],
  1308 + materialLength: length,
  1309 + materialWidth: width,
  1310 + dMachineLength: length, // 上机长
  1311 + dMachineWidth: width, // 上机宽
  1312 + sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸
  1313 + sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸
  1314 + sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2),
  1315 + newMaterialLength: length,
  1316 + newMaterialWidth: width,
  1317 + sLayoutRate: Number(
  1318 + (
  1319 + (((length || slaveData[index].materialLength) * (width || slaveData[index].materialWidth)) /
  1320 + (slaveData[index].dMaxLength * slaveData[index].dMaxWidth)) *
  1321 + 100
  1322 + ).toFixed(2)
  1323 + ),
  1324 + dWlcd: dWlcd,
  1325 + dWlkd: dWlkd,
  1326 + dMachineQty: Math.floor(dProductQty / dSinglePQty),
  1327 + dSinglePQty: dSinglePQty,
  1328 + dMaterialsKQty: dMaterialsKQty,
  1329 + scale: scale,
  1330 + dPartsLength: innerWidth,
  1331 + dPartsWidth: innerHeight,
  1332 + };
  1333 + // 更新状态
  1334 + props.setState(prevState => ({
  1335 + ...prevState,
  1336 + slaveData: slaveData.map((item, i) => (i === index ? updatedProduct : item)),
  1337 + }));
  1338 + }
  1339 +
  1340 + setMaterialLength(length);
  1341 + setMaterialWidth(width);
  1342 + },
  1343 + []
  1344 + );
  1345 + const onSaveDPartsLength = useCallback((innerWidth, innerHeight, slaveData) => {
  1346 + const { selectedNode } = props.state;
  1347 + const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel);
  1348 + if (index !== undefined && index !== -1) {
  1349 + const updatedProduct = {
  1350 + ...slaveData[index],
  1351 + dPartsLength: innerWidth,
  1352 + dPartsWidth: innerHeight,
  1353 + materialLength: 0,
  1354 + materialWidth: 0,
  1355 + dMachineLength: 0, // 上机长
  1356 + dMachineWidth: 0, // 上机宽
  1357 + newMaterialLength: 0,
  1358 + newMaterialWidth: 0,
  1359 + sLayoutRate: 0,
  1360 + dWlcd: 0,
  1361 + dWlkd: 0,
  1362 + dMachineQty: 0,
  1363 + dSinglePQty: 0,
  1364 + dMaterialsKQty: 0,
  1365 + scale: 1,
  1366 + };
  1367 + props.setState(prevState => ({
  1368 + ...prevState,
  1369 + slaveData: slaveData.map((item, i) => (i === index ? updatedProduct : item)),
  1370 + }));
  1371 + }
  1372 + }, []);
  1373 + const boxProps = {
  1374 + ...props,
  1375 + slaveRowData,
  1376 + dSBJJ: slaveRowData?.dXBJJ,
  1377 + dZBJJ: slaveRowData?.dYBJJ,
  1378 + radioValue: calcMethodData?.find(item => item.sCode === radioValue),
  1379 + boxWidth: 190,
  1380 + boxHeight: 150,
  1381 + textSize: 9,
  1382 + // boxPicData,
  1383 + };
  1384 + const showImgMProps = {
  1385 + ...props,
  1386 + materialLength,
  1387 + materialWidth,
  1388 + bBox: true, // 快速报价盒型展示
  1389 + width: 200,
  1390 + height: 150,
  1391 + size: 9,
  1392 + };
  1393 +
  1394 + return (
  1395 + <div>
  1396 + <Selector
  1397 + columns={4}
  1398 + options={selectList}
  1399 + defaultValue={["3"]}
  1400 + style={{ "--padding": "0.8rem 0" }}
  1401 + onChange={v => {
  1402 + if (v.length) {
  1403 + const data = selectList.find(x => x.sId === v[0]);
  1404 + const slaveNewData = JSON.parse(data.sColumnNameConfig).map(x => {
  1405 + return {
  1406 + [x.sName]: x.sDefault,
  1407 + };
  1408 + });
  1409 + const slaveDataDetail = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {};
  1410 +
  1411 + const rowData = {
  1412 + ...slaveDataDetail,
  1413 + ...data,
  1414 + ...Object.assign({}, ...slaveNewData),
  1415 + };
  1416 + setSlaveRowData(rowData);
  1417 + }
  1418 + }}
  1419 + />
  1420 + <div>
  1421 + <Grid columns={4} gap={8}>
  1422 + {showUpAbleConfigsExtra.map(x => (
  1423 + <Grid.Item>
  1424 + <div className={styles.customer} key={x.id || x.sBig5}>
  1425 + <div>{x.sBig5}</div>
  1426 + <SelectInput {...props} {...x} bCanInput={true} />
  1427 + </div>
  1428 + </Grid.Item>
  1429 + ))}
  1430 + </Grid>
  1431 + </div>
  1432 + <div className={styles.svgBox}>
  1433 + <div style={{ width: "9.375rem", height: "9.375rem" }}>
  1434 + <DynamicSVG {...svgProps} />
  1435 + </div>
  1436 + {slaveRowData && slaveRowData.sPackPath ? <Image src={slaveRowData.sPackPath} width={125} height={125} fit="fill" /> : ""}
  1437 + </div>
  1438 + <div>
  1439 + <div>印刷信息</div>
  1440 + <Grid columns={3} gap={8}>
  1441 + {upViewProps12
  1442 + ? upViewProps12.viewConfigs.map(x => (
  1443 + <Grid.Item>
  1444 + <div className={styles.customer} key={x.id || x.showName}>
  1445 + <div>{x.showName}</div>
  1446 + <SelectInput {...upViewProps12} {...x} bCanInput={false} />
  1447 + </div>
  1448 + </Grid.Item>
  1449 + ))
  1450 + : ""}
  1451 + </Grid>
  1452 + </div>
  1453 + <div>
  1454 + <div>拼版信息</div>
  1455 + <Grid columns={3} gap={8}>
  1456 + {upViewProps20
  1457 + ? upViewProps20.viewConfigs.map(x => (
  1458 + <Grid.Item>
  1459 + <div className={styles.customer} key={x.id || x.showName}>
  1460 + <div>{x.showName}</div>
  1461 + <SelectInput {...upViewProps12} {...x} bCanInput={false} />
  1462 + </div>
  1463 + </Grid.Item>
  1464 + ))
  1465 + : ""}
  1466 + </Grid>
  1467 + </div>
  1468 + <div className={styles.svgBox1}>
  1469 + <div style={{ width: "49%", height: "49%", position: "relative" }}>
  1470 + <Typesetting {...boxProps} onSaveStates={handleSaveState} onSaveDPartsLength={onSaveDPartsLength} />
  1471 + </div>
  1472 + <div style={{ width: "47%", height: "47%", position: "relative" }}>
  1473 + <ShowImgM {...showImgMProps} />
  1474 + </div>
  1475 + </div>
  1476 + <div>
  1477 + <MaterialsComponent {...props} />
  1478 + </div>
  1479 + <div>
  1480 + <div>后道参数</div>
  1481 + {downViewProps.viewConfigs.map((x, i) => (
  1482 + <div>
  1483 + {x.showName}
  1484 + <Switch
  1485 + onChange={async val => {
  1486 + console.log(val, x, "val");
  1487 + }}
  1488 + />
  1489 + </div>
  1490 + ))}
  1491 + </div>
  1492 + <div>
  1493 + 多数量报价
  1494 + <ManyComponent {...props}></ManyComponent>
  1495 + </div>
  1496 + </div>
  1497 + );
  1498 +};
  1499 +
  1500 +// 材料组件
  1501 +const MaterialsComponent = props => {
  1502 + const { state, boxModel } = props;
  1503 + const { slaveRowData, slaveConfig, slaveData = [], selectedNode = {} } = state;
  1504 + if (!slaveRowData) return;
  1505 + const { sParam = "" } = selectedNode;
  1506 + const sParamList = sParam.split(",");
  1507 + let materialsInfoDefaultData = sParam ? new Array(sParamList.length).fill({}).map((_, index) => ({ showName: sParamList[index] })) : [{}];
  1508 + let { materialsInfo = materialsInfoDefaultData } = slaveRowData;
  1509 + const materialsConfig = slaveConfig.gdsconfigformslave
  1510 + .filter(item => item.iTag === 11)
  1511 + .map(item => {
  1512 + const { sName } = item;
  1513 + if (sName === "sMaterialsName") {
  1514 + return {
  1515 + ...item,
  1516 + sVisColumnName: "sMaterialsName",
  1517 + iColValue: 20,
  1518 + };
  1519 + } else if (sName === "sComMaterials") {
  1520 + return {
  1521 + ...item,
  1522 + sName: "bComMaterials",
  1523 + iColValue: 4,
  1524 + };
  1525 + } else {
  1526 + return item;
  1527 + }
  1528 + });
  1529 +
  1530 + const extraState = {
  1531 + calcPriceFinished: false,
  1532 + manyData: [],
  1533 + };
  1534 + return materialsInfo.map((item, index) => {
  1535 + let viewRow = { ...materialsInfo[index], sProductClassifyId: selectedNode.sId };
  1536 + viewRow = { ...viewRow, sMaterialsName0: viewRow.showName || "" };
  1537 + let materialsConfigNew = JSON.parse(JSON.stringify(materialsConfig));
  1538 + if (viewRow.showName) {
  1539 + const iIndex = materialsConfigNew.findIndex(item => item.sName === "sMaterialsName");
  1540 + if (iIndex !== -1) {
  1541 + materialsConfigNew[iIndex].showName = viewRow.showName;
  1542 + }
  1543 + }
  1544 + const viewProps = {
  1545 + ...props,
  1546 + viewConfigs: materialsConfigNew,
  1547 + tableConfig: { ...slaveConfig, gdsconfigformslave: materialsConfigNew },
  1548 + iColValueView: 24,
  1549 + viewRow,
  1550 + tableName: `slaveUp${boxModel}`,
  1551 + onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
  1552 + const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
  1553 + if (iIndex !== -1) {
  1554 + slaveData[iIndex].materialsInfo = materialsInfo.map((item, i) => (i === index ? { ...item, ...changeValue } : item));
  1555 + } else {
  1556 + const { selectedNode = {} } = state;
  1557 + const { showName: sTreeNodeName } = selectedNode;
  1558 + slaveData.push({
  1559 + sId: commonUtils.createSid(),
  1560 + handleType: "add",
  1561 + sBoxModel: boxModel,
  1562 + sTreeNodeName,
  1563 + materialsInfo: materialsInfo.map((item, i) => (i === index ? { ...item, ...changeValue } : item)),
  1564 + });
  1565 + }
  1566 +
  1567 + props.setState(pre => ({ ...pre, slaveData, ...extraState }));
  1568 + },
  1569 + };
  1570 +
  1571 + return (
  1572 + <div>
  1573 + 材料信息
  1574 + <div className={styles.materialsLine}>
  1575 + <div className={styles.selectInput} style={{ width: "50%" }}>
  1576 + <SelectInput {...viewProps} />
  1577 + </div>
  1578 + <div className={styles.materialBtns}>
  1579 + <div className={styles.materialBtns}>
  1580 + <span>来料</span>
  1581 + <Checkbox />
  1582 + </div>
  1583 + <Button
  1584 + color="primary"
  1585 + fill="solid"
  1586 + size="small"
  1587 + style={{ width: "1.93rem", height: "1.93rem", display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center" }}
  1588 + onClick={() => {
  1589 + const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
  1590 + const rowIndex = materialsInfo.findIndex((item, i) => i === index);
  1591 + const materialsInfoNew = [...materialsInfo];
  1592 + materialsInfoNew.splice(rowIndex + 1, 0, {});
  1593 + if (iIndex !== -1) {
  1594 + slaveData[iIndex].materialsInfo = materialsInfoNew;
  1595 + } else {
  1596 + const { selectedNode = {} } = state;
  1597 + const { showName: sTreeNodeName } = selectedNode;
  1598 + slaveData.push({
  1599 + sId: commonUtils.createSid(),
  1600 + handleType: "add",
  1601 + sBoxModel: boxModel,
  1602 + sTreeNodeName,
  1603 + materialsInfo: materialsInfoNew,
  1604 + });
  1605 + }
  1606 + props.setState(pre => ({ ...pre, slaveData, ...extraState }));
  1607 + }}
  1608 + >
  1609 + <AddOutline />
  1610 + </Button>
  1611 + <Button
  1612 + style={
  1613 + index === 0 || viewRow.showName
  1614 + ? {
  1615 + visibility: "hidden",
  1616 + width: "1.93rem",
  1617 + height: "1.93rem",
  1618 + display: "flex",
  1619 + justifyContent: "center",
  1620 + alignItems: "center",
  1621 + textAlign: "center",
  1622 + }
  1623 + : { width: "1.93rem", height: "1.93rem", display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center" }
  1624 + }
  1625 + >
  1626 + <AddOutline />
  1627 + </Button>
  1628 + </div>
  1629 + </div>
  1630 + </div>
  1631 + );
  1632 + });
  1633 +};
  1634 +// 多数量组件
  1635 +const ManyComponent = props => {
  1636 + const { state, setState, enabled, loading } = props;
  1637 + const { masterData = {}, calcPriceLoading, calcPriceFinished, manyData = [] } = state;
  1638 + const [submitLoading, setSubmitLoading] = useState(false);
  1639 + const [processPercent, setProcessPercent] = useState(0);
  1640 + const tableProps = {
  1641 + ...commonBusiness.getTableTypes("many", { ...props, ...state }),
  1642 + fixedHeight: 185,
  1643 + enabled: false,
  1644 + };
  1645 + const { headerColumn, data } = tableProps;
  1646 + return (
  1647 + <div>
  1648 + <div className={styles.tableBox}>
  1649 + {headerColumn.map(item => {
  1650 + return <div className={styles.tableHeader}>{item.title}</div>;
  1651 + })}
  1652 + </div>
  1653 + <div>
  1654 + {data.map(item => {
  1655 + return (
  1656 + <div className={styles.tableBox}>
  1657 + <div className={styles.tableBody}>{item.dManyQty}</div>
  1658 + <div className={styles.tableBody}>{item.dPrintMoney}</div>
  1659 + <div className={styles.tableBody}>{item.dAfterProcessMoney}</div>
  1660 + <div className={styles.tableBody}>{item.dMaterialsMoney}</div>
  1661 + <div className={styles.tableBody}>{item.dManyPrice}</div>
  1662 + <div className={styles.tableBody}> {item.dDiscountMoney}</div>
  1663 + </div>
  1664 + );
  1665 + })}
  1666 + </div>
  1667 + </div>
  1668 + );
  1669 +};
  1670 +export default QuotationAllprogressDetail;
... ...