Browse Source

[Fix 0000]风门控制逻辑修复

bobo04052021@163.com 1 day ago
parent
commit
8a3658cb8a
3 changed files with 529 additions and 532 deletions
  1. 3 10
      pnpm-lock.yaml
  2. 521 521
      src/views/vent/monitorManager/gateMonitor/index.vue
  3. 5 1
      vite.config.ts

+ 3 - 10
pnpm-lock.yaml

@@ -122,9 +122,6 @@ importers:
       katex:
         specifier: ^0.16.25
         version: 0.16.25
-      lodash:
-        specifier: ^4.17.21
-        version: 4.17.21
       lodash-es:
         specifier: ^4.17.21
         version: 4.17.21
@@ -140,9 +137,6 @@ importers:
       mky-svg:
         specifier: ^1.0.2
         version: 1.0.2
-      mockjs:
-        specifier: ^1.1.0
-        version: 1.1.0
       moment:
         specifier: ^2.29.4
         version: 2.30.1
@@ -411,6 +405,9 @@ importers:
       lint-staged:
         specifier: 14.0.1
         version: 14.0.1
+      mockjs:
+        specifier: ^1.1.0
+        version: 1.1.0
       npm-run-all:
         specifier: ^4.1.5
         version: 4.1.5
@@ -1866,28 +1863,24 @@ packages:
     engines: {node: '>=10'}
     cpu: [arm64]
     os: [linux]
-    libc: [glibc]
 
   '@swc/core-linux-arm64-musl@1.15.2':
     resolution: {integrity: sha512-5av6VYZZeneiYIodwzGMlnyVakpuYZryGzFIbgu1XP8wVylZxduEzup4eP8atiMDFmIm+s4wn8GySJmYqeJC0A==}
     engines: {node: '>=10'}
     cpu: [arm64]
     os: [linux]
-    libc: [musl]
 
   '@swc/core-linux-x64-gnu@1.15.2':
     resolution: {integrity: sha512-1nO/UfdCLuT/uE/7oB3EZgTeZDCIa6nL72cFEpdegnqpJVNDI6Qb8U4g/4lfVPkmHq2lvxQ0L+n+JdgaZLhrRA==}
     engines: {node: '>=10'}
     cpu: [x64]
     os: [linux]
-    libc: [glibc]
 
   '@swc/core-linux-x64-musl@1.15.2':
     resolution: {integrity: sha512-Ksfrb0Tx310kr+TLiUOvB/I80lyZ3lSOp6cM18zmNRT/92NB4mW8oX2Jo7K4eVEI2JWyaQUAFubDSha2Q+439A==}
     engines: {node: '>=10'}
     cpu: [x64]
     os: [linux]
-    libc: [musl]
 
   '@swc/core-win32-arm64-msvc@1.15.2':
     resolution: {integrity: sha512-IzUb5RlMUY0r1A9IuJrQ7Tbts1wWb73/zXVXT8VhewbHGoNlBKE0qUhKMED6Tv4wDF+pmbtUJmKXDthytAvLmg==}

+ 521 - 521
src/views/vent/monitorManager/gateMonitor/index.vue

@@ -401,589 +401,589 @@
 </template>
 
 <script setup lang="ts">
