Commit f1436b73dfb82971320255853ddf4064530f1736

Authored by 陈鑫涛
1 parent 06e3687b

盒型默认参数根据主表变化

src/components/Common/Typesetting/typesetting.js
... ... @@ -277,17 +277,6 @@ const Typesetting = props => {
277 277  
278 278 let remaining = isVertical ? commonHeightCheck : commonWidthCheck;
279 279 // const remaining = false;
280   - console.log(innerWidth, '盒长');
281   - console.log(innerHeight, '盒高');
282   - console.log(dFWidthOffset, '首盒纵向偏移');
283   - console.log(dFLengthOffset, '首盒横向偏移');
284   - console.log(dSWidthOffset,radioValue?.sSWidthOffset, '次盒纵向偏移');
285   - console.log(dSLengthOffset,radioValue?.sSLengthOffset, '次盒横向偏移');
286   - console.log(boxLengthOffset, '第二列横向偏移');
287   - console.log(boxWidthOffset, '第二列纵向偏移');
288   - console.log(variabless,'variabless');
289   -
290   -
291 280 const isOdd = num => {
292 281 return num % 2 !== 0;
293 282 };
... ... @@ -497,14 +486,8 @@ const Typesetting = props => {
497 486 }, [radioValue, slaveRowData, masterData, selectedNode, slaveData]);
498 487 // 生成里层 div 的数组
499 488 const innerDivs = [];
500   - // 如果第一列
501   - // if (rows === 0) {
502   - // const maxWidth = Number(slaveDataDetail?.dMaxWidth)
503   - // if (maxWidth > innerHeight) {
504   - // rows = 1
505   - // }
506   - // }
507   -
  489 +
  490 +
508 491 for (let col = 0; col < cols; col++) {
509 492 for (let row = 0; row < rows; row++) {
510 493 const leftPosition = col * innerWidthCombined;
... ... @@ -553,7 +536,16 @@ const Typesetting = props =&gt; {
553 536 innerDivs.push(createBoxOne(0, rows, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon));
554 537 }
555 538 }
556   -
  539 + // 如果第一列
  540 + if (rows === 0) {
  541 + const maxWidth = Number(slaveDataDetail?.dMaxWidth)
  542 + if (maxWidth > innerHeight) {
  543 + let leftPosition = 0;
  544 + let topPosition = 0;
  545 + innerDivs.push(createBoxOne(cols, 0, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon));
  546 + }
  547 + }
  548 + console.log(cols, '列数', rows, '行数');
557 549 // 判断展开长展开宽是否变化
558 550 if (dPartsLength !== innerWidth && !innerDivs.length) {
559 551 setDPartsLength(innerWidth);
... ... @@ -669,12 +661,13 @@ const Typesetting = props =&gt; {
669 661 Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength) &&
670 662 Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth);
671 663  
672   - const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length;
  664 + const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0;
673 665 console.log(
674 666 slaveDataDetail?.dMaxLength,
675 667 slaveDataDetail?.dMaxWidth,
676 668 slaveRowData?.dMachineLength,
677 669 slaveRowData?.dMachineWidth,
  670 + innerDivs,
678 671 isMax,
679 672 isShow,
680 673 "isMax"
... ...
src/components/QuickQuote/index.jsx
... ... @@ -179,6 +179,7 @@ const QuickQuoteEvent = props =&gt; {
179 179  
180 180 addState.onDataChange = (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
181 181 const { masterData = {}, slaveData = [], selectedNode = {}, manyData = [] } = state;
  182 +
182 183 const extraState = {
183 184 calcPriceFinished: false,
184 185 };
... ... @@ -188,9 +189,13 @@ const QuickQuoteEvent = props =&gt; {
188 189 }
189 190  
190 191 if (name === "master") {
  192 + const { showName: sTreeNodeName } = selectedNode;
  193 + const boxModel = props.currentBoxModel.replace("slaveUp", "").replace("slaveDown", "");
  194 + const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel);
191 195 const masterDataNew = { ...masterData, ...changeValue };
192 196 masterDataNew.handleType = masterDataNew.handleType || "update";
193 197 masterDataNew.sId = masterDataNew.sId || commonUtils.createSid();
  198 +
194 199 if (sFieldName === "dProductQty") {
195 200 setState(pre => ({
196 201 ...pre,
... ... @@ -198,6 +203,17 @@ const QuickQuoteEvent = props =&gt; {
198 203 }));
199 204 }
200 205  
  206 + if (sFieldName === "dLength" || sFieldName === "dWidth" || sFieldName === "dHeight") {
  207 + const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[iIndex].sColumnNameConfig, []).map(item => ({
  208 + ...item,
  209 + iColValue: item.iColValue || 6,
  210 + }));
  211 + slaveData[iIndex] = {
  212 + ...slaveData[iIndex],
  213 + upAbleConfigsExtra:sColumnNameConfig
  214 + }
  215 +
  216 + }
201 217 setState(pre => ({ ...pre, masterData: masterDataNew, ...extraState }));
202 218 } else if (name.includes("slave")) {
203 219 const boxModel = name.replace("slaveUp", "").replace("slaveDown", "");
... ... @@ -353,6 +369,14 @@ const QuickQuoteEvent = props =&gt; {
353 369 dFlap: "",
354 370 };
355 371 }
  372 + const {upAbleConfigsExtra} = slaveData[saveIndex] || {};
  373 +
  374 + upAbleConfigsExtra.forEach(item => {
  375 + if (item.sName === sFieldName) {
  376 + item.sAssignFormula = null
  377 + }
  378 + })
  379 +
356 380 setState(pre => ({ ...pre, slaveData, ...extraState }));
357 381 } else if (name === "finished") {
358 382 const { productProcessInfo = [] } = masterData;
... ... @@ -1165,12 +1189,17 @@ const TreeComponent = props =&gt; {
1165 1189 };
1166 1190 if (selectedNode.sProductType === "不干胶") {
1167 1191 props.onSaveState({
1168   - masterData: { ...props.masterData, sFormId: "101251240115016002356125200" },
  1192 + masterData: { ...props.masterData, sFormId: "101251240115016002356125200",sOldFormId:props.masterData.sFormId },
  1193 + });
  1194 + } else {
  1195 + props.onSaveState({
  1196 + masterData: { ...props.masterData, sFormId:props.masterData.sOldFormId || props.masterData.sFormId },
1169 1197 });
1170 1198 }
1171   -
  1199 +
1172 1200 getDropDownData(props);
1173 1201 }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]);
  1202 + console.log(props.masterData,'pppppp',selectedNode.sProductType);
