fix:对接通知管理接口 进行联调测试
This commit is contained in:
@@ -4,21 +4,27 @@
|
||||
<a-tab-pane key="1" tab="通知管理">
|
||||
<ns-view-list-table v-bind="notificationConfig" ref="mainRef">
|
||||
<template #bodyCell="{ record, column }">
|
||||
<template v-if="column.dataIndex === 'enableRules'">
|
||||
<template v-if="column.dataIndex === 'enableNotifications'">
|
||||
<a-switch
|
||||
:checked="record.enableRules === 1 ? true : false"
|
||||
:checked="record.enableNotifications === 1 ? true : false"
|
||||
:class="{
|
||||
'blue-background': record.enableRules === 1 ? true : false,
|
||||
'grey-background': record.enableRules === 1 ? false : true,
|
||||
'blue-background': record.enableNotifications === 1 ? true : false,
|
||||
'grey-background': record.enableNotifications === 1 ? false : true,
|
||||
}"
|
||||
@change="
|
||||
clickSwitch({ type: 1, enableRules: record.enableRules, record: record })
|
||||
" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'prioritys'">
|
||||
{{ record.priority ? record.priority.label : '' }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'notificationMethod'">
|
||||
{{ getNotificationMethod(record.notificationMethod) }}
|
||||
</template>
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
<!-- 联系方式 -->
|
||||
<notificationManagement ref="notificationManagements" @editObject="editObject" />
|
||||
<notificationManagement ref="notificationManagements" @updNotification="updNotification" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="设备告警" force-render>
|
||||
<ns-view-list-table
|
||||
@@ -49,7 +55,7 @@
|
||||
{{ record.repetitions.label }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'prioritys'">
|
||||
{{ record.priority.label }}
|
||||
{{ record.priority ? record.priority.label : '-' }}
|
||||
</template>
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
@@ -90,7 +96,7 @@
|
||||
{{ record.repetitions.label }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'prioritys'">
|
||||
{{ record.priority.label }}
|
||||
{{ record.priority ? record.priority.label : '-' }}
|
||||
</template>
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
@@ -124,6 +130,7 @@
|
||||
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
|
||||
import { energyAlarms } from '/@/api/alarmSettings/energyAlarm';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { notificationManagementApi } from '/@/api/alarmSettings/notificationManagements';
|
||||
|
||||
export default {
|
||||
name: 'AlarmSettingsIndex',
|
||||
@@ -146,6 +153,22 @@
|
||||
const equipmentAlarm = ref(true);
|
||||
const energyAlarm = ref(true);
|
||||
const notificationConfig = notificationtableConfig(notificationManagements);
|
||||
//获取 通知方式
|
||||
const getNotificationMethod = (data: any) => {
|
||||
if (!data) return '';
|
||||
const methods = [];
|
||||
const notifications = data.split(',');
|
||||
|
||||
notifications.forEach((notification) => {
|
||||
if (notification === '1') {
|
||||
methods.push('站内信息');
|
||||
} else if (notification === '2') {
|
||||
methods.push('邮件');
|
||||
}
|
||||
});
|
||||
|
||||
return methods.join('/');
|
||||
};
|
||||
//能源告警配置
|
||||
const energyAlarmConfig = energyAlarmConfigs(
|
||||
editeEnergyAlarm,
|
||||
@@ -169,6 +192,10 @@
|
||||
energyAlarm.value = !energyAlarm.value;
|
||||
configureEnergyAlarms.value.show = false;
|
||||
};
|
||||
//通知 修改成功
|
||||
const updNotification = () => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
};
|
||||
const clickSwitch = (data: any) => {
|
||||
NsModal.confirm({
|
||||
title: '启用状态',
|
||||
@@ -182,12 +209,14 @@
|
||||
if (data.type === 1) {
|
||||
//通知方式
|
||||
http
|
||||
.post(deviceAlarms.addOrUpNewData, {
|
||||
.post(notificationManagementApi.upData, {
|
||||
id: data.record.id,
|
||||
enableRules: data.record.enableRules === 1 ? 0 : 1,
|
||||
enableNotifications: data.record.enableNotifications === 1 ? 0 : 1,
|
||||
})
|
||||
.then(() => {
|
||||
NsMessage.success(data.record.enableRules === 1 ? '通知已关闭' : '通知已启用');
|
||||
NsMessage.success(
|
||||
data.record.enableNotifications === 1 ? '通知已关闭' : '通知已启用',
|
||||
);
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
}
|
||||
@@ -232,6 +261,8 @@
|
||||
equipmentAlarmConfig,
|
||||
editObject,
|
||||
editeEnergyAlarm,
|
||||
updNotification,
|
||||
getNotificationMethod,
|
||||
clickSwitch,
|
||||
editEquipmentAlarm,
|
||||
notificationManagements,
|
||||
|
||||
Reference in New Issue
Block a user