lb #22

Merged
g7hoo merged 5 commits from lb into test 2023-09-12 11:14:00 +08:00
2 changed files with 28 additions and 32 deletions
Showing only changes of commit 529889fd07 - Show all commits

View File

@ -6,7 +6,11 @@
--> -->
<template> <template>
<el-form ref="form" :model="form" label-width="100px" v-loading="formLoading"> <el-form
ref="form"
:model="dataForm"
label-width="100px"
v-loading="formLoading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
@ -14,7 +18,7 @@
prop="productionLineId" prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="form.productionLineId" v-model="dataForm.productionLineId"
placeholder="请选择产线" placeholder="请选择产线"
@change="handleProductlineChange"> @change="handleProductlineChange">
<el-option <el-option
@ -32,9 +36,9 @@
prop="workshopSectionId" prop="workshopSectionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="form.workshopSectionId" v-model="dataForm.workshopSectionId"
placeholder="请选择工段" placeholder="请选择工段"
@change="$emit('update', form)"> @change="$emit('update', dataForm)">
<el-option <el-option
v-for="opt in worksectionList" v-for="opt in worksectionList"
:key="opt.value" :key="opt.value"
@ -51,9 +55,9 @@
prop="equipmentId" prop="equipmentId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select <el-select
v-model="form.equipmentId" v-model="dataForm.equipmentId"
placeholder="请选择设备" placeholder="请选择设备"
@change="$emit('update', form)"> @change="$emit('update', dataForm)">
<el-option <el-option
v-for="opt in equipmentList" v-for="opt in equipmentList"
:key="opt.value" :key="opt.value"
@ -66,8 +70,8 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工段排序" prop="sort"> <el-form-item label="工段排序" prop="sort">
<el-input <el-input
v-model="form.sort" v-model="dataForm.sort"
@change="$emit('update', form)" @change="$emit('update', dataForm)"
placeholder="请输入工段排序" /> placeholder="请输入工段排序" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -76,9 +80,9 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="产线数据类型" prop="lineDataType"> <el-form-item label="产线数据类型" prop="lineDataType">
<el-select <el-select
v-model="form.lineDataType" v-model="dataForm.lineDataType"
placeholder="请选择产线数据类型" placeholder="请选择产线数据类型"
@change="$emit('update', form)"> @change="$emit('update', dataForm)">
<el-option <el-option
v-for="opt in [ v-for="opt in [
{ label: '无类型', value: 0 }, { label: '无类型', value: 0 },
@ -94,9 +98,9 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="工段数据类型" prop="sectionDataType"> <el-form-item label="工段数据类型" prop="sectionDataType">
<el-select <el-select
v-model="form.sectionDataType" v-model="dataForm.sectionDataType"
placeholder="请选择工段数据类型" placeholder="请选择工段数据类型"
@change="$emit('update', form)"> @change="$emit('update', dataForm)">
<el-option <el-option
v-for="opt in [ v-for="opt in [
{ label: '无类型', value: 0 }, { label: '无类型', value: 0 },
@ -134,25 +138,9 @@ export default {
productionLineList: [], productionLineList: [],
equipmentList: [], equipmentList: [],
worksectionList: [], worksectionList: [],
dataFormCache: null,
}; };
}, },
computed: {
form: {
get() {
return {
productionLineId: this.dataForm.productionLineId,
workshopSectionId: this.dataForm.workshopSectionId,
equipmentId: this.dataForm.equipmentId,
sort: this.dataForm.sort,
lineDataType: this.dataForm.lineDataType,
sectionDataType: this.dataForm.sectionDataType,
};
},
set(val) {
console.log('set form', val);
},
},
},
mounted() { mounted() {
Promise.all([this.getProductLineList(), this.getEquipmentList()]).then( Promise.all([this.getProductLineList(), this.getEquipmentList()]).then(
() => { () => {
@ -160,6 +148,14 @@ export default {
} }
); );
}, },
watch: {
'dataForm.productionLineId': {
handler: async function (plId) {
if (plId) await this.getWorksectionList(plId);
},
immediate: true,
},
},
methods: { methods: {
/** 模拟透传 ref */ /** 模拟透传 ref */
validate(cb) { validate(cb) {
@ -169,9 +165,9 @@ export default {
return this.$refs.form.resetFields(args); return this.$refs.form.resetFields(args);
}, },
async handleProductlineChange(id) { async handleProductlineChange(id) {
console.log('产线变化了!!!', id, this.form);
await this.getWorksectionList(id); await this.getWorksectionList(id);
this.$emit('update', { ...this.form, workshopSectionId: null }); this.dataForm.workshopSectionId = null;
this.$emit('update', this.dataForm);
}, },
// getCode // getCode
async getCode(url) { async getCode(url) {

View File

@ -37,7 +37,7 @@
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" /> <DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>