index.vue 38 KB

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