diff --git a/apps/web-antd/src/views/iot/alert/config/data.ts b/apps/web-antd/src/views/iot/alert/config/data.ts
index c45a95a74..87ae86c1b 100644
--- a/apps/web-antd/src/views/iot/alert/config/data.ts
+++ b/apps/web-antd/src/views/iot/alert/config/data.ts
@@ -9,6 +9,7 @@ import { getSimpleUserList } from '#/api/system/user';
import { getRangePickerDefaultProps } from '#/utils';
/** 新增/修改告警配置的表单 */
+// TODO @AI:两行=》1 行;
export function useFormSchema(): VbenFormSchema[] {
return [
{
@@ -28,6 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
},
rules: 'required',
},
+ // TODO @AI:vue + ep 貌似也要改成 teatarea!
{
fieldName: 'description',
label: '配置描述',
@@ -56,8 +58,11 @@ export function useFormSchema(): VbenFormSchema[] {
buttonStyle: 'solid',
optionType: 'button',
},
+ // TODO @AI:defaultValue 这种要枚举值哇?
+ defaultValue: 0,
rules: 'required',
},
+ // TODO @AI:可能 label 比较宽,需要拉长点。
{
fieldName: 'sceneRuleIds',
label: '关联场景联动规则',
@@ -69,6 +74,7 @@ export function useFormSchema(): VbenFormSchema[] {
mode: 'multiple',
placeholder: '请选择关联的场景联动规则',
},
+ defaultValue: [],
rules: 'required',
},
{
@@ -82,6 +88,7 @@ export function useFormSchema(): VbenFormSchema[] {
mode: 'multiple',
placeholder: '请选择接收的用户',
},
+ defaultValue: [],
rules: 'required',
},
{
@@ -93,6 +100,7 @@ export function useFormSchema(): VbenFormSchema[] {
mode: 'multiple',
placeholder: '请选择接收类型',
},
+ defaultValue: [],
rules: 'required',
},
];
@@ -155,7 +163,10 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
field: 'level',
title: '告警级别',
minWidth: 100,
- slots: { default: 'level' },
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.IOT_ALERT_LEVEL },
+ },
},
{
field: 'status',
@@ -170,7 +181,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
field: 'sceneRuleIds',
title: '关联场景联动规则',
minWidth: 150,
- slots: { default: 'sceneRules' },
+ formatter: ({ cellValue }) => `${cellValue?.length || 0} 条`,
},
{
field: 'receiveUserNames',
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 b83176369..6ba25d9c2 100644
--- a/apps/web-antd/src/views/iot/alert/config/index.vue
+++ b/apps/web-antd/src/views/iot/alert/config/index.vue
@@ -1,6 +1,6 @@
@@ -102,20 +102,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
]"
/>
-
-
-
-
- {{ getDictLabel(DICT_TYPE.IOT_ALERT_LEVEL, row.level) }}
-
-
-
-
-
- {{ row.sceneRuleIds?.length || 0 }} 条
-
-
-
+
+
+
-// TODO @AI:是不是要简化成 form.vue?类似 system user form 的情况?
-// TODO @AI:整体风格,看看是不是要对齐下 system user form 的风格;
-import type { AlertConfig } from '#/api/iot/alert/config';
+// TODO @AI:是不是应该拿到【config/modules】里?
+import type { AlertConfigApi } from '#/api/iot/alert/config';
import { computed, ref } from 'vue';
@@ -22,7 +21,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', ['告警配置'])
@@ -49,7 +48,7 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
// 提交表单
- const data = (await formApi.getValues()) as AlertConfig;
+ const data = (await formApi.getValues()) as AlertConfigApi.AlertConfig;
try {
await (formData.value?.id
? updateAlertConfig(data)
@@ -68,16 +67,8 @@ 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: [],
- receiveUserIds: [],
- receiveTypes: [],
- });
return;
}
modalApi.lock();
diff --git a/apps/web-antd/src/views/iot/alert/record/data.ts b/apps/web-antd/src/views/iot/alert/record/data.ts
index 2c5ef9a84..c91f1d003 100644
--- a/apps/web-antd/src/views/iot/alert/record/data.ts
+++ b/apps/web-antd/src/views/iot/alert/record/data.ts
@@ -101,7 +101,10 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
field: 'configLevel',
title: '告警级别',
minWidth: 100,
- slots: { default: 'configLevel' },
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.IOT_ALERT_LEVEL },
+ },
},
{
field: 'productId',
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 34c5d666c..f8fe80ae3 100644
--- a/apps/web-antd/src/views/iot/alert/record/index.vue
+++ b/apps/web-antd/src/views/iot/alert/record/index.vue
@@ -1,7 +1,6 @@