|
@@ -4,7 +4,7 @@
|
|
|
:close-on-press-escape="false" append-to-body width="80%" :maxable="true">
|
|
:close-on-press-escape="false" append-to-body width="80%" :maxable="true">
|
|
|
<header-title title="基本信息"></header-title>
|
|
<header-title title="基本信息"></header-title>
|
|
|
<base-info ref="baseInfoRefs" v-if="baseForm" :form="baseForm" :btnType="btnType" @resetTable="resetTable"
|
|
<base-info ref="baseInfoRefs" v-if="baseForm" :form="baseForm" :btnType="btnType" @resetTable="resetTable"
|
|
|
- @getList="getList" @changeModel="changeModel" @table2="table2" :packingLists="packingList"
|
|
|
|
|
|
|
+ @changeModel="changeModel" @getList="getList" @table2="table2" :packingLists="packingList"
|
|
|
@getCategoryInfo="getCategoryInfo"></base-info>
|
|
@getCategoryInfo="getCategoryInfo"></base-info>
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<header-title title="质检内容"></header-title>
|
|
<header-title title="质检内容"></header-title>
|
|
@@ -102,26 +102,6 @@
|
|
|
下发
|
|
下发
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <!-- <ele-modal :visible.sync="takeAsampleVisible" title="选择取样信息" width="80vw" append-to-body @close="handleCancel"
|
|
|
|
|
- :maxable="true">
|
|
|
|
|
-
|
|
|
|
|
- <el-table ref="showSampleListTable" :data="selectedList" tooltip-effect="dark" :max-height="300" border
|
|
|
|
|
- row-key="id" @selection-change="handleSelectionChange2">
|
|
|
|
|
- <el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
|
|
|
|
|
- <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
|
|
|
|
|
- <template v-for="column in tableColumns2">
|
|
|
|
|
- <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true" :width="column.width"
|
|
|
|
|
- :align="column.align">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- <div style="width: 100%;text-align: right;margin-top: 12px;">
|
|
|
|
|
- <el-button type="primary" @click="handleConfirm">确定</el-button>
|
|
|
|
|
- <el-button @click="handleCancel">取消</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </ele-modal> -->
|
|
|
|
|
</ele-modal>
|
|
</ele-modal>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -138,7 +118,7 @@ import {
|
|
|
outInRecordsPage,
|
|
outInRecordsPage,
|
|
|
getBatchInfoData
|
|
getBatchInfoData
|
|
|
} from '@/api/inspectionPlan/index.js';
|
|
} from '@/api/inspectionPlan/index.js';
|
|
|
-import { rules } from 'eslint-config-prettier';
|
|
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
baseInfo
|
|
baseInfo
|
|
@@ -177,11 +157,8 @@ export default {
|
|
|
sampleMeasureUnit: '',
|
|
sampleMeasureUnit: '',
|
|
|
sampleProportion: '',
|
|
sampleProportion: '',
|
|
|
supplierMark: '',
|
|
supplierMark: '',
|
|
|
- // planReceiveId: '',
|
|
|
|
|
-
|
|
|
|
|
remark: '',
|
|
remark: '',
|
|
|
accessory: [],
|
|
accessory: [],
|
|
|
-
|
|
|
|
|
conditionType: 1,
|
|
conditionType: 1,
|
|
|
};
|
|
};
|
|
|
};
|
|
};
|
|
@@ -216,8 +193,6 @@ export default {
|
|
|
{ label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
{ label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
|
{ label: '物料代号', prop: 'materielDesignation', align: 'center' },
|
|
{ label: '物料代号', prop: 'materielDesignation', align: 'center' },
|
|
|
{ label: '客户代号', prop: 'clientCode', align: 'center' },
|
|
{ label: '客户代号', prop: 'clientCode', align: 'center' },
|
|
|
- // { label: '供应商名称', prop: 'supplierName', align: 'center', width: '120' },
|
|
|
|
|
- // { label: '供应商代号', prop: 'supplierCode', align: 'center', width: '120' },
|
|
|
|
|
{ label: '刻码', prop: 'engrave', align: 'center' },
|
|
{ label: '刻码', prop: 'engrave', align: 'center' },
|
|
|
{ label: '重量', prop: 'weight', align: 'center' },
|
|
{ label: '重量', prop: 'weight', align: 'center' },
|
|
|
{ label: '重量单位', prop: 'weightUnit', align: 'center' },
|
|
{ label: '重量单位', prop: 'weightUnit', align: 'center' },
|
|
@@ -257,9 +232,6 @@ export default {
|
|
|
isCheck: false,
|
|
isCheck: false,
|
|
|
|
|
|
|
|
rowIds: '',
|
|
rowIds: '',
|
|
|
-
|
|
|
|
|
- takeAsampleVisible: false,
|
|
|
|
|
- confirmSampleData: [],
|
|
|
|
|
formData: {
|
|
formData: {
|
|
|
number: 1,
|
|
number: 1,
|
|
|
sampleUnit: '',
|
|
sampleUnit: '',
|
|
@@ -394,16 +366,13 @@ export default {
|
|
|
created() { },
|
|
created() { },
|
|
|
methods: {
|
|
methods: {
|
|
|
async datasource({ page, limit, where }) {
|
|
async datasource({ page, limit, where }) {
|
|
|
-
|
|
|
|
|
const res = await getInventoryListByPlanId({ ...where, page, limit });
|
|
const res = await getInventoryListByPlanId({ ...where, page, limit });
|
|
|
-
|
|
|
|
|
if (res.list.length > 1) {
|
|
if (res.list.length > 1) {
|
|
|
this.isCheck = true
|
|
this.isCheck = true
|
|
|
} else {
|
|
} else {
|
|
|
this.isCheck = false
|
|
this.isCheck = false
|
|
|
}
|
|
}
|
|
|
this.packingList = res.list;
|
|
this.packingList = res.list;
|
|
|
-
|
|
|
|
|
return res.list;
|
|
return res.list;
|
|
|
},
|
|
},
|
|
|
// 切换质检内容
|
|
// 切换质检内容
|
|
@@ -420,8 +389,10 @@ export default {
|
|
|
const code = await getCode('qms_plan_code');
|
|
const code = await getCode('qms_plan_code');
|
|
|
this.baseForm.code = code;
|
|
this.baseForm.code = code;
|
|
|
return;
|
|
return;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await this.handleEditOrDetail(row);
|
|
|
}
|
|
}
|
|
|
- await this.handleEditOrDetail(row);
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
async handleEditOrDetail(row) {
|
|
async handleEditOrDetail(row) {
|
|
|
console.log('row====', row);
|
|
console.log('row====', row);
|
|
@@ -454,11 +425,9 @@ export default {
|
|
|
// 如果是编辑或者详情,则查询物料清单、质检方案和样品列表
|
|
// 如果是编辑或者详情,则查询物料清单、质检方案和样品列表
|
|
|
if (row.id) {
|
|
if (row.id) {
|
|
|
this.rowIds = row.id;
|
|
this.rowIds = row.id;
|
|
|
-
|
|
|
|
|
//操作行点击时查询清单
|
|
//操作行点击时查询清单
|
|
|
// await this.getInventoryList();
|
|
// await this.getInventoryList();
|
|
|
await this.reload({ planId: row.id });
|
|
await this.reload({ planId: row.id });
|
|
|
-
|
|
|
|
|
//操作行点击时查询样品
|
|
//操作行点击时查询样品
|
|
|
await this.getSampleList(row.id);
|
|
await this.getSampleList(row.id);
|
|
|
//操作行点击时查询质检
|
|
//操作行点击时查询质检
|
|
@@ -496,12 +465,11 @@ export default {
|
|
|
await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark);
|
|
await this.getGoodsList(receiveNo, productCode, null, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark);
|
|
|
|
|
|
|
|
//通过来源和产品 获取质检方案
|
|
//通过来源和产品 获取质检方案
|
|
|
- this.getQualityTemplate(productCode);
|
|
|
|
|
|
|
+ await this.getQualityTemplate(productCode);
|
|
|
},
|
|
},
|
|
|
async getGoodsList(receiveNo, productCode, ids, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark) {
|
|
async getGoodsList(receiveNo, productCode, ids, productCategoryId, productCategoryName, categoryid, batchNo, supplierName, supplierMark) {
|
|
|
this.$refs.table12.setData([])
|
|
this.$refs.table12.setData([])
|
|
|
|
|
|
|
|
-
|
|
|
|
|
let res;
|
|
let res;
|
|
|
const res1 = await outInRecordsPage({
|
|
const res1 = await outInRecordsPage({
|
|
|
sourceBizNo: receiveNo,
|
|
sourceBizNo: receiveNo,
|
|
@@ -517,7 +485,6 @@ export default {
|
|
|
res = res1.list
|
|
res = res1.list
|
|
|
this.isCheck = true;
|
|
this.isCheck = true;
|
|
|
console.log('this.isCheck=true', this.isCheck)
|
|
console.log('this.isCheck=true', this.isCheck)
|
|
|
-
|
|
|
|
|
} else {
|
|
} else {
|
|
|
res = []
|
|
res = []
|
|
|
this.$message.error('此数据已质检,无需再次质检!');
|
|
this.$message.error('此数据已质检,无需再次质检!');
|
|
@@ -545,79 +512,63 @@ export default {
|
|
|
|
|
|
|
|
console.log(res, '来料清单');
|
|
console.log(res, '来料清单');
|
|
|
if (res.length > 0) {
|
|
if (res.length > 0) {
|
|
|
- let _arr1 = [];
|
|
|
|
|
- _arr1 = res.map((m) => {
|
|
|
|
|
|
|
+ const _arr1 = res.map((m) => {
|
|
|
m.sourceId = m.id;
|
|
m.sourceId = m.id;
|
|
|
m.productCategoryId = productCategoryId;
|
|
m.productCategoryId = productCategoryId;
|
|
|
m.productCategoryName = productCategoryName;
|
|
m.productCategoryName = productCategoryName;
|
|
|
delete m.id;
|
|
delete m.id;
|
|
|
- return {
|
|
|
|
|
- ...m
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ return { ...m };
|
|
|
});
|
|
});
|
|
|
console.log(_arr1, '1234567890')
|
|
console.log(_arr1, '1234567890')
|
|
|
|
|
|
|
|
this.packingList = _arr1;
|
|
this.packingList = _arr1;
|
|
|
this.$refs.table12.setData(_arr1);//赋值
|
|
this.$refs.table12.setData(_arr1);//赋值
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
const _arr2 = this.$refs.table12.getData();
|
|
const _arr2 = this.$refs.table12.getData();
|
|
|
|
|
+
|
|
|
if (_arr2.length > 1) {
|
|
if (_arr2.length > 1) {
|
|
|
this.baseForm.productNumber = _arr2.length;
|
|
this.baseForm.productNumber = _arr2.length;
|
|
|
} else {
|
|
} else {
|
|
|
this.baseForm.productNumber = _arr2[0].measureQuantity;
|
|
this.baseForm.productNumber = _arr2[0].measureQuantity;
|
|
|
}
|
|
}
|
|
|
//处理样品清单
|
|
//处理样品清单
|
|
|
- this.aaa();
|
|
|
|
|
|
|
+ await this.handleSampleList();
|
|
|
} else {
|
|
} else {
|
|
|
this.$refs.table12.setData([]);
|
|
this.$refs.table12.setData([]);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- //获取样品编码
|
|
|
|
|
- async getSampleCode() {
|
|
|
|
|
- return await getCode('sample_code');
|
|
|
|
|
- },
|
|
|
|
|
- async aaa() {
|
|
|
|
|
- console.log('aaa')
|
|
|
|
|
|
|
+ async handleSampleList() {
|
|
|
let packingList = this.$refs.table12.getData();
|
|
let packingList = this.$refs.table12.getData();
|
|
|
-
|
|
|
|
|
|
|
+ //全检时
|
|
|
if (this.baseForm.qualityMode == 1) {
|
|
if (this.baseForm.qualityMode == 1) {
|
|
|
this.sampleList = [];
|
|
this.sampleList = [];
|
|
|
- console.log('是否拆包', this.baseForm.isUnpack)
|
|
|
|
|
|
|
+ console.log(this.baseForm.isUnpack, '---isUnpack---')
|
|
|
if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack != '') {
|
|
if (this.baseForm.isUnpack != null && this.baseForm.isUnpack != undefined && this.baseForm.isUnpack != '') {
|
|
|
|
|
+ //拆包
|
|
|
if (this.baseForm.isUnpack == 2) {
|
|
if (this.baseForm.isUnpack == 2) {
|
|
|
- const num = Number(this.baseForm.productNumber || 0);
|
|
|
|
|
- if (num) {
|
|
|
|
|
- this.getUnpackSamList(packingList, num)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ await this.handleUnpackCase(packingList);
|
|
|
} else if (this.baseForm.isUnpack == 1) {
|
|
} else if (this.baseForm.isUnpack == 1) {
|
|
|
- if (this.baseForm.qualityMode == 1) {
|
|
|
|
|
- await this.updatePackingList(packingList);
|
|
|
|
|
- } else {
|
|
|
|
|
- this.sampleList = [];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ await this.updatePackingList(packingList);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- console.log('isCheck', this.isCheck)
|
|
|
|
|
if (!this.isCheck) {
|
|
if (!this.isCheck) {
|
|
|
- const num = Number(this.baseForm.productNumber || 0);
|
|
|
|
|
- if (num) {
|
|
|
|
|
- this.getUnpackSamList(packingList, num)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ await this.handleUnpackCase(packingList);
|
|
|
} else {
|
|
} else {
|
|
|
- if (this.baseForm.qualityMode == 1) {
|
|
|
|
|
-
|
|
|
|
|
- await this.updatePackingList(packingList);
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- this.sampleList = [];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ await this.updatePackingList(packingList);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
this.sampleList = [];
|
|
this.sampleList = [];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ async handleUnpackCase(packingList) {
|
|
|
|
|
+ const num = Number(this.baseForm.productNumber || 0);
|
|
|
|
|
+ if (num) {
|
|
|
|
|
+ await this.getUnpackSamList(packingList, num);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ //获取样品编码
|
|
|
|
|
+ async getSampleCode() {
|
|
|
|
|
+ return await getCode('sample_code');
|
|
|
},
|
|
},
|
|
|
async updatePackingList(list) {
|
|
async updatePackingList(list) {
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -646,7 +597,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- console.log(data, 'datadatadatadatadatadata', num)
|
|
|
|
|
|
|
+ console.log(data, '样品数据-条数', num)
|
|
|
await this.updatePackingList(data);
|
|
await this.updatePackingList(data);
|
|
|
|
|
|
|
|
},
|
|
},
|
|
@@ -688,16 +639,12 @@ export default {
|
|
|
this.schemePagination.total = this.schemeList.length;
|
|
this.schemePagination.total = this.schemeList.length;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
|
|
+ //来料列表表格选择事件
|
|
|
handleSelectionChange(selection) {
|
|
handleSelectionChange(selection) {
|
|
|
- console.log(selection, 'gouxuan')
|
|
|
|
|
-
|
|
|
|
|
|
|
+ console.log(selection, '勾选')
|
|
|
this.selectedList = selection;
|
|
this.selectedList = selection;
|
|
|
-
|
|
|
|
|
this.formData.portion = selection.length;
|
|
this.formData.portion = selection.length;
|
|
|
-
|
|
|
|
|
this.baseForm.sampleNumber = selection.length;
|
|
this.baseForm.sampleNumber = selection.length;
|
|
|
//如果取小样
|
|
//如果取小样
|
|
|
if (this.conditionType == 2) {
|
|
if (this.conditionType == 2) {
|
|
@@ -706,35 +653,118 @@ export default {
|
|
|
this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
|
|
this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ //取样方式选择
|
|
|
|
|
+ handleSampleNumber(val) {
|
|
|
|
|
+ console.log(val, 'val');
|
|
|
|
|
+ this.conditionType = val;
|
|
|
|
|
+ //清空样品清单列表
|
|
|
|
|
+ this.sampleList = []
|
|
|
|
|
+ const dataS = this.$refs.table12.getData();
|
|
|
|
|
+ //取整样
|
|
|
|
|
+ if (val == 1) {
|
|
|
|
|
+ this.sampleList = dataS;
|
|
|
|
|
+ this.formData.portion = dataS.length;
|
|
|
|
|
+ this.$refs.table12.toggleAllSelection();
|
|
|
|
|
+ this.activeName = '2';
|
|
|
|
|
+ this.$message.success('取样成功!');
|
|
|
|
|
+ } else if (val == 2) {
|
|
|
|
|
+ this.formData.sampleUnit = dataS[0].measureUnit;
|
|
|
|
|
|
|
|
- // 样品列表分页方法
|
|
|
|
|
- handleSampleSizeChange(val) {
|
|
|
|
|
- this.samplePagination.pageSize = val;
|
|
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
|
|
- },
|
|
|
|
|
- handleSampleCurrentChange(val) {
|
|
|
|
|
- this.samplePagination.currentPage = val;
|
|
|
|
|
|
|
+ this.$refs.table12.clearSelection();
|
|
|
|
|
+ //小样
|
|
|
|
|
+ if (this.selectedList.length == 0) {
|
|
|
|
|
+ this.$message.warning('请先选择样品!');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (this.formData.number == null || this.formData.sampleUnit == '') {
|
|
|
|
|
+ this.$message.warning('请先选择取样的数量和单位!');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- // 质检方案分页方法
|
|
|
|
|
- handleSchemeSizeChange(val) {
|
|
|
|
|
- this.schemePagination.pageSize = val;
|
|
|
|
|
- this.schemePagination.currentPage = 1;
|
|
|
|
|
- },
|
|
|
|
|
- handleSchemeCurrentChange(val) {
|
|
|
|
|
- this.schemePagination.currentPage = val;
|
|
|
|
|
|
|
+ handleInputNumber(val) {
|
|
|
|
|
+ let packingList = this.$refs.table12.getData()
|
|
|
|
|
+
|
|
|
|
|
+ const maxValue = packingList.length > 1 ? packingList.length : packingList[0].measureQuantity;
|
|
|
|
|
+
|
|
|
|
|
+ if (val > maxValue) {
|
|
|
|
|
+ this.$message.warning('数量不能大于计量数量!');
|
|
|
|
|
+ this.formData.number = maxValue;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
- changeModel(val) {
|
|
|
|
|
- this.baseForm.qualityMode = val;
|
|
|
|
|
- this.baseForm.sampleNumber = ''
|
|
|
|
|
- console.log(this.baseForm.productNumber, 'productNumberproductNumber数量')
|
|
|
|
|
- if (this.baseForm.qualityMode == 1) {
|
|
|
|
|
- this.aaa()
|
|
|
|
|
|
|
+ handleInput(val) {
|
|
|
|
|
+ if (val == 0 || val == '' || val == null) {
|
|
|
|
|
+ this.$refs.table12.clearSelection();
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ let packingList = this.$refs.table12.getData();
|
|
|
|
|
+ if (!packingList || packingList.length === 0) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const portion = Number(this.formData.portion);
|
|
|
|
|
+ if (this.isCheck) {
|
|
|
|
|
+ if (portion > packingList.length) {
|
|
|
|
|
+ this.$message.warning('取样数量不能大于来源清单数量!');
|
|
|
|
|
+ this.formData.portion = packingList.length;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ packingList.slice(0, this.formData.portion).forEach(row => {
|
|
|
|
|
+ this.$refs.table12.toggleRowSelection(row);
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
- this.sampleList = [];
|
|
|
|
|
|
|
+ const maxQuantity = Number(packingList[0].measureQuantity);
|
|
|
|
|
+ if (portion > maxQuantity) {
|
|
|
|
|
+ this.$message.warning('取样数量不能大于计量数量!');
|
|
|
|
|
+ this.formData.portion = maxQuantity;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ getCategoryInfo(val) {
|
|
|
|
|
+ this.isConsumable = val.isConsumable;
|
|
|
|
|
+ },
|
|
|
|
|
+ changeSamUnit(val) {
|
|
|
|
|
+ this.$refs.baseInfoRefs.getsampleMeasureUnit(val);
|
|
|
|
|
+ },
|
|
|
|
|
+ //抽样确认按钮事件-样品列表右上角确认按钮
|
|
|
|
|
+ handleSampleSubmit() {
|
|
|
|
|
+ this.$refs.ruleForm.validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ this.sampleList = []
|
|
|
|
|
+ this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
|
|
|
|
|
+
|
|
|
|
|
+ if (this.conditionType == 1) {
|
|
|
|
|
+ this.sampleList = this.selectedList
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let measureQ = this.formData.number;
|
|
|
|
|
+ let unit = this.formData.sampleUnit;
|
|
|
|
|
+ let nums = Number(this.formData.portion);
|
|
|
|
|
+
|
|
|
|
|
+ console.log(measureQ, unit, nums, 'measureQ, unit, nums')
|
|
|
|
|
+ this.getNewSampleList(measureQ, unit, nums)
|
|
|
|
|
+ }
|
|
|
|
|
+ this.activeName = '2'
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ //更新计量数量、单位后重新生成样品列表数据
|
|
|
|
|
+ getNewSampleList(measureQ, unit, nums) {
|
|
|
|
|
+ this.sampleList = [];
|
|
|
|
|
+ if (!this.selectedList || this.selectedList.length == 0) {
|
|
|
|
|
+ this.$message.warning('请先选择样品!');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ this.sampleList = this.selectedList.map(oldItem => {
|
|
|
|
|
+ const newItem = JSON.parse(JSON.stringify(oldItem));
|
|
|
|
|
+ newItem.measureQuantity = measureQ;
|
|
|
|
|
+ newItem.measureUnit = unit;
|
|
|
|
|
+ return newItem;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ //监听类型变化
|
|
|
resetTable() {
|
|
resetTable() {
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
this.table1();
|
|
this.table1();
|
|
@@ -781,6 +811,7 @@ export default {
|
|
|
|
|
|
|
|
if (this.btnType == 'issued' && this.schemeList.length < 1) {
|
|
if (this.btnType == 'issued' && this.schemeList.length < 1) {
|
|
|
this.$message.warning('质检方案不能为空!');
|
|
this.$message.warning('质检方案不能为空!');
|
|
|
|
|
+ this.loading = false;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
let URL =
|
|
let URL =
|
|
@@ -798,7 +829,6 @@ export default {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
- this.loading = false;
|
|
|
|
|
},
|
|
},
|
|
|
handleIssued() {
|
|
handleIssued() {
|
|
|
if (this.sampleList.length == 0) {
|
|
if (this.sampleList.length == 0) {
|
|
@@ -826,6 +856,7 @@ export default {
|
|
|
|
|
|
|
|
if (this.btnType == 'issued' && this.schemeList.length < 1) {
|
|
if (this.btnType == 'issued' && this.schemeList.length < 1) {
|
|
|
this.$message.warning('质检方案不能为空!');
|
|
this.$message.warning('质检方案不能为空!');
|
|
|
|
|
+ this.loading = false;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -840,139 +871,34 @@ export default {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
- this.loading = false;
|
|
|
|
|
},
|
|
},
|
|
|
- handleSampleNumber(val) {
|
|
|
|
|
- console.log(val, 'val')
|
|
|
|
|
- this.conditionType = val;
|
|
|
|
|
- //清空样品清单列表
|
|
|
|
|
- this.sampleList = []
|
|
|
|
|
- let dataS = this.$refs.table12.getData()
|
|
|
|
|
- //取整样
|
|
|
|
|
- if (val == 1) {
|
|
|
|
|
- this.sampleList = dataS
|
|
|
|
|
- this.formData.portion = dataS.length
|
|
|
|
|
- this.$refs.table12.toggleAllSelection();
|
|
|
|
|
- this.activeName = '2'
|
|
|
|
|
- this.$message.success('取样成功!');
|
|
|
|
|
- } else if (val == 2) {
|
|
|
|
|
- this.formData.sampleUnit = dataS[0].measureUnit
|
|
|
|
|
-
|
|
|
|
|
- this.$refs.table12.clearSelection();
|
|
|
|
|
- //小样
|
|
|
|
|
- if (this.selectedList.length == 0) {
|
|
|
|
|
- this.$message.warning('请先选择样品!');
|
|
|
|
|
- } else {
|
|
|
|
|
- if (this.formData.number == null || this.formData.sampleUnit == '') {
|
|
|
|
|
- this.$message.warning('请先选择取样的数量和单位!');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- handleInputNumber(val) {
|
|
|
|
|
- let packingList = this.$refs.table12.getData()
|
|
|
|
|
-
|
|
|
|
|
- const maxValue = packingList.length > 1 ? packingList.length : packingList[0].measureQuantity;
|
|
|
|
|
-
|
|
|
|
|
- if (val > maxValue) {
|
|
|
|
|
- this.$message.warning('数量不能大于计量数量!');
|
|
|
|
|
- this.formData.number = maxValue;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- handleInput(val) {
|
|
|
|
|
- if (val == 0 || val == '' || val == null) {
|
|
|
|
|
- this.$refs.table12.clearSelection();
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- let packingList = this.$refs.table12.getData();
|
|
|
|
|
- if (!packingList || packingList.length === 0) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const portion = Number(this.formData.portion);
|
|
|
|
|
- if (this.isCheck) {
|
|
|
|
|
- if (portion > packingList.length) {
|
|
|
|
|
- this.$message.warning('取样数量不能大于来源清单数量!');
|
|
|
|
|
- this.formData.portion = packingList.length;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- packingList.slice(0, this.formData.portion).forEach(row => {
|
|
|
|
|
- this.$refs.table12.toggleRowSelection(row);
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- const maxQuantity = Number(packingList[0].measureQuantity);
|
|
|
|
|
- if (portion > maxQuantity) {
|
|
|
|
|
- this.$message.warning('取样数量不能大于计量数量!');
|
|
|
|
|
- this.formData.portion = maxQuantity;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- getCategoryInfo(val) {
|
|
|
|
|
- this.isConsumable = val.isConsumable;
|
|
|
|
|
- },
|
|
|
|
|
- changeSamUnit(val) {
|
|
|
|
|
- this.$refs.baseInfoRefs.getsampleMeasureUnit(val)
|
|
|
|
|
- },
|
|
|
|
|
- handleSampleSubmit() {
|
|
|
|
|
- this.$refs.ruleForm.validate((valid) => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- this.sampleList = []
|
|
|
|
|
- this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
|
|
|
|
|
-
|
|
|
|
|
- if (this.conditionType == 1) {
|
|
|
|
|
- this.sampleList = this.selectedList
|
|
|
|
|
- } else {
|
|
|
|
|
- let measureQ = this.formData.number;
|
|
|
|
|
- let unit = this.formData.sampleUnit;
|
|
|
|
|
- let nums = Number(this.formData.portion);
|
|
|
|
|
-
|
|
|
|
|
- console.log(measureQ, unit, nums, 'measureQ, unit, nums')
|
|
|
|
|
- this.getNewSampleList(measureQ, unit, nums)
|
|
|
|
|
- }
|
|
|
|
|
- this.activeName = '2'
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 样品列表分页方法
|
|
|
|
|
+ handleSampleSizeChange(val) {
|
|
|
|
|
+ this.samplePagination.pageSize = val;
|
|
|
|
|
+ this.samplePagination.currentPage = 1;
|
|
|
},
|
|
},
|
|
|
- getNewSampleList(measureQ, unit, nums) {
|
|
|
|
|
- this.sampleList = [];
|
|
|
|
|
- if (!this.selectedList || this.selectedList.length == 0) {
|
|
|
|
|
- this.$message.warning('请先选择样品!');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.sampleList = this.selectedList.map(oldItem => {
|
|
|
|
|
- const newItem = JSON.parse(JSON.stringify(oldItem));
|
|
|
|
|
- newItem.measureQuantity = measureQ;
|
|
|
|
|
- newItem.measureUnit = unit;
|
|
|
|
|
- return newItem;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ handleSampleCurrentChange(val) {
|
|
|
|
|
+ this.samplePagination.currentPage = val;
|
|
|
},
|
|
},
|
|
|
- handleCancel() {
|
|
|
|
|
- this.takeAsampleVisible = false;
|
|
|
|
|
|
|
+ // 质检方案分页方法
|
|
|
|
|
+ handleSchemeSizeChange(val) {
|
|
|
|
|
+ this.schemePagination.pageSize = val;
|
|
|
|
|
+ this.schemePagination.currentPage = 1;
|
|
|
},
|
|
},
|
|
|
- handleSelectionChange2(selection) {
|
|
|
|
|
- console.log(selection, '123')
|
|
|
|
|
- this.confirmSampleData = selection;
|
|
|
|
|
|
|
+ handleSchemeCurrentChange(val) {
|
|
|
|
|
+ this.schemePagination.currentPage = val;
|
|
|
},
|
|
},
|
|
|
- handleConfirm() {
|
|
|
|
|
-
|
|
|
|
|
- //赋值取样数量和取样单位
|
|
|
|
|
- // this.baseForm.sampleNumber = this.sampleData[0].measureQuantity
|
|
|
|
|
- // this.baseForm.sampleMeasureUnit = this.sampleData[0].measureUnit
|
|
|
|
|
- if (this.confirmSampleData.length > 0) {
|
|
|
|
|
- this.sampleList = this.confirmSampleData;
|
|
|
|
|
|
|
+ //检验方式改变时,重新获取样品列表
|
|
|
|
|
+ changeModel(val) {
|
|
|
|
|
+ this.baseForm.qualityMode = val;
|
|
|
|
|
+ this.baseForm.sampleNumber = '';
|
|
|
|
|
+ console.log(this.baseForm.productNumber, 'productNumberproductNumber数量')
|
|
|
|
|
+ if (this.baseForm.qualityMode == 1) {
|
|
|
|
|
+ this.handleSampleList();
|
|
|
} else {
|
|
} else {
|
|
|
- this.sampleList = this.selectedList;
|
|
|
|
|
|
|
+ this.sampleList = [];
|
|
|
}
|
|
}
|
|
|
- this.takeAsampleVisible = false;
|
|
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|