diff --git a/src/views/iot/rule/scene/111index.vue b/src/views/iot/rule/scene/111index.vue
deleted file mode 100644
index 4a05a201..00000000
--- a/src/views/iot/rule/scene/111index.vue
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 搜索
- 重置
-
- 新增
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ row.triggers?.length }}个
-
-
- {{ row.actions?.length }}个
-
-
-
-
-
- 编辑
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/iot/rule/scene/RuleSceneForm.vue b/src/views/iot/rule/scene/RuleSceneForm.vue
deleted file mode 100644
index b79b6b4d..00000000
--- a/src/views/iot/rule/scene/RuleSceneForm.vue
+++ /dev/null
@@ -1,224 +0,0 @@
-
-
-
-
diff --git a/src/views/iot/rule/scene/components/RuleSceneForm.vue b/src/views/iot/rule/scene/components/RuleSceneForm.vue
index 11c82f47..73914a3a 100644
--- a/src/views/iot/rule/scene/components/RuleSceneForm.vue
+++ b/src/views/iot/rule/scene/components/RuleSceneForm.vue
@@ -19,22 +19,13 @@
class="form-container"
>
-
+
-
+
-
+
!!props.ruleScene?.id)
-const drawerTitle = computed(() => isEdit.value ? '编辑场景联动规则' : '新增场景联动规则')
+const drawerTitle = computed(() => (isEdit.value ? '编辑场景联动规则' : '新增场景联动规则'))
const canSubmit = computed(() => {
- return formData.value.name &&
- formData.value.triggers.length > 0 &&
- formData.value.actions.length > 0 &&
- triggerValidation.value.valid &&
- actionValidation.value.valid
+ return (
+ formData.value.name &&
+ formData.value.triggers.length > 0 &&
+ formData.value.actions.length > 0 &&
+ triggerValidation.value.valid &&
+ actionValidation.value.valid
+ )
})
// 事件处理
@@ -136,15 +120,15 @@ const handleActionValidate = (result: { valid: boolean; message: string }) => {
const handleValidate = async () => {
try {
await formRef.value?.validate()
-
+
if (!triggerValidation.value.valid) {
throw new Error(triggerValidation.value.message)
}
-
+
if (!actionValidation.value.valid) {
throw new Error(actionValidation.value.message)
}
-
+
validationResult.value = { valid: true, message: '验证通过' }
showSuccess('规则验证通过')
return true
@@ -164,16 +148,16 @@ const handleSubmit = async () => {
if (!isValid) {
throw new Error('表单验证失败')
}
-
+
// 转换数据格式
const apiData = transformFormToApi(formData.value)
-
+
// 这里应该调用API保存数据
console.log('提交数据:', apiData)
-
+
// 模拟API调用
- await new Promise(resolve => setTimeout(resolve, 1000))
-
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+
return apiData
},
{
@@ -184,7 +168,7 @@ const handleSubmit = async () => {
successMessage: isEdit.value ? '更新成功' : '创建成功'
}
)
-
+
if (result) {
emit('success')
handleClose()
@@ -216,11 +200,14 @@ watch(drawerVisible, (visible) => {
})
// 监听props变化
-watch(() => props.ruleScene, () => {
- if (drawerVisible.value) {
- initFormData()
+watch(
+ () => props.ruleScene,
+ () => {
+ if (drawerVisible.value) {
+ initFormData()
+ }
}
-})
+)