update 检测信息记录

This commit is contained in:
lb
2023-09-27 10:14:24 +08:00
parent 20808c0975
commit 90695acefd
4 changed files with 63 additions and 20 deletions

View File

@@ -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(

View File

@@ -147,7 +147,7 @@ export default {
},
yAxis: {
type: 'value',
name: '单位/片',
name: '检测数量',
nameTextStyle: {
color: '#999',
fontSize: 14,