|
|
@ -10,10 +10,10 @@ |
|
|
|
@close="handleClose"> |
|
|
|
<div style="width: 100%; overflow: hidden; overflow-y: hidden; height: 100%"> |
|
|
|
<a-form ref="formRef" :model="infoObject" :rules="rules" style="width: 80%"> |
|
|
|
<a-form-item ref="notification" label="通知方式" name="notification"> |
|
|
|
<a-form-item ref="notificationMethod" label="通知方式" name="notificationMethod"> |
|
|
|
<a-select |
|
|
|
ref="select" |
|
|
|
v-model:value="infoObject.notification" |
|
|
|
v-model:value="infoObject.notificationMethod" |
|
|
|
style="width: 100%" |
|
|
|
mode="multiple" |
|
|
|
:options="devicePointData" |
|
|
@ -24,34 +24,18 @@ |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="启用规则"> |
|
|
|
<a-switch |
|
|
|
:checked="infoObject.enableRules === 1 ? true : false" |
|
|
|
:checked="infoObject.enableNotifications === 1 ? true : false" |
|
|
|
:class="{ |
|
|
|
'blue-background': infoObject.enableRules === 1 ? true : false, |
|
|
|
'grey-background': infoObject.enableRules === 1 ? false : true, |
|
|
|
'blue-background': infoObject.enableNotifications === 1 ? true : false, |
|
|
|
'grey-background': infoObject.enableNotifications === 1 ? false : true, |
|
|
|
}" |
|
|
|
@click="clickSwitch" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
<div style="width: 100%; height: 765px; overflow-y: auto"> |
|
|
|
<div style="margin-bottom: 8px"> |
|
|
|
<div style="width: 100%; display: flex; position: relative"> |
|
|
|
<div |
|
|
|
style=" |
|
|
|
border-width: 0px; |
|
|
|
position: absolute; |
|
|
|
left: 0px; |
|
|
|
top: 5px; |
|
|
|
width: 5px; |
|
|
|
height: 15px; |
|
|
|
background: inherit; |
|
|
|
background-color: #2778ff; |
|
|
|
border: none; |
|
|
|
border-radius: 5px; |
|
|
|
-moz-box-shadow: none; |
|
|
|
-webkit-box-shadow: none; |
|
|
|
box-shadow: none; |
|
|
|
"></div> |
|
|
|
<span style="margin-left: 24px; color: #333333">联系人名单</span> |
|
|
|
<div style="width: 100%; display: flex; position: relative" class="ns-title-extra-box"> |
|
|
|
<span style="margin-left: 12px; color: #333333">联系人名单</span> |
|
|
|
</div> |
|
|
|
<img |
|
|
|
style="width: 100%; margin-top: -10px" |
|
|
@ -67,10 +51,10 @@ |
|
|
|
:pagination="pagination"> |
|
|
|
<template #bodyCell="{ record, column }"> |
|
|
|
<template v-if="column.dataIndex === 'address'"> |
|
|
|
{{ record.userRoleInfos?.[0].deptRoleInfoList }} |
|
|
|
{{ record?.deptRoleInfoList || record.userRoleInfos?.[0].deptRoleInfoList }} |
|
|
|
</template> |
|
|
|
<template v-if="column.dataIndex === 'operation'"> |
|
|
|
<a style="color: rgb(210, 0, 5)" @click="remove(record)">移除</a> |
|
|
|
<a style="color: #2778ff" @click="remove(record)">移除</a> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</a-table> |
|
|
@ -85,12 +69,12 @@ |
|
|
|
</template> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { ref } from 'vue'; |
|
|
|
// import { NsMessage } from '/nerv-lib/component'; |
|
|
|
// import { http } from '/nerv-lib/util'; |
|
|
|
// import { number } from 'vue-types'; |
|
|
|
import { NsMessage } from '/nerv-lib/component'; |
|
|
|
import { http } from '/nerv-lib/util'; |
|
|
|
import linkPeople from './linkPeople/index.vue'; |
|
|
|
|
|
|
|
// import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms'; |
|
|
|
import { notificationManagementApi } from '/@/api/alarmSettings/notificationManagements'; |
|
|
|
import { async } from '@antv/x6/lib/registry/marker/async'; |
|
|
|
import { info } from 'node_modules/loglevel'; |
|
|
|
|
|
|
|
//table 数据 |
|
|
|
const columns = [ |
|
|
@ -125,6 +109,8 @@ |
|
|
|
title: '部门', |
|
|
|
dataIndex: 'address', |
|
|
|
key: 'address', |
|
|
|
width: 200, |
|
|
|
textEllipsis: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
@ -160,7 +146,7 @@ |
|
|
|
dataSource.value.forEach((item) => { |
|
|
|
ids.push(item.userId); |
|
|
|
}); |
|
|
|
linkPeoples.value.getData({ id: ids, data: dataSource }); |
|
|
|
linkPeoples.value.getData({ id: ids, data: dataSource.value }); |
|
|
|
}; |
|
|
|
//取消弹窗 |
|
|
|
const handleCancel = () => { |
|
|
@ -173,7 +159,7 @@ |
|
|
|
}; |
|
|
|
//表单数据 |
|
|
|
const infoObject = ref({ |
|
|
|
enableRules: 0, |
|
|
|
enableNotifications: 0, |
|
|
|
}); |
|
|
|
//设备点位搜索 |
|
|
|
const filterDevicePoint = (input: string, option: any) => { |
|
|
@ -181,45 +167,47 @@ |
|
|
|
}; |
|
|
|
//开关 |
|
|
|
const clickSwitch = () => { |
|
|
|
if (infoObject.value.enableRules === 1) { |
|
|
|
infoObject.value.enableRules = 0; |
|
|
|
if (infoObject.value.enableNotifications === 1) { |
|
|
|
infoObject.value.enableNotifications = 0; |
|
|
|
} else { |
|
|
|
infoObject.value.enableRules = 1; |
|
|
|
infoObject.value.enableNotifications = 1; |
|
|
|
} |
|
|
|
}; |
|
|
|
// 通知信息 |
|
|
|
const devicePointData = ref([ |
|
|
|
{ label: '站内信息', value: 1 }, |
|
|
|
{ label: '邮件', value: 2 }, |
|
|
|
{ label: '站内信息', value: '1' }, |
|
|
|
{ label: '邮件', value: '2' }, |
|
|
|
]); |
|
|
|
|
|
|
|
const rules = { |
|
|
|
notification: [{ required: true, message: '请选择通知方式', trigger: 'change' }], |
|
|
|
notificationMethod: [{ required: true, message: '请选择通知方式', trigger: 'change' }], |
|
|
|
user: [{ required: true, message: '请选择通知人', trigger: 'change' }], |
|
|
|
}; |
|
|
|
const formRef = ref(); |
|
|
|
const emit = defineEmits(['editObject']); |
|
|
|
const toggle = (value: any) => { |
|
|
|
const emit = defineEmits(['updNotification']); |
|
|
|
const toggle = async (value: any) => { |
|
|
|
//判断 是新增 还是修改 |
|
|
|
if (value) { |
|
|
|
// 获取接口 |
|
|
|
infoObject.value = { |
|
|
|
enableRules: 0, |
|
|
|
}; |
|
|
|
// await http |
|
|
|
// .post(group.queryDeviceGroupTree, { |
|
|
|
// pageNum: 1, |
|
|
|
// pageSize: 999, |
|
|
|
// energyType: selectedOptions[0].dicKey, |
|
|
|
// orgId: orgId.value, |
|
|
|
// }) |
|
|
|
// .then((res) => { |
|
|
|
// jdTreeData.value = res.data; |
|
|
|
// }); |
|
|
|
// // 获取接口 |
|
|
|
await http |
|
|
|
.post(notificationManagementApi.findById, { |
|
|
|
id: value.id, |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
infoObject.value = res.data; |
|
|
|
if (infoObject.value.notificationMethod) { |
|
|
|
infoObject.value.notificationMethod = infoObject.value.notificationMethod.split(','); |
|
|
|
} else { |
|
|
|
infoObject.value.notificationMethod = []; |
|
|
|
} |
|
|
|
dataSource.value = res.data.hxAlarmNotifyUserList; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
infoObject.value = { |
|
|
|
enableRules: 0, |
|
|
|
enableNotifications: 0, |
|
|
|
notificationMethod: [], |
|
|
|
}; |
|
|
|
dataSource.value = []; |
|
|
|
} |
|
|
|
visible.value = !visible.value; |
|
|
|
}; |
|
|
@ -233,24 +221,36 @@ |
|
|
|
dataSource.value = [...dataSource.value]; |
|
|
|
}; |
|
|
|
const btnClick = () => { |
|
|
|
console.log(infoObject.value); |
|
|
|
//发送请求数据 |
|
|
|
let obj = {}; |
|
|
|
obj.selectList = []; |
|
|
|
dataSource.value.forEach((item) => { |
|
|
|
obj.selectList.push({ |
|
|
|
userId: item.userId, |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log(obj, '数据'); |
|
|
|
if (dataSource.value.length === 0) { |
|
|
|
NsMessage.warn('请选择联系人'); |
|
|
|
return; |
|
|
|
} |
|
|
|
//表单校验 |
|
|
|
formRef.value.validate().then(() => { |
|
|
|
//发送请求数据 |
|
|
|
let obj = { |
|
|
|
id: null, |
|
|
|
notificationMethod: null, |
|
|
|
hxAlarmNotifyUserList: [], |
|
|
|
enableNotifications: 0, |
|
|
|
}; |
|
|
|
obj.notificationMethod = infoObject.value.notificationMethod.toString(); |
|
|
|
obj.id = infoObject.value.id; |
|
|
|
obj.enableNotifications = infoObject.value.enableNotifications; |
|
|
|
dataSource.value.forEach((item) => { |
|
|
|
obj.hxAlarmNotifyUserList.push({ |
|
|
|
userId: item.userId, |
|
|
|
contactInformationId: infoObject.value.id, |
|
|
|
}); |
|
|
|
}); |
|
|
|
//调用接口 |
|
|
|
// http.post(deviceAlarms.addOrUpNewData, infoObject.value).then(() => { |
|
|
|
// NsMessage.success('操作成功'); |
|
|
|
// visible.value = false; |
|
|
|
// emit('editObject', null); |
|
|
|
// }); |
|
|
|
http.post(notificationManagementApi.upData, obj).then((res) => { |
|
|
|
if (res.msg === 'success') { |
|
|
|
NsMessage.success('操作成功'); |
|
|
|
visible.value = false; |
|
|
|
emit('updNotification', null); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
const handleClose = () => { |
|
|
|