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-11-07 19:10:45 +08:00
|
|
|
<el-form ref="form" :model="dataForm" label-width="120px" v-loading="formLoading">
|
|
|
|
<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-09-18 17:01:44 +08:00
|
|
|
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="按钮盒识别码" prop="buttonId" :rules="[
|
2023-09-22 10:54:21 +08:00
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
2023-09-18 17:01:44 +08:00
|
|
|
{
|
|
|
|
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-09-18 17:01:44 +08:00
|
|
|
<el-form-item
|
|
|
|
label="报警编码"
|
|
|
|
prop="code"
|
|
|
|
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
|
|
|
<el-select
|
|
|
|
v-model="dataForm.code"
|
|
|
|
placeholder="请选择产线"
|
|
|
|
@change="handleProductlineChange">
|
|
|
|
<el-option
|
|
|
|
v-for="opt in productionLineList"
|
|
|
|
:key="opt.value"
|
|
|
|
:label="opt.label"
|
|
|
|
:value="opt.value" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item> -->
|
2023-11-07 19:10:45 +08:00
|
|
|
</el-col>
|
2023-09-18 17:01:44 +08:00
|
|
|
|
2023-11-07 19:10:45 +08:00
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="按钮盒模式" prop="model">
|
|
|
|
<el-input v-model="dataForm.model" @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">
|
|
|
|
<el-form-item label="按钮值" prop="keyValue" :rules="[
|
2023-09-22 10:54:21 +08:00
|
|
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
2023-09-18 17:01:44 +08:00
|
|
|
{
|
|
|
|
type: 'number',
|
|
|
|
message: '请输入100以内的整数',
|
|
|
|
trigger: 'blur',
|
|
|
|
transform: (val) =>
|
2023-09-22 10:54:21 +08:00
|
|
|
Number.isInteger(+val) &&
|
|
|
|
Number(val) >= 0 &&
|
|
|
|
Number(val) <= 100 &&
|
|
|
|
Number(val),
|
2023-09-18 17:01:44 +08:00
|
|
|
},
|
|
|
|
]">
|
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">
|
|
|
|
<el-form-item label="检测内容" prop="inspectionDetContent">
|
|
|
|
<el-input type="textarea" v-model="dataForm.inspectionDetContent" placeholder="请输入检测内容"
|
|
|
|
@change="$emit('update', dataForm)"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
2023-09-18 17:01:44 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'DialogForm',
|
|
|
|
model: {
|
|
|
|
prop: 'dataForm',
|
|
|
|
event: 'update',
|
|
|
|
},
|
|
|
|
emits: ['update'],
|
|
|
|
components: {},
|
|
|
|
props: {
|
|
|
|
dataForm: {
|
|
|
|
type: Object,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
formLoading: true,
|
|
|
|
productionLineList: [],
|
|
|
|
workshopSectionList: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.getProductionLineList();
|
|
|
|
// 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-09-22 10:54:21 +08:00
|
|
|
if (id != null) this.getWorksectionList(id);
|
2023-09-18 17:01:44 +08:00
|
|
|
},
|
2023-09-22 10:54:21 +08:00
|
|
|
immediate: true,
|
|
|
|
},
|
2023-09-18 17:01:44 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
/** 模拟透传 ref */
|
|
|
|
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;
|
|
|
|
},
|
|
|
|
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
|
|
|
|
async getCode(url) {
|
|
|
|
const response = await this.$axios(url);
|
|
|
|
return response.data;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.el-date-editor,
|
|
|
|
.el-select {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
</style>
|