|
|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
- <el-dialog
|
|
|
+ <ele-modal
|
|
|
:visible.sync="visible"
|
|
|
+ v-if="visible"
|
|
|
:before-close="handleClose"
|
|
|
:close-on-click-modal="true"
|
|
|
:close-on-press-escape="false"
|
|
|
@@ -8,7 +9,7 @@
|
|
|
append-to-body
|
|
|
width="90%"
|
|
|
>
|
|
|
- <div class="ele-body" v-if="visible">
|
|
|
+ <div class="ele-body">
|
|
|
<el-card shadow="never">
|
|
|
<header-title title="基本信息">
|
|
|
<el-button @click="cancel">返回</el-button>
|
|
|
@@ -47,6 +48,7 @@
|
|
|
:scheme-list="schemeList"
|
|
|
:loading="loading"
|
|
|
:form="form"
|
|
|
+ :status="statusType"
|
|
|
@handleSelectionChange="handleSelectionChange1"
|
|
|
@batch-quality="batchQuality"
|
|
|
@batch-dispose="batchDispose"
|
|
|
@@ -67,16 +69,22 @@
|
|
|
@handleDispose="handleDispose"
|
|
|
></sampleListDialog>
|
|
|
<sampleDisposeDialog
|
|
|
+ v-if="sampleDisposeVisble"
|
|
|
+ :sampleDisposeVisble.sync="sampleDisposeVisble"
|
|
|
ref="disposeRef"
|
|
|
@handleDisposeConfirm="handleDisposeConfirm"
|
|
|
+ :rowData="rowData"
|
|
|
+ @close="closeDispose"
|
|
|
+ @handleDispose="handleDispose"
|
|
|
></sampleDisposeDialog>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import baseInfo from './components/baseInfo.vue';
|
|
|
- import QualityContentTabs from './components/QualityContentTabs.vue';
|
|
|
+ // import QualityContentTabs from './components/QualityContentTabs.vue';
|
|
|
+ import QualityContentTabs from './components/newQualityContentTabs.vue';
|
|
|
|
|
|
import { getCode } from '@/api/login';
|
|
|
import {
|
|
|
@@ -105,31 +113,6 @@
|
|
|
},
|
|
|
mixins: [dictMixins],
|
|
|
|
|
|
- props: {
|
|
|
- // workListIds: {
|
|
|
- // type: Array,
|
|
|
- // default() {
|
|
|
- // return [];
|
|
|
- // }
|
|
|
- // },
|
|
|
- // activeName: {
|
|
|
- // type: String
|
|
|
- // },
|
|
|
- // reportNeedFeed: {}
|
|
|
- workListIds: {
|
|
|
- type: Array,
|
|
|
- default() {
|
|
|
- return [];
|
|
|
- }
|
|
|
- },
|
|
|
- taskId: {
|
|
|
- type: String,
|
|
|
- default() {
|
|
|
- return null;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
data() {
|
|
|
const defaultForm = function () {
|
|
|
return {
|
|
|
@@ -167,7 +150,9 @@
|
|
|
};
|
|
|
};
|
|
|
return {
|
|
|
+ rowData: null,
|
|
|
defaultForm,
|
|
|
+ sampleDisposeVisble: false,
|
|
|
// 表单数据
|
|
|
form: { ...defaultForm() },
|
|
|
voList: [],
|
|
|
@@ -179,12 +164,13 @@
|
|
|
loading: false,
|
|
|
|
|
|
tabTaskId: null,
|
|
|
- visible: false,
|
|
|
// activeName: '2',
|
|
|
|
|
|
packingList: [],
|
|
|
+ // 样品清单,处置,批量处置,批量质检,质检的操作
|
|
|
sampleList: [],
|
|
|
schemeList: [],
|
|
|
+ inventoryList: [],
|
|
|
activeName: '1',
|
|
|
|
|
|
isValid: true,
|
|
|
@@ -193,12 +179,13 @@
|
|
|
qualityTimeStart: '',
|
|
|
isReportProcessProduce: false,
|
|
|
addStatus: [],
|
|
|
- dataWork: {},
|
|
|
- inventoryList: []
|
|
|
+ statusType: false,
|
|
|
+ visible: false,
|
|
|
+ dataWork: {}
|
|
|
};
|
|
|
},
|
|
|
// watch: {
|
|
|
- // workListIds: {
|
|
|
+ // '$route.query.id': {
|
|
|
// handler(id) {
|
|
|
// if (id) {
|
|
|
// this.getDetail();
|
|
|
@@ -210,37 +197,26 @@
|
|
|
// },
|
|
|
|
|
|
created() {
|
|
|
- // console.log(11111);
|
|
|
- // console.log(this.workListIds);
|
|
|
// this.open();
|
|
|
- // if (this.workListIds[0]) {
|
|
|
+ // if (this.$route.query.id) {
|
|
|
// this.getDetail();
|
|
|
// }
|
|
|
},
|
|
|
methods: {
|
|
|
//切换检验方式
|
|
|
changeModel(val, flag) {
|
|
|
+ console.log('切换检验方式');
|
|
|
+
|
|
|
this.$refs.tabsRef.tableSelClear();
|
|
|
this.sampleList = [];
|
|
|
this.$refs.tabsRef.tabsChange('1');
|
|
|
this.$refs.tabsRef.tabsConditionType(null);
|
|
|
-
|
|
|
this.form.qualityMode = val;
|
|
|
//检验方式 全检
|
|
|
if (this.form.qualityMode == 1) {
|
|
|
this.activeName = '2';
|
|
|
this.form.sampleNumber = '';
|
|
|
- const sData = this.$refs.tabsRef.$refs.sourceTable.getData();
|
|
|
- if (sData.length == 0) {
|
|
|
- for (let i = 0; i < sData.length; i++) {
|
|
|
- this.$set(sData[i], 'qualityStatus', 2);
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(
|
|
|
- this.$refs.tabsRef.$refs.sourceTable.getData(),
|
|
|
- 'packingList'
|
|
|
- );
|
|
|
- this.getProSamList(sData);
|
|
|
+ this.changeGetSampleList(this.inventoryList);
|
|
|
} else {
|
|
|
this.activeName = '1';
|
|
|
if (!flag) {
|
|
|
@@ -248,37 +224,6 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- async open(req) {
|
|
|
- this.visible = true;
|
|
|
- this.dataWork = req.data;
|
|
|
- this.getDetail(req.workOrderId);
|
|
|
- this.type = req.data.type ? req.data.type : req.type;
|
|
|
- this.qualityType = req.data.qualityType ? req.data.qualityType : '';
|
|
|
-
|
|
|
- this.title =
|
|
|
- this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
|
|
|
-
|
|
|
- if (this.type == 'add') {
|
|
|
- const code = await getCode('quality_work_order_code');
|
|
|
- this.form.code = code;
|
|
|
- } else {
|
|
|
- if (
|
|
|
- req.data.qualityTimeStart != '' ||
|
|
|
- req.data.qualityTimeStart != null ||
|
|
|
- req.data.qualityTimeStart != undefined
|
|
|
- ) {
|
|
|
- this.qualityTimeStart = this.getNowTime();
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- handleClose() {
|
|
|
- this.visible = false;
|
|
|
- // this.$refs.equiTable.clearSelection();
|
|
|
- this.$emit('close', false);
|
|
|
- },
|
|
|
-
|
|
|
//根据类型判断样品清单现实列表数据
|
|
|
async getProSamList(list) {
|
|
|
//生产检验
|
|
|
@@ -356,6 +301,133 @@
|
|
|
this.sampleList = this.addStatus;
|
|
|
}
|
|
|
},
|
|
|
+ // 创建计量数量为1的样品清单函数,用于计数类型的
|
|
|
+ async createSampleList(list) {
|
|
|
+ if (this.form.qualityMode != null) {
|
|
|
+ console.log('sssssjijdiajdia');
|
|
|
+
|
|
|
+ this.$message('正在生成样品清单');
|
|
|
+ const ProductSampleList = [];
|
|
|
+ console.log(list, 'list');
|
|
|
+ for (const oldItem of list) {
|
|
|
+ const count = oldItem.measureQuantity;
|
|
|
+ const newMeasureQuantity = oldItem.measureQuantity / count;
|
|
|
+ const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
|
|
|
+
|
|
|
+ console.log(typeof oldItem.qualitySampleTemplateList, 'ssssss');
|
|
|
+
|
|
|
+ // 遍历新数组设置 qualityResults 默认值
|
|
|
+ this.schemeList.forEach((item) => {
|
|
|
+ if (typeof item === 'object' && item !== null) {
|
|
|
+ item.qualityResults = 1; // 设置默认值
|
|
|
+ }
|
|
|
+ delete item.id;
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(oldItem, 'oldItem');
|
|
|
+ console.log(count, newMeasureQuantity, newWeight);
|
|
|
+ delete oldItem.id;
|
|
|
+
|
|
|
+ if (
|
|
|
+ oldItem.qualitySampleTemplateList == undefined ||
|
|
|
+ oldItem.qualitySampleTemplateList == null ||
|
|
|
+ oldItem.qualitySampleTemplateList.length == 0
|
|
|
+ ) {
|
|
|
+ oldItem.qualitySampleTemplateList = JSON.parse(
|
|
|
+ JSON.stringify(this.schemeList)
|
|
|
+ );
|
|
|
+ for (let i = 0; i < count; i++) {
|
|
|
+ ProductSampleList.push({
|
|
|
+ ...oldItem,
|
|
|
+ measureQuantity: newMeasureQuantity,
|
|
|
+ weight: newWeight,
|
|
|
+ sampleCode: await this.getSampleCode(),
|
|
|
+ qualitySampleTemplateList: JSON.parse(
|
|
|
+ JSON.stringify(this.schemeList)
|
|
|
+ )
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(ProductSampleList, 'ProductSampleList');
|
|
|
+ this.sampleList = ProductSampleList;
|
|
|
+ const pNum = ProductSampleList.reduce((sum, item) => {
|
|
|
+ return sum + Number(item.weight || 0);
|
|
|
+ }, 0);
|
|
|
+ this.form.totalWeight = parseFloat(pNum.toFixed(2));
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < count; i++) {
|
|
|
+ ProductSampleList.push({
|
|
|
+ ...oldItem,
|
|
|
+ measureQuantity: newMeasureQuantity,
|
|
|
+ weight: newWeight,
|
|
|
+ sampleCode: await this.getSampleCode(),
|
|
|
+ qualitySampleTemplateList: JSON.parse(
|
|
|
+ JSON.stringify(oldItem.qualitySampleTemplateList)
|
|
|
+ )
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(ProductSampleList, 'ProductSampleList');
|
|
|
+ this.sampleList = ProductSampleList;
|
|
|
+ const pNum = ProductSampleList.reduce((sum, item) => {
|
|
|
+ return sum + Number(item.weight || 0);
|
|
|
+ }, 0);
|
|
|
+ this.form.totalWeight = parseFloat(pNum.toFixed(2));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 全检计量计重的样品清单函数
|
|
|
+ async updatePackingList(list, sampleCount) {
|
|
|
+ // for (let i = 0; i < list.length; i++) {
|
|
|
+ // list[i].sampleCode = await this.getSampleCode();
|
|
|
+ // }
|
|
|
+
|
|
|
+ const dataList = [];
|
|
|
+ let currentNum = sampleCount - list.length;
|
|
|
+ let currentNum1 = sampleCount;
|
|
|
+ // console.log(this.selectedList);
|
|
|
+
|
|
|
+ for (const item of list) {
|
|
|
+ const qualitySampleTemplateList = item.qualitySampleTemplateList
|
|
|
+ ?.length
|
|
|
+ ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
|
|
|
+ : JSON.parse(
|
|
|
+ JSON.stringify(
|
|
|
+ this.schemeList.map((item) => {
|
|
|
+ item['qualityResults'] = 1;
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ if (sampleCount >= list.length) {
|
|
|
+ dataList.push({
|
|
|
+ ...item,
|
|
|
+ measureQuantity: item.measureQuantity, //作为计量数量
|
|
|
+ sampleCode: await this.getSampleCode(),
|
|
|
+ qualitySampleTemplateList
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.sampleList = dataList;
|
|
|
+ this.sampleNumber = this.sampleList.length;
|
|
|
+ },
|
|
|
+ // 切换检验方式为全检后生成样品
|
|
|
+ changeGetSampleList(list) {
|
|
|
+ this.$message('正在生成样品清单');
|
|
|
+ console.log(list);
|
|
|
+ console.log(this.form.total);
|
|
|
+
|
|
|
+ // 计量类型1是数量,2是重量
|
|
|
+ if (this.form.inspectionStandards == 1) {
|
|
|
+ this.createSampleList(list);
|
|
|
+ }
|
|
|
+ if (this.form.inspectionStandards == 2) {
|
|
|
+ this.updatePackingList(list, this.form.total);
|
|
|
+ // this.handleWeightFullSample(this.form.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
//输入取样数量
|
|
|
changeNumber(val) {
|
|
|
if (this.form.qualityMode !== 2) {
|
|
|
@@ -459,32 +531,47 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // async open(req) {
|
|
|
- // this.equipmentdialog = true;
|
|
|
- // console.log('弹窗打开了.....');
|
|
|
- // console.log(req);
|
|
|
- // console.log(req[workOrderId]);
|
|
|
- // console.log(req.workOrderId);
|
|
|
- // // this.getDetail(req.workOrderId);
|
|
|
- // this.type = this.$route.query.type;
|
|
|
- // this.qualityType = this.$route.query.qualityType;
|
|
|
-
|
|
|
- // this.title =
|
|
|
- // this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
|
|
|
-
|
|
|
- // if (this.type == 'add') {
|
|
|
- // const code = await getCode('quality_work_order_code');
|
|
|
- // this.form.code = code;
|
|
|
- // } else {
|
|
|
- // if (
|
|
|
- // this.$route.query.qualityTimeStart != '' ||
|
|
|
- // this.$route.query.qualityTimeStart != null ||
|
|
|
- // this.$route.query.qualityTimeStart != undefined
|
|
|
- // ) {
|
|
|
- // this.qualityTimeStart = this.getNowTime();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
+ async open(req) {
|
|
|
+ this.visible = true;
|
|
|
+ this.dataWork = req.data;
|
|
|
+ this.getDetail(req.workOrderId);
|
|
|
+ this.type = req.data.type ? req.data.type : req.type;
|
|
|
+ this.qualityType = req.data.qualityType ? req.data.qualityType : '';
|
|
|
+
|
|
|
+ this.title =
|
|
|
+ this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
|
|
|
+
|
|
|
+ if (this.type == 'add') {
|
|
|
+ const code = await getCode('quality_work_order_code');
|
|
|
+ this.form.code = code;
|
|
|
+ } else {
|
|
|
+ if (
|
|
|
+ req.data.qualityTimeStart != '' ||
|
|
|
+ req.data.qualityTimeStart != null ||
|
|
|
+ req.data.qualityTimeStart != undefined
|
|
|
+ ) {
|
|
|
+ this.qualityTimeStart = this.getNowTime();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // this.type = this.$route.query.type;
|
|
|
+ // this.qualityType = this.$route.query.qualityType;
|
|
|
+
|
|
|
+ // this.title =
|
|
|
+ // this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
|
|
|
+
|
|
|
+ // if (this.type == 'add') {
|
|
|
+ // const code = await getCode('quality_work_order_code');
|
|
|
+ // this.form.code = code;
|
|
|
+ // } else {
|
|
|
+ // if (
|
|
|
+ // this.$route.query.qualityTimeStart != '' ||
|
|
|
+ // this.$route.query.qualityTimeStart != null ||
|
|
|
+ // this.$route.query.qualityTimeStart != undefined
|
|
|
+ // ) {
|
|
|
+ // this.qualityTimeStart = this.getNowTime();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ },
|
|
|
getNowTime() {
|
|
|
const nowDate = this.getNowDate();
|
|
|
return (
|
|
|
@@ -506,38 +593,36 @@
|
|
|
return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate;
|
|
|
},
|
|
|
async getDetail(id) {
|
|
|
- getById(id)
|
|
|
- .then((res) => {
|
|
|
- if (!res.qualifiedNumber) {
|
|
|
- res.qualifiedNumber = res.total;
|
|
|
- }
|
|
|
-
|
|
|
- this.form = res.data;
|
|
|
+ getById(id).then((res) => {
|
|
|
+ this.form = res.data;
|
|
|
+ this.statusType = this.form.status == 1 ? true : false;
|
|
|
|
|
|
- this.isReportProcessProduce =
|
|
|
- this.form.isReportProcessProduce == 1 ? true : false;
|
|
|
+ this.isReportProcessProduce =
|
|
|
+ this.form.isReportProcessProduce == 1 ? true : false;
|
|
|
|
|
|
- this.tabTaskId =
|
|
|
- this.categoryParamList[0] && this.categoryParamList[0].id;
|
|
|
+ this.tabTaskId =
|
|
|
+ this.categoryParamList[0] && this.categoryParamList[0].id;
|
|
|
|
|
|
- if (this.form.groupId) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.baseInfoRefs?.getUserList({
|
|
|
- groupId: this.form.groupId
|
|
|
- });
|
|
|
+ if (this.form.groupId) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.baseInfoRefs?.getUserList({
|
|
|
+ groupId: this.form.groupId
|
|
|
});
|
|
|
- }
|
|
|
- if (this.form.produceRoutingId) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.baseInfoRefs?.getTaskList();
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((error) => console.error('Error fetching data:', error));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.form.produceRoutingId) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.baseInfoRefs?.getTaskList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
// await this.queryQualityInventory()
|
|
|
+ // 质检方案
|
|
|
await this.queryQualityTempleContent();
|
|
|
+ // 样品清单
|
|
|
await this.queryQualitySamplContent();
|
|
|
+ // 来源清单
|
|
|
await this.getQueryQualityInventory();
|
|
|
},
|
|
|
// getNewData(val) {
|
|
|
@@ -662,14 +747,13 @@
|
|
|
console.log(unit, '所选单位');
|
|
|
console.log(sampleCount, '数量');
|
|
|
try {
|
|
|
- console.log(this.isStandard1OrWeightSample());
|
|
|
- console.log(this.isWeightStandardFullSample());
|
|
|
if (this.isStandard1OrWeightSample()) {
|
|
|
//抽检计量整样小样或者抽检计重小样
|
|
|
if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
|
|
|
return; //取样数量验证
|
|
|
if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
|
|
|
return; // 若计量单位为重量,还需验证总重量是否足够
|
|
|
+ console.log(1111111111111);
|
|
|
|
|
|
await this.getNewFullSampleList(
|
|
|
Math.ceil(sampleCount),
|
|
|
@@ -677,13 +761,14 @@
|
|
|
unit
|
|
|
);
|
|
|
} else if (this.isWeightStandardFullSample()) {
|
|
|
- console.log('1111111111111');
|
|
|
//抽检取计重取整样
|
|
|
if (!this.validateSampleCount(sampleCount)) return;
|
|
|
- console.log('1111111111111');
|
|
|
+ console.log(222222222222222222);
|
|
|
await this.handleWeightFullSample(sampleCount);
|
|
|
}
|
|
|
this.activeName = '2';
|
|
|
+
|
|
|
+ this.$refs.tabsRef.tabsChange('2');
|
|
|
} catch (error) {
|
|
|
console.error('取样处理失败:', error);
|
|
|
this.$message.error('取样处理失败');
|
|
|
@@ -702,6 +787,8 @@
|
|
|
return;
|
|
|
}
|
|
|
this.activeName = '2';
|
|
|
+ this.$refs.tabsRef.tabsChange('2');
|
|
|
+
|
|
|
if (this.form.isUnpack == 1) {
|
|
|
// 1 拆包 2 不拆
|
|
|
let measureQuantity = 1;
|
|
|
@@ -806,12 +893,14 @@
|
|
|
|
|
|
async queryQualitySamplContent() {
|
|
|
const res = await queryQualitySamplContent({
|
|
|
- qualityWorkerId: this.dataWork.id,
|
|
|
+ qualityWorkerId: this.$route.query.id,
|
|
|
size: 1000
|
|
|
});
|
|
|
let addStatus = res.list.map((item) => {
|
|
|
item.isValid = true;
|
|
|
- item.disposeTime = item.disposeTime ? item.disposeTime : null;
|
|
|
+ // item.disposeTime = item.disposeTime
|
|
|
+ // ? item.disposeTime.split(' ')[0]
|
|
|
+ // : null;
|
|
|
item.sampleDate = item.sampleDate
|
|
|
? item.sampleDate.split(' ')[0]
|
|
|
: null;
|
|
|
@@ -829,12 +918,15 @@
|
|
|
},
|
|
|
async queryQualityTempleContent() {
|
|
|
const res = await queryQualityTempleContent({
|
|
|
- qualityWorkerId: this.dataWork.id
|
|
|
+ qualityWorkerId: this.$route.query.id
|
|
|
});
|
|
|
console.log(res, '质检方案');
|
|
|
this.schemeList = res.list;
|
|
|
},
|
|
|
+ // 取样
|
|
|
getConditionType(val) {
|
|
|
+ console.log(val, '------取样的回调');
|
|
|
+
|
|
|
this.form.conditionType = val;
|
|
|
},
|
|
|
|
|
|
@@ -848,8 +940,6 @@
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
- // this.type = 'edit';
|
|
|
// this.loading = true;
|
|
|
let URL =
|
|
|
this.type == 'add' ? save : this.type == 'edit' ? update : '';
|
|
|
@@ -858,20 +948,23 @@
|
|
|
|
|
|
delete this.form['qualityTimeEnd'];
|
|
|
|
|
|
+ console.log(this.sampleList);
|
|
|
+
|
|
|
let params = {
|
|
|
...this.form,
|
|
|
sampleList: this.sampleList,
|
|
|
planTemplateList: this.schemeList,
|
|
|
templateList: this.schemeList,
|
|
|
+ // qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
|
|
|
qualityInventoryList: this.inventoryList
|
|
|
};
|
|
|
console.log(params, 'params ----');
|
|
|
+
|
|
|
URL(params)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
this.$message.success(msg);
|
|
|
- this.visible = false;
|
|
|
- // this.cancel();
|
|
|
+ this.cancel();
|
|
|
this.$emit('done');
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
@@ -926,18 +1019,22 @@
|
|
|
}, 0);
|
|
|
this.form.totalWeight = parseFloat(pNum.toFixed(2));
|
|
|
},
|
|
|
- handleDispose(index, row, type) {
|
|
|
- if (!this.sampleList[index]) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ handleDispose(data) {
|
|
|
+ console.log(data);
|
|
|
+ // return
|
|
|
+ this.rowData = data;
|
|
|
+ this.sampleDisposeVisble = true;
|
|
|
+ // if (!this.sampleList[index]) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
- this.sampleList[index].sampleDate = this.getNowTimes();
|
|
|
+ // this.sampleList[index].sampleDate = this.getNowTimes();
|
|
|
|
|
|
- this.sampleList[index].disposeTime = this.getNowTimes();
|
|
|
+ // this.sampleList[index].disposeTime = this.getNowTimes();
|
|
|
|
|
|
- console.log(index, row, type, this.qualityType);
|
|
|
+ // console.log(index, row, type, this.qualityType);
|
|
|
|
|
|
- this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
|
|
|
+ // this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
|
|
|
},
|
|
|
// 报工
|
|
|
handleReporting(index, row) {
|
|
|
@@ -974,34 +1071,32 @@
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- console.log();
|
|
|
+
|
|
|
+ // this.form.qualityTimeEnd = new Date(this.getNowTime());
|
|
|
+ // this.form.qualityTimeStart = new Date(this.qualityTimeStart);
|
|
|
|
|
|
this.form.qualityTimeEnd = this.getNowTime();
|
|
|
this.form.qualityTimeStart = this.qualityTimeStart;
|
|
|
|
|
|
+ console.log(this.form.qualityTimeStart, this.form.qualityTimeEnd);
|
|
|
+
|
|
|
// if (this.form.qualityMode == 1) {
|
|
|
// this.form.qualityResults = '';
|
|
|
// }
|
|
|
|
|
|
- // if (this.schemeList.length == 0) {
|
|
|
- // this.$message.error('样品清单不能为空!');
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
let params = {
|
|
|
...this.form,
|
|
|
sampleList: this.sampleList,
|
|
|
planTemplateList: this.schemeList,
|
|
|
- qualityInventoryList: this.inventoryList
|
|
|
// qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
|
|
|
+ qualityInventoryList: this.inventoryList
|
|
|
};
|
|
|
console.log(params, 'params');
|
|
|
+
|
|
|
exeReportWork(params)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
this.$message.success(msg);
|
|
|
- this.visible = false;
|
|
|
- // this.$emit('close', false);
|
|
|
// this.cancel();
|
|
|
this.$emit('done');
|
|
|
})
|
|
|
@@ -1013,20 +1108,24 @@
|
|
|
// 处理确认事件
|
|
|
handleDisposeConfirm(data, index) {
|
|
|
console.log(data, index, '确认处置事件');
|
|
|
+ console.log(this.sampleList);
|
|
|
|
|
|
- if (index != null) {
|
|
|
- this.$set(this.sampleList, index, data);
|
|
|
- } else {
|
|
|
+ if (index == undefined) {
|
|
|
this.sampleList.forEach((obj) => {
|
|
|
- obj.disposalStatus = data.disposalStatus;
|
|
|
+ obj.disposeType = data.disposeType;
|
|
|
obj.sampleDate = data.sampleDate;
|
|
|
- obj.disposeTime = data.disposeTime;
|
|
|
obj.sampleCondition = data.sampleCondition;
|
|
|
obj.producerManufacturer = data.producerManufacturer;
|
|
|
obj.samplePlace = data.samplePlace;
|
|
|
obj.sampleRemark = data.sampleRemark;
|
|
|
+ obj.depotId = data.depotId;
|
|
|
+ obj.depotName = data.depotName;
|
|
|
});
|
|
|
+ } else {
|
|
|
+ this.$set(this.sampleList, index, data);
|
|
|
}
|
|
|
+
|
|
|
+ console.log(this.sampleList);
|
|
|
},
|
|
|
//确认质检
|
|
|
handleConfirm(list, index) {
|
|
|
@@ -1103,12 +1202,18 @@
|
|
|
},
|
|
|
// 批量处置
|
|
|
batchDispose() {
|
|
|
- this.$refs.disposeRef.openDispose(
|
|
|
- null,
|
|
|
- null,
|
|
|
- 'dispose',
|
|
|
- this.qualityType
|
|
|
- );
|
|
|
+ if (this.sampleList && this.sampleList.length) {
|
|
|
+ this.sampleDisposeVisble = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$message('当前没有样品清单可以处置');
|
|
|
+
|
|
|
+ // this.$refs.disposeRef.openDispose(
|
|
|
+ // null,
|
|
|
+ // null,
|
|
|
+ // 'dispose',
|
|
|
+ // this.qualityType
|
|
|
+ // );
|
|
|
},
|
|
|
|
|
|
//全检,检验标准改变时,重新获取样品列表
|
|
|
@@ -1242,6 +1347,10 @@
|
|
|
}
|
|
|
}
|
|
|
this.sampleList = result;
|
|
|
+ if (this.sampleList.length > sampleCount) {
|
|
|
+ this.sampleList = this.sampleList.splice(0, sampleCount);
|
|
|
+ }
|
|
|
+
|
|
|
this.form.sampleNumber = this.sampleList.length;
|
|
|
},
|
|
|
validateWeight(measureQ, sampleCount) {
|
|
|
@@ -1324,10 +1433,21 @@
|
|
|
);
|
|
|
},
|
|
|
|
|
|
+ handleClose() {
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit('close');
|
|
|
+ },
|
|
|
+
|
|
|
validateSampleCount(sampleCount) {
|
|
|
- const invalidItem = this.selectedList.find(
|
|
|
- (item) => item.measureQuantity < sampleCount
|
|
|
- );
|
|
|
+ const chooseNumber = this.selectedList.reduce((acc, pro) => {
|
|
|
+ return pro.measureQuantity ? acc + Number(pro.measureQuantity) : acc;
|
|
|
+ }, 0);
|
|
|
+
|
|
|
+ const invalidItem = chooseNumber < sampleCount;
|
|
|
+ // console.log(this.selectedList, 'this.selectedList');
|
|
|
+ // const invalidItem = this.selectedList.find(
|
|
|
+ // (item) => item.measureQuantity < sampleCount
|
|
|
+ // );
|
|
|
if (invalidItem) {
|
|
|
this.$message.info('所选的条目计量数量小于取样计量数量');
|
|
|
return false;
|
|
|
@@ -1336,22 +1456,59 @@
|
|
|
},
|
|
|
|
|
|
async handleWeightFullSample(sampleCount) {
|
|
|
+ console.log(sampleCount);
|
|
|
+
|
|
|
+ const dataList = [];
|
|
|
+ let currentNum = sampleCount - this.selectedList.length;
|
|
|
+ let currentNum1 = sampleCount;
|
|
|
+ console.log(this.selectedList);
|
|
|
+
|
|
|
for (const item of this.selectedList) {
|
|
|
const qualitySampleTemplateList = item.qualitySampleTemplateList
|
|
|
?.length
|
|
|
? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
|
|
|
- : JSON.parse(JSON.stringify(this.schemeList));
|
|
|
- console.log(
|
|
|
- this.isStandard1OrWeightSample(),
|
|
|
- 'this.isStandard1OrWeightSample()'
|
|
|
- );
|
|
|
- this.sampleList.push({
|
|
|
- ...item,
|
|
|
- measureQuantity: sampleCount, //作为计量数量
|
|
|
- sampleCode: await this.getSampleCode(),
|
|
|
- qualitySampleTemplateList
|
|
|
+ : JSON.parse(
|
|
|
+ JSON.stringify(
|
|
|
+ this.schemeList.map((item) => {
|
|
|
+ item['qualityResults'] = 1;
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ if (sampleCount >= this.selectedList.length) {
|
|
|
+ dataList.push({
|
|
|
+ ...item,
|
|
|
+ measureQuantity: 1, //作为计量数量
|
|
|
+ sampleCode: await this.getSampleCode(),
|
|
|
+ qualitySampleTemplateList
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (dataList.length < sampleCount) {
|
|
|
+ dataList.push({
|
|
|
+ ...item,
|
|
|
+ measureQuantity: currentNum1 > 1 ? 1 : currentNum1, //作为计量数量
|
|
|
+ sampleCode: await this.getSampleCode(),
|
|
|
+ qualitySampleTemplateList
|
|
|
+ });
|
|
|
+ currentNum1 -= 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (sampleCount > this.selectedList.length) {
|
|
|
+ dataList.forEach((item) => {
|
|
|
+ if (currentNum > 0) {
|
|
|
+ let data = this.selectedList.find((val) => val.id == item.id);
|
|
|
+ item['measureQuantity'] =
|
|
|
+ data.measureQuantity - 1 - currentNum > 0
|
|
|
+ ? currentNum + 1
|
|
|
+ : data.measureQuantity;
|
|
|
+ currentNum = currentNum - (data.measureQuantity - 1);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ this.sampleList = dataList;
|
|
|
this.sampleNumber = this.sampleList.length;
|
|
|
},
|
|
|
|
|
|
@@ -1389,6 +1546,11 @@
|
|
|
qualificationRate,
|
|
|
noQualificationRate
|
|
|
);
|
|
|
+ },
|
|
|
+ closeDispose() {
|
|
|
+ this.rowData = null;
|
|
|
+ this.sampleDisposeVisble = false;
|
|
|
+ // this.rowData = null;
|
|
|
}
|
|
|
}
|
|
|
};
|