2023-11-07 19:10:45 +08:00
|
|
|
<!--
|
2023-09-18 17:01:44 +08:00
|
|
|
filename: dialogForm.vue
|
|
|
|
author: liubin
|
|
|
|
date: 2023-09-11 15:55:13
|
|
|
|
description: DialogForm for equipmentBindSection only
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
2023-12-13 16:50:55 +08:00
|
|
|
<el-form ref="dataForm" :model="dataForm" label-width="120px" v-loading="formLoading" label-position="top">
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="产线" prop="productionLineId"
|
|
|
|
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
|
|
|
<el-select v-model="dataForm.productionLineId" placeholder="请选择产线" filterable
|
|
|
|
@change="handleProductlineChange">
|
|
|
|
<el-option v-for="opt in productionLineList" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="工段" prop="sectionId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
|
|
|
<el-select v-model="dataForm.sectionId" placeholder="请选择工段" filterable @change="$emit('update', dataForm)">
|
|
|
|
<el-option v-for="opt in workshopSectionList" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-12-13 16:50:55 +08:00
|
|
|
<el-col :span="24">
|
|
|
|
<el-form-item label="检测内容" prop="inspectionDetIdList"
|
|
|
|
:rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
|
|
|
|
<div class="itemDet" v-for="item in inspectionDetList" :key="item.typeId" style="padding: 0 20px;">
|
|
|
|
<div>{{ item.typeName}} </div>
|
|
|
|
<!-- <div>{{ item.data }} </div> -->
|
|
|
|
<div class="content">
|
|
|
|
<el-checkbox-group v-model="dataForm.inspectionDetIdList" @change="handleCheckedCitiesChange">
|
|
|
|
<el-checkbox v-for="i in item.data" :key="i.content" :label="i.detId">{{ i.content }}
|
|
|
|
</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<!-- <el-col :span="12">
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-form-item label="按钮盒识别码" prop="buttonId" :rules="[
|
2023-11-22 14:00:02 +08:00
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
|
|
|
{
|
|
|
|
type: 'number',
|
|
|
|
message: '请输入整数',
|
|
|
|
trigger: 'blur',
|
|
|
|
transform: (val) => Number.isInteger(Number(val)) && Number(val),
|
|
|
|
},
|
|
|
|
]">
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-input v-model="dataForm.buttonId" @change="$emit('update', dataForm)" placeholder="请输入整数" />
|
|
|
|
</el-form-item>
|
2023-12-04 14:14:34 +08:00
|
|
|
</el-col>
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="按钮值" prop="keyValue" :rules="[
|
2023-11-22 14:00:02 +08:00
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
|
|
|
{
|
|
|
|
type: 'number',
|
|
|
|
message: '请输入100以内的整数',
|
|
|
|
trigger: 'blur',
|
|
|
|
transform: (val) =>
|
|
|
|
Number.isInteger(+val) &&
|
|
|
|
Number(val) >= 0 &&
|
|
|
|
Number(val) <= 100 &&
|
|
|
|
Number(val),
|
|
|
|
},
|
|
|
|
]">
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-input v-model="dataForm.keyValue" type="number" min="0" max="100" @change="$emit('update', dataForm)"
|
|
|
|
placeholder="请输入按钮盒模式" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2023-09-18 17:01:44 +08:00
|
|
|
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-col :span="12">
|
2023-12-04 14:14:34 +08:00
|
|
|
<el-form-item label="检测内容" prop="inspectionDetContent"
|
|
|
|
:rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
|
|
|
|
<el-select v-model="dataForm.inspectionDetContent" placeholder="请选择检测内容" filterable
|
2023-11-22 14:00:02 +08:00
|
|
|
@change="$emit('update', dataForm)">
|
|
|
|
<el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
|
|
</el-select>
|
2023-11-07 19:10:45 +08:00
|
|
|
</el-form-item>
|
2023-12-13 16:50:55 +08:00
|
|
|
</el-col> -->
|
2023-11-07 19:10:45 +08:00
|
|
|
</el-row>
|
|
|
|
</el-form>
|
2023-09-18 17:01:44 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-12-13 16:50:55 +08:00
|
|
|
import basicAdd from '../../mixins/basic-add';
|
|
|
|
import {
|
|
|
|
createQualityInspectionBoxBtn,
|
|
|
|
updateQualityInspectionBoxBtn,
|
|
|
|
getQualityInspectionBoxBtn,
|
|
|
|
getListByLineSection
|
|
|
|
} from '@/api/base/qualityInspectionBoxBtn';
|
2023-09-18 17:01:44 +08:00
|
|
|
export default {
|
2023-12-13 16:50:55 +08:00
|
|
|
mixins: [basicAdd],
|
2023-09-18 17:01:44 +08:00
|
|
|
data() {
|
2023-12-13 16:50:55 +08:00
|
|
|
return {
|
|
|
|
urlOptions: {
|
|
|
|
// isGetCode: false,
|
|
|
|
// codeURL: getCode,
|
|
|
|
createURL: createQualityInspectionBoxBtn,
|
|
|
|
updateURL: updateQualityInspectionBoxBtn,
|
|
|
|
infoURL: getQualityInspectionBoxBtn,
|
|
|
|
},
|
|
|
|
dataForm: {
|
|
|
|
// id: null,
|
|
|
|
sectionId: null,
|
|
|
|
productionLineId: null,
|
|
|
|
inspectionDetIdList:[],
|
|
|
|
},
|
2023-09-18 17:01:44 +08:00
|
|
|
formLoading: true,
|
2023-11-22 14:00:02 +08:00
|
|
|
productionLineList: [],
|
|
|
|
inspectionDetList:[],
|
2023-09-18 17:01:44 +08:00
|
|
|
workshopSectionList: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2023-11-22 14:00:02 +08:00
|
|
|
this.getProductionLineList()
|
|
|
|
this.getQualityInspectionDetList()
|
2023-12-13 16:50:55 +08:00
|
|
|
// this.getList()
|
2023-09-18 17:01:44 +08:00
|
|
|
// this.getWorksectionList();
|
|
|
|
// this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
|
|
|
|
// this.formLoading = false;
|
|
|
|
// this.$emit('update', {
|
|
|
|
// ...this.dataForm,
|
|
|
|
// code,
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'dataForm.productionId': {
|
|
|
|
handler(id) {
|
2023-12-13 16:50:55 +08:00
|
|
|
if (id != null) this.getWorksectionList(id)
|
2023-09-18 17:01:44 +08:00
|
|
|
},
|
2023-12-13 16:50:55 +08:00
|
|
|
immediate: true
|
2023-09-22 10:54:21 +08:00
|
|
|
},
|
2023-09-18 17:01:44 +08:00
|
|
|
},
|
2023-12-13 16:50:55 +08:00
|
|
|
methods: {
|
|
|
|
init(obj) {
|
|
|
|
// console.log(productionLineId);
|
|
|
|
console.log(obj);
|
2024-01-23 16:22:25 +08:00
|
|
|
this.visible = true
|
2023-12-13 16:50:55 +08:00
|
|
|
// if(obj.id)
|
2023-12-15 16:27:30 +08:00
|
|
|
if (obj) {
|
2024-01-23 16:22:25 +08:00
|
|
|
this.dataForm.id = obj.id || null;
|
2023-12-15 16:27:30 +08:00
|
|
|
}
|
2023-12-13 16:50:55 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs["dataForm"].resetFields()
|
|
|
|
if (obj) {
|
|
|
|
getListByLineSection({
|
|
|
|
productionLineId: obj.productionLineId,
|
|
|
|
sectionId: obj.sectionId,
|
|
|
|
}).then((res) => {
|
|
|
|
console.log(res);
|
|
|
|
this.dataForm.inspectionDetIdList = res.data
|
2024-01-23 16:22:25 +08:00
|
|
|
this.dataForm.productionLineId = obj.productionLineId
|
|
|
|
this.getWorksectionList(obj.productionLineId)
|
|
|
|
this.dataForm.sectionId = obj.sectionId
|
2023-12-13 16:50:55 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
if (this.dataForm.id) {
|
2024-01-23 16:22:25 +08:00
|
|
|
console.log(1111);
|
2023-12-13 16:50:55 +08:00
|
|
|
this.urlOptions.infoURL(obj.id).then(response => {
|
|
|
|
this.dataForm.id = response.data.id
|
2024-01-23 16:22:25 +08:00
|
|
|
|
2023-12-13 16:50:55 +08:00
|
|
|
// if (this.setData) {
|
|
|
|
// this.setDataForm()
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// if (this.urlOptions.isGetCode) {
|
|
|
|
// this.getCode()
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
/** 模拟透传 ref */
|
|
|
|
handleCheckedCitiesChange(value) {
|
|
|
|
;console.log(value);
|
|
|
|
// let checkedCount = value.length;
|
|
|
|
// this.checkAll = checkedCount === this.cities.length;
|
|
|
|
// this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
|
|
|
|
},
|
|
|
|
// getList() {
|
|
|
|
// console.log(this.dataForm.sectionId);
|
|
|
|
|
|
|
|
// },
|
2023-09-18 17:01:44 +08:00
|
|
|
validate(cb) {
|
|
|
|
return this.$refs.form.validate(cb);
|
|
|
|
},
|
|
|
|
resetFields(args) {
|
|
|
|
return this.$refs.form.resetFields(args);
|
|
|
|
},
|
|
|
|
async getProductionLineList() {
|
|
|
|
this.formLoading = true;
|
|
|
|
const res = await this.$axios({
|
2023-11-07 19:10:45 +08:00
|
|
|
url: '/base/core-production-line/listAll',
|
2023-09-18 17:01:44 +08:00
|
|
|
method: 'get',
|
|
|
|
});
|
|
|
|
if (res.code == 0) {
|
|
|
|
this.productionLineList = res.data.map((item) => ({
|
|
|
|
label: item.name,
|
|
|
|
value: item.id,
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
this.formLoading = false;
|
|
|
|
},
|
2023-11-22 14:00:02 +08:00
|
|
|
async getQualityInspectionDetList() {
|
|
|
|
this.formLoading = true;
|
|
|
|
const res = await this.$axios({
|
2023-12-13 16:50:55 +08:00
|
|
|
url: '/base/quality-inspection-det/inspectionMap',
|
2023-11-22 14:00:02 +08:00
|
|
|
method: 'get',
|
|
|
|
});
|
|
|
|
if (res.code == 0) {
|
2023-12-13 16:50:55 +08:00
|
|
|
console.log(res)
|
|
|
|
let arr = []
|
|
|
|
for (let i in res.data) {
|
|
|
|
let obj = {
|
|
|
|
typeName: res.data[i].length !== 0 ? res.data[i][0].typeName : '',
|
|
|
|
typeId: res.data[i].length !== 0 ? res.data[i][0].typeId : '',
|
|
|
|
data:[]
|
|
|
|
}
|
|
|
|
let detArr = []
|
|
|
|
res.data[i].forEach(ele => {
|
|
|
|
detArr.push({
|
|
|
|
detId: ele.id,
|
|
|
|
content: ele.content
|
|
|
|
})
|
|
|
|
})
|
|
|
|
obj.data = detArr
|
|
|
|
arr.push(obj)
|
|
|
|
}
|
|
|
|
this.inspectionDetList = arr
|
|
|
|
console.log(this.inspectionDetList);
|
|
|
|
// this.inspectionDetList = res.data.map((item) => ({
|
|
|
|
// label: item.content,
|
|
|
|
// value: item.content,
|
|
|
|
// }));
|
2023-11-22 14:00:02 +08:00
|
|
|
}
|
|
|
|
this.formLoading = false;
|
|
|
|
},
|
2023-09-18 17:01:44 +08:00
|
|
|
async getWorksectionList(id) {
|
|
|
|
this.formLoading = true;
|
|
|
|
const res = await this.$axios({
|
2023-11-07 19:10:45 +08:00
|
|
|
url: '/base/core-workshop-section/listByParentId',
|
2023-09-18 17:01:44 +08:00
|
|
|
method: 'get',
|
|
|
|
params: {
|
|
|
|
id,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
if (res.code == 0) {
|
|
|
|
this.workshopSectionList = res.data.map((item) => ({
|
|
|
|
label: item.name,
|
|
|
|
value: item.id,
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
this.formLoading = false;
|
|
|
|
},
|
|
|
|
|
|
|
|
async handleProductlineChange(id) {
|
|
|
|
await this.getWorksectionList(id);
|
|
|
|
this.dataForm.sectionId = null;
|
|
|
|
this.$emit('update', this.dataForm);
|
|
|
|
},
|
|
|
|
|
2024-01-23 16:22:25 +08:00
|
|
|
// async getCode(url) {
|
|
|
|
// const response = await this.$axios(url);
|
|
|
|
// return response.data;
|
|
|
|
// },
|
2023-09-18 17:01:44 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.el-date-editor,
|
|
|
|
.el-select {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|