From 7459f3766c9bfd36a94e06a9508faac250b2b8e6 Mon Sep 17 00:00:00 2001 From: zxy Date: Tue, 14 Apr 2026 16:58:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(techproc):=20=E4=BF=AE=E5=A4=8D=E5=B7=A5?= =?UTF-8?q?=E5=BA=8F=E8=A1=A8=E5=8D=95=E5=88=9D=E5=A7=8B=E5=8C=96=E5=8F=8A?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/example/techproc/form.vue | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/jnpf-java-boot/jnpf-web/src/views/example/techproc/form.vue b/jnpf-java-boot/jnpf-web/src/views/example/techproc/form.vue index c59fe37..d17bddf 100644 --- a/jnpf-java-boot/jnpf-web/src/views/example/techproc/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/example/techproc/form.vue @@ -113,31 +113,37 @@ export default { this.dialogVisible = true; this.loading = true; - // 如果工序列表已加载,直接初始化;否则等待加载完成 + // 新增时直接显示页面,不需要等待工序列表 + if (!this.dataForm.id) { + this.loading = false; + return; + } + + // 编辑时:如果工序列表已加载,直接初始化;否则等待加载完成 if (this.procListLoaded) { this.doInit(); } }, // 实际初始化逻辑 doInit() { - this.$nextTick(() => { + if (this.$refs.formRef) { this.$refs.formRef.resetFields(); - if (this.dataForm.id) { - request({ - url: `/api/example/techproc/${this.dataForm.id}`, - method: 'get' - }).then(res => { - this.dataForm = res.data - // 将存储的编码拼接转换为名称拼接显示 - this.techProcDisplay = this.convertCodeToName(res.data.techProc) - // 自动选中表格中的工序 - this.setSelectedRows(res.data.procList || res.data.techProc) - this.loading = false - }) - } else { + } + if (this.dataForm.id) { + request({ + url: `/api/example/techproc/${this.dataForm.id}`, + method: 'get' + }).then(res => { + this.dataForm = res.data + // 将存储的编码拼接转换为名称拼接显示 + this.techProcDisplay = this.convertCodeToName(res.data.techProc) + // 自动选中表格中的工序 + this.setSelectedRows(res.data.procList || res.data.techProc) this.loading = false - } - }); + }) + } else { + this.loading = false + } }, // 获取工序列表(不分页) getProcList() {