Переглянути джерело

Merge branch 'master' of http://39.97.59.228:8013/hrx/mky-vent-base

lxh 3 місяців тому
батько
коміт
dfdc2405c0

+ 7 - 6
src/hooks/setting/index.ts

@@ -30,7 +30,8 @@ const getUrl = () => {
             // getHomePath是以前的代码,留下做兼容,获取到一个默认的首页路径
             // 然后正常按配置走,默认使用上面的首页路径
             const homePathKey = data.result['defaultTheme'] ? data.result['defaultTheme'] : '';
-            homePath = data.result['systemHome'] ? data.result['systemHome'] : getHomePath(homePathKey);
+            const legacyHomePath = getHomePath(homePathKey);
+            homePath = data.result['systemHome'] ? data.result['systemHome'] : legacyHomePath;
             const faviconIcon = document.getElementById('faviconIcon');
             if (faviconIcon) {
               faviconIcon.setAttribute('href', `${VUE_APP_URL.baseUrl}/sys/common/static/${logoUrl}`);
@@ -47,11 +48,11 @@ const getUrl = () => {
 };
 
 export async function getRemoteSetting() {
-  if (!sysOrgCode) {
-    try {
-      await getUrl();
-    } catch (error) {}
-  }
+  // if (!sysOrgCode) {
+  try {
+    await getUrl();
+  } catch (error) {}
+  // }
 }
 
 export const useGlobSetting = (): Readonly<GlobConfig> => {

+ 796 - 754
src/views/vent/monitorManager/gateMonitor/index.vue

@@ -5,22 +5,38 @@
       <div class="top-center row">
         <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(1)">打开前门</div>
         <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(2)">关闭前门</div>
-        <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box"
-          @click="playAnimation(8)">打开中间门</div>
-        <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box"
-          @click="playAnimation(9)">关闭中间门</div>
-        <div v-if="hasPermission('btn:control') && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3')"
-          class="button-box" @click="playAnimation(3)">打开后门</div>
-        <div v-if="hasPermission('btn:control') && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3')"
-          class="button-box" @click="playAnimation(4)">关闭后门</div>
-        <div v-if="
-          hasPermission('btn:totalControl') ||
-          (selectData['isShowGatesContrl'] == 1 && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3'))
-        " class="button-box" @click="playAnimation(5)">同时打开</div>
-        <div v-if="
-          hasPermission('btn:totalControl') ||
-          (selectData['isShowGatesContrl'] == 1 && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3'))
-        " class="button-box" @click="playAnimation(6)">同时关闭</div>
+        <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box" @click="playAnimation(8)">打开中间门</div>
+        <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box" @click="playAnimation(9)">关闭中间门</div>
+        <div
+          v-if="hasPermission('btn:control') && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3')"
+          class="button-box"
+          @click="playAnimation(3)"
+          >打开后门
+        </div>
+        <div
+          v-if="hasPermission('btn:control') && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3')"
+          class="button-box"
+          @click="playAnimation(4)"
+          >关闭后门
+        </div>
+        <div
+          v-if="
+            hasPermission('btn:totalControl') ||
+            (selectData['isShowGatesContrl'] == 1 && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3'))
+          "
+          class="button-box"
+          @click="playAnimation(5)"
+          >同时打开
+        </div>
+        <div
+          v-if="
+            hasPermission('btn:totalControl') ||
+            (selectData['isShowGatesContrl'] == 1 && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3'))
+          "
+          class="button-box"
+          @click="playAnimation(6)"
+          >同时关闭
+        </div>
         <template v-if="selectData['gateStyle'] && selectData['gateStyle'].includes('fm_fc')">
           <template v-if="selectData['nwindownum'] == 4">
             <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(10)">A窗控制</div>
@@ -54,9 +70,7 @@
               <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
             </template>
           </a-radio-group>
-          <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">
-            {{
-              item.text }}</div>
+          <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index"> {{ item.text }}</div>
         </div>
         <!-- 济南嘉鸿远程、就地、自动控制,自动切换,点位为true就是选中状态 -->
         <div class="vent-flex-m row" v-else-if="selectData.contrlMod == 'jnjhCtrl' && modelList.length > 0">
@@ -73,9 +87,7 @@
               <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
             </template>
           </a-radio-group>
-          <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">
-            {{
-              item.text }}</div>
+          <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index"> {{ item.text }}</div>
         </div>
       </div>
       <div v-if="hasPermission('gate:overhaul')" class="run-type row">
@@ -91,46 +103,56 @@
       <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 120}px`">
         <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
           <a-tab-pane v-if="!hasPermission('show:noMonitor')" key="1" tab="实时监测">
-            <MonitorTable v-if="activeKey === '1'" ref="MonitorDataTable" class="monitor-table"
-              :columnsType="deviceType" :isShowActionColumn="true" :dataSource="dataSource" design-scope="gate-monitor"
-              @select-row="getSelectRow" :scroll="{ y: scroll.y - 40 }" title="风门监测" :isShowPagination="true">
+            <MonitorTable
+              v-if="activeKey === '1'"
+              ref="MonitorDataTable"
+              class="monitor-table"
+              :columnsType="deviceType"
+              :isShowActionColumn="true"
+              :dataSource="dataSource"
+              design-scope="gate-monitor"
+              @select-row="getSelectRow"
+              :scroll="{ y: scroll.y - 40 }"
+              title="风门监测"
+              :isShowPagination="true"
+            >
               <template #filterCell="{ column, record }">
-                <a-tag
-                  v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'"
-                  color="red">正在运行</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1"
-                  color="default">关闭</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'"
-                  color="#46C66F">打开</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'"
-                  color="#FF0000">点位异常</a-tag>
-                <a-tag
-                  v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'"
-                  color="red">正在运行</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'"
-                  color="default">关闭</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'"
-                  color="#46C66F">打开</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'"
-                  color="#FF0000">点位异常</a-tag>
-                <a-tag
-                  v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'"
-                  color="red">正在运行</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1"
-                  color="default">关闭</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'"
-                  color="#46C66F">打开</a-tag>
-                <a-tag
-                  v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'"
-                  color="#FF0000">点位异常</a-tag>
+                <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
+                  >正在运行
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
+                  >关闭
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'" color="#46C66F"
+                  >打开
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'" color="#FF0000"
+                  >点位异常
+                </a-tag>
+                <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
+                  >正在运行
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
+                  >关闭
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
+                  >打开
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
+                  >点位异常
+                </a-tag>
+                <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
+                  >正在运行
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
+                  >关闭
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
+                  >打开
+                </a-tag>
+                <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
+                  >点位异常
+                </a-tag>
                 <template v-if="column.dataIndex === 'ndoortype'">
                   <span>{{ render.renderDictText(record.ndoortype, 'ndoortype') }}</span>
                 </template>
@@ -149,18 +171,16 @@
                 </template>
                 <a-tag v-else-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : 'red'">{{
                   record.warnFlag == '0' ? '正常' : '报警'
-                  }}</a-tag>
-                <a-tag v-if="column.dataIndex === 'runRoRecondition'"
-                  :color="record.runRoRecondition == '1' ? '#f00' : 'green'">{{
-                    record.runRoRecondition == '1' ? '检修' : '运行'
-                  }}</a-tag>
+                }}</a-tag>
+                <a-tag v-if="column.dataIndex === 'runRoRecondition'" :color="record.runRoRecondition == '1' ? '#f00' : 'green'">{{
+                  record.runRoRecondition == '1' ? '检修' : '运行'
+                }}</a-tag>
                 <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
                   record.netStatus == '0' ? '断开' : '连接'
-                  }}</a-tag>
+                }}</a-tag>
               </template>
               <template #action="{ record }">
-                <a v-if="globalConfig?.showReport" class="table-action-link"
-                  @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
+                <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>
@@ -173,45 +193,48 @@
           </a-tab-pane> -->
           <a-tab-pane v-if="!hasPermission('show:noHistory')" key="3" tab="历史数据">
             <div class="tab-item" v-if="activeKey === '3'">
-              <HistoryTable :columnsType="deviceType" :device-type="deviceType" designScope="gate-history"
-                :scroll="scroll">
+              <HistoryTable :columnsType="deviceType" :device-type="deviceType" designScope="gate-history" :scroll="scroll">
                 <template #filterCell="{ column, record }">
-                  <a-tag
-                    v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'"
-                    color="red">正在运行</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1"
-                    color="default">关闭</a-tag>
+                  <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
+                    >正在运行
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
+                    >关闭
+                  </a-tag>
                   <a-tag
                     v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'"
-                    color="#46C66F">打开</a-tag>
+                    color="#46C66F"
+                    >打开
+                  </a-tag>
                   <a-tag
                     v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'"
-                    color="#FF0000">点位异常</a-tag>
-                  <a-tag
-                    v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'"
-                    color="red">正在运行</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'"
-                    color="default">关闭</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'"
-                    color="#46C66F">打开</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'"
-                    color="#FF0000">点位异常</a-tag>
-                  <a-tag
-                    v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'"
-                    color="red">正在运行</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1"
-                    color="default">关闭</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'"
-                    color="#46C66F">打开</a-tag>
-                  <a-tag
-                    v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'"
-                    color="#FF0000">点位异常</a-tag>
+                    color="#FF0000"
+                    >点位异常
+                  </a-tag>
+                  <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
+                    >正在运行
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
+                    >关闭
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
+                    >打开
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
+                    >点位异常
+                  </a-tag>
+                  <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
+                    >正在运行
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
+                    >关闭
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
+                    >打开
+                  </a-tag>
+                  <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
+                    >点位异常
+                  </a-tag>
                   <template v-if="column.dataIndex === 'ndoortype'">
                     <span v-if="record.ndoortype == '0'">气动风门</span>
                     <span v-else color="default">液压风门</span>
@@ -239,17 +262,23 @@
           <a-tab-pane v-if="!hasPermission('show:noAlarm')" key="4" tab="报警历史">
             <div class="tab-item" v-if="activeKey === '4'">
               <template v-if="sysOrgCode != 'zmhjhzmy'">
-                <AlarmHistoryTable columns-type="alarm" :device-type="deviceType" :device-list-api="getTableList"
-                  designScope="alarm-history" :scroll="scroll">
+                <AlarmHistoryTable
+                  columns-type="alarm"
+                  :device-type="deviceType"
+                  :device-list-api="getTableList"
+                  designScope="alarm-history"
+                  :scroll="scroll"
+                >
                   <template #filterCell="{ column, record }">
-                    <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 === 'netStatus'"
-                      :color="record.netStatus == '0' ? '#f00' : '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 === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
+                      record.netStatus == '0' ? '断开' : '连接'
+                    }}</a-tag>
                   </template>
                 </AlarmHistoryTable>
               </template>
@@ -260,20 +289,25 @@
           </a-tab-pane>
           <a-tab-pane v-if="!hasPermission('show:noHandleHistory')" key="5" tab="操作历史">
             <div class="tab-item" v-if="activeKey === '5'">
-              <HandlerHistoryTable columns-type="operator_history" :device-type="deviceType"
-                :device-list-api="getTableList" designScope="operator_history" :scroll="scroll" />
+              <HandlerHistoryTable
+                columns-type="operator_history"
+                :device-type="deviceType"
+                :device-list-api="getTableList"
+                designScope="operator_history"
+                :scroll="scroll"
+              />
             </div>
           </a-tab-pane>
 
-           <a-tab-pane v-if="hasPermission('gate:list')" key="6" tab="风门故障统计分析">
+          <a-tab-pane v-if="hasPermission('gate:list')" key="6" tab="风门故障统计分析">
             <div class="tab-item" v-if="activeKey === '6'">
-              <WindDoorFaultTable :device-list-api="getOrderByCount" :device-type="deviceType" ></WindDoorFaultTable>
+              <WindDoorFaultTable :device-list-api="getOrderByCount" :device-type="deviceType" />
             </div>
           </a-tab-pane>
 
-           <a-tab-pane v-if="hasPermission('gate:list')" key="7" tab="车辆损坏排查">
+          <a-tab-pane v-if="hasPermission('gate:list')" key="7" tab="车辆损坏排查">
             <div class="tab-item" v-if="activeKey === '7'">
-             <CarDamageTable :device-list-api="getCarList" :gateId="gateId" :device-type="deviceType"></CarDamageTable>
+              <CarDamageTable :device-list-api="getCarList" :gateId="gateId" :device-type="deviceType" />
             </div>
           </a-tab-pane>
 
@@ -290,16 +324,24 @@
                   :x-axis-prop-type="stationType !== 'redis' ? 'ttime' : 'time'"
                 />
               </div> -->
-              <HistoryTableChart chartsColumnsType="gate_chart" :dataSource="sharedData" height="100%"
-                :chartsColumns="chartsColumns" device-type="gate" :is-show-child-type="true" />
+              <HistoryTableChart
+                chartsColumnsType="gate_chart"
+                :dataSource="sharedData"
+                height="100%"
+                :chartsColumns="chartsColumns"
+                device-type="gate"
+                :is-show-child-type="true"
+              />
             </div>
           </a-tab-pane>
-         
         </a-tabs>
       </dv-border-box8>
     </div>
   </div>
-  <div v-if="renderPlayer" ref="playerRef" style="
+  <div
+    v-if="renderPlayer"
+    ref="playerRef"
+    style="
       z-index: 1;
       position: absolute;
       top: 100px;
@@ -309,699 +351,699 @@
       pointer-events: none;
       overflow-y: auto;
       flex-direction: column;
-    ">
+    "
+  >
   </div>
-  <LivePlayer id="fm-player1" style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
-    ref="player1" :videoUrl="flvURL1()" muted live loading controls />
-  <HandleModal v-if="!globalConfig?.simulatedPassword" :modal-is-show="modalIsShow" :modal-title="modalTitle"
-    :modal-type="modalType" @handle-ok="handleOK" @handle-cancel="handleCancel" />
+  <LivePlayer
+    id="fm-player1"
+    style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
+    ref="player1"
+    :videoUrl="flvURL1()"
+    muted
+    live
+    loading
+    controls
+  />
+  <HandleModal
+    v-if="!globalConfig?.simulatedPassword"
+    :modal-is-show="modalIsShow"
+    :modal-title="modalTitle"
+    :modal-type="modalType"
+    @handle-ok="handleOK"
+    @handle-cancel="handleCancel"
+  />
   <DeviceBaseInfo @register="registerModal" :device-type="selectData['deviceType']" />
 </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 lodash from 'lodash';
-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, sysOrgCode);
-
-const { currentRoute } = useRouter();
-const gateId=ref<any>(currentRoute.value['query']['id'])//风门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,
-  },
-};
-const [registerModal, { openModal, closeModal }] = useModal();
-
-const { getCamera, removeCamera } = useCamera();
-
-const tabChange = (activeKeyVal) => {
-  activeKey.value = activeKeyVal;
-  if (activeKeyVal == 1) {
-    nextTick(() => {
-      if (MonitorDataTable.value) MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
+  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 lodash from 'lodash';
+  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, sysOrgCode);
+
+  const { currentRoute } = useRouter();
+  const gateId = ref<any>(currentRoute.value['query']['id']); //风门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,
+    },
+  };
+
+  /** 控制类型枚举 */
+  enum GateControlType {
+    FRONT_GATE_OPEN = 1, // 打开前门
+    FRONT_GATE_CLOSE = 2, // 关闭前门
+    REAR_GATE_OPEN = 3, // 打开后门
+    REAR_GATE_CLOSE = 4, // 关闭后门
+    MID_GATE_OPEN = 8, // 打开中间门
+    MID_GATE_CLOSE = 9, // 关闭中间门
+    GATES_OPEN_TOGETHER = 5, // 同时打开
+    GATES_CLOSE_TOGETHER = 6, // 同时关闭
+    CONTROL_MODE_SWITCH = 7, // 控制模式切换
+    WINDOW_A_CONTROL = 10, // A窗控制
+    WINDOW_B_CONTROL = 11, // B窗控制
+    WINDOW_C_CONTROL = 12, // C窗控制
+    WINDOW_D_CONTROL = 13, // D窗控制
+    FRONT_WINDOW_CONTROL = 14, // 前窗控制
+    REAR_WINDOW_CONTROL = 15, // 后窗控制
+    OVERHAUL_CONTROL = 16, // 检修控制
+  }
+
+  /** 控制类型-标题映射配置 */
+  const GATE_CONTROL_CONFIG_MAP = {
+    [GateControlType.FRONT_GATE_OPEN]: '打开前门',
+    [GateControlType.FRONT_GATE_CLOSE]: '关闭前门',
+    [GateControlType.REAR_GATE_OPEN]: '打开后门',
+    [GateControlType.REAR_GATE_CLOSE]: '关闭后门',
+    [GateControlType.MID_GATE_OPEN]: '打开中间门',
+    [GateControlType.MID_GATE_CLOSE]: '关闭中间门',
+    [GateControlType.GATES_OPEN_TOGETHER]: '同时打开',
+    [GateControlType.GATES_CLOSE_TOGETHER]: '同时关闭',
+    [GateControlType.CONTROL_MODE_SWITCH]: '控制模式切换',
+    [GateControlType.WINDOW_A_CONTROL]: 'A窗控制',
+    [GateControlType.WINDOW_B_CONTROL]: 'B窗控制',
+    [GateControlType.WINDOW_C_CONTROL]: 'C窗控制',
+    [GateControlType.WINDOW_D_CONTROL]: 'D窗控制',
+    [GateControlType.FRONT_WINDOW_CONTROL]: '前窗控制',
+    [GateControlType.REAR_WINDOW_CONTROL]: '后窗控制',
+    [GateControlType.OVERHAUL_CONTROL]: '检修控制',
+  } as const;
+
+  const [registerModal, { openModal, closeModal }] = useModal();
+
+  const { getCamera, removeCamera } = useCamera();
+
+  const tabChange = (activeKeyVal) => {
+    activeKey.value = activeKeyVal;
+    if (activeKeyVal == 1) {
+      nextTick(() => {
+        if (MonitorDataTable.value) MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
+      });
+    }
+  };
+
+  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(lodash.cloneDeep(initData));
+
+  const flvURL1 = () => {
+    // return ''
+    return `/video/gate.mp4`;
+  };
+
+  function deviceEdit(e: Event, type: string, record) {
+    e.stopPropagation();
+    openModal(true, {
+      type,
+      deviceId: record['deviceID'],
     });
   }
-};
-
-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(lodash.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']]);
+  // 获取设备基本信息列表
+  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']]);
+              }
             }
+            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();
           }
-          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;
-
-  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;
+        },
+        flag ? 0 : 1000
+      );
     }
-  } else {
-    type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
-    if (selectData['doorUse'] == 2) {
-      type = 'fmXr';
-    } else if (selectData.ndoorcount == '3' || selectData.deviceType == 'gate_nomal3') {
-      type = 'fmThreeTl';
+  }
+
+  // 切换检测数据
+  async function getSelectRow(selectRow, index) {
+    if (!selectRow) return;
+    loading.value = true;
+    selectRowIndex.value = index;
+
+    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 {
-      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';
+      type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
+      if (selectData['doorUse'] == 2) {
+        type = 'fmXr';
+      } else if (selectData.ndoorcount == '3' || selectData.deviceType == 'gate_nomal3') {
+        type = 'fmThreeTl';
       } else {
-        type = 'fm1'; // 液压
+        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'; // 液压
+        }
       }
     }
-  }
 
-  debugger;
-  setModelType(type).then(async () => {
-    addMonitorText(selectData);
-    loading.value = false;
-  });
-  await getCamera(selectRow.deviceID, playerRef, renderPlayer);
-}
-
-// 播放动画
-function playAnimation(handlerState, data: any = null) {
-  const value = data;
-  switch (handlerState) {
-    case 1: // 打开前门
-      modalTitle.value = '打开前门';
-      modalType.value = '1';
-      modalIsShow.value = true;
-      break;
-    case 2: // 关闭前门
-      modalTitle.value = '关闭前门';
-      modalType.value = '2';
-      modalIsShow.value = true;
-      break;
-    case 3: // 打开后门
-      modalTitle.value = '打开后门';
-      modalType.value = '3';
-      modalIsShow.value = true;
-      break;
-    case 4: // 关闭后门
-      modalTitle.value = '关闭后门';
-      modalType.value = '4';
-      modalIsShow.value = true;
-      break;
-    case 8: // 打开中间门
-      modalTitle.value = '打开中间门';
-      modalType.value = '8';
-      modalIsShow.value = true;
-      break;
-    case 9: // 关闭中间门
-      modalTitle.value = '关闭中间门';
-      modalType.value = '9';
-      modalIsShow.value = true;
-      break;
-    case 5: // 打开前后门
-      modalTitle.value = '同时打开';
-      modalType.value = '5';
-      modalIsShow.value = true;
-      break;
-    case 6: // 关闭前后门
-      modalTitle.value = '同时关闭';
-      modalType.value = '6';
-      modalIsShow.value = true;
-      break;
-
-    case 7: // 控制模式切换
-      modalTitle.value = '控制模式切换';
-      modalType.value = '7';
-      modalIsShow.value = true;
-      break;
-
-    case 10: // 风窗控制
-      modalTitle.value = 'A窗控制';
-      modalType.value = '10';
-      modalIsShow.value = true;
-      break;
-
-    case 11: // 风窗控制
-      modalTitle.value = 'B窗控制';
-      modalType.value = '11';
-      modalIsShow.value = true;
-      break;
-    case 12: // 风窗控制
-      modalTitle.value = 'C窗控制';
-      modalType.value = '12';
-      modalIsShow.value = true;
-      break;
-    case 13: // 风窗控制
-      modalTitle.value = 'D窗控制';
-      modalType.value = '13';
-      modalIsShow.value = true;
-      break;
-    case 14: // 风窗控制
-      modalTitle.value = '前窗控制';
-      modalType.value = '14';
-      modalIsShow.value = true;
-      break;
-    case 15: // 风窗控制
-      modalTitle.value = '后窗控制';
-      modalType.value = '15';
-      modalIsShow.value = true;
-      break;
+    debugger;
+    setModelType(type).then(async () => {
+      addMonitorText(selectData);
+      loading.value = false;
+    });
+    await getCamera(selectRow.deviceID, playerRef, renderPlayer);
   }
 
-  if (globalConfig?.simulatedPassword) {
-    handleOK('', handlerState + '');
-  }
-  contrlValue = value;
-}
-
-const changeOverhaul = (e) => {
-  modalTitle.value = '检修控制';
-  modalType.value = '16';
-  modalIsShow.value = true;
-  contrlValue = e;
-};
-
-function handleOK(passWord, handlerState, value?) {
-  if (!passWord && !globalConfig?.simulatedPassword) {
-    message.warning('请输入密码');
-    return;
-  }
-  const data = {
-    deviceid: selectData.deviceID,
-    devicetype: selectData.deviceType,
-    paramcode: '',
-    value: contrlValue,
-    password: passWord || globalConfig?.simulatedPassword,
-    masterComputer: selectData.masterComputer,
-  };
-  let handler = () => { };
-
-  switch (handlerState) {
-    case '1': // 打开前门
-      data.paramcode = 'frontGateOpen_S';
-      break;
-    case '2': // 关闭前门
-      data.paramcode = 'frontGateClose_S';
-      break;
-    case '3': // 打开后门
-      data.paramcode = 'rearGateOpen_S';
-      break;
-    case '4': // 关闭后门
-      data.paramcode = 'rearGateClose_S';
-      break;
-    case '8': // 打开中间门
-      data.paramcode = 'midGateOpen_S';
-      break;
-    case '9': // 关闭中间门
-      data.paramcode = 'midGateClose_S';
-      break;
-    case '5': // 打开前后门
-      data.paramcode = 'sameTimeOpen';
-      break;
-    case '6': // 关闭前后门
-      data.paramcode = 'sameTimeClose';
-      break;
-    case '7': // 远程与就地
-      if (selectData.contrlMod == 'codeCtrl') {
-        if (contrlValue == '1') {
-          data.paramcode = 'autoRoManualControl1';
-        } else if (contrlValue == '0') {
-          data.paramcode = 'autoRoManualControl2';
-        } else {
-          data.paramcode = 'autoRoManualControl0';
-        }
-        data.value = '';
-        selectData.autoRoManual = null;
-      } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
-        data.paramcode = 'autoRoManualControl';
-        data.value = '';
-        selectData.autoRoManual = null;
+  /** 封装通用的模态框打开方法 */
+  const openGateControlModal = (
+    controlType: GateControlType | number,
+    customTitle?: string // 自定义标题(可选)
+  ) => {
+    // 优先使用自定义标题,无则从配置读取
+    let finalTitle = customTitle;
+    if (!finalTitle) {
+      const configItem = GATE_CONTROL_CONFIG_MAP[controlType as keyof typeof GATE_CONTROL_CONFIG_MAP];
+      if (configItem) {
+        finalTitle = configItem;
       } else {
-        data.paramcode = 'autoRoManualControl';
-        data.value = contrlValue;
-        selectData.autoRoManual = null;
+        message.warning(`未配置控制类型【${controlType}】的标题`);
+        return;
       }
-      break;
-    case '10': // 前(A)窗控制
-      data.paramcode = 'frontSetValue1';
-      data.value = value;
-      break;
-    case '11': // 后(B)窗控制
-      data.paramcode = 'frontSetValue2';
-      data.value = value;
-      break;
-    case '12': // 后(B)窗控制
-      data.paramcode = 'rearSetValue1';
-      data.value = value;
-      break;
-    case '13': // 后(B)窗控制
-      data.paramcode = 'rearSetValue2';
-      data.value = value;
-      break;
-    case '14': // 后(B)窗控制
-      data.paramcode = 'frontSetValue';
-      data.value = value;
-      break;
-    case '15': // 后(B)窗控制
-      data.paramcode = 'rearSetValue';
-      data.value = value;
-      break;
-    case '16': // 检修控制
-      data.paramcode = 'runRoRecondition_S';
-      data.value = selectData['runRoRecondition'] == 0 ? '1' : '0';
-      break;
+    }
+
+    // 统一赋值逻辑
+    modalType.value = String(controlType);
+    modalTitle.value = finalTitle;
+    modalIsShow.value = true;
+
+    // 如果有模拟密码,则直接执行操作
+    if (globalConfig?.simulatedPassword) {
+      handleOK('', String(controlType));
+    }
+  };
+  // 播放动画
+  function playAnimation(handlerState: GateControlType | number, data: any = null) {
+    const value = data;
+    contrlValue = value;
+
+    // 使用封装的方法打开模态框
+    openGateControlModal(handlerState);
   }
 
-  if (data.paramcode) {
-    deviceControlApi(data)
-      .then((res) => {
-        // 模拟时开启
-        if (res.success) {
-          modalIsShow.value = false;
-          if (globalConfig.History_Type == 'remote') {
-            message.success('指令已下发至生产管控平台成功!');
+  const changeOverhaul = (e) => {
+    openGateControlModal(GateControlType.OVERHAUL_CONTROL);
+    contrlValue = e;
+  };
+
+  function handleOK(passWord, handlerState, value?) {
+    if (!passWord && !globalConfig?.simulatedPassword) {
+      message.warning('请输入密码');
+      return;
+    }
+    const data = {
+      deviceid: selectData.deviceID,
+      devicetype: selectData.deviceType,
+      paramcode: '',
+      value: contrlValue,
+      password: passWord || globalConfig?.simulatedPassword,
+      masterComputer: selectData.masterComputer,
+    };
+    let handler = () => { };
+
+    switch (handlerState) {
+      case '1': // 打开前门
+        data.paramcode = 'frontGateOpen_S';
+        break;
+      case '2': // 关闭前门
+        data.paramcode = 'frontGateClose_S';
+        break;
+      case '3': // 打开后门
+        data.paramcode = 'rearGateOpen_S';
+        break;
+      case '4': // 关闭后门
+        data.paramcode = 'rearGateClose_S';
+        break;
+      case '8': // 打开中间门
+        data.paramcode = 'midGateOpen_S';
+        break;
+      case '9': // 关闭中间门
+        data.paramcode = 'midGateClose_S';
+        break;
+      case '5': // 打开前后门
+        data.paramcode = 'sameTimeOpen';
+        break;
+      case '6': // 关闭前后门
+        data.paramcode = 'sameTimeClose';
+        break;
+      case '7': // 远程与就地
+        if (selectData.contrlMod == 'codeCtrl') {
+          if (contrlValue == '1') {
+            data.paramcode = 'autoRoManualControl1';
+          } else if (contrlValue == '0') {
+            data.paramcode = 'autoRoManualControl2';
           } else {
-            message.success('指令已下发成功!');
+            data.paramcode = 'autoRoManualControl0';
           }
+          data.value = '';
+          selectData.autoRoManual = null;
+        } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
+          data.paramcode = 'autoRoManualControl';
+          data.value = '';
+          selectData.autoRoManual = null;
         } else {
-          message.error(res.message);
+          data.paramcode = 'autoRoManualControl';
+          data.value = contrlValue;
+          selectData.autoRoManual = null;
         }
-        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;
+        break;
+      case '10': // 前(A)窗控制
+        data.paramcode = 'frontSetValue1';
+        data.value = value;
+        break;
+      case '11': // 后(B)窗控制
+        data.paramcode = 'frontSetValue2';
+        data.value = value;
+        break;
+      case '12': // 后(B)窗控制
+        data.paramcode = 'rearSetValue1';
+        data.value = value;
+        break;
+      case '13': // 后(B)窗控制
+        data.paramcode = 'rearSetValue2';
+        data.value = value;
+        break;
+      case '14': // 后(B)窗控制
+        data.paramcode = 'frontSetValue';
+        data.value = value;
+        break;
+      case '15': // 后(B)窗控制
+        data.paramcode = 'rearSetValue';
+        data.value = value;
+        break;
+      case '16': // 检修控制
+        data.paramcode = 'runRoRecondition_S';
+        data.value = selectData['runRoRecondition'] == 0 ? '1' : '0';
+        break;
     }
-  }
 
-  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 (data.paramcode) {
+      deviceControlApi(data)
+        .then((res) => {
+          // 模拟时开启
+          if (res.success) {
+            modalIsShow.value = false;
+            if (globalConfig.History_Type == 'remote') {
+              message.success('指令已下发至生产管控平台成功!');
+            } else {
+              message.success('指令已下发成功!');
+            }
+          } 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.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.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.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.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.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.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 (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 (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 (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
-    isMidOpenRunning = 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 (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.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 == '0' && 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.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;
+    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;
+      }
     }
-  }
 
-  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 = '';
-}
-
-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];
+    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;
+      }
+    }
 
-    mountedThree(playerDom)
-      .then(async () => {
-        if (sysOrgCode != 'zmhjhzmy') {
-          await getMonitor(true);
-          loading.value = false;
-        } else {
-          // 韩咀无风门设备,只有报警历史数据,无其他数据
-          setModelType('fm1').then(async () => {
-            loading.value = false;
-            dataSource.value = [];
-            addMonitorText(selectData);
-          });
-        }
-      })
-      .catch(() => { });
+    modelRef.value?.animate?.(selectData.frontGateOpen == '1', selectData.midGateOpen == '1', selectData.rearGateOpen == '1');
   }
-});
 
-onBeforeUnmount(() => {
-  removeCamera(playerRef);
-  getDeviceBaseList();
-});
+  function playWindowAnimation(data, maxarea = 90, isFirst = false) {
+    computePlay(data, maxarea, isFirst);
+  }
 
-onUnmounted(() => {
-  if (timer) {
-    clearTimeout(timer);
-    timer = undefined;
+  function handleCancel() {
+    modalIsShow.value = false;
+    modalTitle.value = '';
+    modalType.value = '';
   }
-  destroy();
-});
+
+  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(playerDom)
+        .then(async () => {
+          if (sysOrgCode != 'zmhjhzmy') {
+            await getMonitor(true);
+            loading.value = false;
+          } else {
+            // 韩咀无风门设备,只有报警历史数据,无其他数据
+            setModelType('fm1').then(async () => {
+              loading.value = false;
+              dataSource.value = [];
+              addMonitorText(selectData);
+            });
+          }
+        })
+        .catch(() => { });
+    }
+  });
+
+  onBeforeUnmount(() => {
+    removeCamera(playerRef);
+    getDeviceBaseList();
+  });
+
+  onUnmounted(() => {
+    if (timer) {
+      clearTimeout(timer);
+      timer = undefined;
+    }
+    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;
+  .button-box {
+    border: none !important;
+    height: 34px !important;
 
-  &:hover {
-    background: var(--vent-device-manager-control-btn-hover) !important;
-  }
+    &:hover {
+      background: var(--vent-device-manager-control-btn-hover) !important;
+    }
 
-  &::before {
-    height: 27px !important;
-    background: var(--vent-device-manager-control-btn) !important;
-  }
+    &::before {
+      height: 27px !important;
+      background: var(--vent-device-manager-control-btn) !important;
+    }
 
-  &::after {
-    top: 35px !important;
+    &::after {
+      top: 35px !important;
+    }
   }
-}
 
-:deep(.@{ventSpace}-tabs-tabpane-active) {
-  height: 100%;
-}
+  :deep(.@{ventSpace}-tabs-tabpane-active) {
+    height: 100%;
+  }
 
-::-webkit-scrollbar-thumb {
-  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
-  background: #4288a444;
-}
+  ::-webkit-scrollbar-thumb {
+    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
+    background: #4288a444;
+  }
 
-:deep(.zxm-radio-disabled + span) {
-  color: var(--vent-font-color) !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(.zxm-radio-disabled .zxm-radio-inner::after) {
+    background-color: #127cb5 !important;
+  }
 
-:deep(.@{ventSpace}-picker-datetime-panel) {
-  height: 200px !important;
-  overflow-y: auto !important;
-}
+  :deep(.@{ventSpace}-picker-datetime-panel) {
+    height: 200px !important;
+    overflow-y: auto !important;
+  }
 </style>

+ 97 - 61
src/views/vent/monitorManager/windowMonitor/index.vue

@@ -302,6 +302,36 @@
   // 设备数据
   const controlType = ref(1);
 
+  /** 控制类型枚举 */
+  enum ControlType {
+    FRONT_AREA = 1, // 前窗面积/角度
+    REAR_AREA = 2, // 后窗面积/角度
+    LDKZ_START = 'ldkzStart', // 自主联动控制开启
+    LDKZ_STOP = 'ldkzStop', // 自主联动控制停止
+    FULL_OPEN = 5, // 一键全开
+    FULL_CLOSE = 6, // 一键全关
+    AIR_VOLUME_AUTO = 7, // 风量自主调控
+    AIR_VOLUME_AUTO_EXT = 8, // 风量自主调控扩展
+    SAME_SET_VALUE = 'sameSetValue', // 前后窗同值设置
+    CO_TEST = 'COTest', // 一氧化碳测试
+    AUTO_RUN = 'autoRun', // 自动运行
+    AUTO_STOP = 'autoStop', // 自动停止
+  }
+
+  /** 控制类型-标题映射配置 */
+  const CONTROL_CONFIG_MAP = {
+    [ControlType.FRONT_AREA]: (nwindownum: number, isAngle = false) =>
+      nwindownum === 2 ? (isAngle ? '设定前窗角度' : '设定前窗面积') : isAngle ? '设定风窗角度' : '设定风窗面积',
+    [ControlType.REAR_AREA]: (nwindownum: number, isAngle = false) =>
+      nwindownum === 2 ? (isAngle ? '设定后窗角度' : '设定后窗面积') : isAngle ? '设定风窗角度' : '设定风窗面积',
+    [ControlType.LDKZ_START]: '自主联动控制开启',
+    [ControlType.LDKZ_STOP]: '自主联动控制停止',
+    [ControlType.FULL_OPEN]: '一键全开',
+    [ControlType.FULL_CLOSE]: '一键全关',
+    [ControlType.AIR_VOLUME_AUTO]: '风量自主调控',
+    [ControlType.AIR_VOLUME_AUTO_EXT]: '风量自主调控',
+  } as const;
+
   const flvURL1 = () => {
     return `/video/window.mp4`;
   };
@@ -420,71 +450,79 @@
     return nextTick();
   }
 
-  // 设置风窗面积
-  const setArea = (flag) => {
-    modalType.value = flag + '';
-    if (flag == 1 || flag == 2) {
-      if (selectData.value.nwindownum == 2) {
-        modalTitle.value = flag === 1 ? '设定前窗面积' : '设定后窗面积';
+  /** 封装通用的模态框打开方法 */
+  const openControlModal = (
+    controlType: ControlType | string | number,
+    customTitle?: string, // 自定义标题
+    nwindownum?: number, // 风窗数量
+    isAngle = false // 是否是角度设置
+  ) => {
+    // 参数校验:风窗数量(动态标题必填)
+    const needWindowNum = [ControlType.FRONT_AREA, ControlType.REAR_AREA].includes(controlType as ControlType);
+    if (needWindowNum && nwindownum === undefined) {
+      message.warning('打开模态框失败:缺少风窗数量参数');
+      return;
+    }
+
+    // 优先使用自定义标题,无则从配置读取
+    let finalTitle = customTitle;
+    if (!finalTitle) {
+      const configItem = CONTROL_CONFIG_MAP[controlType as keyof typeof CONTROL_CONFIG_MAP];
+      if (typeof configItem === 'function') {
+        finalTitle = configItem(nwindownum!, isAngle);
+      } else if (configItem) {
+        finalTitle = configItem;
       } else {
-        modalTitle.value = '设定风窗面积';
+        message.warning(`未配置控制类型【${controlType}】的标题`);
+        return;
       }
-      modalIsShow.value = true;
+    }
+
+    // 统一赋值逻辑
+    modalType.value = String(controlType);
+    modalTitle.value = finalTitle;
+    modalIsShow.value = true;
+  };
+
+  // 设置风窗面积,调用封装的模态框方法
+  const setArea = (flag: ControlType | number) => {
+    modalType.value = flag + '';
+    const nwindownum = selectData.value.nwindownum;
+
+    // 面积设置(1/2为面积,其他为功能控制)
+    if ([ControlType.FRONT_AREA, ControlType.REAR_AREA].includes(flag as ControlType)) {
+      openControlModal(flag, undefined, nwindownum, false);
     } else {
       if (!globalConfig?.simulatedPassword) {
-        if (flag == 'ldkzStart') {
-          modalTitle.value = '自主联动控制开启';
-        } else if (flag == 'ldkzStop') {
-          modalTitle.value = '自主联动控制停止';
-        } else if (flag == 5) {
-          modalTitle.value = '一键全开';
-        } else if (flag == 6) {
-          modalTitle.value = '一键全关';
-        } else if (flag == 7) {
-          modalTitle.value = '风量自主调控';
-        }
-        modalIsShow.value = true;
+        openControlModal(flag, undefined, nwindownum);
       } else {
         handleOK('', modalType.value, selectData.value.nwindownum);
       }
     }
   };
 
-  // 设置风窗角度
-  const setAngle = (flag) => {
+  // 重构setAngle方法,调用封装的模态框方法
+  const setAngle = (flag: ControlType | number) => {
     modalType.value = flag + '';
-    if (flag == 1 || flag == 2) {
-      if (selectData.value.nwindownum == 2) {
-        modalTitle.value = flag === 1 ? '设定前窗角度' : '设定后窗角度';
-      } else {
-        modalTitle.value = '设定风窗角度';
-      }
-      modalIsShow.value = true;
-    } else if (flag == 7) {
-      modalTitle.value = '风量自主调控';
-      modalIsShow.value = true;
+    const nwindownum = selectData.value.nwindownum;
+
+    // 角度设置(1/2为角度,7为风量自主调控,其他为功能控制)
+    if ([ControlType.FRONT_AREA, ControlType.REAR_AREA].includes(flag as ControlType)) {
+      openControlModal(flag, undefined, nwindownum, true);
+    } else if (flag === ControlType.AIR_VOLUME_AUTO) {
+      openControlModal(flag);
     } else {
       if (!globalConfig?.simulatedPassword) {
-        if (flag == 'ldkzStart') {
-          modalTitle.value = '自主联动控制开启';
-        } else if (flag == 'ldkzStop') {
-          modalTitle.value = '自主联动控制停止';
-        } else if (flag == 5) {
-          modalTitle.value = '一键全开';
-        } else if (flag == 6) {
-          modalTitle.value = '一键全关';
-        }
-        modalIsShow.value = true;
+        openControlModal(flag);
       } else {
         handleOK('', modalType.value, selectData.value.nwindownum);
       }
     }
   };
 
-  const setControl = (flag, title) => {
-    modalType.value = flag + '';
-    modalTitle.value = title;
-    modalIsShow.value = true;
+  // 重构setControl方法,调用封装的模态框方法
+  const setControl = (flag: ControlType | string | number, title: string) => {
+    openControlModal(flag, title);
   };
 
   const handleOK = async (passWord, handlerState, value) => {
@@ -501,8 +539,8 @@
     };
     let params;
     // 风窗风量自主调控
-    if (handlerState == 7 || handlerState == 8) {
-      if (handlerState == 7) {
+    if (handlerState == ControlType.AIR_VOLUME_AUTO || handlerState == ControlType.AIR_VOLUME_AUTO_EXT) {
+      if (handlerState == ControlType.AIR_VOLUME_AUTO) {
         // 单道风窗
         params = {
           windowId: selectData.value.deviceID,
@@ -525,10 +563,10 @@
         }
       });
       return;
-    } else if (handlerState == 'ldkzStart' || handlerState == 'ldkzStop') {
-      data.paramcode = 'autoRun';
-      data.value = handlerState == 'ldkzStart' ? 1 : 0;
-      if (handlerState == 'ldkzStart') {
+    } else if (handlerState == ControlType.LDKZ_START || handlerState == ControlType.LDKZ_STOP) {
+      data.paramcode = ControlType.AUTO_RUN;
+      data.value = handlerState == ControlType.LDKZ_START ? 1 : 0;
+      if (handlerState == ControlType.LDKZ_START) {
         ch4.value = value;
         params = { auto: 1, windowId: selectData.value.deviceID, gasMax: ch4.value };
       } else {
@@ -551,7 +589,7 @@
           }
         });
       }
-    } else if (handlerState == 'sameSetValue') {
+    } else if (handlerState == ControlType.SAME_SET_VALUE) {
       const data1 = {
         deviceid: selectData.value.deviceID,
         devicetype: selectData.value.deviceType,
@@ -575,17 +613,17 @@
       }
       handleCancel();
     } else {
-      if (handlerState == 1 || handlerState == 2) {
+      if (handlerState == ControlType.FRONT_AREA || handlerState == ControlType.REAR_AREA) {
         windowAngle.value = value;
-        data.paramcode = handlerState == 1 ? 'frontSetValue' : 'rearSetValue';
+        data.paramcode = handlerState == ControlType.FRONT_AREA ? 'frontSetValue' : 'rearSetValue';
         data.value = windowAngle.value;
-      } else if (handlerState == 5 || handlerState == 6) {
+      } else if (handlerState == ControlType.FULL_OPEN || handlerState == ControlType.FULL_CLOSE) {
         data.paramcode = 'frontSetValue';
-        data.value = handlerState == 5 ? selectData.value.maxarea : 0;
+        data.value = handlerState == ControlType.FULL_OPEN ? selectData.value.maxarea : 0;
       } else if (handlerState.startsWith('frontSetValue')) {
         data.paramcode = handlerState;
         data.value = value;
-      } else if (handlerState == 'COTest') {
+      } else if (handlerState == ControlType.CO_TEST) {
         if (value > 50) {
           // message.warning(`一氧化碳超限,可能存在火灾隐患,是否开启${selectData.value.strinstallpos},使有毒烟气短路?`, 3000);
           createConfirm({
@@ -606,7 +644,7 @@
         }
       } else {
         data.paramcode = handlerState;
-        if (handlerState == 'autoRun' || handlerState == 'autoStop') {
+        if (handlerState == ControlType.AUTO_RUN || handlerState == ControlType.AUTO_STOP) {
           data.value = null;
         } else {
           data.value = value;
@@ -645,8 +683,6 @@
   }
 
   onBeforeMount(() => {
-    // const sendVal = JSON.stringify({ pagetype: 'normal', devicetype: 'window', orgcode: '', ids: '', systemID: '' });
-    // initWebSocket(sendVal);
     getDeviceBaseList();
   });