-  import { onBeforeUnmount, onUnmounted, onMounted, ref, reactive, nextTick, inject, unref, defineAsyncComponent, provide } from 'vue';
-  import MonitorTable from '../comment/MonitorTable.vue';
-  import HistoryTable from '../comment/HistoryTable.vue';
-  import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
-  import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
-  import WindDoorFaultTable from './components/WindDoorFaultTable.vue';
-  import CarDamageTable from './components/CarDamageTable.vue';
-  import AlarmHistoryTableHj from './components/AlarmHistoryTableHj.vue';
-  import HandleModal from './modal.vue';
-  import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
-  import { mountedThree, addMonitorText, play, destroy, setModelType, computePlay } from './gate.threejs';
-  import { deviceControlApi } from '/@/api/vent/index';
-  import { message } from 'ant-design-vue';
-  import { list, getTableList, cameraList, cameraAddrList, getOrderByCount, getCarList } from './gate.api';
-  import { chartsColumns, getModelComponent } from './gate.data';
-  import { cloneDeep } from 'lodash-es';
-  import { setDivHeight } from '/@/utils/event';
-  import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
-  import { useRouter } from 'vue-router';
-  import LivePlayer from '@liveqing/liveplayer-v3';
-  import { useModal } from '/@/components/Modal';
-  import { useCamera } from '/@/hooks/system/useCamera';
-  import { usePermission } from '/@/hooks/web/usePermission';
-  import { getDictItems } from '/@/api/common/api';
-  import { render } from '/@/utils/common/renderUtils';
-  import { useGlobSetting } from '/@/hooks/setting';
-  import { getDictItemsByCode } from '/@/utils/dict';
-  import HistoryTableChart from '../comment/HistoryTableChart.vue';
-
-  const { hasPermission } = usePermission();
-  const { sysOrgCode } = useGlobSetting();
-  const globalConfig = inject<any>('globalConfig');
-
-  const modelRef = ref();
-  /** 模型对应的组件,根据实际情况分为二维三维 */
-  const modelComponent = getModelComponent(globalConfig.is2DModel);
-
-  const { currentRoute } = useRouter();
-  const gateId = ref(''); //风门ID
-  const MonitorDataTable = ref();
-  let contrlValue = '';
-  const playerRef = ref();
-  const deviceType = ref('gate');
-  const activeKey = ref('1'); // tab
-  const loading = ref(false);
-  const renderPlayer = ref(true);
-  // const stationType = ref('plc1');
-  const scroll = reactive({
-    y: 230,
-  });
-  const modelList = ref<{ text: string; value: string }[]>([]);
-  const frontDoorIsOpen = ref(false); //前门是否开启
-  const backDoorIsOpen = ref(false); //后门是否开启
-  const midDoorIsOpen = ref(false); //中间门是否开启
-
-  const modalIsShow = ref<boolean>(false); // 是否显示模态框
-  const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
-  const modalType = ref(''); // 模态框内容显示类型,设备操作类型
-
-  const selectRowIndex = ref(-1); // 选中行
-  const dataSource = ref([]);
-  const sharedData = ref([]);
-  const deviceBaseList = ref([]); // 设备基本信息
-  const updateSharedData = (data) => {
-    sharedData.value = data;
-  };
-  const Option = {
-    grid: {
-      top: '20%',
-      left: '5%',
-      right: '5%',
-      bottom: '3%',
-      containLabel: true,
-    },
-    toolbox: {
-      feature: null,
-    },
-  };
-
-  /** 封装通用的模态框打开方法(setControl 模式:点位code直接传参) */
-  const openGateControlModal = (paramcode: string, title: string) => {
-    modalType.value = paramcode;
-    modalTitle.value = title;
-    modalIsShow.value = true;
-
-    // 模拟密码模式下直接执行操作
-    if (globalConfig?.simulatedPassword) {
-      handleOK('', paramcode);
-    }
-  };
-
-  /** 统一控制入口:点位code + 标题 直接传参(与 windowMonitor 的 setControl 模式一致) */
-  const setControl = (paramcode: string, title: string) => {
-    openGateControlModal(paramcode, title);
-  };
-
-  /** 控制模式切换(paramcode 需根据 contrlMod + contrlValue 动态决定) */
-  const setControlMode = (value?: string) => {
-    contrlValue = value;
-    openGateControlModal('modeSwitch', '控制模式切换');
-  };
-
-  const [registerModal, { openModal, closeModal }] = useModal();
-
-  const { getCamera, removeCamera } = useCamera();
+import { onBeforeUnmount, onUnmounted, onMounted, ref, reactive, nextTick, inject, unref, defineAsyncComponent, provide } from 'vue';
+import MonitorTable from '../comment/MonitorTable.vue';
+import HistoryTable from '../comment/HistoryTable.vue';
+import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
+import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
+import WindDoorFaultTable from './components/WindDoorFaultTable.vue';
+import CarDamageTable from './components/CarDamageTable.vue';
+import AlarmHistoryTableHj from './components/AlarmHistoryTableHj.vue';
+import HandleModal from './modal.vue';
+import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
+import { mountedThree, addMonitorText, play, destroy, setModelType, computePlay } from './gate.threejs';
+import { deviceControlApi } from '/@/api/vent/index';
+import { message } from 'ant-design-vue';
+import { list, getTableList, cameraList, cameraAddrList, getOrderByCount, getCarList } from './gate.api';
+import { chartsColumns, getModelComponent } from './gate.data';
+import { cloneDeep } from 'lodash-es';
+import { setDivHeight } from '/@/utils/event';
+import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
+import { useRouter } from 'vue-router';
+import LivePlayer from '@liveqing/liveplayer-v3';
+import { useModal } from '/@/components/Modal';
+import { useCamera } from '/@/hooks/system/useCamera';
+import { usePermission } from '/@/hooks/web/usePermission';
+import { getDictItems } from '/@/api/common/api';
+import { render } from '/@/utils/common/renderUtils';
+import { useGlobSetting } from '/@/hooks/setting';
+import { getDictItemsByCode } from '/@/utils/dict';
+import HistoryTableChart from '../comment/HistoryTableChart.vue';
+
+const { hasPermission } = usePermission();
+const { sysOrgCode } = useGlobSetting();
+const globalConfig = inject<any>('globalConfig');
+
+const modelRef = ref();
+/** 模型对应的组件,根据实际情况分为二维三维 */
+const modelComponent = getModelComponent(globalConfig.is2DModel);
+
+const { currentRoute } = useRouter();
+const gateId = ref(''); //风门ID
+const MonitorDataTable = ref();
+let contrlValue = '';
+const playerRef = ref();
+const deviceType = ref('gate');
+const activeKey = ref('1'); // tab
+const loading = ref(false);
+const renderPlayer = ref(true);
+// const stationType = ref('plc1');
+const scroll = reactive({
+  y: 230,
+});
+const modelList = ref<{ text: string; value: string }[]>([]);
+const frontDoorIsOpen = ref(false); //前门是否开启
+const backDoorIsOpen = ref(false); //后门是否开启
+const midDoorIsOpen = ref(false); //中间门是否开启
+
+const modalIsShow = ref<boolean>(false); // 是否显示模态框
+const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
+const modalType = ref(''); // 模态框内容显示类型,设备操作类型
+
+const selectRowIndex = ref(-1); // 选中行
+const dataSource = ref([]);
+const sharedData = ref([]);
+const deviceBaseList = ref([]); // 设备基本信息
+const updateSharedData = (data) => {
+  sharedData.value = data;
+};
+const Option = {
+  grid: {
+    top: '20%',
+    left: '5%',
+    right: '5%',
+    bottom: '3%',
+    containLabel: true,
+  },
+  toolbox: {
+    feature: null,
+  },
+};
+
+/** 封装通用的模态框打开方法(setControl 模式:点位code直接传参) */
+const openGateControlModal = (paramcode: string, title: string) => {
+  modalType.value = paramcode;
+  modalTitle.value = title;
+  modalIsShow.value = true;
+
+  // 模拟密码模式下直接执行操作
+  if (globalConfig?.simulatedPassword) {
+    handleOK('', paramcode);
+  }
+};
 
