|
|
@@ -421,6 +421,7 @@ export default {
|
|
|
splitList: [],
|
|
|
localdataList: [],
|
|
|
newDispositionList: [],
|
|
|
+ DispositionListes: [],
|
|
|
withinQuantity: "", //内包装数量
|
|
|
withinUnit: "", //内包装单位
|
|
|
outsideQuantity: "", //外包装数量
|
|
|
@@ -492,19 +493,34 @@ export default {
|
|
|
// this.formedNumLast =
|
|
|
// newVal.formedNumLast || newVal.product[0].feedQuantity;
|
|
|
this.newCategoryId = newVal.product[0].categoryId;
|
|
|
+ // this.formedNumLast = newVal.product.reduce((acc, pro) => {
|
|
|
+ // return pro.extInfo.sourceQuantity
|
|
|
+ // ? acc + Number(pro.extInfo.sourceQuantity)
|
|
|
+ // : acc;
|
|
|
+ // }, 0);
|
|
|
this.formedNumLast = newVal.product.reduce((acc, pro) => {
|
|
|
- return pro.extInfo.sourceQuantity
|
|
|
- ? acc + Number(pro.extInfo.sourceQuantity)
|
|
|
+ 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;
|
|
|
+ // }, 0);
|
|
|
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);
|
|
|
-
|
|
|
- console.log(this.formedNumLast, "this.formedNumLast");
|
|
|
- console.log(this.newCategoryId, "this.newCategoryId");
|
|
|
} else {
|
|
|
this.formedNumLast = 0;
|
|
|
}
|
|
|
@@ -512,6 +528,10 @@ export default {
|
|
|
if (newVal.isUnpack == "1") {
|
|
|
this.packageDispositionFn();
|
|
|
}
|
|
|
+
|
|
|
+ if (newVal.isNewUnpack == 1) {
|
|
|
+ this.getPackingData();
|
|
|
+ }
|
|
|
// this.packageDispositionFn();
|
|
|
//
|
|
|
},
|
|
|
@@ -1051,7 +1071,7 @@ export default {
|
|
|
res.map((v) => {
|
|
|
v.splitList = [];
|
|
|
});
|
|
|
- this.newDispositionList = res;
|
|
|
+ // this.newDispositionList = res;
|
|
|
this.selectList = res;
|
|
|
|
|
|
this.initFn1(this.localdataList[0].arr);
|
|
|
@@ -1120,6 +1140,38 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+
|
|
|
async listFn1(res) {
|
|
|
let {
|
|
|
minimumPackage,
|
|
|
@@ -1140,6 +1192,10 @@ export default {
|
|
|
this.withinPackage = withinPackage; // 内包装
|
|
|
this.outsidePackage = outsidePackage; //外包装
|
|
|
|
|
|
+ this.newDispositionList = this.DispositionListes.filter(
|
|
|
+ (it) => it.code == this.Usertype && it.sort != "0"
|
|
|
+ );
|
|
|
+
|
|
|
this.newDispositionList.map((v, i) => {
|
|
|
v.splitList = arr[i].list;
|
|
|
v.titel = textList[i];
|