From a923d960e2d59bab4a3bdac80e43717513a71e83 Mon Sep 17 00:00:00 2001
From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com>
Date: Wed, 18 Jun 2025 15:22:04 +0800
Subject: [PATCH] app核价
---
src/components/Common/Typesetting/typesetting.js | 47 +++++++++++++++++++++++++++++++++++------------
src/components/QuickQuote/index.jsx | 21 ++++++++++++---------
src/mobile/quotation/detailNew.jsx | 8 +++++---
src/mobile/quotation/master.jsx | 26 ++++++++++++++++----------
4 files changed, 68 insertions(+), 34 deletions(-)
diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js
index 63385e5..91a3caa 100644
--- a/src/components/Common/Typesetting/typesetting.js
+++ b/src/components/Common/Typesetting/typesetting.js
@@ -54,7 +54,7 @@ const Typesetting = props => {
const [dPartsLength, setDPartsLength] = useState(0);
// 横板
- const { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData;
+ let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData;
// 使用 useRef 获取 DOM 元素
const boxRef = useRef(null);
const boxsRef = useRef(null);
@@ -71,9 +71,12 @@ const Typesetting = props => {
const maxWidth = Number(slaveDataDetail?.dMaxLength);
const maxHeight = Number(slaveDataDetail?.dMaxWidth);
- const outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸
- const outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸
- console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait,dHorizontalType,dPortraitType, outerWidth, outerHeight);
+ let outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸
+ let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸
+ dHorizontal = 2;
+ // 如果需要自定义排版数
+
+ console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait, dHorizontalType, dPortraitType, outerWidth, outerHeight);
// 确认是竖向排列还是横向排列
const L = masterData?.dLength;
@@ -192,12 +195,7 @@ const Typesetting = props => {
const boxWidthOffset = evaluateFormula(sSecondLongitudinalOffset, variabless); // 第二列纵向偏移
const isVertical = sSettingMethod === "从上到下"; // true 表示竖向排列,false 表示横向排列 sSettingMethod === '从上到下'
const reference = sSGroupOffset === "首盒"; // 第三列参考
- const style = {
- width: `${outerWidth}px`,
- height: `${outerHeight}px`,
- backgroundColor: "#f3f3f3",
- position: "relative", // 设置外层 div 为相对定位
- };
+
// 计算内层盒子尺寸 加上间距
let jInnerHeight = innerHeight + dXBJJ + dXBJJ;
let jInnerWidth = innerWidth + dYBJJ + dYBJJ;
@@ -216,6 +214,13 @@ const Typesetting = props => {
const innerWidthCombined = isVertical
? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset)
: jInnerWidth * 2 + dSLengthOffset + dFLengthOffset;
+
+ const style = {
+ width: `${outerWidth}px`,
+ height: `${outerHeight}px`,
+ backgroundColor: "#f3f3f3",
+ position: "relative", // 设置外层 div 为相对定位
+ };
// 加上间距后的最大盒子长宽 计算每列可以放多少个组合 需要计算间距
// 每个盒子加上边距 和第二组偏移量 如果根据次盒再加上次盒偏移量
let cols = Math.floor(outerWidth / (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)));
@@ -243,7 +248,7 @@ const Typesetting = props => {
//剩余量能不能放一下单独一个
const commonHeightCheck = remainingHeight > jInnerHeight;
const commonWidthCheck = remainingWidth > jInnerWidth;
- const remaining = isVertical ? commonHeightCheck : commonWidthCheck;
+ let remaining = isVertical ? commonHeightCheck : commonWidthCheck;
console.log(
cols,
rows,
@@ -265,7 +270,21 @@ const Typesetting = props => {
dFLengthOffset,
"rowsMaxLength"
);
-
+ // 从上到下
+ if (isVertical) {
+ // dHorizontal, dPortrait, dHorizontalType, dPortraitType
+ // 如果dHorizontal 与 dHorizontalType 不相同 横板
+ if (Number(dHorizontal) !== Number(dHorizontalType)) {
+ console.log(dHorizontal, "dHorizontal");
+ }
+ } else {
+ if (Number(dHorizontal) !== Number(dHorizontalType)) {
+ // outerWidth = outerWidth - jInnerWidth;
+ }
+ if (Number(dPortrait) !== Number(dPortraitType)) {
+ console.log(dPortrait, "dPortrait");
+ }
+ }
// 抵扣盒默认展示 svg
// const isSvg = props.slaveRowData.sName === "扣抵盒";
// 组装svg数据
@@ -546,6 +565,8 @@ const Typesetting = props => {
newMaterialWidth,
innerWidth,
innerHeight,
+ dHorizontal,
+ dPortrait,
dHorizontalType,
dPortraitType
);
@@ -565,6 +586,8 @@ const Typesetting = props => {
slaveDataDetail.dWlkd,
innerWidth,
innerHeight,
+ dHorizontal,
+ dPortrait,
dHorizontalType,
dPortraitType
);
diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx
index 80f5d7a..e874b38 100644
--- a/src/components/QuickQuote/index.jsx
+++ b/src/components/QuickQuote/index.jsx
@@ -1000,7 +1000,8 @@ const TreeComponent = props => {
// 点击节点后查询数据
useEffect(() => {
if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return;
-
+ console.log(selectedNode,'selectedNode');
+
timeRef.current += 1;
const getSqlDropDownData = async ({ sId }) => {
@@ -1539,7 +1540,9 @@ const BoxComponent = props => {
innerWidth,
innerHeight,
dHorizontal,
- dPortrait
+ dPortrait,
+ dHorizontalType,
+ dPortraitType
) => {
// 查找符合条件的索引
const { selectedNode } = props.state;
@@ -1579,10 +1582,10 @@ const BoxComponent = props => {
scale: scale,
dPartsLength: innerWidth,
dPartsWidth: innerHeight,
- dHorizontal: dHorizontal,
- dPortrait: dPortrait,
- dHorizontalType: dHorizontal,
- dPortraitType: dPortrait,
+ dHorizontal: dHorizontal || dHorizontalType,
+ dPortrait: dPortrait || dPortraitType,
+ dHorizontalType: dHorizontalType, // 判断
+ dPortraitType: dPortraitType,
};
// 更新状态
props.setState(prevState => ({
@@ -2315,7 +2318,7 @@ const BoxModelSelectedModal = props => {
};
return svgProps;
};
-
+ const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected))
const tableProps = {
...commonBusiness.getTableTypes("box", {
...props,
@@ -2333,8 +2336,8 @@ const BoxModelSelectedModal = props => {
// (value ? (column.dataIndex === 'sPackDetailPath' ? (boxData[index].sPackPath ?
: '') :
) : "暂无图片");
column.render = (value, record, index) =>
column.dataIndex === "sPackDetailPathUpLoad" ? (
- boxData[index].sTypes ? (
-
+ selectBoxList[index].sTypes ? (
+
) : (
)
diff --git a/src/mobile/quotation/detailNew.jsx b/src/mobile/quotation/detailNew.jsx
index ac618ff..b23bf90 100644
--- a/src/mobile/quotation/detailNew.jsx
+++ b/src/mobile/quotation/detailNew.jsx
@@ -358,11 +358,10 @@ const QuickQuoteEvent = props => {
return;
}
const type = isDraftSaved ? "add" : "update";
-
props.onSaveState(
{
...addState.onGetAllDelData(),
- masterData: { ...nextProps.masterData, handleType: masterData.handleType, sQuoConfig: JSON.stringify(addState.onGetFilterState(nextState)) },
+ masterData: { ...nextProps.masterData, sQuoConfig: JSON.stringify(addState.onGetFilterState(nextState)) },
slaveData: nextProps.slaveData.map(item => {
return {
...item,
@@ -418,7 +417,10 @@ const QuickQuoteEvent = props => {
newState => {
if (newState) {
props.onButtonClick("BtnDraft", { ...props, ...newState });
- setIsDraftSaved(true);
+
+ // setTimeout(() => {
+ // setIsDraftSaved(true);
+ // }, 500);
}
}
);
diff --git a/src/mobile/quotation/master.jsx b/src/mobile/quotation/master.jsx
index 5e82adf..7cbfa2c 100644
--- a/src/mobile/quotation/master.jsx
+++ b/src/mobile/quotation/master.jsx
@@ -338,7 +338,6 @@ const handleMaterialsChange = async (tableDataRow, sModelsId, masterData, change
};
// 计算数量
const handleCalculation = async (bSave, nextProps, isWait, props) => {
-
const dataUrl = `${commonConfig.server_host}business/addQuotationsheet?sModelsId=${nextProps.sModelsId}`;
const {
masterConfig,
@@ -361,6 +360,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
manyDataCache = [],
dQuickQuoteProductQty,
} = nextProps;
+ console.log("🚀 ~ handleCalculation ~ dQuickQuoteProductQty:", dQuickQuoteProductQty)
let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps;
const sMakePerson = masterData.sMakePerson;
const data = [];
@@ -408,24 +408,28 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
masterData.sFormId = nextProps.masterData.sFormId;
masterData.sBillNo = nextProps.masterData.sBillNo;
}
- masterData.handleType = nextProps.handleType && nextProps.handleType === 'update' ? "update" : "add";
+ masterData.handleType = nextProps.handleType && nextProps.handleType === "update" ? "update" : "add";
if (masterData.handleType === "update" && !commonUtils.isEmpty(sMakePerson)) {
masterData.sMakePerson = sMakePerson;
}
slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`].map(item => {
- item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
+ item.handleType = dQuickQuoteProductQty ? "update" : item.handleType;
+ item.sId = commonUtils.createSid();
return item;
});
controlData = valueReturn[`${controlConfig.sTbName.toLowerCase()}_tmp`].map(item => {
- item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
+ item.handleType = dQuickQuoteProductQty ? "update" : item.handleType;
+ item.sId = commonUtils.createSid();
return item;
});
materialsData = valueReturn[`${materialsConfig.sTbName.toLowerCase()}_tmp`].map(item => {
item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
+ item.sId = commonUtils.createSid();
return item;
});
processData = valueReturn[`${processConfig.sTbName.toLowerCase()}_tmp`].map(item => {
item.handleType = dQuickQuoteProductQty ? "add" : item.handleType;
+ item.sId = commonUtils.createSid();
return item;
});
processData = props.sortData(controlData, processData);
@@ -435,7 +439,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
return {
...item,
sId: manyqtysData[index] ? manyqtysData[index].sId : item.sId,
- handleType: dQuickQuoteProductQty ? "add" : item.handleType,
+ handleType: dQuickQuoteProductQty ? "update" : item.handleType,
};
});
manyqtysData.forEach((x, i) => {
@@ -501,7 +505,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
const data = [];
// masterData.handleType = "update";
// masterData.sFormId = commonUtils.createSid()
- masterData.sId = commonUtils.createSid()
+ masterData.sId = commonUtils.createSid();
data.push(commonBusiness.mergeData("master", masterConfig.sTbName, [masterData]));
data.push(commonBusiness.mergeData("slave", slaveConfig.sTbName, slaveData, slaveDelData));
data.push(commonBusiness.mergeData("control", controlConfig.sTbName, controlData, controlDelData));
@@ -535,7 +539,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
...addState,
});
} else {
- masterData.handleType = 'update'
+ masterData.handleType = "update";
if (isWait) {
return {
slaveData,
@@ -546,7 +550,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
manyqtysData,
loading: false,
packData,
- handleType:'update',
+ handleType: "update",
...addState,
};
} else {
@@ -560,7 +564,7 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => {
loading: false,
packData,
...addState,
- handleType:'update'
+ handleType: "update",
});
}
// message.success(commonFunc.getConfigShowName(masterConfig, "BtnCalculation") + commonFunc.showMessage(app.commonConst, "handleSuccess"));
@@ -794,9 +798,11 @@ const handleSaveData = async (params, props) => {
Toast.show({
content: "保存成功",
});
+ masterData.handleType = "update";
props.onSaveState({
enabled: false,
currentId: masterData.sId,
+ masterData,
});
// 保存后更新panes,currentPane的checkedId,防止浏览器刷新时重新又变成新增。
const iPaneIndex = app.panes.findIndex(item => item.key === app.currentPane.key);
@@ -911,7 +917,7 @@ const handleSave = async (skipCalculation, props) => {
}
}
if ((skipFlag === 0 || masterData.bNoVerify) && !skipCalculation) {
- handleCalculation(true, props, false, props);
+ handleCalculation(true, props.state.newNextProps, false, props);
} else {
props.onSaveData({
data,
--
libgit2 0.22.2