-  const tabChange = (activeKeyVal) => {
-    activeKey.value = activeKeyVal;
-    if (activeKeyVal == 1) {
-      nextTick(() => {
-        if (MonitorDataTable.value) MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
-      });
-    }
-  };
+/** 统一控制入口:点位code + 标题 直接传参(与 windowMonitor 的 setControl 模式一致) */
+const setControl = (paramcode: string, title: string) => {
+  openGateControlModal(paramcode, title);
+};
 
-  const initData = {
-    deviceID: '',
-    deviceType: '',
-    strname: '',
-    frontRearDP: '-', //压差
-    // sourcePressure: '-', //气源压力
-    runRoRecondition: null,
-    autoRoManual: null,
-    netStatus: '0', //通信状态
-    frontGateOpen: '0',
-    frontGateClose: '1',
-    rearGateOpen: '0',
-    rearGateClose: '1',
-    midGateOpen: '0',
-    midGateClose: '1',
-    fault: '气源压力超限',
-    masterComputer: 0,
-    frontGateOpenCtrl: false,
-    rearGateOpenCtrl: false,
-    cameras: [],
-  };
+/** 控制模式切换(paramcode 需根据 contrlMod + contrlValue 动态决定) */
+const setControlMode = (value?: string) => {
+  contrlValue = value;
+  openGateControlModal('modeSwitch', '控制模式切换');
+};
 
-  // 监测数据
-  const selectData = reactive(cloneDeep(initData));
+const [registerModal, { openModal, closeModal }] = useModal();
 
-  const flvURL1 = () => {
-    // return ''
-    return `/video/gate.mp4`;
-  };
+const { getCamera, removeCamera } = useCamera();
 
