index.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  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. </template>
  223. </HistoryTable>
  224. </div>
  225. </a-tab-pane>
  226. <a-tab-pane key="4" tab="报警历史">
  227. <div class="tab-item" v-if="activeKey === '4'">
  228. <AlarmHistoryTable
  229. columns-type="alarm"
  230. :device-type="deviceType"
  231. :device-list-api="getTableList"
  232. designScope="alarm-history"
  233. :scroll="scroll"
  234. >
  235. <template #filterCell="{ column, record }">
  236. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'">
  237. {{ record.warnFlag == '0' ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
  238. >
  239. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  240. record.netStatus == '0' ? '断开' : '连接'
  241. }}</a-tag>
  242. </template>
  243. </AlarmHistoryTable>
  244. </div>
  245. </a-tab-pane>
  246. <a-tab-pane key="5" tab="操作历史">
  247. <div class="tab-item" v-if="activeKey === '5'">
  248. <HandlerHistoryTable
  249. columns-type="operator_history"
  250. :device-type="deviceType"
  251. :device-list-api="getTableList"
  252. designScope="operator_history"
  253. :scroll="scroll"
  254. />
  255. </div>
  256. </a-tab-pane>
  257. </a-tabs>
  258. </dv-border-box8>
  259. </div>
  260. </div>
  261. <div ref="playerRef" style="z-index: 999; position: absolute; top: 100px; right: 15px; width: 300px; height: 280px; margin: auto"> </div>
  262. <LivePlayer
  263. id="fm-player1"
  264. style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
  265. ref="player1"
  266. :videoUrl="flvURL1()"
  267. muted
  268. live
  269. loading
  270. controls
  271. />
  272. <HandleModal
  273. v-if="!globalConfig?.simulatedPassword"
  274. :modal-is-show="modalIsShow"
  275. :modal-title="modalTitle"
  276. :modal-type="modalType"
  277. @handle-ok="handleOK"
  278. @handle-cancel="handleCancel"
  279. />
  280. <DeviceBaseInfo @register="registerModal" :device-type="selectData['deviceType']" />
  281. </template>
  282. <script setup lang="ts">
  283. import { onBeforeUnmount, onUnmounted, onMounted, ref, reactive, nextTick, inject, unref } from 'vue';
  284. import MonitorTable from '../comment/MonitorTable.vue';
  285. import HistoryTable from '../comment/HistoryTable.vue';
  286. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  287. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  288. import HandleModal from './modal.vue';
  289. import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
  290. import { mountedThree, addMonitorText, play, destroy, setModelType, initCameraCanvas } from './gate.threejs';
  291. import { deviceControlApi } from '/@/api/vent/index';
  292. import { message } from 'ant-design-vue';
  293. import { list, getTableList, cameraList, cameraAddrList } from './gate.api';
  294. import lodash from 'lodash';
  295. import { setDivHeight } from '/@/utils/event';
  296. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  297. import { useRouter } from 'vue-router';
  298. import LivePlayer from '@liveqing/liveplayer-v3';
  299. import { useModal } from '/@/components/Modal';
  300. import { useCamera } from '/@/hooks/system/useCamera';
  301. import { usePermission } from '/@/hooks/web/usePermission';
  302. import { getDictItems } from '/@/api/common/api';
  303. const { hasPermission } = usePermission();
  304. const globalConfig = inject('globalConfig');
  305. const { currentRoute } = useRouter();
  306. const MonitorDataTable = ref();
  307. let contrlValue = '';
  308. const playerRef = ref();
  309. const deviceType = ref('gate');
  310. const activeKey = ref('1'); // tab
  311. const loading = ref(false);
  312. const scroll = reactive({
  313. y: 230,
  314. });
  315. const modelList = ref<{ text: string; value: string }[]>([]);
  316. const frontDoorIsOpen = ref(false); //前门是否开启
  317. const backDoorIsOpen = ref(false); //后门是否开启
  318. const midDoorIsOpen = ref(false); //中间门是否开启
  319. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  320. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  321. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  322. const selectRowIndex = ref(-1); // 选中行
  323. const dataSource = ref([]);
  324. const deviceBaseList = ref([]); // 设备基本信息
  325. const [registerModal, { openModal, closeModal }] = useModal();
  326. const { getCamera, removeCamera } = useCamera();
  327. const tabChange = (activeKeyVal) => {
  328. activeKey.value = activeKeyVal;
  329. if (activeKeyVal == 1) {
  330. nextTick(() => {
  331. MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
  332. });
  333. }
  334. };
  335. const initData = {
  336. deviceID: '',
  337. deviceType: '',
  338. strname: '',
  339. frontRearDP: '-', //压差
  340. // sourcePressure: '-', //气源压力
  341. runRoRecondition: null,
  342. autoRoManual: null,
  343. netStatus: '0', //通信状态
  344. frontGateOpen: '0',
  345. frontGateClose: '1',
  346. rearGateOpen: '0',
  347. rearGateClose: '1',
  348. midGateOpen: '0',
  349. midGateClose: '1',
  350. fault: '气源压力超限',
  351. masterComputer: 0,
  352. frontGateOpenCtrl: false,
  353. rearGateOpenCtrl: false,
  354. cameras: [],
  355. };
  356. // 监测数据
  357. const selectData = reactive(lodash.cloneDeep(initData));
  358. const flvURL1 = () => {
  359. // return ''
  360. return `/video/gate.mp4`;
  361. };
  362. function deviceEdit(e: Event, type: string, record) {
  363. e.stopPropagation();
  364. openModal(true, {
  365. type,
  366. deviceId: record['deviceID'],
  367. });
  368. }
  369. // 获取设备基本信息列表
  370. function getDeviceBaseList() {
  371. getTableList({ pageSize: 1000 }).then((res) => {
  372. deviceBaseList.value = res.records;
  373. });
  374. }
  375. // https获取监测数据
  376. let timer: null | NodeJS.Timeout = null;
  377. async function getMonitor(flag?) {
  378. if (Object.prototype.toString.call(timer) === '[object Null]') {
  379. timer = await setTimeout(
  380. async () => {
  381. const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  382. if (res.msgTxt && res.msgTxt[0]) {
  383. dataSource.value = res.msgTxt[0].datalist || [];
  384. dataSource.value.forEach((data: any) => {
  385. const readData = data.readData;
  386. data = Object.assign(data, readData);
  387. });
  388. if (dataSource.value.length > 0 && selectRowIndex.value == -1) {
  389. // 初始打开页面
  390. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  391. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  392. } else {
  393. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  394. }
  395. }
  396. Object.assign(selectData, dataSource.value[selectRowIndex.value]);
  397. addMonitorText(selectData);
  398. monitorAnimation(selectData);
  399. if (timer) {
  400. timer = null;
  401. }
  402. getMonitor();
  403. }
  404. },
  405. flag ? 0 : 1000
  406. );
  407. }
  408. }
  409. // 切换检测数据
  410. async function getSelectRow(selectRow, index) {
  411. if (!selectRow) return;
  412. loading.value = true;
  413. selectRowIndex.value = index;
  414. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  415. Object.assign(selectData, initData, selectRow, baseData);
  416. isFrontOpenRunning = false; //开关门动作是否在进行
  417. isRearOpenRunning = false; //开关门动作是否在进行
  418. isMidOpenRunning = false; //开关门动作是否在进行
  419. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  420. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  421. midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  422. // const type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  423. let type;
  424. if (selectData['doorUse'] == 2) {
  425. type = 'fmXr';
  426. } else {
  427. if (selectData.deviceType == 'gate_ss') {
  428. type = 'fm2';
  429. } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
  430. type = 'fm3';
  431. } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
  432. type = 'fmTwoSs';
  433. } else {
  434. type = 'fm1'; // 液压
  435. }
  436. }
  437. setModelType(type).then(async () => {
  438. addMonitorText(selectData);
  439. loading.value = false;
  440. });
  441. await getCamera(selectRow.deviceID, playerRef.value);
  442. }
  443. // 播放动画
  444. function playAnimation1(handlerState, data: any = null) {
  445. const value = data;
  446. switch (handlerState) {
  447. case 1: // 打开前门
  448. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  449. modalTitle.value = '打开前门';
  450. modalType.value = '1';
  451. modalIsShow.value = true;
  452. } else {
  453. message.warning('前门已经打开或正在打开,请勿重新操作');
  454. }
  455. break;
  456. case 2: // 关闭前门
  457. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  458. modalTitle.value = '关闭前门';
  459. modalType.value = '2';
  460. modalIsShow.value = true;
  461. } else {
  462. message.warning('前门已经关闭或正在关闭,请勿重新操作');
  463. }
  464. break;
  465. case 3: // 打开后门
  466. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  467. modalTitle.value = '打开后门';
  468. modalType.value = '3';
  469. modalIsShow.value = true;
  470. } else {
  471. message.warning('后门已经打开或正在打开,请勿重新操作');
  472. }
  473. break;
  474. case 4: // 关闭后门
  475. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  476. modalTitle.value = '关闭后门';
  477. modalType.value = '4';
  478. modalIsShow.value = true;
  479. } else {
  480. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  481. }
  482. break;
  483. case 8: // 打开中间门
  484. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  485. modalTitle.value = '打开中间门';
  486. modalType.value = '8';
  487. modalIsShow.value = true;
  488. } else {
  489. message.warning('后门已经打开或正在打开,请勿重新操作');
  490. }
  491. break;
  492. case 9: // 关闭中间门
  493. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  494. modalTitle.value = '关闭中间门';
  495. modalType.value = '9';
  496. modalIsShow.value = true;
  497. } else {
  498. message.warning('后门已经关闭或正在关闭,请勿重新操作');
  499. }
  500. break;
  501. case 5: // 打开前后门
  502. if (
  503. selectData.frontGateOpen == '0' &&
  504. selectData.frontGateClose == '1' &&
  505. selectData.rearGateOpen == '0' &&
  506. selectData.rearGateClose == '1'
  507. ) {
  508. modalTitle.value = '打开前后门';
  509. modalType.value = '5';
  510. modalIsShow.value = true;
  511. } else {
  512. message.warning('前后门已经打开或正在打开,请勿重新操作');
  513. }
  514. break;
  515. case 6: // 关闭前后门
  516. if (
  517. selectData.frontGateOpen == '1' &&
  518. selectData.frontGateClose == '0' &&
  519. selectData.rearGateOpen == '1' &&
  520. selectData.rearGateClose == '0'
  521. ) {
  522. modalTitle.value = '关闭前后门';
  523. modalType.value = '6';
  524. modalIsShow.value = true;
  525. } else {
  526. message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  527. }
  528. break;
  529. case 7: // 控制模式切换
  530. modalTitle.value = '控制模式切换';
  531. modalType.value = '7';
  532. modalIsShow.value = true;
  533. break;
  534. }
  535. if (globalConfig?.simulatedPassword) {
  536. handleOK('', handlerState + '');
  537. }
  538. contrlValue = value;
  539. }
  540. // 保德缺打开状态
  541. function playAnimation(handlerState, data: any = null) {
  542. const value = data;
  543. switch (handlerState) {
  544. case 1: // 打开前门
  545. modalTitle.value = '打开前门';
  546. modalType.value = '1';
  547. modalIsShow.value = true;
  548. break;
  549. case 2: // 关闭前门
  550. modalTitle.value = '关闭前门';
  551. modalType.value = '2';
  552. modalIsShow.value = true;
  553. break;
  554. case 3: // 打开后门
  555. modalTitle.value = '打开后门';
  556. modalType.value = '3';
  557. modalIsShow.value = true;
  558. break;
  559. case 4: // 关闭后门
  560. modalTitle.value = '关闭后门';
  561. modalType.value = '4';
  562. modalIsShow.value = true;
  563. break;
  564. case 8: // 打开中间门
  565. modalTitle.value = '打开中间门';
  566. modalType.value = '8';
  567. modalIsShow.value = true;
  568. break;
  569. case 9: // 关闭中间门
  570. modalTitle.value = '关闭中间门';
  571. modalType.value = '9';
  572. modalIsShow.value = true;
  573. break;
  574. case 5: // 打开前后门
  575. modalTitle.value = '打开前后门';
  576. modalType.value = '5';
  577. modalIsShow.value = true;
  578. break;
  579. case 6: // 关闭前后门
  580. modalTitle.value = '关闭前后门';
  581. modalType.value = '6';
  582. modalIsShow.value = true;
  583. break;
  584. case 7: // 控制模式切换
  585. modalTitle.value = '控制模式切换';
  586. modalType.value = '7';
  587. modalIsShow.value = true;
  588. break;
  589. }
  590. if (globalConfig?.simulatedPassword) {
  591. handleOK('', handlerState + '');
  592. }
  593. contrlValue = value;
  594. }
  595. function handleOK(passWord, handlerState) {
  596. if (passWord == '') {
  597. message.warning('请输入密码');
  598. return;
  599. }
  600. if (isOpenRunning) {
  601. return;
  602. }
  603. const data = {
  604. deviceid: selectData.deviceID,
  605. devicetype: selectData.deviceType,
  606. paramcode: '',
  607. value: contrlValue,
  608. password: passWord || globalConfig?.simulatedPassword,
  609. masterComputer: selectData.masterComputer,
  610. };
  611. let handler = () => {};
  612. switch (handlerState) {
  613. case '1': // 打开前门
  614. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  615. handler = () => {
  616. frontDoorIsOpen.value = true;
  617. };
  618. data.paramcode = 'frontGateOpen_S';
  619. }
  620. break;
  621. case '2': // 关闭前门
  622. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  623. handler = () => {
  624. frontDoorIsOpen.value = false;
  625. };
  626. data.paramcode = 'frontGateClose_S';
  627. }
  628. break;
  629. case '3': // 打开后门
  630. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  631. handler = () => {
  632. backDoorIsOpen.value = true;
  633. };
  634. data.paramcode = 'rearGateOpen_S';
  635. }
  636. break;
  637. case '4': // 关闭后门
  638. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  639. handler = () => {
  640. backDoorIsOpen.value = false;
  641. };
  642. data.paramcode = 'rearGateClose_S';
  643. }
  644. break;
  645. case '8': // 打开中间门
  646. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  647. handler = () => {
  648. midDoorIsOpen.value = true;
  649. };
  650. data.paramcode = 'midGateOpen_S';
  651. }
  652. break;
  653. case '9': // 关闭中间门
  654. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  655. handler = () => {
  656. midDoorIsOpen.value = false;
  657. };
  658. data.paramcode = 'midGateClose_S';
  659. }
  660. break;
  661. case '5': // 打开前后门
  662. if (
  663. selectData.frontGateOpen == '0' &&
  664. selectData.frontGateClose == '1' &&
  665. selectData.rearGateOpen == '0' &&
  666. selectData.rearGateClose == '1'
  667. ) {
  668. handler = () => {
  669. frontDoorIsOpen.value = true;
  670. backDoorIsOpen.value = true;
  671. };
  672. data.paramcode = 'sameTimeOpen';
  673. }
  674. break;
  675. case '6': // 关闭前后门
  676. if (
  677. selectData.frontGateOpen == '1' &&
  678. selectData.frontGateClose == '0' &&
  679. selectData.rearGateOpen == '1' &&
  680. selectData.rearGateClose == '0'
  681. ) {
  682. handler = () => {
  683. frontDoorIsOpen.value = false;
  684. backDoorIsOpen.value = false;
  685. };
  686. data.paramcode = 'sameTimeClose';
  687. }
  688. break;
  689. case '7': // 远程与就地
  690. data.paramcode = 'autoRoManualControl';
  691. data.value = selectData.contrlMod != 'loopCtrl' ? contrlValue : '';
  692. selectData.autoRoManual = null;
  693. }
  694. if (data.paramcode) {
  695. deviceControlApi(data).then((res) => {
  696. // 模拟时开启
  697. if (res.success) {
  698. modalIsShow.value = false;
  699. if (globalConfig.History_Type == 'remote') {
  700. message.success('指令已下发至生产管控平台成功!');
  701. } else {
  702. message.success('指令已下发成功!');
  703. }
  704. } else {
  705. message.error(res.message);
  706. }
  707. });
  708. }
  709. }
  710. let isOpenRunning = false; //开关门动作是否在进行
  711. /** 开关门动画调用 */
  712. let isFrontOpenRunning = false; //开关门动作是否在进行
  713. // let isFrontCloseRunning = false; //开关门动作是否在进行
  714. let isRearOpenRunning = false; //开关门动作是否在进行
  715. // let isRearCloseRunning = false; //开关门动作是否在进行
  716. let isMidOpenRunning = false; //中间门动作是否在进行
  717. // let isMidCloseRunning = false; //中间门动作是否在进行
  718. // 0 关闭 1 正在打开 2 打开 3正在关闭
  719. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  720. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  721. let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  722. function monitorAnimation(selectData) {
  723. const timeScale = 0.005;
  724. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  725. isFrontOpenRunning = true;
  726. if (frontDeviceState != 1) {
  727. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  728. play(1, timeScale);
  729. frontDeviceState = 1;
  730. frontDoorIsOpen.value = false;
  731. backDoorIsOpen.value = true;
  732. }
  733. }
  734. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  735. isFrontOpenRunning = true;
  736. if (frontDeviceState != 1) {
  737. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  738. play(1, timeScale);
  739. frontDeviceState = 1;
  740. frontDoorIsOpen.value = false;
  741. backDoorIsOpen.value = true;
  742. }
  743. }
  744. if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  745. isFrontOpenRunning = false;
  746. if (frontDeviceState != 0) {
  747. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  748. play(2, timeScale);
  749. frontDeviceState = 0;
  750. frontDoorIsOpen.value = false;
  751. // backDoorIsOpen.value = false
  752. }
  753. }
  754. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  755. isRearOpenRunning = true;
  756. if (rearDeviceState != 1) {
  757. rearDeviceState = 1;
  758. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  759. play(3, timeScale);
  760. backDoorIsOpen.value = false;
  761. frontDoorIsOpen.value = true;
  762. }
  763. }
  764. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  765. isRearOpenRunning = true;
  766. if (rearDeviceState != 1) {
  767. rearDeviceState = 1;
  768. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  769. play(3, timeScale);
  770. backDoorIsOpen.value = false;
  771. frontDoorIsOpen.value = true;
  772. }
  773. }
  774. if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  775. isRearOpenRunning = false;
  776. if (rearDeviceState != 0) {
  777. rearDeviceState = 0;
  778. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  779. play(4, timeScale);
  780. backDoorIsOpen.value = false;
  781. }
  782. }
  783. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  784. isMidOpenRunning = true;
  785. if (midDeviceState != 1) {
  786. midDeviceState = 1;
  787. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  788. play(8, timeScale);
  789. backDoorIsOpen.value = false;
  790. frontDoorIsOpen.value = true;
  791. }
  792. }
  793. if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  794. isMidOpenRunning = true;
  795. if (midDeviceState != 1) {
  796. midDeviceState = 1;
  797. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  798. play(8, timeScale);
  799. backDoorIsOpen.value = false;
  800. frontDoorIsOpen.value = true;
  801. }
  802. }
  803. if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
  804. isMidOpenRunning = false;
  805. if (midDeviceState != 0) {
  806. midDeviceState = 0;
  807. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  808. play(9, timeScale);
  809. backDoorIsOpen.value = false;
  810. }
  811. }
  812. }
  813. function handleCancel() {
  814. modalIsShow.value = false;
  815. modalTitle.value = '';
  816. modalType.value = '';
  817. selectData.autoRoManual = null;
  818. }
  819. // // 远程、就地切换
  820. // function changeType() {
  821. // const data = {
  822. // deviceid: selectData.deviceID,
  823. // devicetype: selectData.deviceType,
  824. // paramcode: 'autoRoManualControl',
  825. // value: selectData.autoRoManual,
  826. // };
  827. // deviceControlApi(data).then(() => {
  828. // if (globalConfig.History_Type == 'remote') {
  829. // message.success('指令已下发至生产管控平台成功!');
  830. // } else {
  831. // message.success('指令已下发成功!');
  832. // }
  833. // });
  834. // }
  835. onMounted(async () => {
  836. const { query } = unref(currentRoute);
  837. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  838. modelList.value = await getDictItems('gateModel');
  839. loading.value = true;
  840. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  841. mountedThree(playerDom).then(async () => {
  842. await getMonitor(true);
  843. loading.value = false;
  844. });
  845. });
  846. onBeforeUnmount(() => {
  847. getDeviceBaseList();
  848. });
  849. onUnmounted(() => {
  850. removeCamera();
  851. if (timer) {
  852. clearTimeout(timer);
  853. timer = undefined;
  854. }
  855. destroy();
  856. });
  857. </script>
  858. ,
  859. <style lang="less" scoped>
  860. @import '/@/design/vent/modal.less';
  861. .scene-box {
  862. .bottom-tabs-box {
  863. height: 350px;
  864. }
  865. }
  866. .button-box {
  867. border: none !important;
  868. height: 34px !important;
  869. &:hover {
  870. background: linear-gradient(#2cd1ff55, #1eb0ff55) !important;
  871. }
  872. &::before {
  873. height: 27px !important;
  874. background: linear-gradient(#1fa6cb, #127cb5) !important;
  875. }
  876. &::after {
  877. top: 35px !important;
  878. }
  879. }
  880. :deep(.@{ventSpace}-tabs-tabpane-active) {
  881. height: 100%;
  882. }
  883. ::-webkit-scrollbar-thumb {
  884. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  885. background: #4288a444;
  886. }
  887. :deep(.zxm-radio-disabled + span) {
  888. color: #fff !important;
  889. }
  890. :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
  891. background-color: #127cb5 !important;
  892. }
  893. </style>