diff --git a/apps/web-antd/src/views/iot/alert/config/index.vue b/apps/web-antd/src/views/iot/alert/config/index.vue index 0f23562bc..b83176369 100644 --- a/apps/web-antd/src/views/iot/alert/config/index.vue +++ b/apps/web-antd/src/views/iot/alert/config/index.vue @@ -1,8 +1,10 @@ @@ -130,24 +96,25 @@ const [Grid, gridApi] = useVbenVxeGrid({ label: $t('ui.actionTitle.create', ['告警配置']), type: 'primary', icon: ACTION_ICON.ADD, + auth: ['iot:alert-config:create'], onClick: handleCreate, }, ]" /> - + - - {{ getLevelText(row.level) }} + + {{ getDictLabel(DICT_TYPE.IOT_ALERT_LEVEL, row.level) }} - + {{ row.sceneRuleIds?.length || 0 }} 条 - + - {{ getReceiveTypeText(type) }} + {{ getDictLabel(DICT_TYPE.IOT_ALERT_RECEIVE_TYPE, type) }} - -import type { AlertConfigApi } from '#/api/iot/alert/config'; +// TODO @AI:是不是要简化成 form.vue?类似 system user form 的情况? +// TODO @AI:整体风格,看看是不是要对齐下 system user form 的风格; +import type { AlertConfig } from '#/api/iot/alert/config'; import { computed, ref } from 'vue'; @@ -20,7 +22,7 @@ import { useFormSchema } from '../config/data'; defineOptions({ name: 'IoTAlertConfigForm' }); const emit = defineEmits(['success']); -const formData = ref(); +const formData = ref(); const getTitle = computed(() => { return formData.value?.id ? $t('ui.actionTitle.edit', ['告警配置']) @@ -47,7 +49,7 @@ const [Modal, modalApi] = useVbenModal({ } modalApi.lock(); // 提交表单 - const data = (await formApi.getValues()) as AlertConfigApi.AlertConfig; + const data = (await formApi.getValues()) as AlertConfig; try { await (formData.value?.id ? updateAlertConfig(data) @@ -66,9 +68,10 @@ const [Modal, modalApi] = useVbenModal({ return; } // 加载数据 - const data = modalApi.getData(); + const data = modalApi.getData(); if (!data || !data.id) { // 新增时设置默认值 + // TODO @AI:这里是不是不用默认值?status 在 data.ts 里默认就好了? await formApi.setValues({ status: 0, sceneRuleIds: [], diff --git a/apps/web-antd/src/views/iot/alert/record/index.vue b/apps/web-antd/src/views/iot/alert/record/index.vue index 64ba6cfac..34c5d666c 100644 --- a/apps/web-antd/src/views/iot/alert/record/index.vue +++ b/apps/web-antd/src/views/iot/alert/record/index.vue @@ -1,110 +1,57 @@ + - - {{ getLevelText(row.configLevel) }} + + {{ getDictLabel(DICT_TYPE.IOT_ALERT_LEVEL, row.configLevel) }} - - - - {{ getProductName(row.productId) }} - - - - - {{ getDeviceName(row.deviceId) }} - - + { :overlay-style="{ maxWidth: '600px' }" > - {{ row.deviceMessage }} + {{ stringifyDeviceMessage(row.deviceMessage) }} @@ -224,7 +175,6 @@ onMounted(() => { - - { label: '处理', type: 'link', icon: ACTION_ICON.EDIT, + auth: ['iot:alert-record:process'], onClick: handleProcess.bind(null, row), ifShow: !row.processStatus, }, @@ -240,6 +191,7 @@ onMounted(() => { label: '查看', type: 'link', icon: ACTION_ICON.VIEW, + auth: ['iot:alert-record:query'], onClick: handleView.bind(null, row), ifShow: row.processStatus, },
{{ row.deviceMessage }}
{{ stringifyDeviceMessage(row.deviceMessage) }}