Commit a995f36a745fcb60474ad7354bc1006d8358203d
1 parent
a72df219
快速报价高级设置
Showing
3 changed files
with
38 additions
and
44 deletions
src/components/Common/Typesetting/typesetting.js
| @@ -52,7 +52,8 @@ const Typesetting = props => { | @@ -52,7 +52,8 @@ const Typesetting = props => { | ||
| 52 | const [materialName, setMaterialName] = useState(""); | 52 | const [materialName, setMaterialName] = useState(""); |
| 53 | const [dMaterialsKQty, setDMaterialsKQty] = useState(0); | 53 | const [dMaterialsKQty, setDMaterialsKQty] = useState(0); |
| 54 | const [dPartsLength, setDPartsLength] = useState(0); | 54 | const [dPartsLength, setDPartsLength] = useState(0); |
| 55 | - | 55 | + const [newDHorizontalType, setNewDHorizontalType] = useState(0); |
| 56 | + const [newDPortraitType, setNewDPortraitType] = useState(0); | ||
| 56 | // 横板 | 57 | // 横板 |
| 57 | let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData; | 58 | let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData; |
| 58 | // 使用 useRef 获取 DOM 元素 | 59 | // 使用 useRef 获取 DOM 元素 |
| @@ -73,11 +74,9 @@ const Typesetting = props => { | @@ -73,11 +74,9 @@ const Typesetting = props => { | ||
| 73 | 74 | ||
| 74 | let outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸 | 75 | let outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸 |
| 75 | let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 | 76 | let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 |
| 76 | - dHorizontal = 2; | 77 | + // dHorizontal = 1; |
| 77 | // 如果需要自定义排版数 | 78 | // 如果需要自定义排版数 |
| 78 | 79 | ||
| 79 | - console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait, dHorizontalType, dPortraitType, outerWidth, outerHeight); | ||
| 80 | - | ||
| 81 | // 确认是竖向排列还是横向排列 | 80 | // 确认是竖向排列还是横向排列 |
| 82 | const L = masterData?.dLength; | 81 | const L = masterData?.dLength; |
| 83 | const W = masterData?.dWidth; | 82 | const W = masterData?.dWidth; |
| @@ -248,43 +247,35 @@ const Typesetting = props => { | @@ -248,43 +247,35 @@ const Typesetting = props => { | ||
| 248 | //剩余量能不能放一下单独一个 | 247 | //剩余量能不能放一下单独一个 |
| 249 | const commonHeightCheck = remainingHeight > jInnerHeight; | 248 | const commonHeightCheck = remainingHeight > jInnerHeight; |
| 250 | const commonWidthCheck = remainingWidth > jInnerWidth; | 249 | const commonWidthCheck = remainingWidth > jInnerWidth; |
| 250 | + const isCustomized = false; | ||
| 251 | let remaining = isVertical ? commonHeightCheck : commonWidthCheck; | 251 | let remaining = isVertical ? commonHeightCheck : commonWidthCheck; |
| 252 | - console.log( | ||
| 253 | - cols, | ||
| 254 | - rows, | ||
| 255 | - innerWidth, | ||
| 256 | - innerHeight, | ||
| 257 | - jInnerWidth, | ||
| 258 | - jInnerHeight, | ||
| 259 | - innerWidthCombined, | ||
| 260 | - innerHeightCombined, | ||
| 261 | - remainingWidth, | ||
| 262 | - remainingHeight, | ||
| 263 | - colsMaxLength, | ||
| 264 | - rowsMaxLength, | ||
| 265 | - remaining, | ||
| 266 | - isVertical, | ||
| 267 | - boxLengthOffset, | ||
| 268 | - boxWidthOffset, | ||
| 269 | - dSLengthOffset, | ||
| 270 | - dFLengthOffset, | ||
| 271 | - "rowsMaxLength" | ||
| 272 | - ); | ||
| 273 | - // 从上到下 | ||
| 274 | - if (isVertical) { | ||
| 275 | - // dHorizontal, dPortrait, dHorizontalType, dPortraitType | ||
| 276 | - // 如果dHorizontal 与 dHorizontalType 不相同 横板 | ||
| 277 | - if (Number(dHorizontal) !== Number(dHorizontalType)) { | ||
| 278 | - console.log(dHorizontal, "dHorizontal"); | ||
| 279 | - } | ||
| 280 | - } else { | ||
| 281 | - if (Number(dHorizontal) !== Number(dHorizontalType)) { | ||
| 282 | - // outerWidth = outerWidth - jInnerWidth; | ||
| 283 | - } | ||
| 284 | - if (Number(dPortrait) !== Number(dPortraitType)) { | ||
| 285 | - console.log(dPortrait, "dPortrait"); | 252 | + // const remaining = false; |
| 253 | + | ||
| 254 | + const isOdd = num => { | ||
| 255 | + return num % 2 !== 0; | ||
| 256 | + }; | ||
| 257 | + | ||
| 258 | + // 是否定制 | ||
| 259 | + if (isCustomized) { | ||
| 260 | + if (isVertical) { | ||
| 261 | + cols = dHorizontal; | ||
| 262 | + rows = Math.trunc(dPortrait / 2); | ||
| 263 | + if (isOdd(dPortrait)) { | ||
| 264 | + remaining = true; | ||
| 265 | + } else { | ||
| 266 | + remaining = false; | ||
| 267 | + } | ||
| 268 | + } else { | ||
| 269 | + cols = Math.trunc(dHorizontal / 2); | ||
| 270 | + rows = dPortrait; | ||
| 271 | + if (isOdd(dHorizontal)) { | ||
| 272 | + remaining = true; | ||
| 273 | + } else { | ||
| 274 | + remaining = false; | ||
| 275 | + } | ||
| 286 | } | 276 | } |
| 287 | } | 277 | } |
| 278 | + | ||
| 288 | // 抵扣盒默认展示 svg | 279 | // 抵扣盒默认展示 svg |
| 289 | // const isSvg = props.slaveRowData.sName === "扣抵盒"; | 280 | // const isSvg = props.slaveRowData.sName === "扣抵盒"; |
| 290 | // 组装svg数据 | 281 | // 组装svg数据 |
| @@ -533,7 +524,7 @@ const Typesetting = props => { | @@ -533,7 +524,7 @@ const Typesetting = props => { | ||
| 533 | : rows * (cols * 2); | 524 | : rows * (cols * 2); |
| 534 | // 计算竖版数量 | 525 | // 计算竖版数量 |
| 535 | const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2; | 526 | const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2; |
| 536 | - const dPortraitType = isVertical ? rows * 2 : remaining ? rows : rows; | 527 | + const dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows; |
| 537 | 528 | ||
| 538 | const newDProductQty = masterData.dProductQty; | 529 | const newDProductQty = masterData.dProductQty; |
| 539 | const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; | 530 | const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; |
| @@ -541,13 +532,17 @@ const Typesetting = props => { | @@ -541,13 +532,17 @@ const Typesetting = props => { | ||
| 541 | dPartsLength !== innerWidth || | 532 | dPartsLength !== innerWidth || |
| 542 | newMaterialLength !== materialLength || | 533 | newMaterialLength !== materialLength || |
| 543 | newMaterialWidth !== materialWidth || | 534 | newMaterialWidth !== materialWidth || |
| 544 | - materialName !== sMaterialsName | 535 | + materialName !== sMaterialsName || |
| 536 | + newDHorizontalType !== dHorizontalType || | ||
| 537 | + newDPortraitType !== dPortraitType | ||
| 545 | ) { | 538 | ) { |
| 546 | setMaterialLength(newMaterialLength); | 539 | setMaterialLength(newMaterialLength); |
| 547 | setMaterialWidth(newMaterialWidth); | 540 | setMaterialWidth(newMaterialWidth); |
| 548 | setMaterialName(sMaterialsName); | 541 | setMaterialName(sMaterialsName); |
| 549 | setDProductQty(newDProductQty); | 542 | setDProductQty(newDProductQty); |
| 550 | setDPartsLength(innerWidth); | 543 | setDPartsLength(innerWidth); |
| 544 | + setNewDHorizontalType(dHorizontalType); | ||
| 545 | + setNewDPortraitType(dPortraitType); | ||
| 551 | // setDMaterialsKQty(newDMaterialsKQty) | 546 | // setDMaterialsKQty(newDMaterialsKQty) |
| 552 | const scaleX = (clientWidth - 50) / (outerWidth + 110); | 547 | const scaleX = (clientWidth - 50) / (outerWidth + 110); |
| 553 | const scaleY = (clientHeight - 5) / (outerHeight + 90); | 548 | const scaleY = (clientHeight - 5) / (outerHeight + 90); |
src/components/QuickQuote/index.jsx
| @@ -1000,7 +1000,6 @@ const TreeComponent = props => { | @@ -1000,7 +1000,6 @@ const TreeComponent = props => { | ||
| 1000 | // 点击节点后查询数据 | 1000 | // 点击节点后查询数据 |
| 1001 | useEffect(() => { | 1001 | useEffect(() => { |
| 1002 | if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return; | 1002 | if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return; |
| 1003 | - console.log(selectedNode,'selectedNode'); | ||
| 1004 | 1003 | ||
| 1005 | timeRef.current += 1; | 1004 | timeRef.current += 1; |
| 1006 | 1005 | ||
| @@ -1583,8 +1582,8 @@ const BoxComponent = props => { | @@ -1583,8 +1582,8 @@ const BoxComponent = props => { | ||
| 1583 | scale: scale, | 1582 | scale: scale, |
| 1584 | dPartsLength: innerWidth, | 1583 | dPartsLength: innerWidth, |
| 1585 | dPartsWidth: innerHeight, | 1584 | dPartsWidth: innerHeight, |
| 1586 | - dHorizontal: dHorizontal || dHorizontalType, | ||
| 1587 | - dPortrait: dPortrait || dPortraitType, | 1585 | + dHorizontal: dHorizontalType, |
| 1586 | + dPortrait: dPortraitType, | ||
| 1588 | dHorizontalType: dHorizontalType, // 判断 | 1587 | dHorizontalType: dHorizontalType, // 判断 |
| 1589 | dPortraitType: dPortraitType, | 1588 | dPortraitType: dPortraitType, |
| 1590 | }; | 1589 | }; |
src/mobile/quotation/detailNew.jsx
| @@ -1196,7 +1196,7 @@ const QuotationTabs = props => { | @@ -1196,7 +1196,7 @@ const QuotationTabs = props => { | ||
| 1196 | > | 1196 | > |
| 1197 | {sAllPartsNameList && sAllPartsNameList.length | 1197 | {sAllPartsNameList && sAllPartsNameList.length |
| 1198 | ? sAllPartsNameList.map((pane, index) => ( | 1198 | ? sAllPartsNameList.map((pane, index) => ( |
| 1199 | - <Tabs.Tab key={pane} title={pane} style={{ position: "relative" }}> | 1199 | + <Tabs.Tab key={pane} title={pane} > |
| 1200 | <BoxComponent {...tabsProps} paneKey={pane} /> | 1200 | <BoxComponent {...tabsProps} paneKey={pane} /> |
| 1201 | {/* <CloseOutline className={styles.tabClearBtn}/> */} | 1201 | {/* <CloseOutline className={styles.tabClearBtn}/> */} |
| 1202 | </Tabs.Tab> | 1202 | </Tabs.Tab> |