-  function deviceEdit(e: Event, type: string, record) {
-    e.stopPropagation();
-    openModal(true, {
-      type,
-      deviceId: record['deviceID'],
-    });
-  }
-  // 获取设备基本信息列表
-  function getDeviceBaseList() {
-    getTableList({ pageSize: 1000 }).then((res) => {
-      deviceBaseList.value = res.records;
+const tabChange = (activeKeyVal) => {
+  activeKey.value = activeKeyVal;
+  if (activeKeyVal == 1) {
+    nextTick(() => {
+      if (MonitorDataTable.value) MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
     });
   }
-
-  // https获取监测数据
-  let timer: null | NodeJS.Timeout = null;
-  async function getMonitor(flag?) {
-    if (Object.prototype.toString.call(timer) === '[object Null]') {
-      timer = await setTimeout(
-        async () => {
-          const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
-          if (res.msgTxt && res.msgTxt[0]) {
-            dataSource.value = res.msgTxt[0].datalist || [];
-            dataSource.value.forEach((data: any) => {
-              const readData = data.readData;
-              data = Object.assign(data, readData);
-            });
-            if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
-              // 初始打开页面
-              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']]);
-              }
-            }
-            Object.assign(selectData, dataSource.value[selectRowIndex.value]);
-            if (selectData.contrlMod == 'jnjhCtrl') {
-              selectData['autoRoManual'] = selectData['autoRoManual'] == 1 ? true : false;
-              selectData['autoRoManual1'] = selectData['autoRoManual1'] == 1 ? true : false;
-              selectData['autoRoManual2'] = selectData['autoRoManual2'] == 1 ? true : false;
-            }
-            addMonitorText(selectData);
-            monitorAnimation(selectData);
-            if (timer) {
-              timer = null;
+};
+
+const initData = {
+  deviceID: '',
+  deviceType: '',
+  strname: '',
+  frontRearDP: '-', //压差
+  // sourcePressure: '-', //气源压力
+  runRoRecondition: null,
+  autoRoManual: null,
+  netStatus: '0', //通信状态
+  frontGateOpen: '0',
+  frontGateClose: '1',
+  rearGateOpen: '0',
+  rearGateClose: '1',
+  midGateOpen: '0',
+  midGateClose: '1',
+  fault: '气源压力超限',
+  masterComputer: 0,
+  frontGateOpenCtrl: false,
+  rearGateOpenCtrl: false,
+  cameras: [],
+};
+
+// 监测数据
+const selectData = reactive(cloneDeep(initData));
+
+const flvURL1 = () => {
+  // return ''
+  return `/video/gate.mp4`;
+};
+
+function deviceEdit(e: Event, type: string, record) {
+  e.stopPropagation();
+  openModal(true, {
+    type,
+    deviceId: record['deviceID'],
+  });
+}
+// 获取设备基本信息列表
+function getDeviceBaseList() {
+  getTableList({ pageSize: 1000 }).then((res) => {
+    deviceBaseList.value = res.records;
+  });
+}
+
+// https获取监测数据
+let timer: null | NodeJS.Timeout = null;
+async function getMonitor(flag?) {
+  if (Object.prototype.toString.call(timer) === '[object Null]') {
+    timer = await setTimeout(
+      async () => {
+        const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
+        if (res.msgTxt && res.msgTxt[0]) {
+          dataSource.value = res.msgTxt[0].datalist || [];
+          dataSource.value.forEach((data: any) => {
+            const readData = data.readData;
+            data = Object.assign(data, readData);
+          });
+          if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
+            // 初始打开页面
+            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']]);
             }
-            getMonitor();
           }
-        },
-        flag ? 0 : 1000
-      );
-    }
+          Object.assign(selectData, dataSource.value[selectRowIndex.value]);
+          if (selectData.contrlMod == 'jnjhCtrl') {
+            selectData['autoRoManual'] = selectData['autoRoManual'] == 1 ? true : false;
+            selectData['autoRoManual1'] = selectData['autoRoManual1'] == 1 ? true : false;
+            selectData['autoRoManual2'] = selectData['autoRoManual2'] == 1 ? true : false;
+          }
+          addMonitorText(selectData);
+          monitorAnimation(selectData);
+          if (timer) {
+            timer = null;
+          }
+          getMonitor();
+        }
+      },
+      flag ? 0 : 1000
+    );
   }
-
-  // 切换检测数据
-  async function getSelectRow(selectRow, index) {
-    if (!selectRow) return;
-    loading.value = true;
-    selectRowIndex.value = index;
-    gateId.value = selectRow.deviceID;
-    const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
-    Object.assign(selectData, initData, selectRow, baseData);
-    isFrontOpenRunning = false; //开关门动作是否在进行
-    isRearOpenRunning = false; //开关门动作是否在进行
-    isMidOpenRunning = false; //开关门动作是否在进行
-    frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
-    rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
-    midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
-
-    let type;
-    const dictCodes = getDictItemsByCode('gateStyle');
-    if (selectData && dictCodes && dictCodes.length > 0) {
-      const gateStyle = selectData['gateStyle'];
-      switch (gateStyle) {
-        case 'gate_qd':
-          type = 'fm3';
-          break;
-        case 'fmtl3':
-          type = 'fmThreeTl';
-          break;
-        case 'fmSs':
-          type = 'fmTwoSs';
-          break;
-        case 'fm_fc':
-          type = 'fmWindow';
-          break;
-        case 'fmXr':
-          type = 'fmXr';
-          break;
-        case 'fmYy':
-          type = 'fm1';
-          break;
-        case 'fmSs3':
-          type = 'fm2';
-          break;
-        case 'fm_fc_hjg':
-          type = 'fmWindowHjg';
-          break;
-        case 'fm_fc_zhq':
-          type = 'fmWindowZhq';
-          break;
-        default:
-          type = gateStyle;
-      }
-    } else {
-      type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
-      if (selectData['doorUse'] == 2) {
-        type = 'fmXr';
-      } else if (selectData.ndoorcount == '3' || selectData.deviceType == 'gate_nomal3') {
+}
+
+// 切换检测数据
+async function getSelectRow(selectRow, index) {
+  if (!selectRow) return;
+  loading.value = true;
+  selectRowIndex.value = index;
+  gateId.value = selectRow.deviceID;
+  const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
+  Object.assign(selectData, initData, selectRow, baseData);
+  isFrontOpenRunning = false; //开关门动作是否在进行
+  isRearOpenRunning = false; //开关门动作是否在进行
+  isMidOpenRunning = false; //开关门动作是否在进行
+  frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
+  rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
+  midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
+
+  let type;
+  const dictCodes = getDictItemsByCode('gateStyle');
+  if (selectData && dictCodes && dictCodes.length > 0) {
+    const gateStyle = selectData['gateStyle'];
+    switch (gateStyle) {
+      case 'gate_qd':
+        type = 'fm3';
+        break;
+      case 'fmtl3':
         type = 'fmThreeTl';
+        break;
+      case 'fmSs':
+        type = 'fmTwoSs';
+        break;
+      case 'fm_fc':
+        type = 'fmWindow';
+        break;
+      case 'fmXr':
+        type = 'fmXr';
+        break;
+      case 'fmYy':
+        type = 'fm1';
+        break;
+      case 'fmSs3':
+        type = 'fm2';
+        break;
+      case 'fm_fc_hjg':
+        type = 'fmWindowHjg';
+        break;
+      case 'fm_fc_zhq':
+        type = 'fmWindowZhq';
+        break;
+      default:
+        type = gateStyle;
+    }
+  } else {
+    type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
+    if (selectData['doorUse'] == 2) {
+      type = 'fmXr';
+    } else if (selectData.ndoorcount == '3' || selectData.deviceType == 'gate_nomal3') {
+      type = 'fmThreeTl';
+    } else {
+      if (selectData.deviceType == 'gate_ss') {
+        type = 'fm2';
+      } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
+        type = 'fm3';
+      } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
+        type = 'fmTwoSs';
+      } else if (selectData.deviceType == 'gate_tj') {
+        type = 'fmWindow';
       } else {
-        if (selectData.deviceType == 'gate_ss') {
-          type = 'fm2';
-        } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
-          type = 'fm3';
-        } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
-          type = 'fmTwoSs';
-        } else if (selectData.deviceType == 'gate_tj') {
-          type = 'fmWindow';
-        } else {
-          type = 'fm1'; // 液压
-        }
+        type = 'fm1'; // 液压
       }
     }
+  }
 
-    await setSVGModelType(type);
-    await setModelType(type);
-    addMonitorText(selectData);
-    // playAnimation(selectRow, selectData.value.maxarea, true);
-    loading.value = false;
-    await getCamera(selectRow.deviceID, playerRef, renderPlayer);
+  await setSVGModelType(type);
+  await setModelType(type);
+  addMonitorText(selectData);
+  // playAnimation(selectRow, selectData.value.maxarea, true);
+  loading.value = false;
+  await getCamera(selectRow.deviceID, playerRef, renderPlayer);
+}
+
+/** 检修切换 */
+const changeOverhaul = (e) => {
+  // 检修值需要在打开模态框前设置(handleOK 中按 toggle 逻辑计算下发值)
+  openGateControlModal('overhaul', '检修控制');
+  contrlValue = e;
+};
+
+/** 统一下发控制指令(仿 windowMonitor 模式:handlerState 即点位code,特殊情况单独判断) */
+function handleOK(passWord, handlerState, value?) {
+  if (!passWord && !globalConfig?.simulatedPassword) {
+    message.warning('请输入密码');
+    return;
   }
 
-  /** 检修切换 */
-  const changeOverhaul = (e) => {
-    // 检修值需要在打开模态框前设置(handleOK 中按 toggle 逻辑计算下发值)
-    openGateControlModal('overhaul', '检修控制');
-    contrlValue = e;
+  const data = {
+    deviceid: selectData.deviceID,
+    devicetype: selectData.deviceType,
+    paramcode: '',
+    value: value ?? null,
+    password: passWord || globalConfig?.simulatedPassword,
+    masterComputer: selectData.masterComputer,
   };
 
-  /** 统一下发控制指令(仿 windowMonitor 模式:handlerState 即点位code,特殊情况单独判断) */
-  function handleOK(passWord, handlerState, value?) {
-    if (!passWord && !globalConfig?.simulatedPassword) {
-      message.warning('请输入密码');
-      return;
-    }
-
-    const data = {
-      deviceid: selectData.deviceID,
-      devicetype: selectData.deviceType,
-      paramcode: '',
-      value: value ?? null,
-      password: passWord || globalConfig?.simulatedPassword,
-      masterComputer: selectData.masterComputer,
-    };
-
-    // 特殊:控制模式切换(paramcode 根据 contrlMod + contrlValue 动态决定)
-    if (handlerState === 'modeSwitch') {
-      if (selectData.contrlMod == 'codeCtrl') {
-        if (contrlValue == '1') {
-          data.paramcode = 'autoRoManualControl1';
-        } else if (contrlValue == '0') {
-          data.paramcode = 'autoRoManualControl2';
-        } else {
-          data.paramcode = 'autoRoManualControl0';
-        }
-        data.value = '';
-      } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
-        data.paramcode = 'autoRoManualControl';
-        data.value = '';
+  // 特殊:控制模式切换(paramcode 根据 contrlMod + contrlValue 动态决定)
+  if (handlerState === 'modeSwitch') {
+    if (selectData.contrlMod == 'codeCtrl') {
+      if (contrlValue == '1') {
+        data.paramcode = 'autoRoManualControl1';
+      } else if (contrlValue == '0') {
+        data.paramcode = 'autoRoManualControl2';
       } else {
-        data.paramcode = 'autoRoManualControl';
-        data.value = contrlValue;
+        data.paramcode = 'autoRoManualControl0';
       }
-      selectData.autoRoManual = null;
-    }
-    // 特殊:检修控制(value 取反 toggle)
-    else if (handlerState === 'overhaul') {
-      data.paramcode = 'runRoRecondition_S';
-      data.value = selectData['runRoRecondition'] == 0 ? '1' : '0';
-    }
-    // 默认:handlerState 即点位code(setControl 直接传参)
-    else {
-      data.paramcode = handlerState;
-      data.value = value ?? contrlValue;
+      data.value = '';
+    } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
+      data.paramcode = 'autoRoManualControl';
+      data.value = '';
+    } else {
+      data.paramcode = 'autoRoManualControl';
+      data.value = contrlValue;
     }
+    selectData.autoRoManual = null;
+  }
+  // 特殊:检修控制(value 取反 toggle)
+  else if (handlerState === 'overhaul') {
+    data.paramcode = 'runRoRecondition_S';
+    data.value = selectData['runRoRecondition'] == 0 ? '1' : '0';
+  }
+  // 默认:handlerState 即点位code(setControl 直接传参)
+  else {
+    data.paramcode = handlerState;
+    data.value = '';
+  }
 
-    if (data.paramcode) {
-      deviceControlApi(data)
-        .then((res) => {
-          if (res.success) {
-            modalIsShow.value = false;
-            if (globalConfig.History_Type == 'remote') {
-              message.success('指令已下发至生产管控平台成功!');
-            } else {
-              message.success('指令已下发成功!');
-            }
+  if (data.paramcode) {
+    deviceControlApi(data)
+      .then((res) => {
+        if (res.success) {
+          modalIsShow.value = false;
+          if (globalConfig.History_Type == 'remote') {
+            message.success('指令已下发至生产管控平台成功!');
           } else {
-            message.error(res.message);
+            message.success('指令已下发成功!');
           }
-          contrlValue = '';
-        })
-        .catch(() => {
-          message.error('控制异常,请排查问题。。。');
-          contrlValue = '';
-        });
-    }
+        } else {
+          message.error(res.message);
+        }
+        contrlValue = '';
+      })
+      .catch(() => {
+        message.error('控制异常,请排查问题。。。');
+        contrlValue = '';
+      });
   }
-  let isOpenRunning = false; //开关门动作是否在进行
-  /** 开关门动画调用 */
-  let isFrontOpenRunning = false; //开关门动作是否在进行
-  // let isFrontCloseRunning = false; //开关门动作是否在进行
-  let isRearOpenRunning = false; //开关门动作是否在进行
-  // let isRearCloseRunning = false; //开关门动作是否在进行
-  let isMidOpenRunning = false; //中间门动作是否在进行
-  // let isMidCloseRunning = false; //中间门动作是否在进行
-  // 0 关闭 1 正在打开 2 打开 3正在关闭
-  let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
-  let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
-  let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
-
-  function monitorAnimation(selectData) {
-    const timeScale = 0.005;
-    // 带风窗 风窗动画
-    if (selectData['gateStyle'] && selectData['gateStyle'].includes('fm_fc')) playWindowAnimation(selectData);
-
-    if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
-      isFrontOpenRunning = true;
-      if (frontDeviceState != 1) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
-        play(1, timeScale);
-        frontDeviceState = 1;
-        frontDoorIsOpen.value = false;
-        backDoorIsOpen.value = true;
-      }
+}
+let isOpenRunning = false; //开关门动作是否在进行
+/** 开关门动画调用 */
+let isFrontOpenRunning = false; //开关门动作是否在进行
+// let isFrontCloseRunning = false; //开关门动作是否在进行
+let isRearOpenRunning = false; //开关门动作是否在进行
+// let isRearCloseRunning = false; //开关门动作是否在进行
+let isMidOpenRunning = false; //中间门动作是否在进行
+// let isMidCloseRunning = false; //中间门动作是否在进行
+// 0 关闭 1 正在打开 2 打开 3正在关闭
+let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
+let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
+let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
+
+function monitorAnimation(selectData) {
+  const timeScale = 0.005;
+  // 带风窗 风窗动画
+  if (selectData['gateStyle'] && selectData['gateStyle'].includes('fm_fc')) playWindowAnimation(selectData);
+
+  if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
+    isFrontOpenRunning = true;
+    if (frontDeviceState != 1) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
+      play(1, timeScale);
+      frontDeviceState = 1;
+      frontDoorIsOpen.value = false;
+      backDoorIsOpen.value = true;
     }
+  }
 
-    if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
-      isFrontOpenRunning = true;
-      if (frontDeviceState != 1) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
-        play(1, timeScale);
-        frontDeviceState = 1;
-        frontDoorIsOpen.value = false;
-        backDoorIsOpen.value = true;
-      }
+  if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
+    isFrontOpenRunning = true;
+    if (frontDeviceState != 1) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
+      play(1, timeScale);
+      frontDeviceState = 1;
+      frontDoorIsOpen.value = false;
+      backDoorIsOpen.value = true;
     }
+  }
 
