style:采集设备模型-ALARM标识符数据添加删除按钮

main
黄伟杰 2 weeks ago
parent f4f448c48e
commit 6c08ed1e18

@ -167,11 +167,19 @@ link type="primary" @click="openForm('update', scope.row.id)"
<el-table-column label="规则" align="center" prop="fieldRule" />
<el-table-column label="默认值" align="center" prop="defaultValue" />
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
<el-table-column label="操作" align="center" width="120px">
<el-table-column label="操作" align="center" width="160px">
<template #default="scope">
<el-button link type="primary" @click="openRuleForm(scope.row)">
编辑
</el-button>
<el-button
v-if="(scope.row.identifier || '').toString().toUpperCase() === 'ALARM'"
link
type="danger"
@click="handleRuleDelete(scope.row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -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 || []

Loading…
Cancel
Save