|
|
@@ -148,6 +148,10 @@
|
|
|
}}{{ row.extInfo.weightUnit }}</span
|
|
|
>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-slot:feedQuantity="{ row, $index }">
|
|
|
+ <span>{{ row.feedQuantity }}{{ row.unit }}</span>
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
|
|
|
|
<!-- <template v-slot:newWeight="{ row, $index }">
|
|
|
@@ -316,7 +320,7 @@
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:feedQuantity="{ row, $index }">
|
|
|
- <span>{{ row.feedQuantity }}</span>
|
|
|
+ <span>{{ row.feedQuantity }}{{ row.unit }}</span>
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:reportWeight="{ row, $index }">
|
|
|
@@ -461,12 +465,24 @@
|
|
|
console.log(newVal.product, 'newVal.product');
|
|
|
this.newCategoryId = newVal.product[0].categoryId;
|
|
|
this.formedNumLast = newVal.product.reduce((acc, pro) => {
|
|
|
- return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
|
|
|
+ return pro.feedQuantity &&
|
|
|
+ (!pro.extInfo.isQualified ||
|
|
|
+ pro.extInfo.isQualified == 1 ||
|
|
|
+ pro.extInfo.isQualified == 3) &&
|
|
|
+ !pro.extInfo.isLoss
|
|
|
+ ? this.add(acc, Number(pro.feedQuantity))
|
|
|
+ : acc;
|
|
|
}, 0);
|
|
|
} else if (newVal.semiProductList && newVal.semiProductList.length) {
|
|
|
this.newCategoryId = newVal.semiProductList[0].categoryId;
|
|
|
this.formedNumLast = newVal.semiProductList.reduce((acc, pro) => {
|
|
|
- return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
|
|
|
+ return pro.feedQuantity &&
|
|
|
+ (!pro.extInfo.isQualified ||
|
|
|
+ pro.extInfo.isQualified == 1 ||
|
|
|
+ pro.extInfo.isQualified == 3) &&
|
|
|
+ !pro.extInfo.isLoss
|
|
|
+ ? this.add(acc, Number(pro.feedQuantity))
|
|
|
+ : acc;
|
|
|
}, 0);
|
|
|
} else {
|
|
|
this.formedNumLast = 0;
|
|
|
@@ -474,6 +490,10 @@
|
|
|
if (newVal.isUnpack == '1') {
|
|
|
this.packageDispositionFn();
|
|
|
}
|
|
|
+
|
|
|
+ if (this.isNewUnpack == 1) {
|
|
|
+ this.checkUnpackProduction();
|
|
|
+ }
|
|
|
},
|
|
|
deep: true,
|
|
|
immediate: true
|
|
|
@@ -932,6 +952,38 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ toInteger(num) {
|
|
|
+ const len = this.getDecimalLength(num);
|
|
|
+ return {
|
|
|
+ int: Math.round(num * Math.pow(10, len)),
|
|
|
+ factor: Math.pow(10, len)
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ add(a, b) {
|
|
|
+ const { int: aInt, factor: aFactor } = this.toInteger(a);
|
|
|
+ const { int: bInt, factor: bFactor } = this.toInteger(b);
|
|
|
+ const maxFactor = Math.max(aFactor, bFactor);
|
|
|
+ return (
|
|
|
+ (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
|
|
|
+ maxFactor
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ sub(a, b) {
|
|
|
+ const { int: aInt, factor: aFactor } = this.toInteger(a);
|
|
|
+ const { int: bInt, factor: bFactor } = this.toInteger(b);
|
|
|
+ const maxFactor = Math.max(aFactor, bFactor);
|
|
|
+ return (
|
|
|
+ (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
|
|
|
+ maxFactor
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ getDecimalLength(num) {
|
|
|
+ return (num.toString().split('.')[1] || '').length;
|
|
|
+ },
|
|
|
+
|
|
|
checkUnpack() {
|
|
|
this.$confirm('此操作将进行拆包, 是否继续?', '提示', {
|
|
|
confirmButtonText: '确定',
|