|
|
@@ -2,7 +2,8 @@ import { floor, isArray, random, slice } from 'lodash-es';
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
import { get } from '../billboard/utils';
|
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
|
-import { ref, reactive } from 'vue'
|
|
|
+import { reactive } from 'vue';
|
|
|
+import _ from 'lodash';
|
|
|
|
|
|
enum Api {
|
|
|
list = '/safety/ventanalyDevice/homedata2',
|
|
|
@@ -14,7 +15,7 @@ enum Api {
|
|
|
getAlarmRecord = '/ventanaly-device/safety/ventanalyAlarmLog/sysLinkDevAlarmLog',
|
|
|
getTotal = '/safety/ventanalyAlarmLog/total',
|
|
|
sysTypeWarnList = '/safety/ventanalyAlarmLog/sysTypeWarn',
|
|
|
- getDisasterProportion = '/safety/ventanalyAlarmLog/getDisasterProportion'
|
|
|
+ getDisasterProportion = '/safety/ventanalyAlarmLog/getDisasterProportion',
|
|
|
}
|
|
|
|
|
|
// 搞这个缓存是由于:目前代码上的设计是多个模块发出多次请求,每个模块自己负责消费前者的响应。
|
|
|
@@ -123,6 +124,27 @@ export const list = (params) => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ if (res.safetymonitor) {
|
|
|
+ const { sysOrgCode } = useGlobSetting();
|
|
|
+ // 沙坪
|
|
|
+ if (sysOrgCode === 'jsnyspmy') {
|
|
|
+ res.safetymonitor = _.sortBy(res.safetymonitor, (e) => {
|
|
|
+ const map = new Map([
|
|
|
+ ['1960160466651189249', 1],
|
|
|
+ ['1960160465543892994', 2],
|
|
|
+ ['1960160465376120833', 3],
|
|
|
+ ['1960160466168844289', 4],
|
|
|
+ ['1960160465736830977', 5],
|
|
|
+ ['1960160466026237954', 6],
|
|
|
+ ['1960160407146598402', 7],
|
|
|
+ ]);
|
|
|
+
|
|
|
+ const inx = map.get(e.deviceID) || 9999;
|
|
|
+
|
|
|
+ return inx;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return res;
|
|
|
});
|
|
|
@@ -396,26 +418,26 @@ export const getDisasterProportion = (params) => {
|
|
|
//多灾融合预警
|
|
|
function getLevelNum() {
|
|
|
return new Promise(async (resolve) => {
|
|
|
- const list = {}
|
|
|
+ const list: Record<string, any> = {};
|
|
|
const typeArr = ['fire', 'dust', 'vent', 'gas'];
|
|
|
for (let i = 0; i < typeArr.length; i++) {
|
|
|
const type = typeArr[i];
|
|
|
const result = await sysTypeWarnList({ type });
|
|
|
if (type == 'fire') {
|
|
|
- list.fire = result.length || 0
|
|
|
+ list.fire = result.length || 0;
|
|
|
} else if (type == 'dust') {
|
|
|
- list.dust = result.length || 0
|
|
|
+ list.dust = result.length || 0;
|
|
|
} else if (type == 'vent') {
|
|
|
- list.vent = result.length || 0
|
|
|
+ list.vent = result.length || 0;
|
|
|
} else if (type == 'gas') {
|
|
|
- list.gas = result.length || 0
|
|
|
+ list.gas = result.length || 0;
|
|
|
}
|
|
|
}
|
|
|
resolve(list);
|
|
|
});
|
|
|
}
|
|
|
export const getTotal = (params) => {
|
|
|
- const { sysOrgCode, sysDataType } = useGlobSetting();
|
|
|
+ const { sysDataType } = useGlobSetting();
|
|
|
|
|
|
const key = `${Api.getTotal}?${JSON.stringify(params)}`;
|
|
|
if (!cache.has(key)) {
|
|
|
@@ -427,29 +449,29 @@ export const getTotal = (params) => {
|
|
|
);
|
|
|
}
|
|
|
return (cache.get(key) as Promise<any>).then(async (res) => {
|
|
|
- console.log(res, '多灾融合预警数据')
|
|
|
+ console.log(res, '多灾融合预警数据');
|
|
|
|
|
|
- let dataVent=await getLevelNum()
|
|
|
+ const dataVent: any = await getLevelNum();
|
|
|
const levelsList = [
|
|
|
{
|
|
|
- name: "报警",
|
|
|
- value: 0
|
|
|
+ name: '报警',
|
|
|
+ value: 0,
|
|
|
},
|
|
|
{
|
|
|
- name: "重大风险",
|
|
|
- value: 0
|
|
|
+ name: '重大风险',
|
|
|
+ value: 0,
|
|
|
},
|
|
|
{
|
|
|
- name: "较大风险",
|
|
|
- value: 0
|
|
|
+ name: '较大风险',
|
|
|
+ value: 0,
|
|
|
},
|
|
|
{
|
|
|
- name: "一般风险",
|
|
|
- value: 0
|
|
|
+ name: '一般风险',
|
|
|
+ value: 0,
|
|
|
},
|
|
|
{
|
|
|
- name: "低风险",
|
|
|
- value: dataVent.vent || 0
|
|
|
+ name: '低风险',
|
|
|
+ value: dataVent.vent || 0,
|
|
|
},
|
|
|
];
|
|
|
//通风监测预警数据
|
|
|
@@ -459,27 +481,27 @@ export const getTotal = (params) => {
|
|
|
ventJf: res.ventInfo.zongjinfeng,
|
|
|
ventXf: res.ventInfo.xufengliang,
|
|
|
ventHf: res.ventInfo.zonghuifeng,
|
|
|
- }
|
|
|
+ };
|
|
|
res.ventData = [
|
|
|
{
|
|
|
- name: "报警",
|
|
|
- value: res.info.sysInfo.ventS.levels.alarm
|
|
|
+ name: '报警',
|
|
|
+ value: res.info.sysInfo.ventS.levels.alarm,
|
|
|
},
|
|
|
{
|
|
|
- name: "重大风险",
|
|
|
- value: res.info.sysInfo.ventS.levels.red
|
|
|
+ name: '重大风险',
|
|
|
+ value: res.info.sysInfo.ventS.levels.red,
|
|
|
},
|
|
|
{
|
|
|
- name: "较大风险",
|
|
|
- value: res.info.sysInfo.ventS.levels.orange
|
|
|
+ name: '较大风险',
|
|
|
+ value: res.info.sysInfo.ventS.levels.orange,
|
|
|
},
|
|
|
{
|
|
|
- name: "一般风险",
|
|
|
- value: res.info.sysInfo.ventS.levels.yellow
|
|
|
+ name: '一般风险',
|
|
|
+ value: res.info.sysInfo.ventS.levels.yellow,
|
|
|
},
|
|
|
{
|
|
|
- name: "低风险",
|
|
|
- value: dataVent.vent ? dataVent.vent : res.info.sysInfo.ventS.levels.blue
|
|
|
+ name: '低风险',
|
|
|
+ value: dataVent.vent ? dataVent.vent : res.info.sysInfo.ventS.levels.blue,
|
|
|
},
|
|
|
];
|
|
|
|
|
|
@@ -489,42 +511,42 @@ export const getTotal = (params) => {
|
|
|
ventJf: res.ventInfo.totalIntM3,
|
|
|
ventXf: res.ventInfo.xufengliang,
|
|
|
ventHf: res.ventInfo.totalRetM3,
|
|
|
- }
|
|
|
- res.ventData = levelsList
|
|
|
+ };
|
|
|
+ res.ventData = levelsList;
|
|
|
break;
|
|
|
default:
|
|
|
res.ventWarn = {
|
|
|
ventJf: res.ventInfo.totalIntM3,
|
|
|
ventXf: res.ventInfo.xufengliang,
|
|
|
ventHf: res.ventInfo.totalRetM3,
|
|
|
- }
|
|
|
- res.ventData = levelsList
|
|
|
+ };
|
|
|
+ res.ventData = levelsList;
|
|
|
}
|
|
|
//设备监测预警数据
|
|
|
- res.deviceWarn = reactive({})
|
|
|
- Object.keys(res.info.devicekindInfo).forEach((el, index) => {
|
|
|
+ res.deviceWarn = reactive({});
|
|
|
+ Object.keys(res.info.devicekindInfo).forEach((el) => {
|
|
|
res.deviceWarn[`${el}_all`] = res.info.devicekindInfo[el].totalcount;
|
|
|
res.deviceWarn[`${el}_warn`] = res.info.devicekindInfo[el].count;
|
|
|
res.deviceWarn[`${el}_close`] = res.info.devicekindInfo[el].netstatus;
|
|
|
- })
|
|
|
+ });
|
|
|
//瓦斯监测预警数据
|
|
|
- res.gasData = reactive({})
|
|
|
- res.gasData.safety_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.gasNumber, 0)
|
|
|
- res.gasData.gas_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.pumpNumber, 0)
|
|
|
- res.gasData.monitorData = res.info.sysInfo.gasS.devices.map(el => {
|
|
|
+ res.gasData = reactive({});
|
|
|
+ res.gasData.safety_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.gasNumber, 0);
|
|
|
+ res.gasData.gas_sum = res.info.sysInfo.gasS.devices.reduce((a, b) => a + b.pumpNumber, 0);
|
|
|
+ res.gasData.monitorData = res.info.sysInfo.gasS.devices.map((el) => {
|
|
|
return {
|
|
|
label: el.systemname,
|
|
|
value: el.gasNumber,
|
|
|
- value1: el.pumpNumber
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+ value1: el.pumpNumber,
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
//火灾监测预警数据
|
|
|
- res.fireInfos = reactive({})
|
|
|
- res.fireInfos.dataOn = []
|
|
|
-
|
|
|
+ res.fireInfos = reactive({});
|
|
|
+ res.fireInfos.dataOn = [];
|
|
|
+
|
|
|
if (res.bundletubeInfo && res.bundletubeInfo.msgTxt.length != 0 && res.bundletubeInfo.msgTxt[0].datalist.length != 0) {
|
|
|
- res.bundletubeInfo.msgTxt[0].datalist.forEach((el, ind) => {
|
|
|
+ res.bundletubeInfo.msgTxt[0].datalist.forEach((el) => {
|
|
|
res.fireInfos.dataOn.push({
|
|
|
warnLevel: el.syswarnLevel_str,
|
|
|
smokeJd: el.syswarnLevel_des,
|
|
|
@@ -532,7 +554,7 @@ export const getTotal = (params) => {
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
- res.fireInfos.dataOn = []
|
|
|
+ res.fireInfos.dataOn = [];
|
|
|
}
|
|
|
res.fireInfos.tempVal = res.info.sysInfo.fireS.summaryInfo
|
|
|
? res.info.sysInfo.fireS.summaryInfo.external.temperature && res.info.sysInfo.fireS.summaryInfo.external.temperature.maxlevel == '0'
|
|
|
@@ -561,29 +583,28 @@ export const getTotal = (params) => {
|
|
|
: '-'
|
|
|
: '';
|
|
|
//粉尘监测预警数据
|
|
|
- res.dustInfo = [
|
|
|
- {
|
|
|
- name: "报警",
|
|
|
- value: res.info.sysInfo.dustS.levels.alarm
|
|
|
- },
|
|
|
- {
|
|
|
- name: "重大风险",
|
|
|
- value: res.info.sysInfo.dustS.levels.red
|
|
|
- },
|
|
|
- {
|
|
|
- name: "较大风险",
|
|
|
- value: res.info.sysInfo.dustS.levels.orange
|
|
|
- },
|
|
|
- {
|
|
|
- name: "一般风险",
|
|
|
- value: res.info.sysInfo.dustS.levels.yellow
|
|
|
- },
|
|
|
- {
|
|
|
- name: "低风险",
|
|
|
- value: dataVent.dust ? dataVent.dust : res.info.sysInfo.dustS.levels.blue
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
+ res.dustInfo = [
|
|
|
+ {
|
|
|
+ name: '报警',
|
|
|
+ value: res.info.sysInfo.dustS.levels.alarm,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '重大风险',
|
|
|
+ value: res.info.sysInfo.dustS.levels.red,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '较大风险',
|
|
|
+ value: res.info.sysInfo.dustS.levels.orange,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '一般风险',
|
|
|
+ value: res.info.sysInfo.dustS.levels.yellow,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '低风险',
|
|
|
+ value: dataVent.dust ? dataVent.dust : res.info.sysInfo.dustS.levels.blue,
|
|
|
+ },
|
|
|
+ ];
|
|
|
|
|
|
return res;
|
|
|
});
|