|
@@ -7,55 +7,64 @@
|
|
|
>
|
|
>
|
|
|
{{ mainTitle }}
|
|
{{ mainTitle }}
|
|
|
</customHeader>
|
|
</customHeader>
|
|
|
- <div class="bg" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
|
|
|
|
|
- <a-spin :spinning="loading" />
|
|
|
|
|
- <div id="model3D" v-show="!loading" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
|
|
|
|
|
- <slot name="monitorSlot3D"></slot>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <slot :monitor-data="monitorData"></slot>
|
|
|
<div class="scene-box">
|
|
<div class="scene-box">
|
|
|
<div class="center-container">
|
|
<div class="center-container">
|
|
|
<template v-if="activeKey == 'monitor'">
|
|
<template v-if="activeKey == 'monitor'">
|
|
|
- <!-- <balancePressHome v-if="activeKey == 'monitor'" :deviceId="optionValue" /> -->
|
|
|
|
|
|
|
+ <slot name="monitor">
|
|
|
|
|
+ <ModuleCommon
|
|
|
|
|
+ v-for="cfg in mainConfig.configs"
|
|
|
|
|
+ :key="cfg.deviceType"
|
|
|
|
|
+ :show-style="cfg.showStyle"
|
|
|
|
|
+ :module-data="cfg.moduleData"
|
|
|
|
|
+ :module-name="cfg.moduleName"
|
|
|
|
|
+ :device-type="cfg.deviceType"
|
|
|
|
|
+ :data="monitorData"
|
|
|
|
|
+ :visible="true"
|
|
|
|
|
+ />
|
|
|
|
|
+ </slot>
|
|
|
</template>
|
|
</template>
|
|
|
<div v-else class="history-group">
|
|
<div v-else class="history-group">
|
|
|
- <div class="device-button-group" v-if="deviceList.length > 0">
|
|
|
|
|
|
|
+ <div v-if="showDeviceList && deviceList.length > 0" class="device-button-group">
|
|
|
<div
|
|
<div
|
|
|
- class="device-button"
|
|
|
|
|
- :class="{ 'device-active': deviceActive == device.deviceType }"
|
|
|
|
|
v-for="(device, index) in deviceList"
|
|
v-for="(device, index) in deviceList"
|
|
|
|
|
+ :class="{ 'device-button': true, 'device-active': deviceActive == device.deviceType }"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
@click="deviceChange(index)"
|
|
@click="deviceChange(index)"
|
|
|
- >{{ device.deviceName }}</div
|
|
|
|
|
>
|
|
>
|
|
|
|
|
+ {{ device.deviceName }}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="history-container">
|
|
<div class="history-container">
|
|
|
- <HistoryTable
|
|
|
|
|
- v-if="activeKey == 'monitor_history'"
|
|
|
|
|
- class="vent-margin-t-20"
|
|
|
|
|
- :columns-type="`${deviceType}`"
|
|
|
|
|
- :device-type="deviceType"
|
|
|
|
|
- :sysId="optionValue"
|
|
|
|
|
- :scroll="{ y: 650 }"
|
|
|
|
|
- :only-bouned-devices="monitorHistoryConfig.onlyBounedDevices"
|
|
|
|
|
- :show-history-curve="monitorHistoryConfig.showHistoryCurve"
|
|
|
|
|
- />
|
|
|
|
|
- <HandlerHistoryTable
|
|
|
|
|
- v-if="activeKey == 'handler_history'"
|
|
|
|
|
- class="vent-margin-t-20"
|
|
|
|
|
- columns-type="operator_history"
|
|
|
|
|
- :deviceType="deviceType"
|
|
|
|
|
- :device-list-api="getHandlerList"
|
|
|
|
|
- />
|
|
|
|
|
-
|
|
|
|
|
- <AlarmHistoryTable
|
|
|
|
|
- v-if="activeKey == 'faultRecord'"
|
|
|
|
|
- columns-type="alarm"
|
|
|
|
|
- :device-type="deviceType"
|
|
|
|
|
- :list="getAlarmList"
|
|
|
|
|
- :sys-id="optionValue"
|
|
|
|
|
- :device-list-api="workFaceDeviceList.bind(null, { id: optionValue })"
|
|
|
|
|
- designScope="alarm-history"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <slot name="history" :device-type="deviceType" :device-id="optionValue">
|
|
|
|
|
+ <HistoryTable
|
|
|
|
|
+ v-if="activeKey == 'monitor_history'"
|
|
|
|
|
+ class="vent-margin-t-20"
|
|
|
|
|
+ :columns-type="deviceType"
|
|
|
|
|
+ :device-type="deviceType"
|
|
|
|
|
+ :sysId="optionValue"
|
|
|
|
|
+ :scroll="{ y: 650 }"
|
|
|
|
|
+ v-bind="monitorHistoryConfig"
|
|
|
|
|
+ />
|
|
|
|
|
+ </slot>
|
|
|
|
|
+ <slot name="handler" :device-type="deviceType" :device-id="optionValue">
|
|
|
|
|
+ <HandlerHistoryTable
|
|
|
|
|
+ v-if="activeKey == 'handler_history'"
|
|
|
|
|
+ class="vent-margin-t-20"
|
|
|
|
|
+ columns-type="operator_history"
|
|
|
|
|
+ :deviceType="deviceType"
|
|
|
|
|
+ v-bind="handlerHistoryConfig"
|
|
|
|
|
+ />
|
|
|
|
|
+ </slot>
|
|
|
|
|
+ <slot name="alarm" :device-type="deviceType" :device-id="optionValue">
|
|
|
|
|
+ <AlarmHistoryTable
|
|
|
|
|
+ v-if="activeKey == 'faultRecord'"
|
|
|
|
|
+ columns-type="alarm"
|
|
|
|
|
+ :device-type="deviceType"
|
|
|
|
|
+ :sys-id="optionValue"
|
|
|
|
|
+ v-bind="alarmHistoryConfig"
|
|
|
|
|
+ />
|
|
|
|
|
+ </slot>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -68,58 +77,81 @@
|
|
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
|
import { getDevice, sysList } from '../comment/comment.api';
|
|
import { getDevice, sysList } from '../comment/comment.api';
|
|
|
import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
|
|
import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
|
|
|
- // import balancePressHome from './components/balancePressHome.vue';
|
|
|
|
|
|
|
+ import ModuleCommon from '../../home/configurable/components/ModuleCommon.vue';
|
|
|
import HistoryTable from '../comment/HistoryTable.vue';
|
|
import HistoryTable from '../comment/HistoryTable.vue';
|
|
|
import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
|
|
import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
|
|
|
|
|
+ import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
|
import { Config } from '../../deviceManager/configurationTable/types';
|
|
import { Config } from '../../deviceManager/configurationTable/types';
|
|
|
- import { defHttp } from '/@/utils/http/axios';
|
|
|
|
|
- import { workFaceDeviceList } from '../../deviceManager/comment/warningTabel/warning.api';
|
|
|
|
|
|
|
+ import { message } from 'ant-design-vue';
|
|
|
|
|
+ import _ from 'lodash';
|
|
|
|
|
|
|
|
type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
|
|
type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
|
|
|
|
|
|
|
|
const props = withDefaults(
|
|
const props = withDefaults(
|
|
|
defineProps<{
|
|
defineProps<{
|
|
|
mainTitle: string;
|
|
mainTitle: string;
|
|
|
|
|
+ /** 是否显示历史数据上方的设备列表 */
|
|
|
|
|
+ showDeviceList?: boolean;
|
|
|
|
|
+ /** 请求场景数据传入的类型字符 */
|
|
|
|
|
+ strtype: string;
|
|
|
|
|
+ /** 请求场景数据传入的页面类型字符 */
|
|
|
|
|
+ pagetype?: string;
|
|
|
/** 获取各表格配置时依赖的设备类型 */
|
|
/** 获取各表格配置时依赖的设备类型 */
|
|
|
// deviceType: string;
|
|
// deviceType: string;
|
|
|
/** 主要模块配置 */
|
|
/** 主要模块配置 */
|
|
|
mainConfig: {
|
|
mainConfig: {
|
|
|
configs: Config[];
|
|
configs: Config[];
|
|
|
|
|
+ /** 获取该场景所含设备及其监测信息的API */
|
|
|
|
|
+ monitorApi?: (params: { deviceType: string; deviceId: number | string }) => Promise<any>;
|
|
|
|
|
+ /** 定时获取监测信息的配置,单位为毫秒,不传入即默认,传0即停用 */
|
|
|
|
|
+ timer?: number;
|
|
|
};
|
|
};
|
|
|
/** 历史数据配置 */
|
|
/** 历史数据配置 */
|
|
|
monitorHistoryConfig: {
|
|
monitorHistoryConfig: {
|
|
|
/** 请求历史数据时传入的类型字符 */
|
|
/** 请求历史数据时传入的类型字符 */
|
|
|
- columnsType: string;
|
|
|
|
|
|
|
+ columnsType?: string;
|
|
|
|
|
+ /** 如果默认的设备类型不适用,可以传递固定的类型 */
|
|
|
|
|
+ deviceType?: string;
|
|
|
/** 仅展示已绑定设备,选择是则从系统中获取sysId下已绑定设备。仅能查询到已绑定设备的历史数据 */
|
|
/** 仅展示已绑定设备,选择是则从系统中获取sysId下已绑定设备。仅能查询到已绑定设备的历史数据 */
|
|
|
- onlyBounedDevices: boolean;
|
|
|
|
|
|
|
+ onlyBounedDevices?: boolean;
|
|
|
/** 显示历史数据曲线图 */
|
|
/** 显示历史数据曲线图 */
|
|
|
- showHistoryCurve: boolean;
|
|
|
|
|
|
|
+ showHistoryCurve?: boolean;
|
|
|
};
|
|
};
|
|
|
/** 操作历史配置 */
|
|
/** 操作历史配置 */
|
|
|
handlerHistoryConfig: {
|
|
handlerHistoryConfig: {
|
|
|
/** 请求操作历史时传入的类型字符 */
|
|
/** 请求操作历史时传入的类型字符 */
|
|
|
- columnsType: string;
|
|
|
|
|
|
|
+ columnsType?: string;
|
|
|
|
|
+ /** 如果默认的设备类型不适用,可以传递固定的类型 */
|
|
|
|
|
+ deviceType?: string;
|
|
|
|
|
+ /** 获取操作历史的API,可以不提供以使用默认的请求 */
|
|
|
|
|
+ deviceListApi?: (params: any) => Promise<any[]>;
|
|
|
};
|
|
};
|
|
|
/** 报警历史配置 */
|
|
/** 报警历史配置 */
|
|
|
alarmHistoryConfig: {
|
|
alarmHistoryConfig: {
|
|
|
/** 请求报警历史时传入的类型字符 */
|
|
/** 请求报警历史时传入的类型字符 */
|
|
|
- columnsType: string;
|
|
|
|
|
|
|
+ columnsType?: string;
|
|
|
|
|
+ /** 如果默认的设备类型不适用,可以传递固定的类型 */
|
|
|
|
|
+ deviceType?: string;
|
|
|
|
|
+ /** 获取报警历史的API,可以不提供以使用默认的请求 */
|
|
|
|
|
+ list?: (params: any) => Promise<any[]>;
|
|
|
|
|
+ /** 获取设备以供报警历史过滤的API,可以不提供以使用默认的请求 */
|
|
|
|
|
+ deviceListApi?: (params: any) => Promise<any[]>;
|
|
|
};
|
|
};
|
|
|
- /** 请求场景数据传入的类型字符 */
|
|
|
|
|
- strtype: string;
|
|
|
|
|
- /** 请求场景数据传入的页面类型字符 */
|
|
|
|
|
- pagetype: string;
|
|
|
|
|
}>(),
|
|
}>(),
|
|
|
{
|
|
{
|
|
|
|
|
+ mainConfig: () => ({
|
|
|
|
|
+ configs: [],
|
|
|
|
|
+ }),
|
|
|
|
|
+ monitorHistoryConfig: () => ({}),
|
|
|
|
|
+ handlerHistoryConfig: () => ({}),
|
|
|
|
|
+ alarmHistoryConfig: () => ({}),
|
|
|
pagetype: 'normal',
|
|
pagetype: 'normal',
|
|
|
- onlyBounedDevices: false,
|
|
|
|
|
- showHistoryCurve: false,
|
|
|
|
|
|
|
+ showDeviceList: true,
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
const { currentRoute } = useRouter();
|
|
const { currentRoute } = useRouter();
|
|
|
- const loading = ref(false);
|
|
|
|
|
|
|
|
|
|
const activeKey = ref('monitor');
|
|
const activeKey = ref('monitor');
|
|
|
|
|
|
|
@@ -130,8 +162,11 @@
|
|
|
const options = ref([]);
|
|
const options = ref([]);
|
|
|
const optionValue = ref('');
|
|
const optionValue = ref('');
|
|
|
|
|
|
|
|
|
|
+ /** 获取左上角场景选择框数据的方法,如果此时初始场景未赋值则选择首项做初始化 */
|
|
|
async function getSysDataSource() {
|
|
async function getSysDataSource() {
|
|
|
- const res = await sysList({ strtype: props.strtype, pagetype: props.pagetype });
|
|
|
|
|
|
|
+ const res = await sysList({ strtype: props.strtype, pagetype: props.pagetype }).catch(() => {
|
|
|
|
|
+ message.error('获取场景数据时发生了错误');
|
|
|
|
|
+ });
|
|
|
// 初始时选择第一条数据
|
|
// 初始时选择第一条数据
|
|
|
options.value = res.records || [];
|
|
options.value = res.records || [];
|
|
|
if (!optionValue.value) {
|
|
if (!optionValue.value) {
|
|
@@ -151,16 +186,18 @@
|
|
|
const deviceType = ref('');
|
|
const deviceType = ref('');
|
|
|
|
|
|
|
|
function deviceChange(index) {
|
|
function deviceChange(index) {
|
|
|
- deviceType.value = deviceList.value[index].deviceType;
|
|
|
|
|
- deviceActive.value = deviceList.value[index].deviceType;
|
|
|
|
|
|
|
+ deviceType.value = deviceList.value[index]?.deviceType || '';
|
|
|
|
|
+ deviceActive.value = deviceList.value[index]?.deviceType || '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 查询关联设备列表
|
|
// 查询关联设备列表
|
|
|
async function getDeviceList() {
|
|
async function getDeviceList() {
|
|
|
- const { msgTxt = [] } = await getDevice({ devicetype: 'sys', systemID: optionValue.value });
|
|
|
|
|
|
|
+ const { msgTxt = [] } = await getDevice({ devicetype: 'sys', systemID: optionValue.value }).catch(() => {
|
|
|
|
|
+ message.error('获取已绑定设备时发生了错误');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
deviceList.value = msgTxt.reduce((arr, item) => {
|
|
deviceList.value = msgTxt.reduce((arr, item) => {
|
|
|
- const data = item.datalist.forEach((data: any) => {
|
|
|
|
|
|
|
+ const data = item.datalist.map((data: any) => {
|
|
|
return Object.assign(data, data.readData);
|
|
return Object.assign(data, data.readData);
|
|
|
});
|
|
});
|
|
|
// sys代表场景本身,应该过滤掉去处理该场景下的关联设备
|
|
// sys代表场景本身,应该过滤掉去处理该场景下的关联设备
|
|
@@ -173,45 +210,66 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return arr;
|
|
return arr;
|
|
|
- });
|
|
|
|
|
|
|
+ }, []);
|
|
|
if (!deviceActive.value) {
|
|
if (!deviceActive.value) {
|
|
|
deviceChange(0);
|
|
deviceChange(0);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** 获取操作历史 */
|
|
|
|
|
- function getHandlerList() {
|
|
|
|
|
- return sysList({ strtype: deviceType.value });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function getAlarmList() {
|
|
|
|
|
- return (params) => defHttp.get({ url: '/safety/managesysAutoLog/list', params });
|
|
|
|
|
|
|
+ let timer: NodeJS.Timeout;
|
|
|
|
|
+ const monitorData = ref<any>({});
|
|
|
|
|
+ /** 获取本场景下所绑定的设备,将监测数据赋值 */
|
|
|
|
|
+ async function getMonitor() {
|
|
|
|
|
+ if (props.mainConfig.monitorApi) {
|
|
|
|
|
+ monitorData.value = await props.mainConfig
|
|
|
|
|
+ .monitorApi({
|
|
|
|
|
+ deviceType: deviceType.value,
|
|
|
|
|
+ deviceId: optionValue.value,
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {
|
|
|
|
|
+ message.error('获取已绑定设备时发生了错误');
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (optionValue.value) {
|
|
|
|
|
+ const { msgTxt = [] } = await getDevice({ devicetype: 'sys', systemID: optionValue.value }).catch(() => {
|
|
|
|
|
+ message.error('获取已绑定设备时发生了错误');
|
|
|
|
|
+ });
|
|
|
|
|
+ msgTxt.forEach((item) => {
|
|
|
|
|
+ _.set(monitorData.value, item.type, item.datalist);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- onMounted(() => {
|
|
|
|
|
|
|
+ onMounted(async () => {
|
|
|
if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
|
|
if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
|
|
|
optionValue.value = currentRoute.value['query']['id'] as string;
|
|
optionValue.value = currentRoute.value['query']['id'] as string;
|
|
|
}
|
|
}
|
|
|
- getSysDataSource();
|
|
|
|
|
|
|
+ await getSysDataSource();
|
|
|
|
|
+ if (props.mainConfig.timer !== 0) {
|
|
|
|
|
+ timer = setInterval(() => {
|
|
|
|
|
+ getMonitor();
|
|
|
|
|
+ }, props.mainConfig.timer || 5000);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ getMonitor();
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- onUnmounted(() => {});
|
|
|
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
|
+ clearInterval(timer);
|
|
|
|
|
+ });
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
|
@import '/@/design/vent/modal.less';
|
|
@import '/@/design/vent/modal.less';
|
|
|
@ventSpace: zxm;
|
|
@ventSpace: zxm;
|
|
|
.scene-box {
|
|
.scene-box {
|
|
|
- margin-top: 20px;
|
|
|
|
|
|
|
+ margin-top: 40px;
|
|
|
pointer-events: none;
|
|
pointer-events: none;
|
|
|
.history-group {
|
|
.history-group {
|
|
|
- padding: 0 20px;
|
|
|
|
|
|
|
+ margin-top: 80px;
|
|
|
|
|
+ padding: 0 10px;
|
|
|
.history-container {
|
|
.history-container {
|
|
|
pointer-events: auto;
|
|
pointer-events: auto;
|
|
|
- position: relative;
|
|
|
|
|
background: #6195af1a;
|
|
background: #6195af1a;
|
|
|
- width: calc(100% + 10px);
|
|
|
|
|
- top: 0px;
|
|
|
|
|
- left: -10px;
|
|
|
|
|
|
|
+ // width: 100%;
|
|
|
border: 1px solid #00fffd22;
|
|
border: 1px solid #00fffd22;
|
|
|
padding: 10px 0;
|
|
padding: 10px 0;
|
|
|
box-shadow: 0 0 20px #44b4ff33 inset;
|
|
box-shadow: 0 0 20px #44b4ff33 inset;
|
|
@@ -219,17 +277,17 @@
|
|
|
}
|
|
}
|
|
|
.device-button-group {
|
|
.device-button-group {
|
|
|
// margin: 0 20px;
|
|
// margin: 0 20px;
|
|
|
|
|
+ padding: 0 10px;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
pointer-events: auto;
|
|
pointer-events: auto;
|
|
|
position: relative;
|
|
position: relative;
|
|
|
- margin-top: 90px;
|
|
|
|
|
&::after {
|
|
&::after {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
content: '';
|
|
content: '';
|
|
|
- width: calc(100% + 10px);
|
|
|
|
|
|
|
+ width: 100%;
|
|
|
height: 2px;
|
|
height: 2px;
|
|
|
top: 30px;
|
|
top: 30px;
|
|
|
- left: -10px;
|
|
|
|
|
|
|
+ left: -1px;
|
|
|
border-bottom: 1px solid #0efcff;
|
|
border-bottom: 1px solid #0efcff;
|
|
|
}
|
|
}
|
|
|
.device-button {
|
|
.device-button {
|
|
@@ -268,7 +326,7 @@
|
|
|
}
|
|
}
|
|
|
.center-container {
|
|
.center-container {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
- height: calc(100% - 200px);
|
|
|
|
|
|
|
+ height: calc(100% - 150px);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.input-box {
|
|
.input-box {
|