1174 1203  
1175 1204 return (
1176 1205 <Tree
... ... @@ -1432,6 +1461,7 @@ const BoxComponent = props =&gt; {
1432 1461 }));
1433 1462  
1434 1463 const showUpAbleConfigsExtra = upAbleConfigsExtra.filter(x => x.bVisible === 1);
  1464 + console.log("🚀 ~ showUpAbleConfigsExtra:", showUpAbleConfigsExtra);
1435 1465 const upAbleConfigs = [
1436 1466 ...slaveConfig.gdsconfigformslave.filter(item => item.iTag === 10).filter(item => (bBox ? true : item.sName !== "sName")),
1437 1467 ...showUpAbleConfigsExtra,
... ... @@ -1444,6 +1474,7 @@ const BoxComponent = props =&gt; {
1444 1474 viewRow: slaveRowData,
1445 1475 tableName: `slaveUp${boxModel}`,
1446 1476 };
  1477 + console.log("🚀 ~ upViewProps:", props.state);
1447 1478  
1448 1479 const getUpViewPropsByITag = iTag => {
1449 1480 const config = slaveConfig.gdsconfigformslave
... ... @@ -1900,7 +1931,7 @@ const BoxComponent = props =&gt; {
1900 1931 (slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) ||
1901 1932 (Number(sStripType) === 1 && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth)
1902 1933 ) {
1903   - const slaveNewData = JSON.parse(slaveRowData.sColumnNameConfig);
  1934 + const slaveNewData = slaveRowData.upAbleConfigsExtra;
1904 1935 const tables = [
1905 1936 { name: "盒型类别", value: slaveRowData.sBoxType, type: null },
1906 1937 { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes },
... ... @@ -1954,6 +1985,7 @@ const BoxComponent = props =&gt; {
1954 1985 let key = 0;
1955 1986 if (x.sAssignFormula) {
1956 1987 key = evaluateFormula(x.sAssignFormula, variables);
  1988 + slaveRowData[x.sName] = key;
1957 1989 } else {
1958 1990 key = slaveRowData[x.sName];
1959 1991 }
... ... @@ -1993,6 +2025,8 @@ const BoxComponent = props =&gt; {
1993 2025 dSvgBoxHeight: 300,
1994 2026 showNew: 1,
1995 2027 };
  2028 + // upViewProps.viewRow =
  2029 +
1996 2030 const isShowImg = boxList.find(x => x.sName === "盒身")?.type !== "" || false;
1997 2031 const PrintingParameters = props.getI18nName("PrintingParameters", "印刷参数");
1998 2032  
... ... @@ -2001,7 +2035,6 @@ const BoxComponent = props =&gt; {
2001 2035  
2002 2036 const noImage = commonFunc.showLocalMessage(props, "ImpositionInformation", "暂无图片");
2003 2037  
2004   -
2005 2038 const imagesData = [
2006 2039 { src: slaveRowData.sPackDetailPathUpLoad, alt: "展开图" },
2007 2040 { src: slaveRowData.sPackPath, alt: "立体图" },
... ... @@ -2099,14 +2132,13 @@ const BoxComponent = props =&gt; {
2099 2132 {/* <div className={styles.boxRreviewTitile}>展开图</div> */}
2100 2133 {slaveRowData.sPackPath ? (
2101 2134 // <Image width={300} src={slaveRowData.sPackPath} />
2102   -
  2135 +
2103 2136 <Carousel style={{ width: "300px", height: "300px" }} className={styles.carousel} dots>
2104   - { imagesData.map((image, index) => (
  2137 + {imagesData.map((image, index) => (
2105 2138 <div key={index} className="carousel-item">
2106   - <Image width={300} src={image.src} alt={image.alt} />
  2139 + <Image width={300} src={image.src} alt={image.alt} />
2107 2140 </div>
2108   - ))
2109   - }
  2141 + ))}
2110 2142 </Carousel>
2111 2143 ) : (
2112 2144 <div className={styles.noImg}>{noImage}</div>
... ... @@ -2765,7 +2797,6 @@ const BoxModelSelectedModal = props =&gt; {
2765 2797 columns
2766 2798 .filter(item => item.dataIndex?.includes("Path"))
2767 2799 .forEach(column => {
2768   -
2769 2800 // (value ? (column.dataIndex === 'sPackDetailPath' ? (boxData[index].sPackPath ? <img src={value} alt="" width={270} height={270} /> : '') : <img src={value} alt="" width={270} height={270} />) : "暂无图片");
2770 2801 column.render = (value, record, index) =>
2771 2802 column.dataIndex === "sPackDetailPathUpLoad" ? (
... ...