Commit 08147093f959fbb9cea12e63f728e3cf1b214c4d

Authored by 陈鑫涛
1 parent 04a302b6

快速报价

src/components/Common/Typesetting/typesetting.js
@@ -21,6 +21,7 @@ const Typesetting = props => { @@ -21,6 +21,7 @@ const Typesetting = props => {
21 textSize, 21 textSize,
22 isMobile, 22 isMobile,
23 } = props; 23 } = props;
  24 + const hasExecutedRef = useRef(true);
24 if (!slaveRowData) return; 25 if (!slaveRowData) return;
25 let { 26 let {
26 dSBLB = 0, // 上边留白 27 dSBLB = 0, // 上边留白
@@ -39,8 +40,23 @@ const Typesetting = props => { @@ -39,8 +40,23 @@ const Typesetting = props => {
39 sSvgPath, 40 sSvgPath,
40 dL = 0, 41 dL = 0,
41 dW = 0, 42 dW = 0,
  43 + dD = 0,
42 } = slaveRowData; 44 } = slaveRowData;
43 const { masterData, selectedNode, slaveData } = state; 45 const { masterData, selectedNode, slaveData } = state;
  46 + const { sBillNo } = props.masterData
  47 +
  48 + useEffect(() => {
  49 + if (sBillNo) {
  50 + if (hasExecutedRef.current) {
  51 + hasExecutedRef.current = false
  52 + } else {
  53 + // 第一次跳过
  54 + hasExecutedRef.current = true;
  55 + }
  56 + } else {
  57 + hasExecutedRef.current = false
  58 + }
  59 + }, [sBillNo]);
44 if (!masterData) return; 60 if (!masterData) return;
45 // 如果是卷筒类 那么上下左右留白等于左留白 61 // 如果是卷筒类 那么上下左右留白等于左留白
46 if (selectedNode && selectedNode.sTypeKey === "juantong") { 62 if (selectedNode && selectedNode.sTypeKey === "juantong") {
@@ -94,8 +110,8 @@ const Typesetting = props => { @@ -94,8 +110,8 @@ const Typesetting = props => {
94 // 确认是竖向排列还是横向排列 110 // 确认是竖向排列还是横向排列
95 const L = slaveRowData.dL ? Number(dL) : Number(masterData?.dLength) || 0; 111 const L = slaveRowData.dL ? Number(dL) : Number(masterData?.dLength) || 0;
96 const W = slaveRowData.dW ? Number(dW) : masterData?.dWidth || 0; 112 const W = slaveRowData.dW ? Number(dW) : masterData?.dWidth || 0;
97 - const H = masterData?.dWidth || 0;  
98 - const D = masterData?.dHeight || 0; 113 + const H = slaveRowData.dD ? Number(dD) : masterData?.dWidth || 0;
  114 + const D = slaveRowData.dD ? Number(dD) : masterData?.dHeight || 0;
99 // 动态计算公式值 115 // 动态计算公式值
100 const evaluateFormula = (formula, variables) => { 116 const evaluateFormula = (formula, variables) => {
101 if (!formula) return 0; // 如果公式为空,返回0 117 if (!formula) return 0; // 如果公式为空,返回0
@@ -149,7 +165,7 @@ const Typesetting = props => { @@ -149,7 +165,7 @@ const Typesetting = props => {
149 slaveNewData.forEach(x => { 165 slaveNewData.forEach(x => {
150 let key = 0; 166 let key = 0;
151 if (x.sAssignFormula) { 167 if (x.sAssignFormula) {
152 - key = parseFloat(evaluateFormula(x.sAssignFormula, variables)).toFixed(2) || 0; 168 + key = slaveRowData[x.sName];
153 } else { 169 } else {
154 key = slaveRowData[x.sName]; 170 key = slaveRowData[x.sName];
155 } 171 }
@@ -307,7 +323,9 @@ const Typesetting = props => { @@ -307,7 +323,9 @@ const Typesetting = props => {
307 useEffect(() => { 323 useEffect(() => {
308 if (Number(slaveRowData.sTypes) === 9) { 324 if (Number(slaveRowData.sTypes) === 9) {
309 if (L > 0 && W > 0 && H > 0) { 325 if (L > 0 && W > 0 && H > 0) {
310 - const { width, height } = calculateCupUnfoldDimensions(L, W, D); 326 + const lengths = evaluateFormula(sLengthFormula, variabless)
  327 + const widths = evaluateFormula(sWidthFormula, variabless)
  328 + const { width, height } = calculateCupUnfoldDimensions(lengths, widths, D);
311 // 确保新值与旧值不同时才更新 329 // 确保新值与旧值不同时才更新
312 if (width && height) { 330 if (width && height) {
313 setInnerWidth(Number(width.toFixed(2))); 331 setInnerWidth(Number(width.toFixed(2)));
@@ -351,8 +369,8 @@ const Typesetting = props => { @@ -351,8 +369,8 @@ const Typesetting = props => {
351 (isVertical ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset : Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset)) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量 369 (isVertical ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset : Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset)) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
352 // 计算内层盒子宽度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量 370 // 计算内层盒子宽度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
353 const innerWidthCombined = 371 const innerWidthCombined =
354 - (isVertical ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset) : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset) + dYBJJ;  
355 - 372 + (isVertical ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset) : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset);
  373 +
356 const style = { 374 const style = {
357 width: `${outerWidth}px`, 375 width: `${outerWidth}px`,
358 height: `${outerHeight}px`, 376 height: `${outerHeight}px`,
@@ -727,7 +745,7 @@ const Typesetting = props => { @@ -727,7 +745,7 @@ const Typesetting = props => {
727 } 745 }
728 const newDProductQty = masterData.dProductQty; 746 const newDProductQty = masterData.dProductQty;
729 const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; 747 const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1;
730 - 748 + // if (Number(materialLength) < 100) return ''
731 if ( 749 if (
732 dPartsLength !== innerWidth || 750 dPartsLength !== innerWidth ||
733 newMaterialLength !== materialLength || 751 newMaterialLength !== materialLength ||
@@ -853,6 +871,7 @@ const Typesetting = props =&gt; { @@ -853,6 +871,7 @@ const Typesetting = props =&gt; {
853 setIsModalOpen(false); 871 setIsModalOpen(false);
854 }; 872 };
855 873
  874 +
856 return ( 875 return (
857 <> 876 <>
858 {isShow ? ( 877 {isShow ? (
src/components/QuickQuote/index.jsx
@@ -81,12 +81,10 @@ const QuickQuoteEvent = props =&gt; { @@ -81,12 +81,10 @@ const QuickQuoteEvent = props =&gt; {
81 masterData.sCustomerName = sCustomerName; 81 masterData.sCustomerName = sCustomerName;
82 masterData.sCustomerId = sCustomerId; 82 masterData.sCustomerId = sCustomerId;
83 } 83 }
84 -  
85 return { ...result, masterData, slaveData: slaveDataNew, manyData: manyDataNew }; 84 return { ...result, masterData, slaveData: slaveDataNew, manyData: manyDataNew };
86 }; 85 };
87 86
88 const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {}); 87 const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {});
89 -  
90 const [state, setState] = useState(addState.onGetFilterState(sQuoConfig, true)); 88 const [state, setState] = useState(addState.onGetFilterState(sQuoConfig, true));
91 const { formData = [], masterConfig } = state; 89 const { formData = [], masterConfig } = state;
92 const { bLinkFieledClick } = props; 90 const { bLinkFieledClick } = props;
@@ -199,7 +197,6 @@ const QuickQuoteEvent = props =&gt; { @@ -199,7 +197,6 @@ const QuickQuoteEvent = props =&gt; {
199 sBackProcessData, 197 sBackProcessData,
200 }; 198 };
201 }); 199 });
202 -  
203 setState(pre => { 200 setState(pre => {
204 return { ...pre, slaveData: slaveDataNew }; 201 return { ...pre, slaveData: slaveDataNew };
205 }); 202 });
@@ -275,8 +272,8 @@ const QuickQuoteEvent = props =&gt; { @@ -275,8 +272,8 @@ const QuickQuoteEvent = props =&gt; {
275 // } 272 // }
276 273
277 if (name === "master") { 274 if (name === "master") {
278 - const { showName: sTreeNodeName } = selectedNode;  
279 - 275 +
  276 + const { showName: sTreeNodeName } = selectedNode || {};
280 const masterDataNew = { ...masterData, ...changeValue }; 277 const masterDataNew = { ...masterData, ...changeValue };
281 masterDataNew.handleType = masterDataNew.handleType || "update"; 278 masterDataNew.handleType = masterDataNew.handleType || "update";
282 masterDataNew.sId = masterDataNew.sId || commonUtils.createSid(); 279 masterDataNew.sId = masterDataNew.sId || commonUtils.createSid();
@@ -287,9 +284,9 @@ const QuickQuoteEvent = props =&gt; { @@ -287,9 +284,9 @@ const QuickQuoteEvent = props =&gt; {
287 dProductQty: changeValue.dProductQty, 284 dProductQty: changeValue.dProductQty,
288 })); 285 }));
289 } 286 }
290 -  
291 if (sFieldName === "dLength" || sFieldName === "dWidth" || sFieldName === "dHeight") { 287 if (sFieldName === "dLength" || sFieldName === "dWidth" || sFieldName === "dHeight") {
292 - if (props.currentBoxModel) { 288 + if (sTreeNodeName) {
  289 + if (props.currentBoxModel) {
293 const boxModel = props.currentBoxModel.replace("slaveUp", "").replace("slaveDown", ""); 290 const boxModel = props.currentBoxModel.replace("slaveUp", "").replace("slaveDown", "");
294 const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel); 291 const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel);
295 const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[iIndex].sColumnNameConfig, []).map(item => ({ 292 const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[iIndex].sColumnNameConfig, []).map(item => ({
@@ -300,18 +297,22 @@ const QuickQuoteEvent = props =&gt; { @@ -300,18 +297,22 @@ const QuickQuoteEvent = props =&gt; {
300 ...slaveData[iIndex], 297 ...slaveData[iIndex],
301 upAbleConfigsExtra: sColumnNameConfig, 298 upAbleConfigsExtra: sColumnNameConfig,
302 }; 299 };
  300 + } else {
  301 + if (!slaveData[0]) return;
  302 + const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[0].sColumnNameConfig, []).map(item => ({
  303 + ...item,
  304 + iColValue: item.iColValue || 6,
  305 + }));
  306 + slaveData[0] = {
  307 + ...slaveData[0],
  308 + upAbleConfigsExtra: sColumnNameConfig,
  309 + };
  310 + }
303 } else { 311 } else {
304 - if (!slaveData[0]) return;  
305 - const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[0].sColumnNameConfig, []).map(item => ({  
306 - ...item,  
307 - iColValue: item.iColValue || 6,  
308 - }));  
309 - slaveData[0] = {  
310 - ...slaveData[0],  
311 - upAbleConfigsExtra: sColumnNameConfig,  
312 - }; 312 + masterDataNew[sFieldName] = changeValue[sFieldName];
313 } 313 }
314 } 314 }
  315 +
315 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState })); 316 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
316 } else if (name.includes("slave")) { 317 } else if (name.includes("slave")) {
317 const boxModel = name.replace("slaveUp", "").replace("slaveDown", ""); 318 const boxModel = name.replace("slaveUp", "").replace("slaveDown", "");
@@ -566,6 +567,7 @@ const QuickQuoteEvent = props =&gt; { @@ -566,6 +567,7 @@ const QuickQuoteEvent = props =&gt; {
566 } 567 }
567 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState })); 568 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
568 } 569 }
  570 +
569 }; 571 };
570 addState.onDataChange = onDataChange; 572 addState.onDataChange = onDataChange;
571 573
@@ -1063,6 +1065,8 @@ const QuickQuoteEvent = props =&gt; { @@ -1063,6 +1065,8 @@ const QuickQuoteEvent = props =&gt; {
1063 processPrintDataRow.sParentId = masterData.sId; 1065 processPrintDataRow.sParentId = masterData.sId;
1064 processPrintDataRow.sControlId = partsDataRow.sId; 1066 processPrintDataRow.sControlId = partsDataRow.sId;
1065 // processPrintDataRow.sSlaveId = ' '; 1067 // processPrintDataRow.sSlaveId = ' ';
  1068 + processPrintDataRow.sColorSerialMemo = JSON.stringify([{ sId: partInfo.sColorId, sName: partInfo.sColor, dColor: partInfo.iColor }]);
  1069 +
1066 processData.push(processPrintDataRow); 1070 processData.push(processPrintDataRow);
1067 // 配套工序 1071 // 配套工序
1068 if (bProcessAssort) { 1072 if (bProcessAssort) {
@@ -1126,6 +1130,9 @@ const QuickQuoteEvent = props =&gt; { @@ -1126,6 +1130,9 @@ const QuickQuoteEvent = props =&gt; {
1126 } 1130 }
1127 1131
1128 // processAfterDataRow.sSlaveId = ' '; 1132 // processAfterDataRow.sSlaveId = ' ';
  1133 + if (process.sColor) {
  1134 + processAfterDataRow.sColorSerialMemo = JSON.stringify([{ sId: process.sColorId, sName: process.sColor, dColor: process.iColor }]);
  1135 + }
1129 processData.push(processAfterDataRow); 1136 processData.push(processAfterDataRow);
1130 // 配套工序 1137 // 配套工序
1131 if (bProcessAssort) { 1138 if (bProcessAssort) {
@@ -1338,6 +1345,7 @@ const QuickQuoteEvent = props =&gt; { @@ -1338,6 +1345,7 @@ const QuickQuoteEvent = props =&gt; {
1338 // 入口 1345 // 入口
1339 const QuickQuote = baseProps => { 1346 const QuickQuote = baseProps => {
1340 const props = QuickQuoteEvent(baseProps); 1347 const props = QuickQuoteEvent(baseProps);
  1348 +
1341 const [treeClassName, setTreeClassName] = useState(""); 1349 const [treeClassName, setTreeClassName] = useState("");
1342 1350
1343 // 监听页面滚动事件 1351 // 监听页面滚动事件
@@ -1376,6 +1384,7 @@ const QuickQuote = baseProps =&gt; { @@ -1376,6 +1384,7 @@ const QuickQuote = baseProps =&gt; {
1376 1384
1377 // 树形组件 1385 // 树形组件
1378 const TreeComponent = props => { 1386 const TreeComponent = props => {
  1387 +
1379 const { treeData = [], selectedNode = {}, slaveConfig } = props.state; 1388 const { treeData = [], selectedNode = {}, slaveConfig } = props.state;
1380 if (!treeData.length) return ""; 1389 if (!treeData.length) return "";
1381 1390
@@ -1500,7 +1509,7 @@ const TreeComponent = props =&gt; { @@ -1500,7 +1509,7 @@ const TreeComponent = props =&gt; {
1500 ...addState, 1509 ...addState,
1501 sPrintConfig: downAbleConfigs.find(item => item.sType === "1" && item.sName === "胶印"), 1510 sPrintConfig: downAbleConfigs.find(item => item.sType === "1" && item.sName === "胶印"),
1502 downAbleConfigs: downAbleConfigs 1511 downAbleConfigs: downAbleConfigs
1503 - .filter(item => item.sType === "2") 1512 + .filter(item => item.sType === "2" || item.sType === "0")
1504 .map((item, index) => ({ 1513 .map((item, index) => ({
1505 ...item, 1514 ...item,
1506 sName: `sParams${index}`, 1515 sName: `sParams${index}`,
@@ -1527,7 +1536,6 @@ const TreeComponent = props =&gt; { @@ -1527,7 +1536,6 @@ const TreeComponent = props =&gt; {
1527 masterData: { ...props.masterData, sFormId: "101251240115016076506222050" }, 1536 masterData: { ...props.masterData, sFormId: "101251240115016076506222050" },
1528 }); 1537 });
1529 } 1538 }
1530 - console.log(selectedNode, 'selectedNode');  
1531 1539
1532 getDropDownData(props); 1540 getDropDownData(props);
1533 }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]); 1541 }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]);
@@ -1577,15 +1585,17 @@ const ContentComponent = props =&gt; { @@ -1577,15 +1585,17 @@ const ContentComponent = props =&gt; {
1577 sAllPartsName = showName; 1585 sAllPartsName = showName;
1578 } 1586 }
1579 const hasAutoSetDefault = useRef(false); 1587 const hasAutoSetDefault = useRef(false);
  1588 +
1580 useEffect(() => { 1589 useEffect(() => {
1581 hasAutoSetDefault.current = false; 1590 hasAutoSetDefault.current = false;
1582 }, [selectedNode]); 1591 }, [selectedNode]);
1583 // 2. 监听两个依赖:sAllPartsNameDefault 与 slaveData 1592 // 2. 监听两个依赖:sAllPartsNameDefault 与 slaveData
  1593 + const {sBillNo} = props.masterData
1584 useEffect(() => { 1594 useEffect(() => {
1585 if ( 1595 if (
1586 !hasAutoSetDefault.current && // 尚未执行 1596 !hasAutoSetDefault.current && // 尚未执行
1587 selectedNode?.sAllPartsNameDefault?.length && // 有默认值 1597 selectedNode?.sAllPartsNameDefault?.length && // 有默认值
1588 - props.state.slaveData?.length // 子表数据已就位 1598 + props.state.slaveData?.length && !sBillNo // 子表数据已就位
1589 ) { 1599 ) {
1590 const boxModelList = sAllPartsName.split(','); 1600 const boxModelList = sAllPartsName.split(',');
1591 const { slaveData } = props.state; 1601 const { slaveData } = props.state;
@@ -1636,7 +1646,6 @@ const ContentComponent = props =&gt; { @@ -1636,7 +1646,6 @@ const ContentComponent = props =&gt; {
1636 }); 1646 });
1637 } 1647 }
1638 }, [selectedNode?.sAllPartsNameDefault, props.state.slaveData]); 1648 }, [selectedNode?.sAllPartsNameDefault, props.state.slaveData]);
1639 -  
1640 const boxModelList = sAllPartsName.split(","); 1649 const boxModelList = sAllPartsName.split(",");
1641 const [activeKey, setActiveKey] = useState(0); 1650 const [activeKey, setActiveKey] = useState(0);
1642 1651
@@ -1741,8 +1750,10 @@ const ContentComponent = props =&gt; { @@ -1741,8 +1750,10 @@ const ContentComponent = props =&gt; {
1741 1750
1742 // 主表组件 1751 // 主表组件
1743 const MasterComponent = props => { 1752 const MasterComponent = props => {
  1753 +
1744 const { masterConfig, masterData = {}, selectedNode = {} } = props.state; 1754 const { masterConfig, masterData = {}, selectedNode = {} } = props.state;
1745 const { app } = props; 1755 const { app } = props;
  1756 +
1746 if (!masterConfig) return ""; 1757 if (!masterConfig) return "";
1747 1758
1748 const { userinfo } = app; 1759 const { userinfo } = app;
@@ -1762,12 +1773,7 @@ const MasterComponent = props =&gt; { @@ -1762,12 +1773,7 @@ const MasterComponent = props =&gt; {
1762 } 1773 }
1763 }); 1774 });
1764 const JosnAbleConfigs = JSON.parse(JSON.stringify(ableConfigs)); 1775 const JosnAbleConfigs = JSON.parse(JSON.stringify(ableConfigs));
1765 - // 处理长宽样式  
1766 - // selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sProductType !== "不干胶"  
1767 - // ? ableConfigs  
1768 - // : ableConfigs.filter(x => x.sName !== "dHeight");  
1769 const { sStripType = 0 } = selectedNode; 1776 const { sStripType = 0 } = selectedNode;
1770 - // {"0":"长宽高","1":"高宽"} ,0显示长宽高,1显示宽高  
1771 const viewConfigs = Number(sStripType) === 0 ? JosnAbleConfigs : JosnAbleConfigs.filter(x => x.sName !== "dHeight"); 1777 const viewConfigs = Number(sStripType) === 0 ? JosnAbleConfigs : JosnAbleConfigs.filter(x => x.sName !== "dHeight");
1772 if (Number(sStripType) === 0) { 1778 if (Number(sStripType) === 0) {
1773 viewConfigs.forEach(item => { 1779 viewConfigs.forEach(item => {
@@ -1797,6 +1803,7 @@ const MasterComponent = props =&gt; { @@ -1797,6 +1803,7 @@ const MasterComponent = props =&gt; {
1797 } 1803 }
1798 } 1804 }
1799 } 1805 }
  1806 +
1800 const viewProps = { 1807 const viewProps = {
1801 ...props, 1808 ...props,
1802 viewConfigs: viewConfigs, 1809 viewConfigs: viewConfigs,
@@ -1836,6 +1843,7 @@ const MasterComponent = props =&gt; { @@ -1836,6 +1843,7 @@ const MasterComponent = props =&gt; {
1836 1843
1837 // 盒型组件 1844 // 盒型组件
1838 const BoxComponent = props => { 1845 const BoxComponent = props => {
  1846 +
1839 const { dividerProps, state, boxModel } = props; 1847 const { dividerProps, state, boxModel } = props;
1840 const { 1848 const {
1841 masterData = {}, 1849 masterData = {},
@@ -1851,6 +1859,7 @@ const BoxComponent = props =&gt; { @@ -1851,6 +1859,7 @@ const BoxComponent = props =&gt; {
1851 1859
1852 const { bBox } = selectedNode; 1860 const { bBox } = selectedNode;
1853 const [boxTypeList, setBoxTypeList] = useState([]); 1861 const [boxTypeList, setBoxTypeList] = useState([]);
  1862 + const sQuoConfig = commonUtils.convertStrToObj(props.masterData.sQuoConfig, {});
1854 // 卡牌类卷筒类默认使用矩形 当是核价保存过的需要在主表数据加载完后在赋值 1863 // 卡牌类卷筒类默认使用矩形 当是核价保存过的需要在主表数据加载完后在赋值
1855 let slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {}; 1864 let slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {};
1856 const { sBillNo } = slaveRowData; 1865 const { sBillNo } = slaveRowData;
@@ -2080,7 +2089,6 @@ const BoxComponent = props =&gt; { @@ -2080,7 +2089,6 @@ const BoxComponent = props =&gt; {
2080 // const upViewProps11 = getUpViewPropsByITag(11); 2089 // const upViewProps11 = getUpViewPropsByITag(11);
2081 // 印刷参数表单 2090 // 印刷参数表单
2082 let upViewProps12 = getUpViewPropsByITag(12); 2091 let upViewProps12 = getUpViewPropsByITag(12);
2083 -  
2084 const filterConditions = { 2092 const filterConditions = {
2085 juantong: x => 2093 juantong: x =>
2086 x.sName === "iPage" || 2094 x.sName === "iPage" ||
@@ -2106,7 +2114,8 @@ const BoxComponent = props =&gt; { @@ -2106,7 +2114,8 @@ const BoxComponent = props =&gt; {
2106 } 2114 }
2107 2115
2108 // 拼板信息表单 2116 // 拼板信息表单
2109 - const upViewProps20 = getUpViewPropsByITag(20); 2117 + let upViewProps20 = getUpViewPropsByITag(20);
  2118 +
2110 // 如果是卷筒类需要单独处理 2119 // 如果是卷筒类需要单独处理
2111 2120
2112 const { sBackProcessData = [] } = slaveRowData; 2121 const { sBackProcessData = [] } = slaveRowData;
@@ -2277,7 +2286,7 @@ const BoxComponent = props =&gt; { @@ -2277,7 +2286,7 @@ const BoxComponent = props =&gt; {
2277 })), 2286 })),
2278 tableConfig: { ...slaveConfig, gdsconfigformslave: finishedConfigs }, 2287 tableConfig: { ...slaveConfig, gdsconfigformslave: finishedConfigs },
2279 iColValueView: 24, 2288 iColValueView: 24,
2280 - viewRow: masterData, 2289 + viewRow: { ...masterData, sId : masterData.sId || "123" },
2281 getViewRow: config => { 2290 getViewRow: config => {
2282 return productProcessInfo.find(item => item[config.sName]) || {}; 2291 return productProcessInfo.find(item => item[config.sName]) || {};
2283 }, 2292 },
@@ -2325,7 +2334,18 @@ const BoxComponent = props =&gt; { @@ -2325,7 +2334,18 @@ const BoxComponent = props =&gt; {
2325 const [materialLength, setMaterialLength] = useState(0); 2334 const [materialLength, setMaterialLength] = useState(0);
2326 const [materialWidth, setMaterialWidth] = useState(0); 2335 const [materialWidth, setMaterialWidth] = useState(0);
2327 2336
2328 - // 使用 useCallback 确保回调函数的稳定性 2337 + // 使用 防抖防止输出数据错误
  2338 + const debounceTimer = useRef(null);
  2339 +
  2340 + const debouncedHandleSaveState = useCallback(
  2341 + (...args) => {
  2342 + clearTimeout(debounceTimer.current);
  2343 + debounceTimer.current = setTimeout(() => {
  2344 + handleSaveState(...args);
  2345 + }, 500);
  2346 + },
  2347 + [handleSaveState]
  2348 + );
2329 const handleSaveState = ( 2349 const handleSaveState = (
2330 length, 2350 length,
2331 width, 2351 width,
@@ -2346,12 +2366,7 @@ const BoxComponent = props =&gt; { @@ -2346,12 +2366,7 @@ const BoxComponent = props =&gt; {
2346 ) => { 2366 ) => {
2347 // 查找符合条件的索引 2367 // 查找符合条件的索引
2348 const { selectedNode } = props.state; 2368 const { selectedNode } = props.state;
2349 -  
2350 const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); 2369 const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel);
2351 - // 判断展长展宽是否可以放下原纸  
2352 - const isDPartsLength =  
2353 - slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth;  
2354 - const dProductQtys = props.state.masterData.dProductQty || 0;  
2355 if (index !== undefined && index !== -1) { 2370 if (index !== undefined && index !== -1) {
2356 // 计算开数 2371 // 计算开数
2357 // 获取原始对象并创建一个新的对象进行更新 2372 // 获取原始对象并创建一个新的对象进行更新
@@ -2359,8 +2374,8 @@ const BoxComponent = props =&gt; { @@ -2359,8 +2374,8 @@ const BoxComponent = props =&gt; {
2359 ...slaveData[index], 2374 ...slaveData[index],
2360 materialLength: dWlcd, 2375 materialLength: dWlcd,
2361 materialWidth: dWlkd, 2376 materialWidth: dWlkd,
2362 - dMachineLength: length, // 上机长  
2363 - dMachineWidth: width, // 上机宽 2377 + dMachineLength: dWlcd, // 上机长
  2378 + dMachineWidth: dWlkd, // 上机宽
2364 sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸 2379 sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸
2365 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸 2380 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸
2366 sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2), 2381 sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2),
@@ -2405,10 +2420,12 @@ const BoxComponent = props =&gt; { @@ -2405,10 +2420,12 @@ const BoxComponent = props =&gt; {
2405 ...juantongConfig, 2420 ...juantongConfig,
2406 }; 2421 };
2407 // 更新状态 2422 // 更新状态
2408 - props.setState(prevState => ({  
2409 - ...prevState,  
2410 - slaveData: slaveData.map((item, i) => (i === index ? newSlaveData : item)),  
2411 - })); 2423 + setTimeout(() => {
  2424 + props.setState(prevState => ({
  2425 + ...prevState,
  2426 + slaveData: slaveData.map((item, i) => (i === index ? newSlaveData : item)),
  2427 + }));
  2428 + }, 200);
2412 } 2429 }
2413 2430
2414 setMaterialLength(length); 2431 setMaterialLength(length);
@@ -2459,12 +2476,13 @@ const BoxComponent = props =&gt; { @@ -2459,12 +2476,13 @@ const BoxComponent = props =&gt; {
2459 slaveRowData.sName === "卡牌" 2476 slaveRowData.sName === "卡牌"
2460 ) { 2477 ) {
2461 const slaveNewData = slaveRowData.upAbleConfigsExtra || JSON.parse(slaveRowData.sColumnNameConfig); 2478 const slaveNewData = slaveRowData.upAbleConfigsExtra || JSON.parse(slaveRowData.sColumnNameConfig);
  2479 + const slaveRowDatas = sBillNo ? sQuoConfig?.slaveData?.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {} : slaveRowData;
2462 const tables = [ 2480 const tables = [
2463 { name: "盒型类别", value: slaveRowData.sBoxType, type: null }, 2481 { name: "盒型类别", value: slaveRowData.sBoxType, type: null },
2464 { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes }, 2482 { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes },
2465 { name: "盒长", value: slaveRowData.dL ? slaveRowData.dL : masterData.dLength ? Number(masterData.dLength) : 0, type: null }, 2483 { name: "盒长", value: slaveRowData.dL ? slaveRowData.dL : masterData.dLength ? Number(masterData.dLength) : 0, type: null },
2466 { name: "盒宽", value: slaveRowData.dW ? slaveRowData.dW : masterData.dWidth ? Number(masterData.dWidth) : 0, type: null }, 2484 { name: "盒宽", value: slaveRowData.dW ? slaveRowData.dW : masterData.dWidth ? Number(masterData.dWidth) : 0, type: null },
2467 - { name: "盒高", value: masterData.dHeight ? Number(masterData.dHeight) : 0, type: null }, 2485 + { name: "盒高", value: slaveRowData.dD ? slaveRowData.dD : masterData.dHeight ? Number(masterData.dHeight) : 0, type: null },
2468 ]; 2486 ];
2469 const titleList1 = [ 2487 const titleList1 = [
2470 { name: "上方盒舌", value: "dSFHS" }, 2488 { name: "上方盒舌", value: "dSFHS" },
@@ -2517,7 +2535,7 @@ const BoxComponent = props =&gt; { @@ -2517,7 +2535,7 @@ const BoxComponent = props =&gt; {
2517 slaveNewData.forEach(x => { 2535 slaveNewData.forEach(x => {
2518 let key = 0; 2536 let key = 0;
2519 if (x.sAssignFormula) { 2537 if (x.sAssignFormula) {
2520 - key = evaluateFormula(x.sAssignFormula, variables); 2538 + key = sBillNo ? slaveRowData[x.sName] : evaluateFormula(x.sAssignFormula, variables);
2521 slaveRowData[x.sName] = key; 2539 slaveRowData[x.sName] = key;
2522 } else { 2540 } else {
2523 if (x.sTypes && x.sTypes.includes('09')) { 2541 if (x.sTypes && x.sTypes.includes('09')) {
@@ -2578,7 +2596,6 @@ const BoxComponent = props =&gt; { @@ -2578,7 +2596,6 @@ const BoxComponent = props =&gt; {
2578 dSvgBoxHeight: 200, 2596 dSvgBoxHeight: 200,
2579 showNew: 1, 2597 showNew: 1,
2580 }; 2598 };
2581 -  
2582 // upViewProps.viewRow = 2599 // upViewProps.viewRow =
2583 2600
2584 const isShowImg = boxList.find(x => x.sName === "盒身")?.type !== "" || false; 2601 const isShowImg = boxList.find(x => x.sName === "盒身")?.type !== "" || false;
@@ -2771,7 +2788,7 @@ const BoxComponent = props =&gt; { @@ -2771,7 +2788,7 @@ const BoxComponent = props =&gt; {
2771 <div> 2788 <div>
2772 <div style={{ width: "600px", height: "300px" }}> 2789 <div style={{ width: "600px", height: "300px" }}>
2773 <div className={styles.boxComponent}> 2790 <div className={styles.boxComponent}>
2774 - <Typesetting {...boxProps} onSaveStates={handleSaveState} onSaveDPartsLength={onSaveDPartsLength} /> 2791 + <Typesetting {...boxProps} onSaveStates={debouncedHandleSaveState} onSaveDPartsLength={onSaveDPartsLength} />
2775 </div> 2792 </div>
2776 <div className={styles.boxComponent1}> 2793 <div className={styles.boxComponent1}>
2777 <ShowImgM {...showImgMProps} /> 2794 <ShowImgM {...showImgMProps} />
@@ -2914,7 +2931,6 @@ const PrintParamsComponent = props =&gt; { @@ -2914,7 +2931,6 @@ const PrintParamsComponent = props =&gt; {
2914 })); 2931 }));
2915 }, 2932 },
2916 }; 2933 };
2917 -  
2918 result.push( 2934 result.push(
2919 <div className={styles.materialsLine}> 2935 <div className={styles.materialsLine}>
2920 <div className={styles.materialsViewTable} id={viewTableId}> 2936 <div className={styles.materialsViewTable} id={viewTableId}>
@@ -3613,7 +3629,7 @@ const BackendParamsExtraComponent = props =&gt; { @@ -3613,7 +3629,7 @@ const BackendParamsExtraComponent = props =&gt; {
3613 ...props, 3629 ...props,
3614 viewConfigs: viewConfigs.map(item => ({ 3630 viewConfigs: viewConfigs.map(item => ({
3615 ...item, 3631 ...item,
3616 - costomStyle: styles.sParamConfig, 3632 + costomStyle: `${styles.sParamConfig} ${item.showName?.length > 4 ? 'sParamConfigLong' : ""}`,
3617 })), 3633 })),
3618 tableConfig: { ...slaveConfig, gdsconfigformslave: viewConfigs }, 3634 tableConfig: { ...slaveConfig, gdsconfigformslave: viewConfigs },
3619 iColValueView: 24, 3635 iColValueView: 24,
@@ -3629,9 +3645,31 @@ const BackendParamsExtraComponent = props =&gt; { @@ -3629,9 +3645,31 @@ const BackendParamsExtraComponent = props =&gt; {
3629 ); 3645 );
3630 }, 3646 },
3631 tableName: `sBackendParams${sBoxModel}`, 3647 tableName: `sBackendParams${sBoxModel}`,
3632 - getSqlDropDownData: (...args) => { 3648 + getSqlDropDownData: async (...args) => {
3633 const showConfig = args[2]; 3649 const showConfig = args[2];
3634 - const { sParamDropDown = "", sName } = showConfig; 3650 + const { sDropDownType, sParamDropDown = "", sName, sFieldName } = showConfig;
  3651 + if (sDropDownType === "sql" && sParamDropDown?.toLowerCase()?.includes("select")) {
  3652 + args[2] = {
  3653 + ...showConfig,
  3654 + showDropDown: sParamDropDown,
  3655 + };
  3656 + delete args[2].sId;
  3657 + const result = await props.getSqlDropDownData(...args);
  3658 + const { dropDownData } = result;
  3659 + const temp = {
  3660 + ...result,
  3661 + dropDownData: dropDownData.map(item => ({
  3662 + ...item,
  3663 + // sId: item.sValue,
  3664 + value: item.sValue,
  3665 + sParam: showConfig.sParam,
  3666 + [sName]: item.sValue,
  3667 + sParamKey: sName,
  3668 + sFieldName,
  3669 + })),
  3670 + };
  3671 + return temp;
  3672 + }
3635 const dropDownData = sParamDropDown.split(","); 3673 const dropDownData = sParamDropDown.split(",");
3636 if (dropDownData?.length) { 3674 if (dropDownData?.length) {
3637 return { 3675 return {
@@ -3747,6 +3785,7 @@ const GetBestAlgorithm = props =&gt; { @@ -3747,6 +3785,7 @@ const GetBestAlgorithm = props =&gt; {
3747 sSvgPath, 3785 sSvgPath,
3748 dL = 0, 3786 dL = 0,
3749 dW = 0, 3787 dW = 0,
  3788 + dD = 0,
3750 } = slaveRowData; 3789 } = slaveRowData;
3751 if (selectedNode && selectedNode.sTypeKey === "juantong") { 3790 if (selectedNode && selectedNode.sTypeKey === "juantong") {
3752 dXBLB = dSBLB; 3791 dXBLB = dSBLB;
@@ -3762,8 +3801,8 @@ const GetBestAlgorithm = props =&gt; { @@ -3762,8 +3801,8 @@ const GetBestAlgorithm = props =&gt; {
3762 let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 3801 let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸
3763 const L = slaveRowData.dL ? Number(dL) : Number(masterData?.dLength) || 0; 3802 const L = slaveRowData.dL ? Number(dL) : Number(masterData?.dLength) || 0;
3764 const W = slaveRowData.dW ? Number(dW) : masterData?.dWidth || 0; 3803 const W = slaveRowData.dW ? Number(dW) : masterData?.dWidth || 0;
3765 - const H = masterData?.dWidth || 0;  
3766 - const D = masterData?.dHeight || 0; 3804 + const H = slaveRowData.dD ? Number(dD) : masterData?.dWidth || 0;
  3805 + const D = slaveRowData.dD ? Number(dD) : masterData?.dHeight || 0;
3767 // 动态计算公式值 3806 // 动态计算公式值
3768 const evaluateFormula = (formula, variables) => { 3807 const evaluateFormula = (formula, variables) => {
3769 if (!formula) return 0; // 如果公式为空,返回0 3808 if (!formula) return 0; // 如果公式为空,返回0
src/routes/mobile/IndexMobile.js
@@ -96,15 +96,19 @@ class IndexMobile extends React.Component { @@ -96,15 +96,19 @@ class IndexMobile extends React.Component {
96 } 96 }
97 componentDidMount() { 97 componentDidMount() {
98 // 监听系统返回键 98 // 监听系统返回键
  99 + const bExitAgain = commonFunc.showLocalMessage(this.props, 'bExitAgain', '再按一次退出应用');
99 const { plus } = window; 100 const { plus } = window;
100 plus?.key?.addEventListener('backbutton', () => { 101 plus?.key?.addEventListener('backbutton', () => {
101 if (location.pathname === '/indexMobile') { 102 if (location.pathname === '/indexMobile') {
102 // 首页双击返回 103 // 首页双击返回
103 if (this.backPressedOnce) { 104 if (this.backPressedOnce) {
104 - plus.runtime.quit(); 105 + // 把应用切换到后台运行
  106 + // plus.runtime.quit(); // 直接退出应用
  107 + const main = plus?.android?.runtimeMainActivity();
  108 + main?.moveTaskToBack(false); // false:仅隐藏,不销毁
105 } else { 109 } else {
106 this.backPressedOnce = true; 110 this.backPressedOnce = true;
107 - plus.nativeUI.toast('再按一次退出应用'); 111 + plus.nativeUI.toast(bExitAgain);
108 setTimeout(() => { this.backPressedOnce = false; }, 2000); 112 setTimeout(() => { this.backPressedOnce = false; }, 2000);
109 } 113 }
110 } else { 114 } else {