Files
SaaS-lib/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts

158 lines
3.8 KiB
TypeScript
Raw Normal View History

2024-07-19 16:22:15 +08:00
import { notificationManagementApi } from '/@/api/alarmManagement/alarmSettings/notificationManagements';
2024-07-25 11:55:32 +08:00
import { ref } from 'vue';
2024-07-25 15:39:32 +08:00
import { getEnum } from '/@/api';
2024-07-25 11:55:32 +08:00
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
title: '序号',
dataIndex: 'address',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '优先级',
dataIndex: 'prioritys',
},
{
title: '告警类型',
dataIndex: 'alarmTypeName',
},
{
title: '告警标题',
dataIndex: 'alarmTitle',
},
{
title: '错误码',
dataIndex: 'errorCode',
},
{
title: '通知名单',
dataIndex: 'notificationList',
width: 150,
textEllipsis: true,
},
{
title: '通知方式',
dataIndex: 'notificationMethod',
},
{
title: '启用通知',
dataIndex: 'enableNotifications',
},
];
export const notificationtableConfig = (notificationManagements: any) => {
return {
title: '告警规则',
api: notificationManagementApi.getTableList,
headerActions: [],
columns: tableKeyMap,
columnActions: {
title: '操作',
actions: [
{
label: '联系方式',
name: 'FeedBackDetail',
dynamicParams: ['uuid', 'appealType'],
handle: (data: any) => {
notificationManagements.value.toggle(data);
},
},
],
},
formConfig: {
schemas: [
{
field: 'alarmType',
label: '告警类型',
component: 'NsSelect',
componentProps: {
placeholder: '请选告警类型',
allowClear: true,
options: [
{
label: '设备告警',
value: 1,
},
{
label: '网关告警',
value: 2,
},
{
label: '能耗告警',
value: 3,
},
],
},
},
{
field: 'priority',
label: '告警优先级',
2024-07-25 15:39:32 +08:00
component: 'nsSelectApi',
// dynamicParams: {
// id: 'deviceName', //帮定上级联动数据
// },
componentProps: {
2024-07-25 15:39:32 +08:00
api: () => getEnum({ params: { enumType: 'PriorityEnum' } }),
immediate: true,
allowClear: true,
2024-07-25 15:39:32 +08:00
resultField: 'data',
labelField: 'label',
valueField: 'value',
placeholder: '请选择告警优先级',
showSearch: true,
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
// autoSelectFirst: true,
},
},
{
field: 'alarmTitle',
label: '告警标题',
component: 'NsInput',
componentProps: {
allowClear: true,
placeholder: '请输入告警标题关键字',
},
},
{
field: 'errorCode',
label: '错误码',
component: 'NsInput',
componentProps: {
allowClear: true,
placeholder: '请输入告警错误码',
},
},
{
field: 'enableNotifications',
label: '启用状态',
component: 'NsSelect',
componentProps: {
allowClear: true,
placeholder: '请选择启用状态',
options: [
{
label: '启用',
value: '1',
},
{
label: '关闭',
value: '0',
},
],
},
},
],
},
2024-07-25 11:55:32 +08:00
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};
};