|
|
@@ -8,7 +8,7 @@ |
|
|
|
<template> |
|
|
|
<el-form |
|
|
|
ref="form" |
|
|
|
:model="dataForm" |
|
|
|
:model="innerDataForm" |
|
|
|
label-width="100px" |
|
|
|
v-loading="formLoading"> |
|
|
|
<el-row :gutter="20"> |
|
|
@@ -18,11 +18,11 @@ |
|
|
|
prop="inspectionDetId" |
|
|
|
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> |
|
|
|
<el-select |
|
|
|
v-model="dataForm.inspectionDetId" |
|
|
|
v-model="innerDataForm.inspectionDetId" |
|
|
|
placeholder="请选择检测内容" |
|
|
|
filterable |
|
|
|
clearable |
|
|
|
@change="$emit('update', dataForm)"> |
|
|
|
@change="handleInspectionDetChange"> |
|
|
|
<el-option |
|
|
|
v-for="opt in inspectionDetList" |
|
|
|
:key="opt.value" |
|
|
@@ -38,11 +38,11 @@ |
|
|
|
prop="source" |
|
|
|
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> |
|
|
|
<el-select |
|
|
|
v-model="dataForm.source" |
|
|
|
v-model="innerDataForm.source" |
|
|
|
placeholder="请选择来源" |
|
|
|
filterable |
|
|
|
clearable |
|
|
|
@change="$emit('update', dataForm)"> |
|
|
|
@change="$emit('update', innerDataForm)"> |
|
|
|
<el-option |
|
|
|
v-for="opt in [ |
|
|
|
{ label: '手动', value: 1 }, |
|
|
@@ -165,6 +165,7 @@ export default { |
|
|
|
productionLineList: [], |
|
|
|
sectionList: [], |
|
|
|
innerDataForm: {}, |
|
|
|
cacheInspectionDetList: null, |
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
@@ -175,15 +176,18 @@ export default { |
|
|
|
); |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
'innerDataForm.productionLineId': { |
|
|
|
handler: async function (plId) { |
|
|
|
if (plId) await this.getWorksectionList(plId); |
|
|
|
}, |
|
|
|
immediate: true, |
|
|
|
}, |
|
|
|
// 'innerDataForm.productionLineId': { |
|
|
|
// handler: async function (plId) { |
|
|
|
// if (plId) await this.getWorksectionList(plId); |
|
|
|
// }, |
|
|
|
// immediate: true, |
|
|
|
// }, |
|
|
|
dataForm: { |
|
|
|
handler: function (dataForm) { |
|
|
|
this.innerDataForm = JSON.parse(JSON.stringify(dataForm)); |
|
|
|
this.innerDataForm = Object.assign({}, dataForm); |
|
|
|
|
|
|
|
if (dataForm.productionLineId) |
|
|
|
this.getWorksectionList(dataForm.productionLineId); |
|
|
|
}, |
|
|
|
immediate: true, |
|
|
|
}, |
|
|
@@ -196,16 +200,28 @@ export default { |
|
|
|
resetFields(args) { |
|
|
|
return this.$refs.form.resetFields(args); |
|
|
|
}, |
|
|
|
|
|
|
|
handleInspectionDetChange(value) { |
|
|
|
const { id, content } = this.cacheInspectionDetList.find( |
|
|
|
(item) => item.id == value |
|
|
|
); |
|
|
|
this.innerDataForm.inspectionDetId = id; |
|
|
|
this.innerDataForm.inspectionDetContent = content; |
|
|
|
this.$emit('update', this.innerDataForm); |
|
|
|
}, |
|
|
|
|
|
|
|
async handleProductlineChange(id) { |
|
|
|
await this.getWorksectionList(id); |
|
|
|
// await this.getWorksectionList(id); |
|
|
|
this.innerDataForm.sectionId = null; |
|
|
|
this.$emit('update', this.innerDataForm); |
|
|
|
}, |
|
|
|
|
|
|
|
// getCode |
|
|
|
async getCode(url) { |
|
|
|
const response = await this.$axios(url); |
|
|
|
return response.data; |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取产线列表 |
|
|
|
async getProductLineList() { |
|
|
|
const response = await this.$axios('/base/production-line/listAll'); |
|
|
@@ -214,16 +230,19 @@ export default { |
|
|
|
value: item.id, |
|
|
|
})); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取检测内容列表 |
|
|
|
async getInspectionDetList() { |
|
|
|
const response = await this.$axios( |
|
|
|
'/base/quality-inspection-det/listAll' |
|
|
|
); |
|
|
|
this.cacheInspectionDetList = response.data; |
|
|
|
this.inspectionDetList = response.data.map((item) => ({ |
|
|
|
label: item.content, |
|
|
|
value: item.id, |
|
|
|
})); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取工段列表 |
|
|
|
async getWorksectionList(plId) { |
|
|
|
const response = await this.$axios( |
|
|
|