|
@@ -167,7 +167,7 @@
|
|
|
>
|
|
|
<el-input-number
|
|
|
v-model="item.netWeight"
|
|
|
- :precision="0"
|
|
|
+ :precision="2"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
placeholder="请输入"
|
|
@@ -184,7 +184,7 @@
|
|
|
>
|
|
|
<el-input-number
|
|
|
v-model="item.roughWeight"
|
|
|
- :precision="0"
|
|
|
+ :precision="2"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
placeholder="请输入"
|
|
@@ -832,6 +832,7 @@ const handleClickPacking = () => {
|
|
|
item.packQuantity,
|
|
|
formData.data.packDetailList.length - 1
|
|
|
);
|
|
|
+ selectProductData.value = [];
|
|
|
} else {
|
|
|
return ElMessage({
|
|
|
message: "请选择产品 !",
|
|
@@ -841,33 +842,35 @@ const handleClickPacking = () => {
|
|
|
};
|
|
|
|
|
|
const handleChangePackQuantity = (val, index) => {
|
|
|
- // if (val && val > 0) {
|
|
|
- // 转为map对象
|
|
|
const obj = {};
|
|
|
for (let i = 0; i < formData.data.contractProductData.length; i++) {
|
|
|
const e = formData.data.contractProductData[i];
|
|
|
- obj[e.contractId + ""] = Number(e.cpQuantity) - Number(e.sumPackQuantity);
|
|
|
+ obj[e.contractId + "_" + e.productId + ""] =
|
|
|
+ Number(e.cpQuantity) - Number(e.sumPackQuantity);
|
|
|
}
|
|
|
// 计算数量 即装箱数量 * 箱数 新增字段放在最外层
|
|
|
for (let i = 0; i < formData.data.packDetailList.length; i++) {
|
|
|
const ele = formData.data.packDetailList[i];
|
|
|
for (let j = 0; j < ele.packDetailProductList.length; j++) {
|
|
|
const jele = ele.packDetailProductList[j];
|
|
|
- ele[jele.contractId + ""] = Number(ele.packQuantity) * jele.quantity;
|
|
|
+ ele[jele.contractId + "_" + jele.productId + ""] =
|
|
|
+ Number(ele.packQuantity) * jele.quantity;
|
|
|
}
|
|
|
}
|
|
|
// 计算新的待装箱数量
|
|
|
for (let i = 0; i < formData.data.packDetailList.length; i++) {
|
|
|
const e = formData.data.packDetailList[i];
|
|
|
for (const key in obj) {
|
|
|
- obj[key] = obj[key] - e[key];
|
|
|
- if (obj[key] < 0) {
|
|
|
- e.packQuantity = null;
|
|
|
- handleChangePackQuantity(null, index);
|
|
|
- return ElMessage({
|
|
|
- message: "装箱数量 * 箱数不可大于待装箱数量",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
+ if (e.hasOwnProperty(key)) {
|
|
|
+ obj[key] = obj[key] - e[key];
|
|
|
+ if (obj[key] < 0) {
|
|
|
+ e.packQuantity = null;
|
|
|
+ handleChangePackQuantity(null, index);
|
|
|
+ return ElMessage({
|
|
|
+ message: "装箱数量 * 箱数不可大于待装箱数量",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -875,7 +878,7 @@ const handleChangePackQuantity = (val, index) => {
|
|
|
for (let i = 0; i < formData.data.contractProductData.length; i++) {
|
|
|
const e = formData.data.contractProductData[i];
|
|
|
for (const key in obj) {
|
|
|
- if (e.contractId === key) {
|
|
|
+ if (e.contractId + "_" + e.productId + "" === key) {
|
|
|
e.waitQuantity = obj[key];
|
|
|
}
|
|
|
}
|
|
@@ -927,6 +930,7 @@ const handleChangeContract = (val) => {
|
|
|
waitQuantity: Number(x.cpQuantity) - Number(x.sumPackQuantity),
|
|
|
quantity: null,
|
|
|
}));
|
|
|
+ handleChangePackQuantity();
|
|
|
});
|
|
|
};
|
|
|
|