fix:修改字段 对接设备告警

This commit is contained in:
zhaohy
2024-07-25 11:55:32 +08:00
parent 7869b083c3
commit b8b6a46e7e
18 changed files with 131 additions and 42 deletions

View File

@@ -20,7 +20,7 @@
</div>
</div>
<div class="item-box-right">
<img width="54px" height="54px" src="../../../../src/icon/gaojingtonglan.svg" />
<img width="48px" height="48px" src="../../../../src/icon/gaojingtonglan.svg" />
</div>
</div>
</div>

View File

@@ -288,7 +288,7 @@
},
],
},
params: { energyConsumptionAlarmId: value.id },
params: { energyConsumptionAlarmId: value.id, orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -394,6 +394,9 @@
formRef.value.validate().then(() => {
//处理数据
let data = { ...infoObject.value };
if (!data.orgId) {
data.orgId = orgId.value;
}
//关联能耗告警id
data.energyConsumptionAlarmId = energyAlarm.value.id;
data.errorCode = energyAlarm.value.errorCode;

View File

@@ -87,6 +87,11 @@
infoObject.value.intervalDurationUnit = 1;
}
};
//组织id
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
//表单数据
const infoObject = ref({
alarmTitle: null,
@@ -94,6 +99,7 @@
priority: null,
monitorFrequency: null,
createWorkOrder: null,
orgId: null,
enableRules: 0,
});
const formRef = ref();
@@ -245,6 +251,9 @@
//表单校验
formRef.value.validate().then(() => {
let data = { ...infoObject.value };
if (!data.orgId) {
data.orgId = orgId.value;
}
data.createWorkOrder = Number(data.createWorkOrder);
if (data.alarmFrequency !== 2) {
data.repetitions = null;

View File

@@ -279,7 +279,7 @@
},
],
},
params: { equipmentAlarmId: value.id },
params: { equipmentAlarmId: value.id, orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -412,6 +412,9 @@
//数据是否验证通过
formRef.value.validate().then(() => {
let data = { ...infoObject.value };
if (!data.orgId) {
data.orgId = orgId.value;
}
// 配置关联id
data.equipmentAlarmId = equipmentAlarm.value.id;
// 逻辑列表

View File

@@ -87,6 +87,10 @@
import { deviceAlarms } from '/@/api/alarmManagement/alarmSettings/deviceAlarms';
const visible = ref(false);
//组织id
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
//表单数据
const infoObject = ref({
id: null,
@@ -316,6 +320,9 @@
data.intervalDuration = null;
data.intervalDurationUnit = null;
}
if (!data.orgId) {
data.orgId = orgId.value;
}
http.post(deviceAlarms.addOrUpNewData, data).then(() => {
if (infoObject.value.id) {
NsMessage.success('告警编辑成功');

View File

@@ -1,7 +1,11 @@
import { http } from '/nerv-lib/util';
import { NsMessage } from '/nerv-lib/component';
import { energyAlarms } from '/@/api/alarmManagement/alarmSettings/energyAlarm';
import { ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
title: '序号',
@@ -214,6 +218,7 @@ export const energyAlarmConfigs = (
},
],
},
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -1,6 +1,11 @@
import { http } from '/nerv-lib/util';
import { NsMessage } from '/nerv-lib/component';
import { deviceAlarms } from '/@/api/alarmManagement/alarmSettings/deviceAlarms';
import { ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
title: '序号',
@@ -212,6 +217,7 @@ export const equipmentAlarmTableConfig = (
},
],
},
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -1,5 +1,9 @@
import { notificationManagementApi } from '/@/api/alarmManagement/alarmSettings/notificationManagements';
import { ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
title: '序号',
@@ -146,6 +150,7 @@ export const notificationtableConfig = (notificationManagements: any) => {
},
],
},
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -67,7 +67,7 @@
errorCode: null,
alarmTitle: null,
abnormalDescription: null,
deviceInfo: null,
monitoringPoints: null,
alarmRepetitions: null,
updateTime: null,
});
@@ -84,7 +84,7 @@
errorCode: null,
alarmTitle: null,
abnormalDescription: null,
deviceInfo: null,
monitoringPoints: null,
alarmRepetitions: null,
updateTime: null,
};

View File

@@ -11,7 +11,7 @@
<a-tabs>
<a-tab-pane key="1" tab="更新状态">
<div style="width: 100%; padding: 24px">
<a-form ref="formRef" :model="infoObject">
<a-form ref="formRef" :model="infoObject" :rules="rules">
<a-form-item ref="state" label="当前状态" name="state">
<a-select
v-model:value="infoObject.state"
@@ -67,31 +67,53 @@
const energyAlarm = ref({});
const stateOptions = ref();
const logList = ref([]);
const formRef = ref();
const config = ref({
size: logList.value.length,
dataSource: logList.value,
});
// 表单校验
const rules = {
remarks: [
{
required: true,
message: '请输入备注',
trigger: 'change',
validator: (rules, remarks, cbfn) => {
if (remarks && remarks.trim() !== '') {
cbfn();
} else {
cbfn('备注不能为空');
}
},
},
],
state: [{ required: true, message: '请选择当前状态', trigger: 'change' }],
};
const handleClose = () => {
showEdit.value = true;
energyAlarm.value = {};
infoObject.value = {};
visible.value = false;
config.value.dataSource = [];
};
const btnClick = () => {
delete infoObject.value.createTime;
infoObject.value.alarmEnergyConsumptionLogId = energyAlarm.value.id;
if (energyAlarm.value.createWorkOrder === 0) {
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
if (res.msg === 'success') {
NsMessage.success('操作成功');
showEdit.value = true;
energyAlarm.value = {};
infoObject.value = {};
visible.value = false;
emit('logAdd', null);
}
});
}
formRef.value.validate().then(() => {
delete infoObject.value.createTime;
infoObject.value.alarmEnergyConsumptionLogId = energyAlarm.value.id;
if (energyAlarm.value.createWorkOrder === 0) {
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
if (res.msg === 'success') {
NsMessage.success('操作成功');
showEdit.value = true;
energyAlarm.value = {};
infoObject.value = {};
visible.value = false;
emit('logAdd', null);
}
});
}
});
};
//修改状态
const changeShowEdit = () => {
@@ -119,7 +141,6 @@
{ value: 5, label: '已关闭' },
];
}
console.log(data, 'data');
await http
.post(energyAlarmApi.getSelectAlarmEnergyConsumptionLogStatusProcess, {
alarmEnergyConsumptionLogId: data.id,
@@ -149,6 +170,8 @@
infoObject,
changeShowEdit,
showEdit,
rules,
formRef,
energyAlarm,
stateOptions,
btnClick,

View File

@@ -1,6 +1,10 @@
import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm';
import { dict } from '/@/api';
import { ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
title: '序号',
@@ -181,6 +185,7 @@ export const notificationtableConfig = (look: any, status: any) => {
},
],
},
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -67,6 +67,7 @@
const equipmentAlarm = ref({});
const stateOptions = ref();
const logList = ref([]);
const formRef = ref();
const config = ref({
size: logList.value.length,
dataSource: logList.value,
@@ -94,22 +95,26 @@
equipmentAlarm.value = {};
infoObject.value = {};
visible.value = false;
config.value.dataSource = [];
logList.value = [];
};
const btnClick = () => {
delete infoObject.value.createTime;
infoObject.value.alarmEquipmentLogId = equipmentAlarm.value.id;
if (equipmentAlarm.value.createWorkOrder === 0) {
http.post(equipmentAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
if (res.msg === 'success') {
NsMessage.success('操作成功');
showEdit.value = true;
equipmentAlarm.value = {};
infoObject.value = {};
visible.value = false;
emit('logAdd', null);
}
});
}
formRef.value.validate().then(() => {
delete infoObject.value.createTime;
infoObject.value.alarmEquipmentLogId = equipmentAlarm.value.id;
if (equipmentAlarm.value.createWorkOrder === 0) {
http.post(equipmentAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => {
if (res.msg === 'success') {
NsMessage.success('操作成功');
showEdit.value = true;
equipmentAlarm.value = {};
infoObject.value = {};
visible.value = false;
emit('logAdd', null);
}
});
}
});
};
//修改状态
const changeShowEdit = () => {
@@ -137,7 +142,6 @@
{ value: 5, label: '已关闭' },
];
}
console.log(data, 'data');
await http
.post(equipmentAlarmApi.getSelectAlarmEquipmentLogStatusProcess, {
alarmEquipmentLogId: data.id,
@@ -166,6 +170,7 @@
return {
infoObject,
rules,
formRef,
changeShowEdit,
showEdit,
equipmentAlarm,

View File

@@ -1,4 +1,9 @@
import { equipmentAlarmApi } from '/@/api/alarmManagement/equipmentAlarm';
import { ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
@@ -20,18 +25,23 @@ const tableKeyMap = [
{
title: '优先级',
dataIndex: 'priority',
width: 80,
},
{
title: '状态',
dataIndex: 'alarmLogState',
width: 100,
},
{
title: '错误码',
dataIndex: 'errorCode',
width: 100,
},
{
title: '设备信息',
dataIndex: 'deviceInfo',
width: 400,
// textEllipsis: true,
},
{
title: '更新时间',
@@ -40,6 +50,7 @@ const tableKeyMap = [
{
title: '重复次数',
dataIndex: 'alarmRepetitions',
width: 80,
},
];
export const notificationtableConfig = (look: any, status: any) => {
@@ -155,6 +166,7 @@ export const notificationtableConfig = (look: any, status: any) => {
},
],
},
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};

View File

@@ -62,11 +62,11 @@
{ value: 5, label: '已关闭' },
]);
const logList = ref([
{ createName: '李四', state: 3, time: '2024-03-10 10:00:00', desc: '完成' },
{ createName: '王五', state: 5, time: '2024-03-10 10:00:00' },
{ createName: '王五', state: 4, time: '2024-03-10 10:00:00' },
{ createName: '王五', state: 2, time: '2024-03-10 10:00:00', desc: '创建工单' },
{ createName: '赵六', state: 1, time: '2024-03-10 10:00:00' },
{ realName: '李四', state: 3, createTime: '2024-03-10 10:00:00', remarks: '完成' },
{ realName: '王五', state: 5, createTime: '2024-03-10 10:00:00' },
{ realName: '王五', state: 4, createTime: '2024-03-10 10:00:00' },
{ realName: '王五', state: 2, createTime: '2024-03-10 10:00:00', remarks: '创建工单' },
{ realName: '赵六', state: 1, createTime: '2024-03-10 10:00:00' },
]);
const config = ref({
size: logList.value.length,

View File

@@ -1,4 +1,9 @@
import { gatewayAlarmApi } from '/@/api/alarmManagement/gatewayAlarm';
import { ref } from 'vue';
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const tableKeyMap = [
{
title: '序号',
@@ -139,6 +144,7 @@ export const notificationtableConfig = (look: any, status: any) => {
},
],
},
params: { orgId: orgId.value },
// pagination: { pageSizeOptions: false },
rowKey: 'id',
};