-    if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
-      isFrontOpenRunning = false;
-      if (frontDeviceState != 0) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
-        play(2, timeScale);
-        frontDeviceState = 0;
-        frontDoorIsOpen.value = false;
-        // backDoorIsOpen.value = false
-      }
+  if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
+    isFrontOpenRunning = false;
+    if (frontDeviceState != 0) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
+      play(2, timeScale);
+      frontDeviceState = 0;
+      frontDoorIsOpen.value = false;
+      // backDoorIsOpen.value = false
     }
-    if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
-      isRearOpenRunning = true;
-
-      if (rearDeviceState != 1) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
-        play(3, timeScale);
-        rearDeviceState = 1;
-        backDoorIsOpen.value = false;
-        frontDoorIsOpen.value = true;
-      }
+  }
+  if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
+    isRearOpenRunning = true;
+
+    if (rearDeviceState != 1) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
+      play(3, timeScale);
+      rearDeviceState = 1;
+      backDoorIsOpen.value = false;
+      frontDoorIsOpen.value = true;
     }
-    if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
-      isRearOpenRunning = true;
-
-      if (rearDeviceState != 1) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
-        play(3, timeScale);
-        rearDeviceState = 1;
-        backDoorIsOpen.value = false;
-        frontDoorIsOpen.value = true;
-      }
+  }
+  if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
+    isRearOpenRunning = true;
+
+    if (rearDeviceState != 1) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
+      play(3, timeScale);
+      rearDeviceState = 1;
+      backDoorIsOpen.value = false;
+      frontDoorIsOpen.value = true;
     }
