diff --git a/src/views/iot/devicemodel/index.vue b/src/views/iot/devicemodel/index.vue index 802f898f..68ded9fe 100644 --- a/src/views/iot/devicemodel/index.vue +++ b/src/views/iot/devicemodel/index.vue @@ -167,11 +167,19 @@ link type="primary" @click="openForm('update', scope.row.id)" - + @@ -645,7 +653,15 @@ const openCreateRuleForm = () => { createRuleDialogVisible.value = true } -const openRuleForm = (row: DeviceModelRuleVO & { pointRulesVOList?: any[] }) => { +const openRuleForm = async (row: DeviceModelRuleVO & { pointRulesVOList?: any[] }) => { + const modelId = row.modelId || attributeModelId.value + if (!modelId) { + message.error('模型信息缺失,无法加载点位规则') + return + } + + await loadRuleAttributeOptions(modelId) + ruleForm.id = row.id ruleForm.identifier = row.identifier ruleForm.fieldName = row.fieldName @@ -726,6 +742,16 @@ const handleRuleSubmit = async () => { } } +const handleRuleDelete = async (id: number) => { + if (!id) return + try { + await message.delConfirm() + await request.delete({ url: '/iot/device-model-rules/delete?id=' + id }) + message.success(t('common.delSuccess')) + await getRuleList() + } catch { } +} + const handleAddPointRule = () => { if (!isRunningIdentifier.value) return const allOptions = currentRuleOptions.value || []