|
|
@@ -136,7 +136,7 @@ export default {
|
|
|
totalWeight: '',
|
|
|
sampleNumber: null,
|
|
|
sampleProportion: '',
|
|
|
- supplierMark:'',
|
|
|
+ supplierMark: '',
|
|
|
// planReceiveId: '',
|
|
|
|
|
|
remark: '',
|
|
|
@@ -163,7 +163,7 @@ export default {
|
|
|
{ label: '批次号', prop: 'batchNo', align: 'center' },
|
|
|
{ label: '发货条码', prop: 'barcodes', align: 'center' },
|
|
|
{ label: '包装编码', prop: 'packageNo', align: 'center' },
|
|
|
- { label: '包装数量', prop: 'packingQuantity', align: 'center' },
|
|
|
+ // { label: '包装数量', prop: 'packingQuantity', align: 'center' },
|
|
|
{ label: '包装单位', prop: 'packingUnit', align: 'center' },
|
|
|
{ label: '计量数量', prop: 'measureQuantity', align: 'center' },
|
|
|
{ label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
|
@@ -351,7 +351,7 @@ export default {
|
|
|
});
|
|
|
console.log(res1, 'res1')
|
|
|
if (res1.list.length > 0) {
|
|
|
- console.log(res1.list[0].status, 'statusssssssssssssssssssss')
|
|
|
+ console.log(res1.list[0].status, 'status=2 不赋值')
|
|
|
if (res1.list[0].status != 2) {
|
|
|
res = res1.list
|
|
|
this.isCheck = true;
|
|
|
@@ -394,33 +394,62 @@ export default {
|
|
|
this.packingList = _arr1;
|
|
|
this.pagination.total = this.packingList.length;
|
|
|
console.log(this.packingList, '来料清单');
|
|
|
+ if (this.packingList.length > 1) {
|
|
|
+ this.baseForm.productNumber = this.packingList.length;
|
|
|
+ } else {
|
|
|
+ this.baseForm.productNumber = this.packingList[0].measureQuantity;
|
|
|
+ }
|
|
|
this.aaa();
|
|
|
} else {
|
|
|
this.packingList = [];
|
|
|
}
|
|
|
},
|
|
|
aaa() {
|
|
|
- this.sampleList = [];
|
|
|
- if (!this.isCheck) {
|
|
|
- console.log(111111111111111, this.baseForm.productNumber)
|
|
|
- let num = Number(this.baseForm.productNumber || 0);
|
|
|
- if (num) {
|
|
|
- let data = [];
|
|
|
- for (let i = 0; i < num; i++) {
|
|
|
- data.push(this.packingList[0]);
|
|
|
+ console.log('aaa')
|
|
|
+ if (this.baseForm.qualityMode == 1) {
|
|
|
+ this.sampleList = [];
|
|
|
+ if (!this.isCheck) {
|
|
|
+ const num = Number(this.baseForm.productNumber || 0);
|
|
|
+ if (num) {
|
|
|
+ this.getUnpackSamList(this.packingList, num)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.baseForm.qualityMode == 1) {
|
|
|
+ this.sampleList = this.packingList;
|
|
|
+ this.samplePagination.currentPage = 1;
|
|
|
+ this.samplePagination.total = this.packingList.length;
|
|
|
+ } else {
|
|
|
+ this.sampleList = [];
|
|
|
}
|
|
|
-
|
|
|
- console.log(data, 'datadatadatadatadatadata', num)
|
|
|
- this.sampleList = data;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = data.length;
|
|
|
}
|
|
|
} else {
|
|
|
- this.sampleList = this.packingList;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = this.packingList.length;
|
|
|
+ this.sampleList = [];
|
|
|
}
|
|
|
|
|
|
+ },
|
|
|
+ getUnpackSamList(list, num) {
|
|
|
+ const data = [];
|
|
|
+ list.forEach(oldItem => {
|
|
|
+ const newMeasureQuantity = oldItem.measureQuantity / this.baseForm.productNumber;
|
|
|
+ const newWeight = parseFloat((oldItem.weight / this.baseForm.productNumber).toFixed(2))
|
|
|
+
|
|
|
+ delete oldItem.id;
|
|
|
+
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ data.push({
|
|
|
+ ...oldItem,
|
|
|
+ measureQuantity: newMeasureQuantity,
|
|
|
+ weight: newWeight
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(data, 'datadatadatadatadatadata', num)
|
|
|
+
|
|
|
+ this.sampleList = data;
|
|
|
+ this.samplePagination.currentPage = 1;
|
|
|
+ this.samplePagination.total = data.length;
|
|
|
+
|
|
|
},
|
|
|
async getQualityTemplate(productCode, ids) {
|
|
|
|
|
|
@@ -433,7 +462,6 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.baseForm.sampleProportion = res.checkProportion;
|
|
|
- console.log(res, 'resresresresresresresresresresresresresresresresresresresresresres')
|
|
|
this.baseForm.inspectionStandards = res?.inspectionStandards;
|
|
|
|
|
|
let combinedList = [];
|
|
|
@@ -465,14 +493,14 @@ export default {
|
|
|
|
|
|
},
|
|
|
handleSelectionChange(selection) {
|
|
|
- console.log(selection, '勾选列表');
|
|
|
if (this.baseForm.qualityMode === 2) {
|
|
|
this.selectedList = selection;
|
|
|
|
|
|
this.sampleList = selection;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = selection.length;
|
|
|
- this.baseForm.sampleNumber = selection.length;
|
|
|
+ // console.log(this.sampleList, 'sampleList勾选列表')
|
|
|
+ // this.samplePagination.currentPage = 1;
|
|
|
+ // this.samplePagination.total = selection.length;
|
|
|
+ // this.baseForm.sampleNumber = selection.length;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -520,38 +548,35 @@ export default {
|
|
|
this.$refs.showPackingListTable.clearSelection();
|
|
|
return;
|
|
|
}
|
|
|
- console.log('取样数量', val)
|
|
|
+ console.log('取样数量', val, this.isCheck)
|
|
|
|
|
|
if (this.isCheck) {
|
|
|
if (val > this.packingList.length) {
|
|
|
- this.$message.warning('取样数量不能大于物料明细总数!');
|
|
|
+ this.$message.warning('取样数量不能大于来源清单数量!');
|
|
|
return;
|
|
|
}
|
|
|
const rows = this.packingList.slice(0, val);
|
|
|
rows.forEach((row) => {
|
|
|
this.$refs.showPackingListTable.toggleRowSelection(row);
|
|
|
});
|
|
|
+ if (this.baseForm.qualityMode == 1) {
|
|
|
+ this.sampleList = this.packingList;
|
|
|
+ this.samplePagination.currentPage = 1;
|
|
|
+ this.samplePagination.total = this.packingList.length;
|
|
|
+ } else {
|
|
|
+ this.sampleList = this.selectedList;
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
- if (val > this.packingList[0].packingQuantity) {
|
|
|
- this.$message.warning('取样数量不能大于包装数量!');
|
|
|
+ if (val > this.packingList[0].measureQuantity) {
|
|
|
+ this.$message.warning('取样数量不能大于计量数量!');
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- this.sampleLis = [];
|
|
|
- let num = Number(val);
|
|
|
- if (num) {
|
|
|
- let data = [];
|
|
|
- for (let i = 0; i < num; i++) {
|
|
|
- data.push(this.packingList[0]);
|
|
|
+ const num = Number(val);
|
|
|
+ if (num) {
|
|
|
+ this.getUnpackSamList(this.packingList, num);
|
|
|
}
|
|
|
-
|
|
|
- console.log(data, 'datadatadatadatadatadata', num)
|
|
|
- this.sampleList = data;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = data.length;
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
|
|
|
resetTable() {
|