+  }
 
-    if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
-      isRearOpenRunning = false;
-      if (rearDeviceState != 0) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
-        play(4, timeScale);
-        rearDeviceState = 0;
-        backDoorIsOpen.value = false;
-      }
+  if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
+    isRearOpenRunning = false;
+    if (rearDeviceState != 0) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
+      play(4, timeScale);
+      rearDeviceState = 0;
+      backDoorIsOpen.value = false;
     }
+  }
 
-    if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
-      isMidOpenRunning = true;
+  if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
+    isMidOpenRunning = true;
 
-      if (midDeviceState != 1) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
-        play(8, timeScale);
-        midDeviceState = 1;
-        backDoorIsOpen.value = false;
-        frontDoorIsOpen.value = true;
-      }
+    if (midDeviceState != 1) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
+      play(8, timeScale);
+      midDeviceState = 1;
+      backDoorIsOpen.value = false;
+      frontDoorIsOpen.value = true;
     }
+  }
 
-    if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
-      isMidOpenRunning = true;
+  if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
+    isMidOpenRunning = true;
 
-      if (midDeviceState != 1) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
-        play(8, timeScale);
-        midDeviceState = 1;
-        backDoorIsOpen.value = false;
-        frontDoorIsOpen.value = true;
-      }
+    if (midDeviceState != 1) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
+      play(8, timeScale);
+      midDeviceState = 1;
+      backDoorIsOpen.value = false;
+      frontDoorIsOpen.value = true;
     }
