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