|
|
@@ -89,7 +89,7 @@
|
|
|
import baseInfo from './baseInfo.vue';
|
|
|
|
|
|
import { getCode } from '@/api/login';
|
|
|
-import {save, update, planIssued} from '@/api/inspectionPlan';
|
|
|
+import { save, update, planIssued } from '@/api/inspectionPlan';
|
|
|
import {
|
|
|
getPurchaseWarehouseGoods,
|
|
|
getQualityTemplateList,
|
|
|
@@ -205,7 +205,8 @@ export default {
|
|
|
listPage: [],
|
|
|
|
|
|
activeName: '1',
|
|
|
- selectedList: []
|
|
|
+ selectedList: [],
|
|
|
+ isCheck: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -236,9 +237,6 @@ export default {
|
|
|
// 切换质检内容
|
|
|
handleClick(tab) {
|
|
|
this.activeName = tab.name;
|
|
|
- // if (this.activeName === '2') {
|
|
|
- // this.updateSampleList();
|
|
|
- // }
|
|
|
},
|
|
|
|
|
|
checkSelectable(row, index) {
|
|
|
@@ -332,50 +330,43 @@ export default {
|
|
|
this.schemePagination.currentPage = 1;
|
|
|
this.schemePagination.total = this.schemeList.length;
|
|
|
},
|
|
|
- async getList(receiveNo, productCode, productCategoryId, productCategoryName,categoryid,batchNo) {
|
|
|
+ async getList(receiveNo, productCode, productCategoryId, productCategoryName, categoryid, batchNo) {
|
|
|
//通过来源和产品 获取来料清单
|
|
|
- await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName,categoryid,batchNo);
|
|
|
+ await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName, categoryid, batchNo);
|
|
|
|
|
|
- //通过抽样方式获取样品列表 全检 样品列表等于来料清单列表
|
|
|
- if (this.baseForm.qualityMode == 1) {
|
|
|
- this.sampleList = this.packingList;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = this.packingList.length;
|
|
|
- }
|
|
|
//通过来源和产品 获取质检方案
|
|
|
this.getQualityTemplate(productCode);
|
|
|
},
|
|
|
- async getGoodsList(receiveNo, productCode, ids, productCategoryId, productCategoryName,categoryid,batchNo) {
|
|
|
+ async getGoodsList(receiveNo, productCode, ids, productCategoryId, productCategoryName, categoryid, batchNo) {
|
|
|
let res;
|
|
|
- // 根据物品id 编码查询主数据中物品编码是否需要拆包 是走 包装明细表 否 走获取产品表
|
|
|
- let cateRes = await getByCategoryId({
|
|
|
- categoryId: categoryid
|
|
|
- })
|
|
|
- if (cateRes) {
|
|
|
- if (cateRes.isUnpack == 1) {
|
|
|
- res = await outInRecordsPage({
|
|
|
- // receiveNo: receiveNo,
|
|
|
- sourceBizNo: receiveNo,
|
|
|
- categoryCode: productCode,
|
|
|
- categoryId: categoryid,
|
|
|
- qualityQlanId: ids,
|
|
|
- size:-1
|
|
|
- });
|
|
|
- }else{
|
|
|
- // 获取没有拆包的产品数据 --- 等接口
|
|
|
- let resData = await getBatchInfoData({
|
|
|
- sourceBizNo: receiveNo,
|
|
|
- categoryCode: productCode,
|
|
|
- batchNo: batchNo,
|
|
|
- });
|
|
|
- res.list = resData;
|
|
|
+ const res1 = await outInRecordsPage({
|
|
|
+ sourceBizNo: receiveNo,
|
|
|
+ categoryCode: productCode,
|
|
|
+ categoryId: categoryid,
|
|
|
+ qualityQlanId: ids,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ console.log(res1, 'res1')
|
|
|
+ if (res1.list.length > 0) {
|
|
|
+ res = res1.list
|
|
|
+ this.isCheck = true;
|
|
|
+ } else {
|
|
|
+ let resData = await getBatchInfoData({
|
|
|
+ sourceBizNo: receiveNo,
|
|
|
+ categoryCode: productCode,
|
|
|
+ batchNo: batchNo,
|
|
|
+ });
|
|
|
+ console.log(resData, 'resData')
|
|
|
+ if (resData) {
|
|
|
+ this.isCheck = false;
|
|
|
+ res = [resData];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
console.log(res, '来料清单');
|
|
|
- if (Array.isArray(res?.list)) {
|
|
|
+ if (res.length > 0) {
|
|
|
let _arr1 = [];
|
|
|
- _arr1 = res.list.map((m) => {
|
|
|
+ _arr1 = res.map((m) => {
|
|
|
m.sourceId = m.id;
|
|
|
m.productCategoryId = productCategoryId;
|
|
|
m.productCategoryName = productCategoryName;
|
|
|
@@ -387,41 +378,70 @@ export default {
|
|
|
this.packingList = _arr1;
|
|
|
this.pagination.total = this.packingList.length;
|
|
|
console.log(this.packingList, '来料清单');
|
|
|
+ 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(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;
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
async getQualityTemplate(productCode, ids) {
|
|
|
- let res = await getQualityTemplateList({
|
|
|
+
|
|
|
+ await getQualityTemplateList({
|
|
|
productCode: productCode,
|
|
|
qualityQlanId: ids
|
|
|
+ }).then((res) => {
|
|
|
+ console.log(res, 'resresresresresresresresresresresresresresresresresresresresresres')
|
|
|
+ this.baseForm.inspectionStandards = res?.inspectionStandards;
|
|
|
+
|
|
|
+ let combinedList = [];
|
|
|
+ for (let i = 0; i < res.qualityTemplateVOList.length; i++) {
|
|
|
+
|
|
|
+ res.qualityTemplateVOList[i].inspectionItemVOList = res.qualityTemplateVOList[i]?.inspectionItemVOList.map(
|
|
|
+ (item) => {
|
|
|
+ item.templateId = res.qualityTemplateVOList[i]?.id;
|
|
|
+ item.qualitySchemeTemplateCode =
|
|
|
+ res.qualityTemplateVOList[i]?.qualitySchemeTemplateCode;
|
|
|
+ item.qualitySchemeTemplateName =
|
|
|
+ res.qualityTemplateVOList[i]?.qualitySchemeTemplateName;
|
|
|
+
|
|
|
+ delete item.id;
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...item
|
|
|
+ };
|
|
|
+ }
|
|
|
+ );
|
|
|
+ combinedList = combinedList.concat(res.qualityTemplateVOList[i].inspectionItemVOList);
|
|
|
+ console.log(combinedList, '质检方案');
|
|
|
+ this.schemeList = combinedList;
|
|
|
+ this.schemePagination.currentPage = 1;
|
|
|
+ this.schemePagination.total = this.schemeList.length;
|
|
|
+ }
|
|
|
});
|
|
|
- this.baseForm.inspectionStandards = res?.inspectionStandards;
|
|
|
|
|
|
- let combinedList = [];
|
|
|
- for (let i = 0; i < res.qualityTemplateVOList.length; i++) {
|
|
|
|
|
|
- res.qualityTemplateVOList[i].inspectionItemVOList = res.qualityTemplateVOList[i]?.inspectionItemVOList.map(
|
|
|
- (item) => {
|
|
|
- item.templateId = res.qualityTemplateVOList[i]?.id;
|
|
|
- item.qualitySchemeTemplateCode =
|
|
|
- res.qualityTemplateVOList[i]?.qualitySchemeTemplateCode;
|
|
|
- item.qualitySchemeTemplateName =
|
|
|
- res.qualityTemplateVOList[i]?.qualitySchemeTemplateName;
|
|
|
-
|
|
|
- delete item.id;
|
|
|
-
|
|
|
- return {
|
|
|
- ...item
|
|
|
- };
|
|
|
- }
|
|
|
- );
|
|
|
- combinedList = combinedList.concat(res.qualityTemplateVOList[i].inspectionItemVOList);
|
|
|
- }
|
|
|
- console.log(combinedList, '质检方案');
|
|
|
- this.schemeList = combinedList;
|
|
|
- this.schemePagination.currentPage = 1;
|
|
|
- this.schemePagination.total = this.schemeList.length;
|
|
|
},
|
|
|
handleSelectionChange(selection) {
|
|
|
console.log(selection, '勾选列表');
|
|
|
@@ -463,26 +483,14 @@ export default {
|
|
|
},
|
|
|
changeModel(val) {
|
|
|
this.baseForm.qualityMode = val;
|
|
|
- this.updateSampleList();
|
|
|
- },
|
|
|
- updateSampleList() {
|
|
|
- if (this.baseForm.qualityMode === 1) {
|
|
|
- // 全检
|
|
|
- this.sampleList = this.packingList;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = this.packingList.length;
|
|
|
- this.baseForm.sampleNumber = '';
|
|
|
- } else if (this.btnType != 'add' && this.baseForm.qualityMode === 2) {
|
|
|
- // 抽检
|
|
|
- if (this.selectedList.length > 0) {
|
|
|
- this.sampleList = this.selectedList;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = this.sampleList.length;
|
|
|
- this.baseForm.sampleNumber = this.sampleList.length;
|
|
|
- }
|
|
|
+ console.log(this.baseForm.productNumber, 'productNumberproductNumber数量')
|
|
|
+ if (this.baseForm.qualityMode == 1) {
|
|
|
+ this.aaa()
|
|
|
+ } else {
|
|
|
+ this.sampleList = [];
|
|
|
}
|
|
|
- console.log(this.sampleList, '样品列表更新完成');
|
|
|
},
|
|
|
+
|
|
|
changeNumber(val) {
|
|
|
if (this.baseForm.qualityMode !== 2) {
|
|
|
return;
|
|
|
@@ -491,15 +499,37 @@ export default {
|
|
|
this.$refs.showPackingListTable.clearSelection();
|
|
|
return;
|
|
|
}
|
|
|
+ console.log('取样数量', val)
|
|
|
|
|
|
- if (val > this.packingList.length) {
|
|
|
- this.$message.warning('取样数量不能大于物料明细总数!');
|
|
|
- return;
|
|
|
+ if (this.isCheck) {
|
|
|
+ if (val > this.packingList.length) {
|
|
|
+ this.$message.warning('取样数量不能大于物料明细总数!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const rows = this.packingList.slice(0, val);
|
|
|
+ rows.forEach((row) => {
|
|
|
+ this.$refs.showPackingListTable.toggleRowSelection(row);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (val > this.packingList[0].packingQuantity) {
|
|
|
+ this.$message.warning('取样数量不能大于包装数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- const rows = this.packingList.slice(0, val);
|
|
|
- rows.forEach((row) => {
|
|
|
- this.$refs.showPackingListTable.toggleRowSelection(row);
|
|
|
- });
|
|
|
+ this.sampleLis = [];
|
|
|
+ let num = Number(val);
|
|
|
+ if (num) {
|
|
|
+ let data = [];
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
+ data.push(this.packingList[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(data, 'datadatadatadatadatadata', num)
|
|
|
+ this.sampleList = data;
|
|
|
+ this.samplePagination.currentPage = 1;
|
|
|
+ this.samplePagination.total = data.length;
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
resetTable() {
|
|
|
@@ -633,7 +663,7 @@ export default {
|
|
|
.el-pagination {
|
|
|
padding: 12px 16px;
|
|
|
background: #fff;
|
|
|
- border: 1px solid #ebeef5;
|
|
|
+ border: 1px solid#ebeef5;
|
|
|
border-top: none;
|
|
|
}
|
|
|
</style>
|