-
-    if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
-      isMidOpenRunning = false;
-      if (midDeviceState != 0) {
-        // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
-        play(9, timeScale);
-        midDeviceState = 0;
-        backDoorIsOpen.value = false;
-      }
-    }
-
-    modelRef.value?.animate?.(selectData.frontGateOpen == '1', selectData.midGateOpen == '1', selectData.rearGateOpen == '1');
   }
 
-  function playWindowAnimation(data, maxarea = 90, isFirst = false) {
-    computePlay(data, maxarea, isFirst);
+  if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
+    isMidOpenRunning = false;
+    if (midDeviceState != 0) {
+      // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
+      play(9, timeScale);
+      midDeviceState = 0;
+      backDoorIsOpen.value = false;
+    }
   }
 
-  function handleCancel() {
-    modalIsShow.value = false;
-    modalTitle.value = '';
-    modalType.value = '';
+  modelRef.value?.animate?.(selectData.frontGateOpen == '1', selectData.midGateOpen == '1', selectData.rearGateOpen == '1');
+}
+
+function playWindowAnimation(data, maxarea = 90, isFirst = false) {
+  computePlay(data, maxarea, isFirst);
+}
+
+function handleCancel() {
+  modalIsShow.value = false;
+  modalTitle.value = '';
+  modalType.value = '';
+}
+
+const handleSwitchChange = (checked: boolean) => {
+  contrlValue = checked;
+  setControl('manualAutoMode_w', '手动/自动模式切换');
+};
+
+function setSVGModelType(type) {
+  modelComponent.value = getModelComponent(globalConfig.is2DModel, type);
+  return nextTick();
+}
+
+onMounted(async () => {
+  const { query } = unref(currentRoute);
+  if (query['deviceType']) deviceType.value = query['deviceType'] as string;
+  modelList.value = await getDictItems('gateModel');
+  if (globalConfig.is2DModel) {
+    await getMonitor(true);
+  } else {
+    loading.value = true;
+    // const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
+    mountedThree()
+      .then(async () => {
+        if (sysOrgCode != 'zmhjhzmy') {
+          await getMonitor(true);
+          loading.value = false;
+        } else {
+          // 韩咀无风门设备,只有报警历史数据,无其他数据
+          setModelType('fm1').then(async () => {
+            loading.value = false;
+            dataSource.value = [];
+            addMonitorText(selectData);
+          });
+        }
+      })
+      .catch((e) => {
+        console.log(e);
+      });
   }
+});
 
