From a0f2a3284ebf81c683ea08a815a2abe35a8c83cb Mon Sep 17 00:00:00 2001 From: "zhonghua.li" Date: Sat, 4 Apr 2026 11:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9B=B6=E5=94=AE=E5=9C=BA?= =?UTF-8?q?=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/index.vue | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/views/device/index.vue b/src/views/device/index.vue index b65fa6a..aa8303f 100644 --- a/src/views/device/index.vue +++ b/src/views/device/index.vue @@ -131,6 +131,12 @@ /> + + + + + + { + if (!this.isEdit && (!value || String(value).trim() === '')) { + callback(new Error('请选择场景')) + } else { + callback() + } + }, + trigger: 'change' + } ] }, batchAssignRules: { @@ -534,7 +553,8 @@ export default { salesName: '', salesPhone: '', projectId: '', - bindStatus: false + bindStatus: false, + scene: '' } this.dialogVisible = true // 确保表单引用已准备好并清除验证 @@ -611,7 +631,11 @@ export default { } } const submitFunc = this.isEdit ? updateDevice : addDevice - submitFunc(this.deviceForm).then(response => { + const payload = { ...this.deviceForm } + if (this.isEdit) { + delete payload.scene + } + submitFunc(payload).then(response => { if (response.code === 20000) { this.$message.success(this.isEdit ? '更新成功' : '添加成功') this.dialogVisible = false