|
|
@@ -29,7 +29,7 @@
|
|
|
></base-info>
|
|
|
<el-row>
|
|
|
<header-title title="质检内容"></header-title>
|
|
|
-
|
|
|
+ <!-- :needPage="btnType == 'add' ? false : true" -->
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
<el-tab-pane label="来源清单" name="1">
|
|
|
<!-- 来料列表表格 -->
|
|
|
@@ -37,8 +37,10 @@
|
|
|
ref="table12"
|
|
|
:columns="tableColumns"
|
|
|
:datasource="datasource"
|
|
|
- :needPage="btnType == 'add' ? false : true"
|
|
|
+ :needPage="btnType != 'detail' ? false : true"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
+ :page-size="50000"
|
|
|
+ :page-sizes="[5000]"
|
|
|
>
|
|
|
<template
|
|
|
v-slot:toolbar
|
|
|
@@ -466,9 +468,12 @@
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
+ isScheme: true,
|
|
|
+ isOrder: true,
|
|
|
isConsumable: '', //0 单件 1批量
|
|
|
netWeight: '', // 净重
|
|
|
conditionType: null,
|
|
|
+ isFormNumber: true,
|
|
|
|
|
|
sampleListCode: '',
|
|
|
productItem: {} //产品信息
|
|
|
@@ -574,7 +579,7 @@
|
|
|
},
|
|
|
// 分页后的样品列表
|
|
|
paginatedSampleList() {
|
|
|
- if (this.rowIds) {
|
|
|
+ if (this.rowIds && this.isOrder) {
|
|
|
return this.sampleList;
|
|
|
}
|
|
|
const { currentPage, pageSize } = this.samplePagination;
|
|
|
@@ -584,7 +589,7 @@
|
|
|
},
|
|
|
// 分页后的质检方案列表
|
|
|
paginatedSchemeList() {
|
|
|
- if (this.rowIds) {
|
|
|
+ if (this.rowIds && this.isScheme) {
|
|
|
return this.schemeList;
|
|
|
}
|
|
|
const { currentPage, pageSize } = this.schemePagination;
|
|
|
@@ -598,9 +603,9 @@
|
|
|
//成品检验类型,计划来源主数据,修改数量生成来源清单
|
|
|
changeProductNumberModel(num) {
|
|
|
this.$refs.table12.setData([]);
|
|
|
+ this.isOrder = false;
|
|
|
let nums = Number(num);
|
|
|
let p = this.productItem;
|
|
|
- console.log(p, 'productItem');
|
|
|
let list = [];
|
|
|
if (this.isConsumable == 0) {
|
|
|
for (let i = 0; i < nums; i++) {
|
|
|
@@ -609,7 +614,7 @@
|
|
|
batchNo: p.batchNo,
|
|
|
categoryCode: p.code, //编码
|
|
|
categoryName: p.name, //名称
|
|
|
- measureQuantity: 1, //计量数量
|
|
|
+ measureQuantity: 1,
|
|
|
measureUnit: p.measuringUnit, //计量单位
|
|
|
weightUnit: p.weightUnit, //重量单位
|
|
|
weight: p.netWeight //重量
|
|
|
@@ -636,6 +641,7 @@
|
|
|
this.baseForm.qualityMode == 1 &&
|
|
|
this.baseForm.inspectionStandards
|
|
|
) {
|
|
|
+ this.isFormNumber = false;
|
|
|
this.handleSampleList();
|
|
|
}
|
|
|
console.log(this.baseForm, 'form --');
|
|
|
@@ -665,6 +671,7 @@
|
|
|
getInspectionStandards(data) {
|
|
|
console.log(data, 'data');
|
|
|
this.baseForm.inspectionStandards = data;
|
|
|
+ this.isOrder = false;
|
|
|
this.handleSampleList();
|
|
|
},
|
|
|
async datasource({ page, limit, where }) {
|
|
|
@@ -709,7 +716,10 @@
|
|
|
let data = await getQualityTemplateByIds({
|
|
|
templateIds: select.map((item) => item.id)
|
|
|
});
|
|
|
+ console.log('---------------------------');
|
|
|
+ this.isScheme = false;
|
|
|
this.schemeList.push(...data);
|
|
|
+ this.schemePagination.total = this.schemeList.length;
|
|
|
},
|
|
|
async handleEditOrDetail(row) {
|
|
|
console.log('row====', row);
|
|
|
@@ -744,6 +754,16 @@
|
|
|
// 如果是编辑或者详情,则查询物料清单、质检方案和样品列表
|
|
|
if (row.id) {
|
|
|
this.rowIds = row.id;
|
|
|
+ this.isScheme = true;
|
|
|
+ this.schemePagination.currentPage = 1;
|
|
|
+ this.schemePagination.pageSize = 10;
|
|
|
+ this.schemePagination.total = 0;
|
|
|
+ this.samplePagination.pageSize = 10;
|
|
|
+ this.samplePagination.currentPage = 1;
|
|
|
+ this.samplePagination.total = 0;
|
|
|
+ this.isFormNumber = true;
|
|
|
+ this.isOrder = true;
|
|
|
+
|
|
|
if (row.isUnpack === 1) {
|
|
|
this.isCheck = true;
|
|
|
} else {
|
|
|
@@ -892,6 +912,11 @@
|
|
|
},
|
|
|
async handleSampleList() {
|
|
|
let packingList = this.$refs.table12.getData();
|
|
|
+ // console.log(
|
|
|
+ // this.baseForm.qualityMode,
|
|
|
+ // this.baseForm.inspectionStandards,
|
|
|
+ // this.btnType
|
|
|
+ // );
|
|
|
//全检时 计量时
|
|
|
if (
|
|
|
this.baseForm.qualityMode == 1 &&
|
|
|
@@ -900,7 +925,45 @@
|
|
|
) {
|
|
|
this.sampleList = [];
|
|
|
console.log(this.baseForm, '---isUnpack---');
|
|
|
- await this.handleUnpackCase(packingList);
|
|
|
+ if (this.baseForm.productNumber) {
|
|
|
+ this.$refs.table12.setData([]);
|
|
|
+ let nums = Number(this.baseForm.productNumber);
|
|
|
+ let p = this.productItem;
|
|
|
+ let list = [];
|
|
|
+
|
|
|
+ for (let i = 0; i < nums; i++) {
|
|
|
+ let obj = {
|
|
|
+ id: p.id,
|
|
|
+ batchNo: p.batchNo,
|
|
|
+ categoryCode: p.code, //编码
|
|
|
+ categoryName: p.name, //名称
|
|
|
+ measureQuantity: 1,
|
|
|
+ measureUnit: p.measuringUnit, //计量单位
|
|
|
+ weightUnit: p.weightUnit, //重量单位
|
|
|
+ weight: p.netWeight //重量
|
|
|
+ };
|
|
|
+ list.push(obj);
|
|
|
+ }
|
|
|
+ this.$refs.table12.setData(list);
|
|
|
+ let packList = this.$refs.table12.getData();
|
|
|
+ await this.handleUnpackCase(packList);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (this.rowIds) {
|
|
|
+ // const res = await getInventoryListByPlanId({
|
|
|
+ // planId: this.rowIds,
|
|
|
+ // pageNum: 1,
|
|
|
+ // size: 5000
|
|
|
+ // });
|
|
|
+ // // console.log(res.list);
|
|
|
+ // if (res.list.length > 0) {
|
|
|
+ // await this.handleUnpackCase(res.list);
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // await this.handleUnpackCase(packingList);
|
|
|
+ // }
|
|
|
+
|
|
|
// if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack != '') {
|
|
|
// //拆包
|
|
|
// if (this.baseForm.isUnpack == 1) {
|
|
|
@@ -923,7 +986,25 @@
|
|
|
this.btnType != 'detail'
|
|
|
) {
|
|
|
this.sampleList = [];
|
|
|
- this.getFullInspectionWeight(packingList);
|
|
|
+ let list = [];
|
|
|
+ if (this.baseForm.productNumber) {
|
|
|
+ let p = this.productItem;
|
|
|
+ let obj = {
|
|
|
+ id: p.id,
|
|
|
+ batchNo: p.batchNo,
|
|
|
+ categoryCode: p.code, //编码
|
|
|
+ categoryName: p.name, //名称
|
|
|
+ measureQuantity: this.baseForm.productNumber, //计量数量
|
|
|
+ measureUnit: p.measuringUnit, //计量单位
|
|
|
+ weightUnit: p.weightUnit, //重量单位
|
|
|
+ weight: p.netWeight * this.baseForm.productNumber //重量
|
|
|
+ };
|
|
|
+ list.push(obj);
|
|
|
+ }
|
|
|
+ this.$refs.table12.setData(list);
|
|
|
+ let packList = this.$refs.table12.getData();
|
|
|
+ // console.log(list);
|
|
|
+ this.getFullInspectionWeight(packList);
|
|
|
} else {
|
|
|
this.sampleList = [];
|
|
|
}
|
|
|
@@ -937,6 +1018,7 @@
|
|
|
//拆包处理样品清单数据
|
|
|
async handleUnpackCase(packingList) {
|
|
|
const num = Number(this.baseForm.productNumber || 0);
|
|
|
+ console.log('num:' + num);
|
|
|
if (num) {
|
|
|
await this.getUnpackSamList(packingList, num);
|
|
|
}
|
|
|
@@ -948,6 +1030,7 @@
|
|
|
|
|
|
//更新样品清单数据
|
|
|
async updatePackingList(list) {
|
|
|
+ console.log(list);
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
list[i].sampleCode = await this.getSampleCode();
|
|
|
}
|
|
|
@@ -955,11 +1038,13 @@
|
|
|
this.baseForm.sampleNumber = list.length;
|
|
|
this.samplePagination.currentPage = 1;
|
|
|
this.samplePagination.total = list.length;
|
|
|
+ // this.samplePagination.total = this.sampleList.length;
|
|
|
},
|
|
|
|
|
|
async getUnpackSamList(list, num) {
|
|
|
+ console.log(list, num);
|
|
|
let data = [];
|
|
|
- list.forEach((oldItem) => {
|
|
|
+ list.forEach((oldItem, index) => {
|
|
|
const newMeasureQuantity =
|
|
|
oldItem.measureQuantity / this.baseForm.productNumber;
|
|
|
const newWeight = parseFloat(
|
|
|
@@ -985,6 +1070,10 @@
|
|
|
...oldItem,
|
|
|
measureQuantity: 1,
|
|
|
weight: this.netWeight || 0
|
|
|
+ // weight:
|
|
|
+ // num - index >= 1
|
|
|
+ // ? this.netWeight
|
|
|
+ // : ((num * 100000 - index * 100000) / 100000) * this.netWeight
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -1541,16 +1630,14 @@
|
|
|
async handleSampleSizeChange(val) {
|
|
|
this.samplePagination.pageSize = val;
|
|
|
this.samplePagination.currentPage = 1;
|
|
|
- console.log(1111);
|
|
|
- if (this.rowIds) {
|
|
|
- console.log(2222);
|
|
|
+ if (this.rowIds && this.isOrder) {
|
|
|
await this.getSampleList(this.rowIds);
|
|
|
}
|
|
|
//操作行点击时查询样品
|
|
|
},
|
|
|
async handleSampleCurrentChange(val) {
|
|
|
this.samplePagination.currentPage = val;
|
|
|
- if (this.rowIds) {
|
|
|
+ if (this.rowIds && this.isOrder) {
|
|
|
await this.getSampleList(this.rowIds);
|
|
|
}
|
|
|
},
|
|
|
@@ -1559,14 +1646,14 @@
|
|
|
this.schemePagination.pageSize = val;
|
|
|
this.schemePagination.currentPage = 1;
|
|
|
//操作行点击时查询质检
|
|
|
- if (this.rowIds) {
|
|
|
+ if (this.rowIds && this.isScheme) {
|
|
|
await this.getTemplateList(this.rowIds);
|
|
|
}
|
|
|
},
|
|
|
async handleSchemeCurrentChange(val) {
|
|
|
this.schemePagination.currentPage = val;
|
|
|
//操作行点击时查询质检
|
|
|
- if (this.rowIds) {
|
|
|
+ if (this.rowIds && this.isScheme) {
|
|
|
await this.getTemplateList(this.rowIds);
|
|
|
}
|
|
|
},
|