| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <!-- eslint-disable vue/multi-word-component-names -->
- <template>
- <!-- 把 dedust3D 放到这里则模型可以正常旋转 -->
- <div id="dedust3D" v-show="activeKey == 'monitor'" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
- <div class="scene-box">
- <customHeader
- :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }"
- :options="options"
- :optionValue="optionValue"
- @change="getSelectRow"
- >
- 除尘风机智能管控
- </customHeader>
- <div class="center-container">
- <template v-if="activeKey == 'monitor'">
- <DedustHome :deviceId="optionValue" />
- </template>
- <div v-else class="history-group">
- <div class="device-button-group" v-if="deviceList.length > 0 && activeKey !== 'faultRecord'">
- <div
- class="device-button"
- :class="{ 'device-active': deviceActive == device.deviceType }"
- v-for="(device, index) in deviceList"
- :key="index"
- @click="deviceChange(index)"
- >{{ device.deviceName }}</div
- >
- </div>
- <div class="history-container">
- <DedustHistory
- v-if="activeKey == 'monitor_history'"
- ref="historyTable"
- class="vent-margin-t-20"
- :deviceId="optionValue"
- :device-type="deviceType"
- />
- <HandleHistory
- v-if="activeKey == 'handler_history'"
- ref="alarmHistoryTable"
- class="vent-margin-t-20"
- :deviceId="optionValue"
- :device-type="deviceType"
- />
- <AlarmHistory
- v-if="activeKey == 'faultRecord'"
- ref="handlerHistoryTable"
- class="vent-margin-t-20"
- :deviceId="optionValue"
- :device-type="deviceType"
- />
- </div>
- </div>
- </div>
- <BottomMenu @change="changeActive" />
- </div>
- </template>
- <script setup lang="ts">
- import { onBeforeMount, ref, onMounted, reactive } from 'vue';
- import { systemList, getTableList } from './dedust.api';
- import customHeader from '/@/components/vent/customHeader.vue';
- import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
- import DedustHome from './components/DedustHome.vue';
- import DedustHistory from './components/DedustHistory.vue';
- import HandleHistory from './components/HandleHistory.vue';
- import AlarmHistory from './components/AlarmHistory.vue';
- import { useRouter } from 'vue-router';
- type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
- const { currentRoute } = useRouter();
- const activeKey = ref('monitor');
- const historyTable = ref();
- const alarmHistoryTable = ref();
- const handlerHistoryTable = ref();
- //关联设备
- const deviceList = ref<DeviceType[]>([]);
- const deviceActive = ref('');
- const deviceType = ref('');
- const options = ref();
- // 默认初始是第一行
- // const selectRowIndex = ref(0);
- const dataSource = ref([]);
- const optionValue = ref('');
- // 监测数据
- const selectData = reactive({});
- function changeActive(activeValue) {
- activeKey.value = activeValue;
- }
- function deviceChange(index) {
- deviceActive.value = deviceType.value = deviceList.value[index].deviceType;
- }
- // 查询关联设备列表
- async function getDeviceList() {
- const res = await systemList({ devicetype: 'sys', systemID: optionValue.value });
- if (res && res.msgTxt && res.msgTxt.length) {
- const result = res.msgTxt;
- const deviceArr: DeviceType[] = [];
- result.forEach((item) => {
- const data = item['datalist'].filter((data: any) => {
- const readData = data.readData;
- return Object.assign(data, readData);
- });
- if (item.type != 'sys') {
- deviceArr.unshift({
- deviceType: item.type,
- deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'],
- datalist: data,
- });
- }
- });
- deviceList.value = deviceArr;
- deviceActive.value = deviceArr[0].deviceType;
- deviceChange(0);
- }
- }
- async function getSysDataSource() {
- const res = await getTableList({ strtype: 'sys_surface_juejin', pagetype: 'normal' });
- if (!options.value && res) {
- // 初始时选择第一条数据
- options.value = res.records || [];
- if (!optionValue.value) {
- optionValue.value = options.value[0]['id'];
- getDeviceList();
- }
- }
- }
- // 切换检测数据
- async function getSelectRow(deviceID) {
- const currentData = dataSource.value.find((item: any) => {
- return item.deviceID == deviceID;
- });
- if (currentData) {
- optionValue.value = currentData['deviceID'];
- Object.assign(selectData, currentData);
- await getDeviceList();
- }
- }
- onBeforeMount(() => {});
- onMounted(async () => {
- if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
- optionValue.value = currentRoute.value['query']['id'] as string;
- }
- await getSysDataSource();
- await getDeviceList();
- });
- </script>
- <style lang="less" scoped>
- @import '/@/design/theme.less';
- @import '/@/design/vent/modal.less';
- .history-group {
- padding: 0 20px;
- margin-top: 90px;
- .history-container {
- position: relative;
- background: #6195af1a;
- width: calc(100% + 10px);
- top: 0px;
- left: -10px;
- border: 1px solid #00fffd22;
- padding: 10px 0;
- box-shadow: 0 0 20px #44b4ff33 inset;
- }
- }
- .device-button-group {
- // margin: 0 20px;
- display: flex;
- pointer-events: auto;
- position: relative;
- &::after {
- position: absolute;
- content: '';
- width: calc(100% + 10px);
- height: 2px;
- top: 30px;
- left: -10px;
- border-bottom: 1px solid var(--vent-base-border);
- }
- .device-button {
- padding: 4px 15px;
- position: relative;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 14px;
- color: var(--vent-font-color);
- cursor: pointer;
- margin: 0 3px;
- &::before {
- content: '';
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- border: 1px solid #6176af;
- transform: skewX(-38deg);
- background-color: rgba(0, 77, 103, 85%);
- z-index: -1;
- }
- }
- .device-active {
- // color: #0efcff;
- &::before {
- border-color: #0efcff;
- box-shadow: 1px 1px 3px 1px #0efcff inset;
- }
- }
- }
- </style>
|