Commit a923d960e2d59bab4a3bdac80e43717513a71e83

Authored by 陈鑫涛
1 parent d765b569

app核价

src/components/Common/Typesetting/typesetting.js
... ... @@ -54,7 +54,7 @@ const Typesetting = props => {
54 54 const [dPartsLength, setDPartsLength] = useState(0);
55 55  
56 56 // 横板
57   - const { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData;
  57 + let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData;
58 58 // 使用 useRef 获取 DOM 元素
59 59 const boxRef = useRef(null);
60 60 const boxsRef = useRef(null);
... ... @@ -71,9 +71,12 @@ const Typesetting = props => {
71 71 const maxWidth = Number(slaveDataDetail?.dMaxLength);
72 72 const maxHeight = Number(slaveDataDetail?.dMaxWidth);
73 73  
74   - const outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸
75   - const outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸
76   - console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait,dHorizontalType,dPortraitType, outerWidth, outerHeight);
  74 + let outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸
  75 + let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸
  76 + dHorizontal = 2;
  77 + // 如果需要自定义排版数
  78 +
  79 + console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait, dHorizontalType, dPortraitType, outerWidth, outerHeight);
77 80  
78 81 // 确认是竖向排列还是横向排列
79 82 const L = masterData?.dLength;
... ... @@ -192,12 +195,7 @@ const Typesetting = props => {
192 195 const boxWidthOffset = evaluateFormula(sSecondLongitudinalOffset, variabless); // 第二列纵向偏移
193 196 const isVertical = sSettingMethod === "从上到下"; // true 表示竖向排列,false 表示横向排列 sSettingMethod === '从上到下'
194 197 const reference = sSGroupOffset === "首盒"; // 第三列参考
195   - const style = {
196   - width: `${outerWidth}px`,
197   - height: `${outerHeight}px`,
198   - backgroundColor: "#f3f3f3",
199   - position: "relative", // 设置外层 div 为相对定位
200   - };
  198 +
201 199 // 计算内层盒子尺寸 加上间距
202 200 let jInnerHeight = innerHeight + dXBJJ + dXBJJ;
203 201 let jInnerWidth = innerWidth + dYBJJ + dYBJJ;
... ... @@ -216,6 +214,13 @@ const Typesetting = props => {
216 214 const innerWidthCombined = isVertical
217 215 ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset)
218 216 : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset;
  217 +
  218 + const style = {
  219 + width: `${outerWidth}px`,
  220 + height: `${outerHeight}px`,
  221 + backgroundColor: "#f3f3f3",
  222 + position: "relative", // 设置外层 div 为相对定位
  223 + };
219 224 // 加上间距后的最大盒子长宽 计算每列可以放多少个组合 需要计算间距
220 225 // 每个盒子加上边距 和第二组偏移量 如果根据次盒再加上次盒偏移量
221 226 let cols = Math.floor(outerWidth / (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)));
... ... @@ -243,7 +248,7 @@ const Typesetting = props => {
243 248 //剩余量能不能放一下单独一个
244 249 const commonHeightCheck = remainingHeight > jInnerHeight;
245 250 const commonWidthCheck = remainingWidth > jInnerWidth;
246   - const remaining = isVertical ? commonHeightCheck : commonWidthCheck;
  251 + let remaining = isVertical ? commonHeightCheck : commonWidthCheck;
247 252 console.log(
248 253 cols,
249 254 rows,
... ... @@ -265,7 +270,21 @@ const Typesetting = props => {
265 270 dFLengthOffset,
266 271 "rowsMaxLength"
267 272 );
268   -
  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");
  286 + }
  287 + }
269 288 // 抵扣盒默认展示 svg
270 289 // const isSvg = props.slaveRowData.sName === "扣抵盒";
271 290 // 组装svg数据
... ... @@ -546,6 +565,8 @@ const Typesetting = props => {
546 565 newMaterialWidth,
547 566 innerWidth,
548 567 innerHeight,
  568 + dHorizontal,
  569 + dPortrait,
549 570 dHorizontalType,
550 571 dPortraitType
551 572 );
... ... @@ -565,6 +586,8 @@ const Typesetting = props => {
565 586 slaveDataDetail.dWlkd,
566 587 innerWidth,
567 588 innerHeight,
  589 + dHorizontal,
  590 + dPortrait,
568 591 dHorizontalType,
569 592 dPortraitType
570 593 );
... ...
src/components/QuickQuote/index.jsx
... ... @@ -1000,7 +1000,8 @@ const TreeComponent = props => {
1000 1000 // 点击节点后查询数据
1001 1001 useEffect(() => {
1002 1002 if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return;
1003   -
  1003 + console.log(selectedNode,'selectedNode');
  1004 +
1004 1005 timeRef.current += 1;
1005 1006  
1006 1007 const getSqlDropDownData = async ({ sId }) => {
... ... @@ -1539,7 +1540,9 @@ const BoxComponent = props => {
1539 1540 innerWidth,
1540 1541 innerHeight,
1541 1542 dHorizontal,
1542   - dPortrait
  1543 + dPortrait,
  1544 + dHorizontalType,
  1545 + dPortraitType
1543 1546 ) => {
1544 1547 // 查找符合条件的索引
1545 1548 const { selectedNode } = props.state;
... ... @@ -1579,10 +1582,10 @@ const BoxComponent = props => {
1579 1582 scale: scale,
1580 1583 dPartsLength: innerWidth,
1581 1584 dPartsWidth: innerHeight,
1582   - dHorizontal: dHorizontal,
1583   - dPortrait: dPortrait,
1584   - dHorizontalType: dHorizontal,
1585   - dPortraitType: dPortrait,
  1585 + dHorizontal: dHorizontal || dHorizontalType,
  1586 + dPortrait: dPortrait || dPortraitType,
  1587 + dHorizontalType: dHorizontalType, // 判断
  1588 + dPortraitType: dPortraitType,
1586 1589 };
1587 1590 // 更新状态
1588 1591 props.setState(prevState => ({
... ... @@ -2315,7 +2318,7 @@ const BoxModelSelectedModal = props => {
2315 2318 };
2316 2319 return svgProps;
2317 2320 };
2318   -
  2321 + const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected))
2319 2322 const tableProps = {
2320 2323 ...commonBusiness.getTableTypes("box", {
2321 2324 ...props,
... ... @@ -2333,8 +2336,8 @@ const BoxModelSelectedModal = props => {
2333 2336 // (value ? (column.dataIndex === 'sPackDetailPath' ? (boxData[index].sPackPath ? <img src={value} alt="" width={270} height={270} /> : '') : <img src={value} alt="" width={270} height={270} />) : "暂无图片");
2334 2337 column.render = (value, record, index) =>
2335 2338 column.dataIndex === "sPackDetailPathUpLoad" ? (
2336   - boxData[index].sTypes ? (
2337   - <DynamicSVG {...getSvgProps(boxData[index])} />
  2339 + selectBoxList[index].sTypes ? (
  2340 + <DynamicSVG {...getSvgProps(selectBoxList[index])} />
2338 2341 ) : (
2339 2342 <img src={value} alt="" width={270} height={270} />
2340 2343 )
... ...
src/mobile/quotation/detailNew.jsx
... ... @@ -358,11 +358,10 @@ const QuickQuoteEvent = props =&gt; {
358 358 return;
359 359 }
360 360 const type = isDraftSaved ? "add" : "update";
361   -
362 361 props.onSaveState(
363 362 {
364 363 ...addState.onGetAllDelData(),
365   - masterData: { ...nextProps.masterData, handleType: masterData.handleType, sQuoConfig: JSON.stringify(addState.onGetFilterState(nextState)) },
  364 + masterData: { ...nextProps.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(nextState)) },
366 365 slaveData: nextProps.slaveData.map(item => {
367 366 return {
368 367 ...item,
... ... @@ -418,7 +417,10 @@ const QuickQuoteEvent = props =&gt; {
418 417 newState => {
419 418 if (newState) {
420 419 props.onButtonClick("BtnDraft", { ...props, ...newState });
421   - setIsDraftSaved(true);
  420 +
  421 + // setTimeout(() => {
  422 + // setIsDraftSaved(true);
  423 + // }, 500);
422 424 }
423 425 }
424 426 );
... ...
src/mobile/quotation/master.jsx
... ... @@ -338,7 +338,6 @@ const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, change
338 338 };
339 339 // 计算数量
340 340 const handleCalculation = async (bSave, nextProps, isWait, props) => {
341   -
342 341 const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`;
343 342 const {
344 343 masterConfig,
... ... @@ -361,6 +360,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
361 360 manyDataCache = [],
362 361 dQuickQuoteProductQty,
363 362 } = nextProps;
  363 + console.log("🚀 ~ handleCalculation ~ dQuickQuoteProductQty:", dQuickQuoteProductQty)
364 364 let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps;
365 365 const sMakePerson = masterData.sMakePerson;
366 366 const data = [];
... ... @@ -408,24 +408,28 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
408 408 masterData.sFormId = nextProps.masterData.sFormId;
409 409 masterData.sBillNo = nextProps.masterData.sBillNo;
410 410 }
411   - masterData.handleType = nextProps.handleType && nextProps.handleType === 'update' ? "update" : "add";
  411 + masterData.handleType = nextProps.handleType && nextProps.handleType === "update" ? "update" : "add";
412 412 if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) {
413 413 masterData.sMakePerson = sMakePerson;
414 414 }
415 415 slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`].map(item => {
416   - item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  416 + item.handleType = dQuickQuoteProductQty ? "update" : item.handleType;
  417 + item.sId = commonUtils.createSid();
417 418 return item;
418 419 });
419 420 controlData = valueReturn[`${controlConfig.sTbName.toLowerCase()}_tmp`].map(item => {
420   - item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  421 + item.handleType = dQuickQuoteProductQty ? "update" : item.handleType;
  422 + item.sId = commonUtils.createSid();
421 423 return item;
422 424 });
423 425 materialsData = valueReturn[`${materialsConfig.sTbName.toLowerCase()}_tmp`].map(item => {
424 426 item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  427 + item.sId = commonUtils.createSid();
425 428 return item;
426 429 });
427 430 processData = valueReturn[`${processConfig.sTbName.toLowerCase()}_tmp`].map(item => {
428 431 item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
  432 + item.sId = commonUtils.createSid();
429 433 return item;
430 434 });
431 435 processData = props.sortData(controlData, processData);
... ... @@ -435,7 +439,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
435 439 return {
436 440 ...item,
437 441 sId: manyqtysData[index] ? manyqtysData[index].sId : item.sId,
438   - handleType: dQuickQuoteProductQty ? "add" : item.handleType,
  442 + handleType: dQuickQuoteProductQty ? "update" : item.handleType,
439 443 };
440 444 });
441 445 manyqtysData.forEach((x, i) => {
... ... @@ -501,7 +505,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
501 505 const data = [];
502 506 // masterData.handleType = "update";
503 507 // masterData.sFormId = commonUtils.createSid()
504   - masterData.sId = commonUtils.createSid()
  508 + masterData.sId = commonUtils.createSid();
505 509 data.push(commonBusiness.mergeData("master", masterConfig.sTbName, [masterData]));
506 510 data.push(commonBusiness.mergeData("slave", slaveConfig.sTbName, slaveData, slaveDelData));
507 511 data.push(commonBusiness.mergeData("control", controlConfig.sTbName, controlData, controlDelData));
... ... @@ -535,7 +539,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
535 539 ...addState,
536 540 });
537 541 } else {
538   - masterData.handleType = 'update'
  542 + masterData.handleType = "update";
539 543 if (isWait) {
540 544 return {
541 545 slaveData,
... ... @@ -546,7 +550,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
546 550 manyqtysData,
547 551 loading: false,
548 552 packData,
549   - handleType:'update',
  553 + handleType: "update",
550 554 ...addState,
551 555 };
552 556 } else {
... ... @@ -560,7 +564,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) =&gt; {
560 564 loading: false,
561 565 packData,
562 566 ...addState,
563   - handleType:'update'
  567 + handleType: "update",
564 568 });
565 569 }
566 570 // message.success(commonFunc.getConfigShowName(masterConfig, "BtnCalculation") + commonFunc.showMessage(app.commonConst, "handleSuccess"));
... ... @@ -794,9 +798,11 @@ const handleSaveData = async (params, props) =&gt; {
794 798 Toast.show({
795 799 content: "保存成功",
796 800 });
  801 + masterData.handleType = "update";
797 802 props.onSaveState({
798 803 enabled: false,
799 804 currentId: masterData.sId,
  805 + masterData,
800 806 });
801 807 // 保存后更新panes,currentPane的checkedId,防止浏览器刷新时重新又变成新增。
802 808 const iPaneIndex = app.panes.findIndex(item => item.key === app.currentPane.key);
... ... @@ -911,7 +917,7 @@ const handleSave = async (skipCalculation, props) =&gt; {
911 917 }
912 918 }
913 919 if ((skipFlag === 0 || masterData.bNoVerify) && !skipCalculation) {
914   - handleCalculation(true, props, false, props);
  920 + handleCalculation(true, props.state.newNextProps, false, props);
915 921 } else {
916 922 props.onSaveData({
917 923 data,
... ...