123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794 |
- <template>
- <div class="bg" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
- <a-spin :spinning="loading" />
- <div id="window3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
- </div>
- <div class="scene-box">
- <div class="top-box">
- <div class="top-center row">
- <div v-if="hasPermission('btn:testWind')" class="button-box" @click="startRun()">启动测风</div>
-
-
-
-
-
- </div>
-
- </div>
- <div class="title-text">
- {{ selectData.supplyAirAddr || selectData.strname }}
- </div>
- <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 350, scroll)">
- <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 120}px`">
- <div class="tabs-button-group">
- <a-button class="tabs-button" type="primary" @click="openModel">一键测风</a-button>
- </div>
- <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
- <a-tab-pane key="1" tab="实时监测">
- <MonitorTable
- v-if="activeKey === '1'"
- ref="MonitorDataTable"
- columnsType="windrect_monitor"
- :dataSource="dataSource"
- design-scope="windrect-monitor"
- @selectRow="getSelectRow"
- :scroll="{ y: scroll.y - 40 }"
- title="测风装置监测"
- :isShowPagination="true"
- :isShowActionColumn="true"
- >
- <template #filterCell="{ column, record }">
- <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#FF5812' : 'green'">{{
- record.netStatus == '0' ? '断开' : '连接'
- }}</a-tag>
- <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
- {{ record.warnFlag == '0' ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
- >
- <a-tag v-if="column.dataIndex === 'sign'" :color="record.sign == '0' ? '#95CF65' : record.sign == 1 ? '#4590EA' : '#9876AA'">
- {{ record.sign == '0' ? '高位' : record.sign == 1 ? '中位' : '低位' }}</a-tag
- >
- <template v-if="record && column && column.dataIndex === 'isRun' && record.isRun">
- <a-tag v-if="record.isRun == -2 || record.isRun == -1" :color="record.isRun == -2 ? '#95CF65' : '#ED5700'">{{
- record.isRun == -2 ? '空闲' : '等待'
- }}</a-tag>
- <a-tag v-else-if="record.isRun == 100" color="#4693FF">空闲</a-tag>
- <Progress v-else :percent="Number(record.isRun)" size="small" status="active" />
- </template>
- </template>
- <template #action="{ record }">
- <a v-if="globalConfig?.showReport" class="table-action-link" @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
- <a class="table-action-link" @click="deviceEdit($event, 'deviceInfo', record)">设备编辑</a>
- </template>
- </MonitorTable>
- </a-tab-pane>
- <a-tab-pane key="2" tab="监测曲线图" force-render>
- <div class="tab-item" v-if="activeKey === '2'">
- <DeviceEcharts
- chartsColumnsType="windrect_chart"
- xAxisPropType="strname"
- :dataSource="dataSource"
- height="100%"
- :chartsColumns="chartsColumnList"
- :device-list-api="list.bind(null, { devicetype: 'windrect', pagetype: 'normal' })"
- device-type="windrect"
- />
- </div>
- </a-tab-pane>
- <a-tab-pane key="3" tab="历史数据">
- <div class="tab-item">
- <HistoryTable columns-type="windrect" device-type="windrect" designScope="windrect-history" :scroll="scroll">
-
- {{
- record.warnFlag == '0' ? '正常' : '报警'
- }}
- {{
- record.netStatus == '0' ? '断开' : '连接'
- }}
- </HistoryTable>
- </div>
- </a-tab-pane>
- <a-tab-pane key="4" tab="报警历史">
- <div class="tab-item" v-if="activeKey === '4'">
- <AlarmHistoryTable columns-type="alarm" device-type="windrect" designScope="alarm-history" :scroll="scroll" />
- </div>
- </a-tab-pane>
-
- <a-tab-pane v-if="hasPermission('windrect:result')" key="6" tab="测风结果">
- <ResultTable v-if="activeKey === '6'" deviceType="windrect_list" :scroll="scroll" />
- </a-tab-pane>
- </a-tabs>
- </dv-border-box8>
- </div>
- </div>
- <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 10px; width: 300px; height: 280px; margin: auto"></div>
- <BasicModal v-bind="$attrs" @register="registerModal" title="一键测风" width="900px" @ok="handleOk" @cancel="handleCancel">
- <div class="head-line">
-
- <div class="vent-flex-row">
- <div v-for="(criticalPath, index) in criticalPathList" :key="index" class="button-box" @click="selectCriticalPath(criticalPath.id)">{{
- criticalPath.systemname
- }}</div>
- </div>
- </div>
- <div>
- <ModalTable ref="modalTable" deviceType="windrect_list" />
- </div>
- </BasicModal>
- <HandleModal
- v-if="!globalConfig?.simulatedPassword"
- :modal-is-show="modalIsShow"
- modal-title="启动测风"
- :modal-type="modalType"
- @handle-ok="controlDevice"
- @handle-cancel="handleCancelControl"
- />
- <DeviceBaseInfo @register="regModal" :device-type="selectData['deviceType']" />
- </template>
- <script setup lang="ts">
- import DeviceEcharts from '../comment/DeviceEcharts.vue';
- import { onBeforeMount, ref, onMounted, onUnmounted, reactive, toRaw, nextTick, inject } from 'vue';
- import { BasicModal, useModalInner } from '/@/components/Modal';
- import MonitorTable from '../comment/MonitorTable.vue';
- import ModalTable from './components/modalTable.vue';
- import HandleModal from './components/modal.vue';
- import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
- import ResultTable from './components/resultTable.vue';
- import HistoryTable from '../comment/HistoryTable.vue';
- import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
- import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
- import { deviceControlApi } from '/@/api/vent/index';
- import { mountedThree, destroy, addMonitorText, play, setModelType, playCamera } from './windrect.threejs';
- import { list, pathList, deviceList, testWind, exportXls } from './windrect.api';
- import { message, Progress } from 'ant-design-vue';
- import { chartsColumns, option } from './windrect.data';
- import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
- import { setDivHeight } from '/@/utils/event';
- import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
- import { useRouter } from 'vue-router';
- import { useModal } from '/@/components/Modal';
- import { useCamera } from '/@/hooks/system/useCamera';
- import { usePermission } from '/@/hooks/web/usePermission';
- const { hasPermission } = usePermission();
- const globalConfig = inject('globalConfig');
- const { currentRoute } = useRouter();
- const MonitorDataTable = ref();
- const scroll = reactive({
- y: 230,
- });
- const modalType = ref('');
- const modalIsShow = ref(false);
- const modalTable = ref();
- const runNum = ref(5);
- const criticalPathList = ref([]);
- const playerRef = ref();
- const activeKey = ref('1');
- const loading = ref(false);
-
- const selectRowIndex = ref(-1);
-
- const selectData = reactive({
- deviceID: '',
- deviceType: '',
- strname: '',
- dataDh: '-',
- dataDtestq: '-',
-
- dataDequivalarea: '-',
- netStatus: '0',
- fault: '气源压力超限',
- sign: -1,
- sensorRight: 0,
- sensorMiddle: 1,
- sensorLeft: 0,
- });
- const chartsColumnArr = getTableHeaderColumns('windrect_chart');
- const chartsColumnList = ref(chartsColumnArr.length > 0 ? chartsColumnArr : chartsColumns);
-
-
-
-
-
-
- const dataSource = ref([]);
- const [regModal, { openModal }] = useModal();
- const { getCamera, removeCamera } = useCamera();
- const tabChange = (activeKeyVal) => {
- activeKey.value = activeKeyVal;
- if (activeKeyVal == 1) {
- nextTick(() => {
- MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
- });
- }
- };
-
- const controlType = ref(1);
-
- const [registerModal, { setModalProps, closeModal }] = useModalInner();
-
- let timer: null | NodeJS.Timeout = null;
- function getMonitor(flag?) {
- if (Object.prototype.toString.call(timer) === '[object Null]') {
- timer = setTimeout(
- () => {
- list({ devicetype: 'windrect', pagetype: 'normal' }).then((res) => {
- if (res && res.msgTxt[0]) {
- dataSource.value = res.msgTxt[0].datalist || [];
- if (dataSource.value.length > 0) {
- dataSource.value.forEach((data: any) => {
- const readData = data.readData;
- data = Object.assign(data, readData);
- });
- if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
-
- if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
- MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
- } else {
- MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
- }
- }
- const data: any = toRaw(dataSource.value[selectRowIndex.value]);
- Object.assign(selectData, data);
- addMonitorText(selectData);
- palyAnimation(selectData);
- }
- }
- if (timer) {
- timer = null;
- }
- getMonitor();
- });
- },
- flag ? 0 : 1000
- );
- }
- }
- let deviceRunState = '',
- tanTouRunState = '';
-
- function palyAnimation(selectData) {
- if (selectData.deviceType == 'windrect_normal') {
- if (selectData['apparatusRun'] == 1) {
- const flag = selectData.sign == '0' ? 'up' : selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null;
- if (flag) play(flag);
- } else {
- const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : null;
- if (flag) play(flag, true);
- }
- }
-
- if (selectData.deviceType == 'windrect_rect_single') {
- if (selectData['apparatusRun'] == 1) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (selectData['poleIncipient'] == 1) {
-
- if (selectData.sensorMiddle == 1 && !deviceRunState && !tanTouRunState) {
-
- deviceRunState = 'up';
- tanTouRunState = 'middle';
- play('up', true);
- play('middle', true);
- }
- if (deviceRunState == 'up-m') {
- play('up', true);
- play('middle', true);
- deviceRunState = '';
- tanTouRunState = '';
- playCamera('end');
- }
-
- if (selectData.sensorLeft == '0' && selectData.sensorMiddle == '0' && selectData.sensorRight == '0') {
-
- if (tanTouRunState == 'middle') {
- tanTouRunState = 'left-m';
- play('left');
- }
-
- if (tanTouRunState == 'left') {
- tanTouRunState = 'right-m';
- play('right');
- }
- }
- if (selectData.sensorLeft == 1) {
- tanTouRunState = 'left';
- if (!tanTouRunState || tanTouRunState == 'left-m') {
- play('left', true);
- }
- }
- if (selectData.sensorRight == 1) {
- tanTouRunState = 'right';
- if (!tanTouRunState || tanTouRunState == 'right-m') {
- play('right', true);
- }
- }
- } else if (selectData['poleMiddle'] == 1) {
- if (deviceRunState == 'center-m') {
- play('center', true);
- deviceRunState = 'center';
- tanTouRunState = 'right';
- play('right', true);
- }
- if (!deviceRunState) {
- deviceRunState = 'center';
- play('center', true);
- }
- if (!tanTouRunState) {
- play('right', true);
- }
-
- if (selectData.sensorLeft == '0' && selectData.sensorMiddle == '0' && selectData.sensorRight == '0') {
-
- if (tanTouRunState == 'right') {
- tanTouRunState = 'middle-m';
- play('middle');
- }
-
- if (tanTouRunState == 'middle') {
- tanTouRunState = 'left-m';
- play('left');
- }
- }
- if (selectData.sensorMiddle == 1) {
- tanTouRunState = 'middle';
- if (!tanTouRunState || tanTouRunState == 'middle-m') {
- play('middle', true);
- }
- }
- if (selectData.sensorLeft == 1) {
- tanTouRunState = 'left';
- if (!tanTouRunState || tanTouRunState == 'left-m') {
- play('left', true);
- }
- }
- } else if (selectData['poleNether'] == 1) {
- if (deviceRunState == 'down-m') {
- play('down', true);
- deviceRunState = 'down';
- tanTouRunState = 'left';
- play('left', true);
- }
- if (!deviceRunState) {
- play('down', true);
- deviceRunState = 'down';
- }
- if (!tanTouRunState) {
- play('left', true);
- }
-
- if (selectData.sensorLeft == '0' && selectData.sensorMiddle == '0' && selectData.sensorRight == '0') {
-
- if (tanTouRunState == 'left') {
- tanTouRunState = 'left-middle-m';
- play('middle');
- }
-
- if (tanTouRunState == 'middle1') {
- tanTouRunState = 'right-m';
- play('right');
- }
-
- if (tanTouRunState == 'right') {
- tanTouRunState = 'right-middle-m';
- play('middle');
- }
- }
- if (selectData.sensorMiddle == 1) {
- if (tanTouRunState == 'left-middle-m') tanTouRunState = 'middle1';
- if (tanTouRunState == 'right-middle-m') tanTouRunState = 'middle2';
- if (!tanTouRunState || tanTouRunState == 'left-middle-m' || tanTouRunState == 'right-middle-m') {
- play('middle', true);
- }
- }
- if (selectData.sensorRight == 1) {
- tanTouRunState = 'right';
- if (!tanTouRunState || tanTouRunState == 'right-m') {
- play('right', true);
- }
- }
- } else {
-
- if (deviceRunState == 'up') {
- deviceRunState = 'center-m';
- play('center');
- }
- if (deviceRunState == 'center') {
- deviceRunState = 'down-m';
- play('down');
- }
- if (deviceRunState == 'down') {
- deviceRunState = 'up-m';
- play('up');
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- } else {
-
-
-
-
- }
- }
- if (selectData.deviceType == 'windrect_rect') {
- if (selectData['apparatusRun'] == 1) {
- const flag = selectData.sign == '0' ? 'center' : selectData.sign == 1 ? 'down' : selectData.sign == 2 ? 'up' : null;
- if (flag) play(flag);
- } else {
- const flag = selectData.sign == 1 ? 'center' : selectData.sign == 2 ? 'down' : selectData.sign == '0' ? 'up' : null;
- if (flag) play(flag, true);
- }
- }
- if (selectData.deviceType == 'windrect_ds') {
- if (selectData['apparatusRun'] == 1) {
- if (!deviceRunState) {
- deviceRunState = 'start';
- play('start');
- }
- } else {
- deviceRunState = '';
- play('start', true);
- }
- }
- }
-
- function testPlay(flag) {
- if (selectData.deviceType == 'windrect_rect') {
- setTimeout(() => {
- play('center');
- }, 0);
- setTimeout(() => {
- play('down');
- }, 4000);
- setTimeout(() => {
- play('up');
- }, 10000);
- }
- if (selectData.deviceType == 'windrect_normal') {
- setTimeout(() => {
- play('up');
- }, 0);
- setTimeout(() => {
- play('center');
- }, 10000);
- setTimeout(() => {
- play('down');
- }, 18000);
- setTimeout(() => {
- play('up');
- }, 21000);
- }
- if (selectData.deviceType == 'windrect_ds') {
- play('moni');
- }
- }
- function clearPlay() {
- modalType.value = 'autoClear';
- modalIsShow.value = true;
- if (globalConfig?.simulatedPassword) {
- controlDevice('', modalType.value);
- }
- }
- function startRun() {
- modalType.value = 'sing';
- modalIsShow.value = true;
- if (globalConfig?.simulatedPassword) {
- controlDevice('', modalType.value);
- }
- }
-
- async function getSelectRow(selectRow, index) {
- if (selectRow) {
- loading.value = true;
- selectRowIndex.value = index;
- Object.assign(selectData, selectRow);
- let type = '';
- if (selectRow.deviceType.startsWith('windrect_rect')) {
- type = 'lmWindRect';
- }
- if (selectRow.deviceType.startsWith('windrect_normal')) {
- type = 'zdWindRect';
- }
- if (selectRow.deviceType.startsWith('windrect_rect_single')) {
- type = 'lmWindSide';
- }
- if (selectRow.deviceType.startsWith('windrect_ds')) {
- type = 'dsWindRect_move';
- }
- if (selectRow.deviceType.startsWith('windrect_ds_four')) {
- type = 'dsWindRect_four';
- }
- if (
- selectRow.deviceType.startsWith('windrect_ds_two') ||
- selectRow.deviceType.startsWith('windrect_ds_sut') ||
- selectRow.deviceType.startsWith('windrect_muti')
- ) {
- type = 'duisheFixed';
- }
- if (selectRow.deviceType.startsWith('windrect_dd') || selectRow.deviceType == 'windrect_safety' || selectRow.deviceType == 'windrect_sensor') {
- type = 'ddWindSide';
- }
-
- await setModelType(type);
- loading.value = false;
- deviceRunState = '';
- tanTouRunState = '';
- await getCamera(selectRow.deviceID, playerRef.value);
- }
- }
-
- function handleOk() {
- modalType.value = 'multiple';
- modalIsShow.value = true;
- if (globalConfig?.simulatedPassword) {
- controlDevice('', modalType.value);
- }
- }
-
- function openModel() {
- setModalProps({ visible: true });
- }
- function exportExcel(id) {
- exportXls({ testid: id });
- }
-
- function handleCancel() {
- setModalProps({ visible: false });
- modalTable.value.clearSelectedRowKeys();
- }
-
- function handleCancelControl() {
- modalIsShow.value = false;
- }
- function controlDevice(passWord, type) {
- try {
- if (type == 'sing') {
- testWind({ ids: [selectData.deviceID], maxnum: runNum.value, password: passWord || globalConfig?.simulatedPassword }).then((res) => {
- message.success('开始测风。。。');
- modalIsShow.value = false;
- });
- } else if (type == 'multiple') {
- const ids = toRaw(modalTable.value.selectedRowKeys);
- testWind({ ids: ids, maxnum: runNum.value, password: passWord || globalConfig?.simulatedPassword }).then((res) => {
- message.success(res);
- setModalProps({ visible: false });
- modalTable.value.clearSelectedRowKeys();
- modalIsShow.value = false;
- });
- } else if (type == 'autoClear') {
- const data = {
- deviceid: selectData.deviceID,
- devicetype: selectData.deviceType,
- paramcode: 'autoClear',
- value: null,
- password: passWord || globalConfig?.simulatedPassword,
- masterComputer: selectData.masterComputer,
- };
- deviceControlApi(data).then((res) => {
-
- if (res.success) {
- if (globalConfig.History_Type == 'remote') {
- message.success('指令已下发至生产管控平台成功!');
- } else {
- message.success('指令已下发成功!');
- }
- }
- modalIsShow.value = false;
- });
- }
- } catch (error) {
- message.error('测风失败,请联系管理员。。。');
- modalIsShow.value = false;
- }
- }
-
- async function getPathList() {
- const pathArr = await pathList({});
- criticalPathList.value = pathArr.records.filter((item) => {
- return item.strsystype == 3;
- });
- }
-
- function selectCriticalPath(pathId) {
- deviceList({ deviceType: 'wind', sysId: pathId }).then((res) => {
- const ids: string[] = [];
- res.records.forEach((item) => {
- ids.push(item.id);
- });
- if (modalTable.value) modalTable.value.setSelectedRowKeys(ids);
- });
- }
- function deviceEdit(e: Event, type: string, record) {
- e.stopPropagation();
- openModal(true, {
- type,
- deviceId: record['deviceID'],
- });
- }
- onBeforeMount(() => {
- getPathList();
- });
- onMounted(() => {
- const playerDom = document.getElementById('cf-player1')?.getElementsByClassName('vjs-tech')[0];
- loading.value = true;
- mountedThree(playerDom).then(async () => {
- getMonitor(true);
-
- });
- });
- onUnmounted(() => {
- removeCamera();
- if (timer) {
- clearTimeout(timer);
- timer = undefined;
- }
- destroy();
- });
- </script>
- <style scoped lang="less">
- @import '/@/design/vent/modal.less';
- @ventSpace: zxm;
- :deep(.@{ventSpace}-tabs-tabpane-active) {
- height: 100%;
- }
- .scene-box {
- .bottom-tabs-box {
- height: 350px;
- }
- }
- .head-line {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- .button-box {
- position: relative;
- padding: 5px;
- border: 1px transparent solid;
- border-radius: 5px;
- margin-left: 8px;
- margin-right: 8px;
- width: auto;
- height: 34px;
- border: 1px solid #65dbea;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #fff;
- padding: 0 15px;
- cursor: pointer;
- pointer-events: auto;
- &:hover {
- background: linear-gradient(#3eb2ff55, #00c3ff55);
- }
- &::before {
- width: calc(100% - 6px);
- height: 26px;
- content: '';
- position: absolute;
- top: 3px;
- right: 0;
- left: 3px;
- bottom: 0;
- z-index: -1;
- border-radius: inherit; /*important*/
- background: linear-gradient(#014978, #3bf3fc);
- }
- }
- }
- </style>
|