index.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  1. <template>
  2. <div class="bg" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
  3. <a-spin :spinning="loading" />
  4. <div id="deviceDetail" class="device-detail">
  5. <div id="deviceCard" class="device-card" style="z-index: -1; position: absolute">
  6. <div class="title">KJ-980-F矿用本安型监控分站</div>
  7. <div class="detail-box">
  8. <div class="left-box"></div>
  9. <div class="right-box">
  10. <div><span class="detail-title">规格型号:</span> <span>KJ-980-F</span></div>
  11. <div
  12. ><span class="detail-title">技术参数:</span>
  13. <span
  14. >380V,电机功率22kW,50Hz,B级绝缘,额定电流42.2A,效率90.5%,能效等级3,接法角型,2940r/min,轴承6311/CM 6211/CM,功率因数0.89</span
  15. >
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div id="damper3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"></div>
  22. </div>
  23. <div class="scene-box">
  24. <div class="top-box">
  25. <div class="top-center row">
  26. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(1)">打开前门</div>
  27. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(2)">关闭前门</div>
  28. <div v-if="hasPermission('btn:control') && selectData.deviceType == 'gate_ss'" class="button-box" @click="playAnimation(8)">打开中间门</div>
  29. <div v-if="hasPermission('btn:control') && selectData.deviceType == 'gate_ss'" class="button-box" @click="playAnimation(9)">关闭中间门</div>
  30. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(3)">打开后门</div>
  31. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(4)">关闭后门</div>
  32. <div v-if="hasPermission('btn:control') && selectData.deviceType != 'gate_ss'" class="button-box" @click="playAnimation(5)">同时打开</div>
  33. <div v-if="hasPermission('btn:control') && selectData.deviceType != 'gate_ss'" class="button-box" @click="playAnimation(6)">同时关闭</div>
  34. </div>
  35. <!-- 控制模式 -->
  36. <div class="top-right row">
  37. <div class="vent-flex-m row" v-if="selectData.contrlMod == 'loopCtrl'">
  38. <div class="control-title">控制模式:</div>
  39. <a-radio-group v-model:value="selectData.autoRoManual">
  40. <template v-for="(item, index) in modelList" :key="index">
  41. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  42. </template>
  43. </a-radio-group>
  44. <div class="button-box" @click="playAnimation(7)">切换模式</div>
  45. <!-- <div class="button-box" @click="playAnimation(10)">自主联动控制</div> -->
  46. </div>
  47. <div class="vent-flex-m row" v-else>
  48. <div class="control-title">控制模式:</div>
  49. <a-radio-group v-model:value="selectData.autoRoManual">
  50. <template v-for="(item, index) in modelList" :key="index">
  51. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  52. </template>
  53. </a-radio-group>
  54. <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">{{ item.text }}</div>
  55. </div>
  56. <!-- <div class="run-type row">
  57. <div class="control-title">运行状态:</div>
  58. <a-radio-group v-model:value="selectData.runRoRecondition">
  59. <a-radio :value="`0`">检修</a-radio>
  60. <a-radio :value="`1`">运行</a-radio>
  61. </a-radio-group>
  62. </div> -->
  63. </div>
  64. </div>
  65. <div class="title-text">
  66. {{ selectData.supplyAirAddr || selectData.strinstallpos || selectData.strname }}
  67. </div>
  68. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 350, scroll)">
  69. <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 120}px`">
  70. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  71. <a-tab-pane key="1" tab="实时监测">
  72. <MonitorTable
  73. v-if="activeKey === '1'"
  74. ref="MonitorDataTable"
  75. class="monitor-table"
  76. :columnsType="deviceType"
  77. :isShowActionColumn="true"
  78. :dataSource="dataSource"
  79. design-scope="gate-monitor"
  80. @selectRow="getSelectRow"
  81. :scroll="{ y: scroll.y - 40 }"
  82. title="风门监测"
  83. :isShowPagination="true"
  84. >
  85. <template #filterCell="{ column, record }">
  86. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
  87. >正在运行</a-tag
  88. >
  89. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
  90. >关闭</a-tag
  91. >
  92. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'" color="#46C66F"
  93. >打开</a-tag
  94. >
  95. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'" color="#FF0000"
  96. >点位异常</a-tag
  97. >
  98. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
  99. >正在运行</a-tag
  100. >
  101. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
  102. >关闭</a-tag
  103. >
  104. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
  105. >打开</a-tag
  106. >
  107. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
  108. >点位异常</a-tag
  109. >
  110. <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
  111. >正在运行</a-tag
  112. >
  113. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
  114. >关闭</a-tag
  115. >
  116. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
  117. >打开</a-tag
  118. >
  119. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
  120. >点位异常</a-tag
  121. >
  122. <template v-if="column.dataIndex === 'ndoortype'">
  123. <span v-if="record.ndoortype == '0'">气动风门</span>
  124. <span v-else color="default">液压风门</span>
  125. </template>
  126. <template v-if="column.dataIndex === 'doorUse'">
  127. <span v-if="record.doorUse == 1" color="default">行车风门</span>
  128. <span v-else-if="record.doorUse == 2">行人风门</span>
  129. <span v-else-if="record.doorUse == 3">短路风门</span>
  130. </template>
  131. <template v-else-if="column.dataIndex === 'warnLevel'">
  132. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  133. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  134. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  135. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  136. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  137. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  138. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  139. <a-tag v-else color="green">正常</a-tag>
  140. </template>
  141. <a-tag v-else-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : 'red'">{{
  142. record.warnFlag == '0' ? '正常' : '报警'
  143. }}</a-tag>
  144. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  145. record.netStatus == '0' ? '断开' : '连接'
  146. }}</a-tag>
  147. </template>
  148. <template #action="{ record }">
  149. <a v-if="globalConfig?.showReport" class="table-action-link" @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
  150. <a class="table-action-link" @click="deviceEdit($event, 'deviceInfo', record)">设备编辑</a>
  151. </template>
  152. </MonitorTable>
  153. </a-tab-pane>
  154. <!-- <a-tab-pane key="2" tab="实时曲线图" force-render>
  155. <div class="tab-item" v-if="activeKey === '2'">
  156. <DeviceEcharts chartsColumnsType="gate_chart" xAxisPropType="strname" :dataSource="dataSource" height="100%"
  157. :chartsColumns="chartsColumns" :device-list-api="list" device-type="gate" />
  158. </div>
  159. </a-tab-pane> -->
  160. <a-tab-pane key="3" tab="历史数据">
  161. <div class="tab-item" v-if="activeKey === '3'">
  162. <HistoryTable :columnsType="deviceType" :device-type="deviceType" designScope="gate-history" :scroll="scroll">
  163. <template #filterCell="{ column, record }">
  164. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
  165. >正在运行</a-tag
  166. >
  167. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
  168. >关闭</a-tag
  169. >
  170. <a-tag
  171. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'"
  172. color="#46C66F"
  173. >打开</a-tag
  174. >
  175. <a-tag
  176. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'"
  177. color="#FF0000"
  178. >点位异常</a-tag
  179. >
  180. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
  181. >正在运行</a-tag
  182. >
  183. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
  184. >关闭</a-tag
  185. >
  186. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
  187. >打开</a-tag
  188. >
  189. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
  190. >点位异常</a-tag
  191. >
  192. <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
  193. >正在运行</a-tag
  194. >
  195. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
  196. >关闭</a-tag
  197. >
  198. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
  199. >打开</a-tag
  200. >
  201. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
  202. >点位异常</a-tag
  203. >
  204. <template v-if="column.dataIndex === 'ndoortype'">
  205. <span v-if="record.ndoortype == '0'">气动风门</span>
  206. <span v-else color="default">液压风门</span>
  207. </template>
  208. <template v-if="column.dataIndex === 'doorUse'">
  209. <span v-if="record.doorUse == 1" color="default">行车风门</span>
  210. <span v-else-if="record.doorUse == 2">行人风门</span>
  211. <span v-else-if="record.doorUse == 3">短路风门</span>
  212. </template>
  213. <template v-else-if="column.dataIndex === 'warnLevel'">
  214. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  215. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  216. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  217. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  218. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  219. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  220. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  221. <a-tag v-else color="green">正常</a-tag>
  222. </template>
  223. </template>
  224. </HistoryTable>
  225. </div>
  226. </a-tab-pane>
  227. <a-tab-pane key="4" tab="报警历史">
  228. <div class="tab-item" v-if="activeKey === '4'">
  229. <AlarmHistoryTable
  230. columns-type="alarm"
  231. :device-type="deviceType"
  232. :device-list-api="getTableList"
  233. designScope="alarm-history"
  234. :scroll="scroll"
  235. >
  236. <template #filterCell="{ column, record }">
  237. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
  238. {{ record.warnFlag == '0' ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
  239. >
  240. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  241. record.netStatus == '0' ? '断开' : '连接'
  242. }}</a-tag>
  243. </template>
  244. </AlarmHistoryTable>
  245. </div>
  246. </a-tab-pane>
  247. <a-tab-pane key="5" tab="操作历史">
  248. <div class="tab-item" v-if="activeKey === '5'">
  249. <HandlerHistoryTable
  250. columns-type="operator_history"
  251. :device-type="deviceType"
  252. :device-list-api="getTableList"
  253. designScope="operator_history"
  254. :scroll="scroll"
  255. />
  256. </div>
  257. </a-tab-pane>
  258. </a-tabs>
  259. </dv-border-box8>
  260. </div>
  261. </div>
  262. <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 15px; width: 300px; height: 280px; margin: auto"> </div>
  263. <LivePlayer
  264. id="fm-player1"
  265. style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
  266. ref="player1"
  267. :videoUrl="flvURL1()"
  268. muted
  269. live
  270. loading
  271. controls
  272. />
  273. <HandleModal
  274. v-if="!globalConfig?.simulatedPassword"
  275. :modal-is-show="modalIsShow"
  276. :modal-title="modalTitle"
  277. :modal-type="modalType"
  278. @handle-ok="handleOK"
  279. @handle-cancel="handleCancel"
  280. />
  281. <DeviceBaseInfo @register="registerModal" :device-type="selectData['deviceType']" />
  282. </template>
  283. <script setup lang="ts">
  284. import { onBeforeUnmount, onUnmounted, onMounted, ref, reactive, nextTick, inject, unref } from 'vue';
  285. import MonitorTable from '../comment/MonitorTable.vue';
  286. import HistoryTable from '../comment/HistoryTable.vue';
  287. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  288. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  289. import HandleModal from './modal.vue';
  290. import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
  291. import { mountedThree, addMonitorText, play, destroy, setModelType, initCameraCanvas } from './gate.threejs';
  292. import { deviceControlApi } from '/@/api/vent/index';
  293. import { message } from 'ant-design-vue';
  294. import { list, getTableList, cameraList, cameraAddrList } from './gate.api';
  295. import lodash from 'lodash';
  296. import { setDivHeight } from '/@/utils/event';
  297. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  298. import { useRouter } from 'vue-router';
  299. import LivePlayer from '@liveqing/liveplayer-v3';
  300. import { useModal } from '/@/components/Modal';
  301. import { useCamera } from '/@/hooks/system/useCamera';
  302. import { usePermission } from '/@/hooks/web/usePermission';
  303. import { getDictItems } from '/@/api/common/api';
  304. const { hasPermission } = usePermission();
  305. const globalConfig = inject('globalConfig');
  306. const { currentRoute } = useRouter();
  307. const MonitorDataTable = ref();
  308. let contrlValue = '';
  309. const playerRef = ref();
  310. const deviceType = ref('gate');
  311. const activeKey = ref('1'); // tab
  312. const loading = ref(false);
  313. const scroll = reactive({
  314. y: 230,
  315. });
  316. const modelList = ref<{ text: string; value: string }[]>([]);
  317. const frontDoorIsOpen = ref(false); //前门是否开启
  318. const backDoorIsOpen = ref(false); //后门是否开启
  319. const midDoorIsOpen = ref(false); //中间门是否开启
  320. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  321. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  322. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  323. const selectRowIndex = ref(-1); // 选中行
  324. const dataSource = ref([]);
  325. const deviceBaseList = ref([]); // 设备基本信息
  326. const [registerModal, { openModal, closeModal }] = useModal();
  327. const { getCamera, removeCamera } = useCamera();
  328. const tabChange = (activeKeyVal) => {
  329. activeKey.value = activeKeyVal;
  330. if (activeKeyVal == 1) {
  331. nextTick(() => {
  332. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
  333. });
  334. }
  335. };
  336. const initData = {
  337. deviceID: '',
  338. deviceType: '',
  339. strname: '',
  340. frontRearDP: '-', //压差
  341. // sourcePressure: '-', //气源压力
  342. runRoRecondition: null,
  343. autoRoManual: null,
  344. netStatus: '0', //通信状态
  345. frontGateOpen: '0',
  346. frontGateClose: '1',
  347. rearGateOpen: '0',
  348. rearGateClose: '1',
  349. midGateOpen: '0',
  350. midGateClose: '1',
  351. fault: '气源压力超限',
  352. masterComputer: 0,
  353. frontGateOpenCtrl: false,
  354. rearGateOpenCtrl: false,
  355. cameras: [],
  356. };
  357. // 监测数据
  358. const selectData = reactive(lodash.cloneDeep(initData));
  359. const flvURL1 = () => {
  360. // return ''
  361. return `/video/gate.mp4`;
  362. };
  363. function deviceEdit(e: Event, type: string, record) {
  364. e.stopPropagation();
  365. openModal(true, {
  366. type,
  367. deviceId: record['deviceID'],
  368. });
  369. }
  370. // 获取设备基本信息列表
  371. function getDeviceBaseList() {
  372. getTableList({ pageSize: 1000 }).then((res) => {
  373. deviceBaseList.value = res.records;
  374. });
  375. }
  376. // https获取监测数据
  377. let timer: null | NodeJS.Timeout = null;
  378. async function getMonitor(flag?) {
  379. if (Object.prototype.toString.call(timer) === '[object Null]') {
  380. timer = await setTimeout(
  381. async () => {
  382. const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  383. if (res.msgTxt && res.msgTxt[0]) {
  384. dataSource.value = res.msgTxt[0].datalist || [];
  385. dataSource.value.forEach((data: any) => {
  386. const readData = data.readData;
  387. data = Object.assign(data, readData);
  388. });
  389. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  390. // 初始打开页面
  391. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  392. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  393. } else {
  394. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  395. }
  396. }
  397. Object.assign(selectData, dataSource.value[selectRowIndex.value]);
  398. addMonitorText(selectData);
  399. monitorAnimation(selectData);
  400. if (timer) {
  401. timer = null;
  402. }
  403. getMonitor();
  404. }
  405. },
  406. flag ? 0 : 1000
  407. );
  408. }
  409. }
  410. // 切换检测数据
  411. async function getSelectRow(selectRow, index) {
  412. if (!selectRow) return;
  413. loading.value = true;
  414. selectRowIndex.value = index;
  415. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  416. Object.assign(selectData, initData, selectRow, baseData);
  417. isFrontOpenRunning = false; //开关门动作是否在进行
  418. isRearOpenRunning = false; //开关门动作是否在进行
  419. isMidOpenRunning = false; //开关门动作是否在进行
  420. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  421. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  422. midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  423. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  424. let type;
  425. if (selectData['doorUse'] == 2) {
  426. type = 'fmXr';
  427. } else {
  428. if (selectData.deviceType == 'gate_ss') {
  429. type = 'fm2';
  430. } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
  431. type = 'fm3';
  432. } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
  433. type = 'fmTwoSs';
  434. } else {
  435. type = 'fm1'; // 液压
  436. }
  437. }
  438. setModelType(type).then(async () => {
  439. addMonitorText(selectData);
  440. loading.value = false;
  441. });
  442. await getCamera(selectRow.deviceID, playerRef.value);
  443. }
  444. // 播放动画
  445. function playAnimation1(handlerState, data: any = null) {
  446. const value = data;
  447. switch (handlerState) {
  448. case 1: // 打开前门
  449. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  450. modalTitle.value = '打开前门';
  451. modalType.value = '1';
  452. modalIsShow.value = true;
  453. } else {
  454. message.warning('前门已经打开或正在打开,请勿重新操作');
  455. }
  456. break;
  457. case 2: // 关闭前门
  458. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  459. modalTitle.value = '关闭前门';
  460. modalType.value = '2';
  461. modalIsShow.value = true;
  462. } else {
  463. message.warning('前门已经关闭或正在关闭,请勿重新操作');
  464. }
  465. break;
  466. case 3: // 打开后门
  467. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  468. modalTitle.value = '打开后门';
  469. modalType.value = '3';
  470. modalIsShow.value = true;
  471. } else {
  472. message.warning('后门已经打开或正在打开,请勿重新操作');
  473. }
  474. break;
  475. case 4: // 关闭后门
  476. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  477. modalTitle.value = '关闭后门';
  478. modalType.value = '4';
  479. modalIsShow.value = true;
  480. } else {
  481. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  482. }
  483. break;
  484. case 8: // 打开中间门
  485. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  486. modalTitle.value = '打开中间门';
  487. modalType.value = '8';
  488. modalIsShow.value = true;
  489. } else {
  490. message.warning('后门已经打开或正在打开,请勿重新操作');
  491. }
  492. break;
  493. case 9: // 关闭中间门
  494. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  495. modalTitle.value = '关闭中间门';
  496. modalType.value = '9';
  497. modalIsShow.value = true;
  498. } else {
  499. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  500. }
  501. break;
  502. case 5: // 打开前后门
  503. if (
  504. selectData.frontGateOpen == '0' &&
  505. selectData.frontGateClose == '1' &&
  506. selectData.rearGateOpen == '0' &&
  507. selectData.rearGateClose == '1'
  508. ) {
  509. modalTitle.value = '打开前后门';
  510. modalType.value = '5';
  511. modalIsShow.value = true;
  512. } else {
  513. message.warning('前后门已经打开或正在打开,请勿重新操作');
  514. }
  515. break;
  516. case 6: // 关闭前后门
  517. if (
  518. selectData.frontGateOpen == '1' &&
  519. selectData.frontGateClose == '0' &&
  520. selectData.rearGateOpen == '1' &&
  521. selectData.rearGateClose == '0'
  522. ) {
  523. modalTitle.value = '关闭前后门';
  524. modalType.value = '6';
  525. modalIsShow.value = true;
  526. } else {
  527. message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  528. }
  529. break;
  530. case 7: // 控制模式切换
  531. modalTitle.value = '控制模式切换';
  532. modalType.value = '7';
  533. modalIsShow.value = true;
  534. break;
  535. }
  536. if (globalConfig?.simulatedPassword) {
  537. handleOK('', handlerState + '');
  538. }
  539. contrlValue = value;
  540. }
  541. // 保德缺打开状态
  542. function playAnimation(handlerState, data: any = null) {
  543. const value = data;
  544. switch (handlerState) {
  545. case 1: // 打开前门
  546. modalTitle.value = '打开前门';
  547. modalType.value = '1';
  548. modalIsShow.value = true;
  549. break;
  550. case 2: // 关闭前门
  551. modalTitle.value = '关闭前门';
  552. modalType.value = '2';
  553. modalIsShow.value = true;
  554. break;
  555. case 3: // 打开后门
  556. modalTitle.value = '打开后门';
  557. modalType.value = '3';
  558. modalIsShow.value = true;
  559. break;
  560. case 4: // 关闭后门
  561. modalTitle.value = '关闭后门';
  562. modalType.value = '4';
  563. modalIsShow.value = true;
  564. break;
  565. case 5: // 打开前后门
  566. modalTitle.value = '打开前后门';
  567. modalType.value = '5';
  568. modalIsShow.value = true;
  569. break;
  570. case 6: // 关闭前后门
  571. modalTitle.value = '关闭前后门';
  572. modalType.value = '6';
  573. modalIsShow.value = true;
  574. break;
  575. case 7: // 控制模式切换
  576. modalTitle.value = '控制模式切换';
  577. modalType.value = '7';
  578. modalIsShow.value = true;
  579. break;
  580. case 8: // 打开中间门
  581. modalTitle.value = '打开中间门';
  582. modalType.value = '8';
  583. modalIsShow.value = true;
  584. break;
  585. case 9: // 关闭中间门
  586. modalTitle.value = '关闭中间门';
  587. modalType.value = '9';
  588. modalIsShow.value = true;
  589. break;
  590. case 10: // 控制模式切换
  591. modalTitle.value = '自主联动控制';
  592. modalType.value = '10';
  593. modalIsShow.value = true;
  594. break;
  595. }
  596. if (globalConfig?.simulatedPassword) {
  597. handleOK('', handlerState + '');
  598. }
  599. contrlValue = value;
  600. }
  601. function handleOK(passWord, handlerState) {
  602. if (passWord == '') {
  603. message.warning('请输入密码');
  604. return;
  605. }
  606. if (isOpenRunning) {
  607. return;
  608. }
  609. const data = {
  610. deviceid: selectData.deviceID,
  611. devicetype: selectData.deviceType,
  612. paramcode: '',
  613. value: contrlValue,
  614. password: passWord || globalConfig?.simulatedPassword,
  615. masterComputer: selectData.masterComputer,
  616. };
  617. let handler = () => {};
  618. switch (handlerState) {
  619. case '1': // 打开前门
  620. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  621. handler = () => {
  622. frontDoorIsOpen.value = true;
  623. };
  624. data.paramcode = 'frontGateOpen_S';
  625. }
  626. break;
  627. case '2': // 关闭前门
  628. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  629. handler = () => {
  630. frontDoorIsOpen.value = false;
  631. };
  632. data.paramcode = 'frontGateClose_S';
  633. }
  634. break;
  635. case '3': // 打开后门
  636. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  637. handler = () => {
  638. backDoorIsOpen.value = true;
  639. };
  640. data.paramcode = 'rearGateOpen_S';
  641. }
  642. break;
  643. case '4': // 关闭后门
  644. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  645. handler = () => {
  646. backDoorIsOpen.value = false;
  647. };
  648. data.paramcode = 'rearGateClose_S';
  649. }
  650. break;
  651. case '8': // 打开中间门
  652. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  653. handler = () => {
  654. midDoorIsOpen.value = true;
  655. };
  656. data.paramcode = 'midGateOpen_S';
  657. }
  658. break;
  659. case '9': // 关闭中间门
  660. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  661. handler = () => {
  662. midDoorIsOpen.value = false;
  663. };
  664. data.paramcode = 'midGateClose_S';
  665. }
  666. break;
  667. case '5': // 打开前后门
  668. if (
  669. selectData.frontGateOpen == '0' &&
  670. selectData.frontGateClose == '1' &&
  671. selectData.rearGateOpen == '0' &&
  672. selectData.rearGateClose == '1'
  673. ) {
  674. handler = () => {
  675. frontDoorIsOpen.value = true;
  676. backDoorIsOpen.value = true;
  677. };
  678. data.paramcode = 'sameTimeOpen';
  679. }
  680. break;
  681. case '6': // 关闭前后门
  682. if (
  683. selectData.frontGateOpen == '1' &&
  684. selectData.frontGateClose == '0' &&
  685. selectData.rearGateOpen == '1' &&
  686. selectData.rearGateClose == '0'
  687. ) {
  688. handler = () => {
  689. frontDoorIsOpen.value = false;
  690. backDoorIsOpen.value = false;
  691. };
  692. data.paramcode = 'sameTimeClose';
  693. }
  694. break;
  695. case '7': // 远程与就地
  696. data.paramcode = 'autoRoManualControl';
  697. data.value = selectData.contrlMod != 'loopCtrl' ? contrlValue : '';
  698. selectData.autoRoManual = null;
  699. case '10': // 远程与就地
  700. data.paramcode = 'ldkzControl';
  701. }
  702. if (data.paramcode) {
  703. deviceControlApi(data).then((res) => {
  704. // 模拟时开启
  705. if (res.success) {
  706. modalIsShow.value = false;
  707. if (globalConfig.History_Type == 'remote') {
  708. message.success('指令已下发至生产管控平台成功!');
  709. } else {
  710. message.success('指令已下发成功!');
  711. }
  712. } else {
  713. message.error(res.message);
  714. }
  715. });
  716. }
  717. }
  718. let isOpenRunning = false; //开关门动作是否在进行
  719. /** 开关门动画调用 */
  720. let isFrontOpenRunning = false; //开关门动作是否在进行
  721. // let isFrontCloseRunning = false; //开关门动作是否在进行
  722. let isRearOpenRunning = false; //开关门动作是否在进行
  723. // let isRearCloseRunning = false; //开关门动作是否在进行
  724. let isMidOpenRunning = false; //中间门动作是否在进行
  725. // let isMidCloseRunning = false; //中间门动作是否在进行
  726. // 0 关闭 1 正在打开 2 打开 3正在关闭
  727. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  728. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  729. let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  730. function monitorAnimation(selectData) {
  731. const timeScale = 0.005;
  732. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  733. isFrontOpenRunning = true;
  734. if (frontDeviceState != 1) {
  735. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  736. play(1, timeScale);
  737. frontDeviceState = 1;
  738. frontDoorIsOpen.value = false;
  739. backDoorIsOpen.value = true;
  740. }
  741. }
  742. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  743. isFrontOpenRunning = true;
  744. if (frontDeviceState != 1) {
  745. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  746. play(1, timeScale);
  747. frontDeviceState = 1;
  748. frontDoorIsOpen.value = false;
  749. backDoorIsOpen.value = true;
  750. }
  751. }
  752. if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  753. isFrontOpenRunning = false;
  754. if (frontDeviceState != 0) {
  755. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  756. play(2, timeScale);
  757. frontDeviceState = 0;
  758. frontDoorIsOpen.value = false;
  759. // backDoorIsOpen.value = false
  760. }
  761. }
  762. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  763. isRearOpenRunning = true;
  764. if (rearDeviceState != 1) {
  765. rearDeviceState = 1;
  766. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  767. play(3, timeScale);
  768. backDoorIsOpen.value = false;
  769. frontDoorIsOpen.value = true;
  770. }
  771. }
  772. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  773. isRearOpenRunning = true;
  774. if (rearDeviceState != 1) {
  775. rearDeviceState = 1;
  776. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  777. play(3, timeScale);
  778. backDoorIsOpen.value = false;
  779. frontDoorIsOpen.value = true;
  780. }
  781. }
  782. if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  783. isRearOpenRunning = false;
  784. if (rearDeviceState != 0) {
  785. rearDeviceState = 0;
  786. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  787. play(4, timeScale);
  788. backDoorIsOpen.value = false;
  789. }
  790. }
  791. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  792. isMidOpenRunning = true;
  793. if (midDeviceState != 1) {
  794. midDeviceState = 1;
  795. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  796. play(8, timeScale);
  797. backDoorIsOpen.value = false;
  798. frontDoorIsOpen.value = true;
  799. }
  800. }
  801. if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  802. isMidOpenRunning = true;
  803. if (midDeviceState != 1) {
  804. midDeviceState = 1;
  805. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  806. play(8, timeScale);
  807. backDoorIsOpen.value = false;
  808. frontDoorIsOpen.value = true;
  809. }
  810. }
  811. if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
  812. isMidOpenRunning = false;
  813. if (midDeviceState != 0) {
  814. midDeviceState = 0;
  815. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  816. play(9, timeScale);
  817. backDoorIsOpen.value = false;
  818. }
  819. }
  820. }
  821. function handleCancel() {
  822. modalIsShow.value = false;
  823. modalTitle.value = '';
  824. modalType.value = '';
  825. selectData.autoRoManual = null;
  826. }
  827. // // 远程、就地切换
  828. // function changeType() {
  829. // const data = {
  830. // deviceid: selectData.deviceID,
  831. // devicetype: selectData.deviceType,
  832. // paramcode: 'autoRoManualControl',
  833. // value: selectData.autoRoManual,
  834. // };
  835. // deviceControlApi(data).then(() => {
  836. // if (globalConfig.History_Type == 'remote') {
  837. // message.success('指令已下发至生产管控平台成功!');
  838. // } else {
  839. // message.success('指令已下发成功!');
  840. // }
  841. // });
  842. // }
  843. onMounted(async () => {
  844. const { query } = unref(currentRoute);
  845. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  846. modelList.value = await getDictItems('gateModel');
  847. loading.value = true;
  848. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  849. mountedThree(playerDom).then(async () => {
  850. await getMonitor(true);
  851. loading.value = false;
  852. });
  853. });
  854. onBeforeUnmount(() => {
  855. getDeviceBaseList();
  856. });
  857. onUnmounted(() => {
  858. removeCamera();
  859. if (timer) {
  860. clearTimeout(timer);
  861. timer = undefined;
  862. }
  863. destroy();
  864. });
  865. </script>
  866. ,
  867. <style lang="less" scoped>
  868. @import '/@/design/vent/modal.less';
  869. .scene-box {
  870. .bottom-tabs-box {
  871. height: 350px;
  872. }
  873. }
  874. .button-box {
  875. border: none !important;
  876. height: 34px !important;
  877. &:hover {
  878. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  879. }
  880. &::before {
  881. height: 27px !important;
  882. background: linear-gradient(#1fa6cb, #127cb5) !important;
  883. }
  884. &::after {
  885. top: 35px !important;
  886. }
  887. }
  888. :deep(.@{ventSpace}-tabs-tabpane-active) {
  889. height: 100%;
  890. }
  891. ::-webkit-scrollbar-thumb {
  892. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  893. background: #4288a444;
  894. }
  895. :deep(.zxm-radio-disabled + span) {
  896. color: #fff !important;
  897. }
  898. :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
  899. background-color: #127cb5 !important;
  900. }
  901. </style>