|
|
|
@ -222,11 +222,19 @@ link :type="isRowConnected(scope.row) ? 'warning' : 'success'"
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
width="180px"
|
|
|
|
width="180px"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<el-table-column label="操作" align="center" width="120px">
|
|
|
|
<el-table-column label="操作" align="center" width="160px">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-button link type="primary" @click="openRuleForm(scope.row)">
|
|
|
|
<el-button link type="primary" @click="openRuleForm(scope.row)">
|
|
|
|
编辑
|
|
|
|
编辑
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
v-if="(scope.row.identifier || '').toString().toUpperCase() === 'ALARM'"
|
|
|
|
|
|
|
|
link
|
|
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
|
|
@click="handleRuleDelete(scope.row.id)"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
删除
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</el-table>
|
|
|
|
@ -250,7 +258,7 @@ link :type="isRowConnected(scope.row) ? 'warning' : 'success'"
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-col w-full">
|
|
|
|
<div class="flex flex-col w-full">
|
|
|
|
<div class="border border-gray-200 dark:border-gray-600 rounded-md px-16px py-12px">
|
|
|
|
<div class="border border-gray-200 dark:border-gray-600 rounded-md py-12px">
|
|
|
|
<el-form-item label="点位规则">
|
|
|
|
<el-form-item label="点位规则">
|
|
|
|
<el-select
|
|
|
|
<el-select
|
|
|
|
v-model="ruleForm.fieldRule"
|
|
|
|
v-model="ruleForm.fieldRule"
|
|
|
|
@ -619,8 +627,8 @@ const resetRuleQuery = () => {
|
|
|
|
|
|
|
|
|
|
|
|
const loadRuleAttributeOptions = async (deviceId: number) => {
|
|
|
|
const loadRuleAttributeOptions = async (deviceId: number) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const res = await DeviceApi.getDeviceAttributePage({ pageNo: 1, pageSize: 1000, deviceId })
|
|
|
|
const res = await request.get({ url: '/iot/device-contact-model/list', params: { id: deviceId } })
|
|
|
|
const data = Array.isArray((res as any)?.list) ? (res as any).list : (Array.isArray(res) ? res : [])
|
|
|
|
const data = Array.isArray(res) ? res : (res as any)?.list ?? []
|
|
|
|
ruleAttributeOptions.value = data as any[]
|
|
|
|
ruleAttributeOptions.value = data as any[]
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
ruleAttributeOptions.value = []
|
|
|
|
ruleAttributeOptions.value = []
|
|
|
|
@ -638,7 +646,7 @@ watch(
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ruleQueryParams.pageNo = 1
|
|
|
|
ruleQueryParams.pageNo = 1
|
|
|
|
await Promise.all([getRuleList(), loadRuleAttributeOptions(val)])
|
|
|
|
await getRuleList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@ -704,7 +712,15 @@ const isRunningIdentifier = computed(() => {
|
|
|
|
return (ruleForm.identifier || '').toString().toUpperCase() === 'RUNNING'
|
|
|
|
return (ruleForm.identifier || '').toString().toUpperCase() === 'RUNNING'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const openRuleForm = (row: DevicePointRuleVO & { pointRulesVOList?: any[] }) => {
|
|
|
|
const openRuleForm = async (row: DevicePointRuleVO & { pointRulesVOList?: any[] }) => {
|
|
|
|
|
|
|
|
const deviceId = row.deviceId || attributeDeviceId.value
|
|
|
|
|
|
|
|
if (!deviceId) {
|
|
|
|
|
|
|
|
message.error('设备信息缺失,无法加载点位规则')
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await loadRuleAttributeOptions(deviceId)
|
|
|
|
|
|
|
|
|
|
|
|
ruleForm.id = row.id
|
|
|
|
ruleForm.id = row.id
|
|
|
|
ruleForm.identifier = row.identifier
|
|
|
|
ruleForm.identifier = row.identifier
|
|
|
|
ruleForm.fieldName = row.fieldName
|
|
|
|
ruleForm.fieldName = row.fieldName
|
|
|
|
@ -785,6 +801,16 @@ const handleRuleSubmit = async () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleRuleDelete = async (id: number) => {
|
|
|
|
|
|
|
|
if (!id) return
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
await message.delConfirm()
|
|
|
|
|
|
|
|
await request.delete({ url: '/iot/device-point-rules/delete?id=' + id })
|
|
|
|
|
|
|
|
message.success(t('common.delSuccess'))
|
|
|
|
|
|
|
|
await getRuleList()
|
|
|
|
|
|
|
|
} catch { }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleAddPointRule = () => {
|
|
|
|
const handleAddPointRule = () => {
|
|
|
|
if (!isRunningIdentifier.value) return
|
|
|
|
if (!isRunningIdentifier.value) return
|
|
|
|
const allOptions = currentRuleOptions.value || []
|
|
|
|
const allOptions = currentRuleOptions.value || []
|
|
|
|
|