perf:【IoT 物联网】场景联动告警执行器无需额外配置
parent
8343faa027
commit
d0c8efdff8
|
|
@ -49,13 +49,13 @@
|
||||||
@update:model-value="(val) => (actionConfig.deviceControl = val)"
|
@update:model-value="(val) => (actionConfig.deviceControl = val)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 告警执行器 -->
|
<!-- 告警执行器 - 无需额外配置 -->
|
||||||
<AlertAction
|
<div v-else-if="isAlertAction" class="bg-[#dbe5f6] flex items-center justify-center p-10px">
|
||||||
v-else-if="isAlertAction"
|
<el-icon class="mr-5px text-blue-500"><Icon icon="ep:info-filled" /></el-icon>
|
||||||
:action-type="actionConfig.type"
|
<span class="text-gray-600">
|
||||||
:model-value="actionConfig.alert"
|
{{ getAlertActionDescription(actionConfig.type) }}
|
||||||
@update:model-value="(val) => (actionConfig.alert = val)"
|
</span>
|
||||||
/>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 产品、设备的选择 -->
|
<!-- 产品、设备的选择 -->
|
||||||
|
|
@ -76,11 +76,9 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
import ProductTableSelect from '@/views/iot/product/product/components/ProductTableSelect.vue'
|
import ProductTableSelect from '@/views/iot/product/product/components/ProductTableSelect.vue'
|
||||||
import DeviceTableSelect from '@/views/iot/device/device/components/DeviceTableSelect.vue'
|
import DeviceTableSelect from '@/views/iot/device/device/components/DeviceTableSelect.vue'
|
||||||
import DeviceControlAction from './DeviceControlAction.vue'
|
import DeviceControlAction from './DeviceControlAction.vue'
|
||||||
import AlertAction from './AlertAction.vue'
|
|
||||||
import { ProductApi, ProductVO } from '@/api/iot/product/product'
|
import { ProductApi, ProductVO } from '@/api/iot/product/product'
|
||||||
import { DeviceApi, DeviceVO } from '@/api/iot/device/device'
|
import { DeviceApi, DeviceVO } from '@/api/iot/device/device'
|
||||||
import {
|
import {
|
||||||
ActionAlert,
|
|
||||||
ActionConfig,
|
ActionConfig,
|
||||||
ActionDeviceControl,
|
ActionDeviceControl,
|
||||||
IotDeviceMessageIdentifierEnum,
|
IotDeviceMessageIdentifierEnum,
|
||||||
|
|
@ -113,6 +111,18 @@ const isAlertAction = computed(() => {
|
||||||
].includes(actionConfig.value.type as any)
|
].includes(actionConfig.value.type as any)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 获取告警执行器描述文本 */
|
||||||
|
const getAlertActionDescription = (actionType: number) => {
|
||||||
|
switch (actionType) {
|
||||||
|
case IotRuleSceneActionTypeEnum.ALERT_TRIGGER:
|
||||||
|
return '触发告警通知,系统将自动发送告警信息'
|
||||||
|
case IotRuleSceneActionTypeEnum.ALERT_RECOVER:
|
||||||
|
return '恢复告警状态,系统将自动发送恢复通知'
|
||||||
|
default:
|
||||||
|
return '告警相关操作,无需额外配置'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 初始化执行器结构 */
|
/** 初始化执行器结构 */
|
||||||
const initActionConfig = () => {
|
const initActionConfig = () => {
|
||||||
if (!actionConfig.value) {
|
if (!actionConfig.value) {
|
||||||
|
|
@ -136,9 +146,9 @@ const initActionConfig = () => {
|
||||||
} as ActionDeviceControl
|
} as ActionDeviceControl
|
||||||
}
|
}
|
||||||
|
|
||||||
// 告警执行器初始化
|
// 告警执行器初始化 - 无需额外配置,清空 alert 配置
|
||||||
if (isAlertAction.value && !actionConfig.value.alert) {
|
if (isAlertAction.value) {
|
||||||
actionConfig.value.alert = {} as ActionAlert
|
actionConfig.value.alert = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue