fix(techproc): 修复工序表单初始化及选择逻辑
This commit is contained in:
parent
d381961a9a
commit
7459f3766c
@ -113,31 +113,37 @@ export default {
|
|||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
// 如果工序列表已加载,直接初始化;否则等待加载完成
|
// 新增时直接显示页面,不需要等待工序列表
|
||||||
|
if (!this.dataForm.id) {
|
||||||
|
this.loading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑时:如果工序列表已加载,直接初始化;否则等待加载完成
|
||||||
if (this.procListLoaded) {
|
if (this.procListLoaded) {
|
||||||
this.doInit();
|
this.doInit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 实际初始化逻辑
|
// 实际初始化逻辑
|
||||||
doInit() {
|
doInit() {
|
||||||
this.$nextTick(() => {
|
if (this.$refs.formRef) {
|
||||||
this.$refs.formRef.resetFields();
|
this.$refs.formRef.resetFields();
|
||||||
if (this.dataForm.id) {
|
}
|
||||||
request({
|
if (this.dataForm.id) {
|
||||||
url: `/api/example/techproc/${this.dataForm.id}`,
|
request({
|
||||||
method: 'get'
|
url: `/api/example/techproc/${this.dataForm.id}`,
|
||||||
}).then(res => {
|
method: 'get'
|
||||||
this.dataForm = res.data
|
}).then(res => {
|
||||||
// 将存储的编码拼接转换为名称拼接显示
|
this.dataForm = res.data
|
||||||
this.techProcDisplay = this.convertCodeToName(res.data.techProc)
|
// 将存储的编码拼接转换为名称拼接显示
|
||||||
// 自动选中表格中的工序
|
this.techProcDisplay = this.convertCodeToName(res.data.techProc)
|
||||||
this.setSelectedRows(res.data.procList || res.data.techProc)
|
// 自动选中表格中的工序
|
||||||
this.loading = false
|
this.setSelectedRows(res.data.procList || res.data.techProc)
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
})
|
||||||
});
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 获取工序列表(不分页)
|
// 获取工序列表(不分页)
|
||||||
getProcList() {
|
getProcList() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user