index.vue 38 KB

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