-  const handleSwitchChange = (checked: boolean) => {
-    contrlValue = checked;
-    setControl('manualAutoMode_w', '手动/自动模式切换');
-  };
+onBeforeUnmount(() => {
+  removeCamera(playerRef);
+  getDeviceBaseList();
+});
 
-  function setSVGModelType(type) {
-    modelComponent.value = getModelComponent(globalConfig.is2DModel, type);
-    return nextTick();
+onUnmounted(() => {
+  if (timer) {
+    clearTimeout(timer);
+    timer = undefined;
   }
-
-  onMounted(async () => {
-    const { query } = unref(currentRoute);
-    if (query['deviceType']) deviceType.value = query['deviceType'] as string;
-    modelList.value = await getDictItems('gateModel');
-    if (globalConfig.is2DModel) {
-      await getMonitor(true);
-    } else {
-      loading.value = true;
-      // const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
-      mountedThree()
-        .then(async () => {
-          if (sysOrgCode != 'zmhjhzmy') {
-            await getMonitor(true);
-            loading.value = false;
-          } else {
-            // 韩咀无风门设备,只有报警历史数据,无其他数据
-            setModelType('fm1').then(async () => {
-              loading.value = false;
-              dataSource.value = [];
-              addMonitorText(selectData);
-            });
-          }
-        })
-        .catch((e) => {
-          console.log(e);
-        });
-    }
-  });
-
-  onBeforeUnmount(() => {
-    removeCamera(playerRef);
-    getDeviceBaseList();
-  });
-
-  onUnmounted(() => {
-    if (timer) {
-      clearTimeout(timer);
-      timer = undefined;
-    }
-    destroy();
-  });
+  destroy();
+});
 </script>
 
 <style lang="less" scoped>
-  @import '/@/design/theme.less';
-  @import '/@/design/vent/modal.less';
+@import '/@/design/theme.less';
+@import '/@/design/vent/modal.less';
 
-  .scene-box {
-    .bottom-tabs-box {
-      height: 350px;
-    }
+.scene-box {
+  .bottom-tabs-box {
+    height: 350px;
   }
+}
 
-  .button-box {
-    border: none !important;
-    height: 34px !important;
-
-    &:hover {
-      background: var(--vent-device-manager-control-btn-hover) !important;
-    }
-
-    &::before {
-      height: 27px !important;
-      background: var(--vent-device-manager-control-btn) !important;
-    }
+.button-box {
+  border: none !important;
+  height: 34px !important;
 
-    &::after {
-      top: 35px !important;
-    }
+  &:hover {
+    background: var(--vent-device-manager-control-btn-hover) !important;
   }
 
-  :deep(.@{ventSpace}-tabs-tabpane-active) {
-    height: 100%;
+  &::before {
+    height: 27px !important;
+    background: var(--vent-device-manager-control-btn) !important;
   }
 
-  ::-webkit-scrollbar-thumb {
-    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
-    background: #4288a444;
+  &::after {
+    top: 35px !important;
   }
+}
 
-  :deep(.zxm-radio-disabled + span) {
-    color: var(--vent-font-color) !important;
-  }
+:deep(.@{ventSpace}-tabs-tabpane-active) {
+  height: 100%;
+}
 
-  :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
-    background-color: #127cb5 !important;
-  }
+::-webkit-scrollbar-thumb {
+  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
+  background: #4288a444;
+}
 
-  :deep(.@{ventSpace}-picker-datetime-panel) {
-    height: 200px !important;
-    overflow-y: auto !important;
-  }
+:deep(.zxm-radio-disabled + span) {
+  color: var(--vent-font-color) !important;
+}
+
+:deep(.zxm-radio-disabled .zxm-radio-inner::after) {
+  background-color: #127cb5 !important;
+}
+
+:deep(.@{ventSpace}-picker-datetime-panel) {
+  height: 200px !important;
+  overflow-y: auto !important;
+}
 </style>

+ 5 - 1
vite.config.ts

@@ -96,7 +96,11 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
             vue: ['vue', 'vue-router'],
             'cron-parser-vendor': ['cron-parser'],
             // MiniChat 重型依赖分包——Office 预览
-            'office-preview': ['@vue-office/pdf', '@vue-office/docx', '@vue-office/excel'],
+            'office-preview': [
+              '@vue-office/pdf/lib/v3/vue-office-pdf.mjs',
+              '@vue-office/docx/lib/v3/vue-office-docx.mjs',
+              '@vue-office/excel/lib/v3/vue-office-excel.mjs',
+            ],
             // MiniChat 重型依赖分包——Markdown/LaTeX/代码高亮
             'markdown-vendor': ['marked', 'katex', 'highlight.js'],
           },