index.vue 36 KB

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