add:配置设备告警对接接口 对接告警配置 里面的数据来源 设备节点
This commit is contained in:
@@ -11,26 +11,22 @@
|
||||
}"
|
||||
@click="clickSwitch({ enableRules: record.enableRules, record: record })" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'equipmentInfo'">
|
||||
{{
|
||||
record?.enableRules
|
||||
? record.enableRules + '>' + record.deviceType + '>' + record.deviceName
|
||||
: '-'
|
||||
}}
|
||||
</template>
|
||||
<!-- <template v-if="column.dataIndex === 'equipmentInfo'">
|
||||
{{ record.site + '>' + record.deviceType + '>' + record.deviceName }}
|
||||
</template> -->
|
||||
</template>
|
||||
</ns-view-list-table>
|
||||
<!-- 新增or编辑界面 -->
|
||||
<editConfigureDeviceAlarm ref="editConfigureDeviceAlarms" />
|
||||
<editConfigureDeviceAlarm ref="editConfigureDeviceAlarms" @editObject="editObject" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { ref, createVNode } from 'vue';
|
||||
import { http } from '/nerv-lib/util';
|
||||
import data from '../notificationManagementMock.json';
|
||||
import { NsMessage, NsModal } from '/nerv-lib/component';
|
||||
import editConfigureDeviceAlarm from '../equipmentAlarm/editConfigureDeviceAlarm.vue';
|
||||
import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { device } from '/@/api/deviceManage';
|
||||
|
||||
export default {
|
||||
components: { editConfigureDeviceAlarm },
|
||||
@@ -42,7 +38,10 @@
|
||||
const tableConfig = ref({});
|
||||
const mainRef = ref({});
|
||||
const editConfigureDeviceAlarms = ref({});
|
||||
const mockData = ref(data.listData);
|
||||
//组织数
|
||||
const orgId = ref('');
|
||||
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
|
||||
orgId.value = result;
|
||||
const clickSwitch = (data: any) => {
|
||||
NsModal.confirm({
|
||||
title: '启用状态',
|
||||
@@ -50,7 +49,7 @@
|
||||
content: '确定' + (data.record.enableRules === 1 ? '关闭' : '启用') + '吗?',
|
||||
onOk: () => {
|
||||
http
|
||||
.post(deviceAlarms.addOrUpNewData, {
|
||||
.post(deviceAlarms.configAddOrUpNewData, {
|
||||
id: data.record.id,
|
||||
enableRules: data.record.enableRules === 1 ? 0 : 1,
|
||||
})
|
||||
@@ -61,6 +60,10 @@
|
||||
},
|
||||
});
|
||||
};
|
||||
// 编辑或添加成功 刷新列表
|
||||
const editObject = () => {
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
};
|
||||
const doWnload = (url: any) => {
|
||||
const a = document.createElement('a');
|
||||
document.body.appendChild(a);
|
||||
@@ -75,15 +78,14 @@
|
||||
show.value = true;
|
||||
tableConfig.value = {
|
||||
title: '告警规则',
|
||||
api: deviceAlarms.getTableList,
|
||||
value: mockData.value,
|
||||
api: deviceAlarms.configGetTableList,
|
||||
headerActions: [
|
||||
{
|
||||
label: '新增',
|
||||
name: 'RoleTypeAdd',
|
||||
type: 'primary',
|
||||
handle: () => {
|
||||
editConfigureDeviceAlarms.value.toggle();
|
||||
editConfigureDeviceAlarms.value.toggle(null, configureDeviceAlarmsData.value);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -113,16 +115,26 @@
|
||||
},
|
||||
{
|
||||
label: '批量删除',
|
||||
name: 'groupTemDownload',
|
||||
type: 'primary',
|
||||
name: 'userBatchDel',
|
||||
confirm: true,
|
||||
dynamicDisabled: (data: any) => {
|
||||
return data.list.length === 0;
|
||||
},
|
||||
confirm: true,
|
||||
isReload: true,
|
||||
isClearCheck: true,
|
||||
// api: origanizemanage.batchDel,
|
||||
dynamicParams: { userIds: 'userId[]' },
|
||||
handle: (data: any) => {
|
||||
let ids = [];
|
||||
data.list.forEach((item) => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
data.list = [];
|
||||
http.post(deviceAlarms.configDel, { ids: ids.toString() }).then(() => {
|
||||
NsMessage.success('告警规则删除成功');
|
||||
//清空选中
|
||||
mainRef.value.nsTableRef.clearCheck();
|
||||
//刷新表单
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
@@ -139,20 +151,19 @@
|
||||
},
|
||||
{
|
||||
title: '设备信息',
|
||||
dataIndex: 'equipmentInfo',
|
||||
dataIndex: 'deviceInfo',
|
||||
},
|
||||
{
|
||||
title: '告警点位',
|
||||
dataIndex: 'devicePoint',
|
||||
dataIndex: 'devicePointName',
|
||||
},
|
||||
{
|
||||
title: '判断条件',
|
||||
dataIndex: 'ruleType',
|
||||
dataIndex: 'conditionalJudgment',
|
||||
},
|
||||
{
|
||||
title: '取值类型',
|
||||
dataIndex: 'valueType',
|
||||
textEllipsis: true,
|
||||
},
|
||||
{
|
||||
title: '异常描述',
|
||||
@@ -172,7 +183,7 @@
|
||||
name: 'FeedBackDetail',
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
handle: (data: any) => {
|
||||
editConfigureDeviceAlarms.value.toggle(data);
|
||||
editConfigureDeviceAlarms.value.toggle(data, configureDeviceAlarmsData);
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -181,8 +192,10 @@
|
||||
dynamicParams: ['uuid', 'appealType'],
|
||||
confirm: true,
|
||||
handle: () => {
|
||||
// mockData.value.splice(0, 1);
|
||||
console.log(data, 'xxxxxxx');
|
||||
http.post(deviceAlarms.configDel, { ids: data.id }).then(() => {
|
||||
NsMessage.success('操作成功');
|
||||
mainRef.value?.nsTableRef.reload();
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -191,60 +204,73 @@
|
||||
title: value.errorCode,
|
||||
schemas: [
|
||||
{
|
||||
field: 'provider',
|
||||
field: 'deviceName',
|
||||
label: '设备名称',
|
||||
component: 'NsInput',
|
||||
componentProps: {
|
||||
placeholder: '请输入设备名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
label: '设备点位',
|
||||
component: 'nsSelectApi',
|
||||
componentProps: {
|
||||
api: '/api/community/objs/DictItem',
|
||||
api: device.queryDevicePage,
|
||||
allowClear: true,
|
||||
params: {
|
||||
pageSize: 100,
|
||||
code: 'MZ',
|
||||
orgId: orgId.value,
|
||||
pageNum: 1,
|
||||
pageSize: 99,
|
||||
},
|
||||
placeholder: '请选择设备点位',
|
||||
resultField: 'data',
|
||||
labelField: 'dictName',
|
||||
valueField: 'dictValue',
|
||||
immediate: true,
|
||||
autoSelectFirst: false,
|
||||
resultField: 'data.records',
|
||||
labelField: 'deviceName',
|
||||
valueField: 'id',
|
||||
autoAddLink: true, //默认添加联动
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'payWay',
|
||||
field: 'devicePoint',
|
||||
label: '设备点位',
|
||||
component: 'nsSelectApi',
|
||||
dynamicParams: {
|
||||
id: 'deviceName', //帮定上级联动数据
|
||||
},
|
||||
componentProps: {
|
||||
api: device.queryDevicePoint,
|
||||
allowClear: true,
|
||||
resultField: 'data',
|
||||
placeholder: '请选择设备点位',
|
||||
labelField: 'code',
|
||||
valueField: 'id',
|
||||
dependency: 'deviceName',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'enableRules',
|
||||
label: '启用状态',
|
||||
component: 'NsSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择启用状态',
|
||||
allowClear: true,
|
||||
options: [
|
||||
{
|
||||
label: '启用',
|
||||
value: '1',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '关闭',
|
||||
value: '0',
|
||||
value: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'provider',
|
||||
field: 'abnormalDescription',
|
||||
label: '异常描述',
|
||||
component: 'NsInput',
|
||||
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入异常描述关键字',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
params: { id: value.id },
|
||||
params: { equipmentAlarmId: value.id },
|
||||
// pagination: { pageSizeOptions: false },
|
||||
rowKey: 'id',
|
||||
};
|
||||
@@ -255,6 +281,9 @@
|
||||
clickSwitch,
|
||||
doWnload,
|
||||
tableConfig,
|
||||
orgId,
|
||||
mainRef,
|
||||
editObject,
|
||||
editConfigureDeviceAlarms,
|
||||
setconfigureDeviceAlarmsData,
|
||||
};
|
||||
|
Reference in New Issue
Block a user