index.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. <template>
  2. <component ref="modelRef" :loading="loading" :is="modelComponent" />
  3. <div class="scene-box">
  4. <div class="top-box">
  5. <div class="top-center row">
  6. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(1)">打开前门</div>
  7. <div v-if="hasPermission('btn:control')" class="button-box" @click="playAnimation(2)">关闭前门</div>
  8. <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box" @click="playAnimation(8)">打开中间门</div>
  9. <div v-if="hasPermission('btn:control') && selectData.ndoorcount == '3'" class="button-box" @click="playAnimation(9)">关闭中间门</div>
  10. <div
  11. v-if="hasPermission('btn:control') && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3')"
  12. class="button-box"
  13. @click="playAnimation(3)"
  14. >打开后门</div
  15. >
  16. <div
  17. v-if="hasPermission('btn:control') && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3')"
  18. class="button-box"
  19. @click="playAnimation(4)"
  20. >关闭后门</div
  21. >
  22. <div
  23. v-if="
  24. hasPermission('btn:totalControl') ||
  25. (selectData['isShowGatesContrl'] == 1 && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3'))
  26. "
  27. class="button-box"
  28. @click="playAnimation(5)"
  29. >同时打开</div
  30. >
  31. <div
  32. v-if="
  33. hasPermission('btn:totalControl') ||
  34. (selectData['isShowGatesContrl'] == 1 && (selectData.ndoorcount == '2' || selectData.ndoorcount == '3'))
  35. "
  36. class="button-box"
  37. @click="playAnimation(6)"
  38. >同时关闭</div
  39. >
  40. <template v-if="selectData['gateStyle'] && selectData['gateStyle'].includes('fm_fc')">
  41. <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(10)">A窗控制</div>
  42. <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(11)">B窗控制</div>
  43. <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(12)">C窗控制</div>
  44. <div v-if="hasPermission('btn:controlWindow')" class="button-box" @click="playAnimation(13)">D窗控制</div>
  45. </template>
  46. </div>
  47. <!-- 控制模式 -->
  48. <div class="top-right row" v-if="hasPermission('btn:remote')">
  49. <!-- -->
  50. <div class="vent-flex-m row" v-if="selectData.contrlMod == 'loopCtrl' && modelList.length > 0">
  51. <div class="control-title">控制模式:</div>
  52. <a-radio-group v-model:value="selectData.autoRoManual">
  53. <template v-for="(item, index) in modelList" :key="index">
  54. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  55. </template>
  56. </a-radio-group>
  57. <div class="button-box" @click="playAnimation(7)">切换模式</div>
  58. </div>
  59. <!-- 控制指令是多个,每个状态需要下发单独的指令 -->
  60. <div class="vent-flex-m row" v-else-if="selectData.contrlMod == 'codeCtrl' && modelList.length > 0">
  61. <div class="control-title">控制模式:</div>
  62. <a-radio-group v-model:value="selectData.autoRoManual">
  63. <template v-for="(item, index) in modelList" :key="index">
  64. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  65. </template>
  66. </a-radio-group>
  67. <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">{{ item.text }}</div>
  68. </div>
  69. <!-- 济南嘉鸿远程、就地、自动控制,自动切换,点位为true就是选中状态 -->
  70. <div class="vent-flex-m row" v-else-if="selectData.contrlMod == 'jnjhCtrl' && modelList.length > 0">
  71. <div class="control-title">控制模式:</div>
  72. <a-radio v-model:checked="selectData['autoRoManual']" :disabled="true">远程</a-radio>
  73. <a-radio v-model:checked="selectData['autoRoManual1']" :disabled="true">自动</a-radio>
  74. <a-radio v-model:checked="selectData['autoRoManual2']" :disabled="true">手动</a-radio>
  75. <div class="button-box" @click="playAnimation(7)">模式切换</div>
  76. </div>
  77. <div class="vent-flex-m row" v-else-if="modelList.length > 0">
  78. <div class="control-title">控制模式:</div>
  79. <a-radio-group v-model:value="selectData.autoRoManual">
  80. <template v-for="(item, index) in modelList" :key="index">
  81. <a-radio :value="item.value" :disabled="true">{{ item.text }}</a-radio>
  82. </template>
  83. </a-radio-group>
  84. <div class="button-box" v-for="(item, index) in modelList" @click="playAnimation(7, item.value)" :key="index">{{ item.text }}</div>
  85. </div>
  86. <!-- <div class="run-type row">
  87. <div class="control-title">运行状态:</div>
  88. <a-radio-group v-model:value="selectData.runRoRecondition">
  89. <a-radio :value="`0`">检修</a-radio>
  90. <a-radio :value="`1`">运行</a-radio>
  91. </a-radio-group>
  92. </div> -->
  93. </div>
  94. </div>
  95. <div class="title-text"> {{ selectData.supplyAirAddr || selectData.strinstallpos || selectData.strname }} </div>
  96. <div class="bottom-tabs-box" @mousedown="setDivHeight($event, 350, scroll)">
  97. <dv-border-box8 :dur="5" :style="`padding: 5px; height: ${scroll.y + 120}px`">
  98. <a-tabs class="tabs-box" v-model:activeKey="activeKey" @change="tabChange">
  99. <a-tab-pane v-if="!hasPermission('show:noMonitor')" key="1" tab="实时监测">
  100. <MonitorTable
  101. v-if="activeKey === '1'"
  102. ref="MonitorDataTable"
  103. class="monitor-table"
  104. :columnsType="deviceType"
  105. :isShowActionColumn="true"
  106. :dataSource="dataSource"
  107. design-scope="gate-monitor"
  108. @selectRow="getSelectRow"
  109. :scroll="{ y: scroll.y - 40 }"
  110. title="风门监测"
  111. :isShowPagination="true"
  112. >
  113. <template #filterCell="{ column, record }">
  114. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
  115. >正在运行</a-tag
  116. >
  117. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
  118. >关闭</a-tag
  119. >
  120. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'" color="#46C66F"
  121. >打开</a-tag
  122. >
  123. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'" color="#FF0000"
  124. >点位异常</a-tag
  125. >
  126. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
  127. >正在运行</a-tag
  128. >
  129. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
  130. >关闭</a-tag
  131. >
  132. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
  133. >打开</a-tag
  134. >
  135. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
  136. >点位异常</a-tag
  137. >
  138. <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
  139. >正在运行</a-tag
  140. >
  141. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
  142. >关闭</a-tag
  143. >
  144. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
  145. >打开</a-tag
  146. >
  147. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
  148. >点位异常</a-tag
  149. >
  150. <template v-if="column.dataIndex === 'ndoortype'">
  151. <span>{{ render.renderDictText(record.ndoortype, 'ndoortype') }}</span>
  152. </template>
  153. <template v-if="column.dataIndex === 'doorUse'">
  154. <span>{{ render.renderDictText(record.doorUse, 'doorUse') }}</span>
  155. </template>
  156. <template v-else-if="column.dataIndex === 'warnLevel'">
  157. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  158. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  159. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  160. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  161. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  162. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  163. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  164. <a-tag v-else color="green">正常</a-tag>
  165. </template>
  166. <a-tag v-else-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == '0' ? 'green' : 'red'">{{
  167. record.warnFlag == '0' ? '正常' : '报警'
  168. }}</a-tag>
  169. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  170. record.netStatus == '0' ? '断开' : '连接'
  171. }}</a-tag>
  172. </template>
  173. <template #action="{ record }">
  174. <a v-if="globalConfig?.showReport" class="table-action-link" @click="deviceEdit($event, 'reportInfo', record)">报表录入</a>
  175. <a class="table-action-link" @click="deviceEdit($event, 'deviceInfo', record)">设备编辑</a>
  176. </template>
  177. </MonitorTable>
  178. </a-tab-pane>
  179. <!-- <a-tab-pane key="2" tab="实时曲线图" force-render>
  180. <div class="tab-item" v-if="activeKey === '2'">
  181. <DeviceEcharts chartsColumnsType="gate_chart" xAxisPropType="strname" :dataSource="dataSource" height="100%"
  182. :chartsColumns="chartsColumns" :device-list-api="list" device-type="gate" />
  183. </div>
  184. </a-tab-pane> -->
  185. <a-tab-pane v-if="!hasPermission('show:noHistory')" key="3" tab="历史数据">
  186. <div class="tab-item" v-if="activeKey === '3'">
  187. <HistoryTable :columnsType="deviceType" :device-type="deviceType" designScope="gate-history" :scroll="scroll">
  188. <template #filterCell="{ column, record }">
  189. <a-tag v-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == '0'" color="red"
  190. >正在运行</a-tag
  191. >
  192. <a-tag v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '0' && record.frontGateClose == 1" color="default"
  193. >关闭</a-tag
  194. >
  195. <a-tag
  196. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '0'"
  197. color="#46C66F"
  198. >打开</a-tag
  199. >
  200. <a-tag
  201. v-else-if="column.dataIndex === 'frontGateOpen' && record.frontGateOpen == '1' && record.frontGateClose == '1'"
  202. color="#FF0000"
  203. >点位异常</a-tag
  204. >
  205. <a-tag v-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '0'" color="red"
  206. >正在运行</a-tag
  207. >
  208. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '0' && record.rearGateClose == '1'" color="default"
  209. >关闭</a-tag
  210. >
  211. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '0'" color="#46C66F"
  212. >打开</a-tag
  213. >
  214. <a-tag v-else-if="column.dataIndex === 'rearGateOpen' && record.rearGateOpen == '1' && record.rearGateClose == '1'" color="#FF0000"
  215. >点位异常</a-tag
  216. >
  217. <a-tag v-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == '0'" color="red"
  218. >正在运行</a-tag
  219. >
  220. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '0' && record.midGateClose == 1" color="default"
  221. >关闭</a-tag
  222. >
  223. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '0'" color="#46C66F"
  224. >打开</a-tag
  225. >
  226. <a-tag v-else-if="column.dataIndex === 'midGateOpen' && record.midGateOpen == '1' && record.midGateClose == '1'" color="#FF0000"
  227. >点位异常</a-tag
  228. >
  229. <template v-if="column.dataIndex === 'ndoortype'">
  230. <span v-if="record.ndoortype == '0'">气动风门</span>
  231. <span v-else color="default">液压风门</span>
  232. </template>
  233. <template v-if="column.dataIndex === 'doorUse'">
  234. <span v-if="record.doorUse == 1" color="default">行车风门</span>
  235. <span v-else-if="record.doorUse == 2">行人风门</span>
  236. <span v-else-if="record.doorUse == 3">短路风门</span>
  237. <span v-else-if="record.doorUse == 4">行车/短路风门</span>
  238. </template>
  239. <template v-else-if="column.dataIndex === 'warnLevel'">
  240. <a-tag v-if="record.warnLevel == '101'" color="green">低风险</a-tag>
  241. <a-tag v-else-if="record.warnLevel == '102'" color="#FF5812">一般风险</a-tag>
  242. <a-tag v-else-if="record.warnLevel == '103'" color="#FF5812">较大风险</a-tag>
  243. <a-tag v-else-if="record.warnLevel == '104'" color="#FF5812">重大风险</a-tag>
  244. <a-tag v-else-if="record.warnLevel == '201'" color="#FF0000">报警</a-tag>
  245. <a-tag v-else-if="record.warnLevel == '10000'" color="#FF5812">数据超限</a-tag>
  246. <a-tag v-else-if="record.warnLevel == '1001'" color="default">网络中断</a-tag>
  247. <a-tag v-else color="green">正常</a-tag>
  248. </template>
  249. </template>
  250. </HistoryTable>
  251. </div>
  252. </a-tab-pane>
  253. <a-tab-pane v-if="!hasPermission('show:noAlarm')" key="4" tab="报警历史">
  254. <div class="tab-item" v-if="activeKey === '4'">
  255. <template v-if="sysOrgCode != 'zmhjhzmy'">
  256. <AlarmHistoryTable
  257. columns-type="alarm"
  258. :device-type="deviceType"
  259. :device-list-api="getTableList"
  260. designScope="alarm-history"
  261. :scroll="scroll"
  262. >
  263. <template #filterCell="{ column, record }">
  264. <a-tag
  265. v-if="column.dataIndex === 'warnFlag'"
  266. :color="record.warnFlag == '0' ? 'green' : record.warnFlag == 1 ? '#FF5812' : 'gray'"
  267. >
  268. {{ record.warnFlag == '0' ? '正常' : record.warnFlag == 1 ? '报警' : record.warnFlag == 2 ? '断开' : '未监测' }}</a-tag
  269. >
  270. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  271. record.netStatus == '0' ? '断开' : '连接'
  272. }}</a-tag>
  273. </template>
  274. </AlarmHistoryTable>
  275. </template>
  276. <template v-else>
  277. <AlarmHistoryTableHj :scroll="scroll" />
  278. </template>
  279. </div>
  280. </a-tab-pane>
  281. <a-tab-pane v-if="!hasPermission('show:noHandleHistory')" key="5" tab="操作历史">
  282. <div class="tab-item" v-if="activeKey === '5'">
  283. <HandlerHistoryTable
  284. columns-type="operator_history"
  285. :device-type="deviceType"
  286. :device-list-api="getTableList"
  287. designScope="operator_history"
  288. :scroll="scroll"
  289. />
  290. </div>
  291. </a-tab-pane>
  292. <!-- v-if="sysOrgCode === 'sdmtjtswmk'" -->
  293. <a-tab-pane v-if="sysOrgCode === 'sdmtjtswmk'" key="2" tab="风门轴反馈推力曲线">
  294. <div class="tab-item" v-if="activeKey === '2'">
  295. <!-- <div class="history-chart">
  296. <BarAndLine
  297. :charts-columns="chartsColumns"
  298. chartsType="history"
  299. :option="Option"
  300. :data-source="sharedData"
  301. height="290px"
  302. :x-axis-prop-type="stationType !== 'redis' ? 'ttime' : 'time'"
  303. />
  304. </div> -->
  305. <HistoryTableChart
  306. chartsColumnsType="gate_chart"
  307. :dataSource="sharedData"
  308. height="100%"
  309. :chartsColumns="chartsColumns"
  310. device-type="gate"
  311. :is-show-child-type="true"
  312. />
  313. </div>
  314. </a-tab-pane>
  315. </a-tabs>
  316. </dv-border-box8>
  317. </div>
  318. </div>
  319. <div
  320. ref="playerRef"
  321. style="
  322. z-index: 1;
  323. position: absolute;
  324. top: 100px;
  325. right: 0px;
  326. width: 100%;
  327. height: 800px;
  328. overflow-y: auto;
  329. pointer-events: none;
  330. margin-left: auto;
  331. "
  332. >
  333. </div>
  334. <LivePlayer
  335. id="fm-player1"
  336. style="height: 220px; width: 300px; position: absolute; top: 0px; z-index: -1"
  337. ref="player1"
  338. :videoUrl="flvURL1()"
  339. muted
  340. live
  341. loading
  342. controls
  343. />
  344. <HandleModal
  345. v-if="!globalConfig?.simulatedPassword"
  346. :modal-is-show="modalIsShow"
  347. :modal-title="modalTitle"
  348. :modal-type="modalType"
  349. @handle-ok="handleOK"
  350. @handle-cancel="handleCancel"
  351. />
  352. <DeviceBaseInfo @register="registerModal" :device-type="selectData['deviceType']" />
  353. </template>
  354. <script setup lang="ts">
  355. import { onBeforeUnmount, onUnmounted, onMounted, ref, reactive, nextTick, inject, unref, defineAsyncComponent, provide } from 'vue';
  356. import MonitorTable from '../comment/MonitorTable.vue';
  357. import HistoryTable from '../comment/HistoryTable.vue';
  358. import AlarmHistoryTable from '../comment/AlarmHistoryTable.vue';
  359. import HandlerHistoryTable from '../comment/HandlerHistoryTable.vue';
  360. import AlarmHistoryTableHj from './components/AlarmHistoryTableHj.vue';
  361. import HandleModal from './modal.vue';
  362. import DeviceBaseInfo from '../comment/components/DeviceBaseInfo.vue';
  363. import { mountedThree, addMonitorText, play, destroy, setModelType, computePlay } from './gate.threejs';
  364. import { deviceControlApi } from '/@/api/vent/index';
  365. import { message } from 'ant-design-vue';
  366. import { list, getTableList, cameraList, cameraAddrList } from './gate.api';
  367. import { chartsColumns, getModelComponent } from './gate.data';
  368. import lodash from 'lodash';
  369. import { setDivHeight } from '/@/utils/event';
  370. import { BorderBox8 as DvBorderBox8 } from '@kjgl77/datav-vue3';
  371. import { useRouter } from 'vue-router';
  372. import LivePlayer from '@liveqing/liveplayer-v3';
  373. import { useModal } from '/@/components/Modal';
  374. import { useCamera } from '/@/hooks/system/useCamera';
  375. import { usePermission } from '/@/hooks/web/usePermission';
  376. import { getDictItems } from '/@/api/common/api';
  377. import { render } from '/@/utils/common/renderUtils';
  378. import { useGlobSetting } from '/@/hooks/setting';
  379. import { getDictItemsByCode } from '/@/utils/dict';
  380. import { defHttp } from '/@/utils/http/axios';
  381. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  382. import HistoryTableChart from '../comment/HistoryTableChart.vue';
  383. import { useSvgAnimation } from '/@/hooks/vent/useSvgAnimation';
  384. const { hasPermission } = usePermission();
  385. const { sysOrgCode } = useGlobSetting();
  386. const globalConfig = inject<any>('globalConfig');
  387. const modelRef = ref();
  388. /** 模型对应的组件,根据实际情况分为二维三维 */
  389. const modelComponent = getModelComponent(globalConfig.is2DModel, sysOrgCode);
  390. const { currentRoute } = useRouter();
  391. const MonitorDataTable = ref();
  392. let contrlValue = '';
  393. const playerRef = ref();
  394. const deviceType = ref('gate');
  395. const activeKey = ref('1'); // tab
  396. const loading = ref(false);
  397. // const stationType = ref('plc1');
  398. const scroll = reactive({
  399. y: 230,
  400. });
  401. const modelList = ref<{ text: string; value: string }[]>([]);
  402. const frontDoorIsOpen = ref(false); //前门是否开启
  403. const backDoorIsOpen = ref(false); //后门是否开启
  404. const midDoorIsOpen = ref(false); //中间门是否开启
  405. const modalIsShow = ref<boolean>(false); // 是否显示模态框
  406. const modalTitle = ref(''); // 模态框标题显示内容,根据设备操作类型决定
  407. const modalType = ref(''); // 模态框内容显示类型,设备操作类型
  408. const selectRowIndex = ref(-1); // 选中行
  409. const dataSource = ref([]);
  410. const sharedData = ref([]);
  411. const deviceBaseList = ref([]); // 设备基本信息
  412. const updateSharedData = (data) => {
  413. sharedData.value = data;
  414. };
  415. const Option = {
  416. grid: {
  417. top: '20%',
  418. left: '5%',
  419. right: '5%',
  420. bottom: '3%',
  421. containLabel: true,
  422. },
  423. toolbox: {
  424. feature: null,
  425. },
  426. };
  427. const [registerModal, { openModal, closeModal }] = useModal();
  428. const { getCamera, removeCamera } = useCamera();
  429. const tabChange = (activeKeyVal) => {
  430. activeKey.value = activeKeyVal;
  431. if (activeKeyVal == 1) {
  432. nextTick(() => {
  433. if (MonitorDataTable.value) MonitorDataTable.value.setSelectedRowKeys([selectData.deviceID]);
  434. });
  435. }
  436. };
  437. const initData = {
  438. deviceID: '',
  439. deviceType: '',
  440. strname: '',
  441. frontRearDP: '-', //压差
  442. // sourcePressure: '-', //气源压力
  443. runRoRecondition: null,
  444. autoRoManual: null,
  445. netStatus: '0', //通信状态
  446. frontGateOpen: '0',
  447. frontGateClose: '1',
  448. rearGateOpen: '0',
  449. rearGateClose: '1',
  450. midGateOpen: '0',
  451. midGateClose: '1',
  452. fault: '气源压力超限',
  453. masterComputer: 0,
  454. frontGateOpenCtrl: false,
  455. rearGateOpenCtrl: false,
  456. cameras: [],
  457. };
  458. // 监测数据
  459. const selectData = reactive(lodash.cloneDeep(initData));
  460. const flvURL1 = () => {
  461. // return ''
  462. return `/video/gate.mp4`;
  463. };
  464. function deviceEdit(e: Event, type: string, record) {
  465. e.stopPropagation();
  466. openModal(true, {
  467. type,
  468. deviceId: record['deviceID'],
  469. });
  470. }
  471. // 获取设备基本信息列表
  472. function getDeviceBaseList() {
  473. getTableList({ pageSize: 1000 }).then((res) => {
  474. deviceBaseList.value = res.records;
  475. });
  476. }
  477. // https获取监测数据
  478. let timer: null | NodeJS.Timeout = null;
  479. async function getMonitor(flag?) {
  480. if (Object.prototype.toString.call(timer) === '[object Null]') {
  481. timer = await setTimeout(
  482. async () => {
  483. const res = await list({ devicetype: deviceType.value, pagetype: 'normal' });
  484. if (res.msgTxt && res.msgTxt[0]) {
  485. dataSource.value = res.msgTxt[0].datalist || [];
  486. dataSource.value.forEach((data: any) => {
  487. const readData = data.readData;
  488. data = Object.assign(data, readData);
  489. });
  490. if (dataSource.value.length > 0 && selectRowIndex.value == -1 && MonitorDataTable.value) {
  491. // 初始打开页面
  492. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  493. MonitorDataTable.value.setSelectedRowKeys([currentRoute.value['query']['id']]);
  494. } else {
  495. MonitorDataTable.value.setSelectedRowKeys([dataSource.value[0]['deviceID']]);
  496. }
  497. }
  498. Object.assign(selectData, dataSource.value[selectRowIndex.value]);
  499. if (selectData.contrlMod == 'jnjhCtrl') {
  500. selectData['autoRoManual'] = selectData['autoRoManual'] == 1 ? true : false;
  501. selectData['autoRoManual1'] = selectData['autoRoManual1'] == 1 ? true : false;
  502. selectData['autoRoManual2'] = selectData['autoRoManual2'] == 1 ? true : false;
  503. }
  504. addMonitorText(selectData);
  505. monitorAnimation(selectData);
  506. if (timer) {
  507. timer = null;
  508. }
  509. getMonitor();
  510. }
  511. },
  512. flag ? 0 : 1000
  513. );
  514. }
  515. }
  516. // 切换检测数据
  517. async function getSelectRow(selectRow, index) {
  518. if (!selectRow) return;
  519. loading.value = true;
  520. selectRowIndex.value = index;
  521. const baseData: any = deviceBaseList.value.find((baseData: any) => baseData.id === selectRow.deviceID);
  522. Object.assign(selectData, initData, selectRow, baseData);
  523. isFrontOpenRunning = false; //开关门动作是否在进行
  524. isRearOpenRunning = false; //开关门动作是否在进行
  525. isMidOpenRunning = false; //开关门动作是否在进行
  526. frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  527. rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  528. midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  529. let type;
  530. const dictCodes = getDictItemsByCode('gateStyle');
  531. if (selectData && dictCodes && dictCodes.length > 0) {
  532. const gateStyle = selectData['gateStyle'];
  533. switch (gateStyle) {
  534. case 'gate_qd':
  535. type = 'fm3';
  536. break;
  537. case 'fmtl3':
  538. type = 'fmThreeTl';
  539. break;
  540. case 'fmSs':
  541. type = 'fmTwoSs';
  542. break;
  543. case 'fm_fc':
  544. type = 'fmWindow';
  545. break;
  546. case 'fmXr':
  547. type = 'fmXr';
  548. break;
  549. case 'fmYy':
  550. type = 'fm1';
  551. break;
  552. case 'fmSs3':
  553. type = 'fm2';
  554. break;
  555. case 'fm_fc_hjg':
  556. type = 'fmWindowHjg';
  557. break;
  558. case 'fm_fc_zhq':
  559. type = 'fmWindowZhq';
  560. break;
  561. default:
  562. type = gateStyle;
  563. }
  564. } else {
  565. type = selectData.nwindownum == 1 ? 'singleWindow' : 'doubleWindow';
  566. if (selectData['doorUse'] == 2) {
  567. type = 'fmXr';
  568. } else if (selectData.ndoorcount == '3' || selectData.deviceType == 'gate_nomal3') {
  569. type = 'fmThreeTl';
  570. } else {
  571. if (selectData.deviceType == 'gate_ss') {
  572. type = 'fm2';
  573. } else if (selectData.deviceType == 'gate_qd' || selectData.deviceType == 'gate_normal') {
  574. type = 'fm3';
  575. } else if (selectData.deviceType == 'gate_ss_two' || selectData.deviceType == 'gate_ss_two1') {
  576. type = 'fmTwoSs';
  577. } else if (selectData.deviceType == 'gate_tj') {
  578. type = 'fmWindow';
  579. } else {
  580. type = 'fm1'; // 液压
  581. }
  582. }
  583. }
  584. debugger;
  585. setModelType(type).then(async () => {
  586. addMonitorText(selectData);
  587. loading.value = false;
  588. });
  589. await getCamera(selectRow.deviceID, playerRef.value);
  590. }
  591. // 播放动画
  592. function playAnimation(handlerState, data: any = null) {
  593. const value = data;
  594. switch (handlerState) {
  595. case 1: // 打开前门
  596. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  597. modalTitle.value = '打开前门';
  598. modalType.value = '1';
  599. modalIsShow.value = true;
  600. } else {
  601. // message.warning('前门已经打开或正在打开,请勿重新操作');
  602. message.warning('没有监测到前门关到位,无法进行指令下发操作');
  603. }
  604. break;
  605. case 2: // 关闭前门
  606. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  607. modalTitle.value = '关闭前门';
  608. modalType.value = '2';
  609. modalIsShow.value = true;
  610. } else {
  611. // message.warning('前门已经关闭或正在关闭,请勿重新操作');
  612. message.warning('没有监测到前门开到位,无法进行指令下发操作');
  613. }
  614. break;
  615. case 3: // 打开后门
  616. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  617. modalTitle.value = '打开后门';
  618. modalType.value = '3';
  619. modalIsShow.value = true;
  620. } else {
  621. // message.warning('后门已经打开或正在打开,请勿重新操作');
  622. message.warning('没有监测到后门关到位,无法进行指令下发操作');
  623. }
  624. break;
  625. case 4: // 关闭后门
  626. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  627. modalTitle.value = '关闭后门';
  628. modalType.value = '4';
  629. modalIsShow.value = true;
  630. } else {
  631. // message.warning('后门已经关闭或正在关闭,请勿重新操作');
  632. message.warning('没有监测到后门开到位,无法进行指令下发操作');
  633. }
  634. break;
  635. case 8: // 打开中间门
  636. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  637. modalTitle.value = '打开中间门';
  638. modalType.value = '8';
  639. modalIsShow.value = true;
  640. } else {
  641. // message.warning('后门已经打开或正在打开,请勿重新操作');
  642. message.warning('没有监测到中间门关到位,无法进行指令下发操作');
  643. }
  644. break;
  645. case 9: // 关闭中间门
  646. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  647. modalTitle.value = '关闭中间门';
  648. modalType.value = '9';
  649. modalIsShow.value = true;
  650. } else {
  651. // message.warning('后门已经关闭或正在关闭,请勿重新操作');
  652. message.warning('没有监测到中间门开到位,无法进行指令下发操作');
  653. }
  654. break;
  655. case 5: // 打开前后门
  656. if (
  657. selectData.frontGateOpen == '0' &&
  658. selectData.frontGateClose == '1' &&
  659. selectData.rearGateOpen == '0' &&
  660. selectData.rearGateClose == '1'
  661. ) {
  662. modalTitle.value = '打开前后门';
  663. modalType.value = '5';
  664. modalIsShow.value = true;
  665. } else {
  666. // message.warning('前后门已经打开或正在打开,请勿重新操作');
  667. message.warning('没有监测到前门、后门关到位,无法进行指令下发操作');
  668. }
  669. break;
  670. case 6: // 关闭前后门
  671. if (
  672. selectData.frontGateOpen == '1' &&
  673. selectData.frontGateClose == '0' &&
  674. selectData.rearGateOpen == '1' &&
  675. selectData.rearGateClose == '0'
  676. ) {
  677. modalTitle.value = '关闭前后门';
  678. modalType.value = '6';
  679. modalIsShow.value = true;
  680. } else {
  681. // message.warning('前后门已经关闭或正在关闭,请勿重新操作');
  682. message.warning('没有监测到前门、后门开到位,无法进行指令下发操作');
  683. }
  684. break;
  685. case 7: // 控制模式切换
  686. modalTitle.value = '控制模式切换';
  687. modalType.value = '7';
  688. modalIsShow.value = true;
  689. break;
  690. case 10: // 风窗控制
  691. modalTitle.value = 'A窗控制';
  692. modalType.value = '10';
  693. modalIsShow.value = true;
  694. break;
  695. case 11: // 风窗控制
  696. modalTitle.value = 'B窗控制';
  697. modalType.value = '11';
  698. modalIsShow.value = true;
  699. break;
  700. case 12: // 风窗控制
  701. modalTitle.value = 'C窗控制';
  702. modalType.value = '12';
  703. modalIsShow.value = true;
  704. break;
  705. case 13: // 风窗控制
  706. modalTitle.value = 'D窗控制';
  707. modalType.value = '13';
  708. modalIsShow.value = true;
  709. break;
  710. }
  711. if (globalConfig?.simulatedPassword) {
  712. handleOK('', handlerState + '');
  713. }
  714. contrlValue = value;
  715. }
  716. // 保德缺打开状态
  717. // function playAnimation(handlerState, data: any = null) {
  718. // const value = data;
  719. // switch (handlerState) {
  720. // case 1: // 打开前门
  721. // modalTitle.value = '打开前门';
  722. // modalType.value = '1';
  723. // modalIsShow.value = true;
  724. // break;
  725. // case 2: // 关闭前门
  726. // modalTitle.value = '关闭前门';
  727. // modalType.value = '2';
  728. // modalIsShow.value = true;
  729. // break;
  730. // case 3: // 打开后门
  731. // modalTitle.value = '打开后门';
  732. // modalType.value = '3';
  733. // modalIsShow.value = true;
  734. // break;
  735. // case 4: // 关闭后门
  736. // modalTitle.value = '关闭后门';
  737. // modalType.value = '4';
  738. // modalIsShow.value = true;
  739. // break;
  740. // case 8: // 打开中间门
  741. // modalTitle.value = '打开中间门';
  742. // modalType.value = '8';
  743. // modalIsShow.value = true;
  744. // break;
  745. // case 9: // 关闭中间门
  746. // modalTitle.value = '关闭中间门';
  747. // modalType.value = '9';
  748. // modalIsShow.value = true;
  749. // break;
  750. // case 5: // 打开前后门
  751. // modalTitle.value = '打开前后门';
  752. // modalType.value = '5';
  753. // modalIsShow.value = true;
  754. // break;
  755. // case 6: // 关闭前后门
  756. // modalTitle.value = '关闭前后门';
  757. // modalType.value = '6';
  758. // modalIsShow.value = true;
  759. // break;
  760. // case 7: // 控制模式切换
  761. // modalTitle.value = '控制模式切换';
  762. // modalType.value = '7';
  763. // modalIsShow.value = true;
  764. // break;
  765. // case 10: // 风窗控制
  766. // modalTitle.value = '风窗控制';
  767. // modalType.value = '10';
  768. // modalIsShow.value = true;
  769. // break;
  770. // }
  771. // if (globalConfig?.simulatedPassword) {
  772. // handleOK('', handlerState + '');
  773. // }
  774. // contrlValue = value;
  775. // }
  776. function handleOK(passWord, handlerState, value?) {
  777. if (!passWord && !globalConfig?.simulatedPassword) {
  778. message.warning('请输入密码');
  779. return;
  780. }
  781. if (isOpenRunning) {
  782. message.warning('风门正在运行。。。');
  783. modalIsShow.value = false;
  784. return;
  785. }
  786. const data = {
  787. deviceid: selectData.deviceID,
  788. devicetype: selectData.deviceType,
  789. paramcode: '',
  790. value: contrlValue,
  791. password: passWord || globalConfig?.simulatedPassword,
  792. masterComputer: selectData.masterComputer,
  793. };
  794. let handler = () => {};
  795. debugger;
  796. switch (handlerState) {
  797. case '1': // 打开前门
  798. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '1') {
  799. handler = () => {
  800. frontDoorIsOpen.value = true;
  801. };
  802. data.paramcode = 'frontGateOpen_S';
  803. } else {
  804. message.warning('前门已打开。。。');
  805. modalIsShow.value = false;
  806. }
  807. break;
  808. case '2': // 关闭前门
  809. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0') {
  810. handler = () => {
  811. frontDoorIsOpen.value = false;
  812. };
  813. data.paramcode = 'frontGateClose_S';
  814. } else {
  815. message.warning('前门已关闭。。。');
  816. modalIsShow.value = false;
  817. }
  818. break;
  819. case '3': // 打开后门
  820. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '1') {
  821. handler = () => {
  822. backDoorIsOpen.value = true;
  823. };
  824. data.paramcode = 'rearGateOpen_S';
  825. } else {
  826. message.warning('后门已打开。。。');
  827. modalIsShow.value = false;
  828. }
  829. break;
  830. case '4': // 关闭后门
  831. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0') {
  832. handler = () => {
  833. backDoorIsOpen.value = false;
  834. };
  835. data.paramcode = 'rearGateClose_S';
  836. } else {
  837. message.warning('后门已关闭。。。');
  838. modalIsShow.value = false;
  839. }
  840. break;
  841. case '8': // 打开中间门
  842. if (selectData.midGateOpen == '0' && selectData.midGateClose == '1') {
  843. handler = () => {
  844. midDoorIsOpen.value = true;
  845. };
  846. data.paramcode = 'midGateOpen_S';
  847. } else {
  848. message.warning('中间风门已打开。。。');
  849. modalIsShow.value = false;
  850. }
  851. break;
  852. case '9': // 关闭中间门
  853. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0') {
  854. handler = () => {
  855. midDoorIsOpen.value = false;
  856. };
  857. data.paramcode = 'midGateClose_S';
  858. } else {
  859. message.warning('中间风门已关闭。。。');
  860. modalIsShow.value = false;
  861. }
  862. break;
  863. case '5': // 打开前后门
  864. if (
  865. selectData.frontGateOpen == '0' &&
  866. selectData.frontGateClose == '1' &&
  867. selectData.rearGateOpen == '0' &&
  868. selectData.rearGateClose == '1'
  869. ) {
  870. handler = () => {
  871. frontDoorIsOpen.value = true;
  872. backDoorIsOpen.value = true;
  873. };
  874. data.paramcode = 'sameTimeOpen';
  875. }
  876. break;
  877. case '6': // 关闭前后门
  878. if (
  879. selectData.frontGateOpen == '1' &&
  880. selectData.frontGateClose == '0' &&
  881. selectData.rearGateOpen == '1' &&
  882. selectData.rearGateClose == '0'
  883. ) {
  884. handler = () => {
  885. frontDoorIsOpen.value = false;
  886. backDoorIsOpen.value = false;
  887. };
  888. data.paramcode = 'sameTimeClose';
  889. }
  890. break;
  891. case '7': // 远程与就地
  892. if (selectData.contrlMod == 'codeCtrl') {
  893. if (contrlValue == '1') {
  894. data.paramcode = 'autoRoManualControl1';
  895. } else if (contrlValue == '0') {
  896. data.paramcode = 'autoRoManualControl2';
  897. } else {
  898. data.paramcode = 'autoRoManualControl0';
  899. }
  900. data.value = '';
  901. selectData.autoRoManual = null;
  902. } else if (selectData.contrlMod == 'loopCtrl' || selectData.contrlMod == 'jnjhCtrl') {
  903. data.paramcode = 'autoRoManualControl';
  904. data.value = '';
  905. selectData.autoRoManual = null;
  906. } else {
  907. data.paramcode = 'autoRoManualControl';
  908. data.value = contrlValue;
  909. selectData.autoRoManual = null;
  910. }
  911. break;
  912. case '10': // 前(A)窗控制
  913. data.paramcode = 'frontSetValue1';
  914. data.value = value;
  915. break;
  916. case '11': // 后(B)窗控制
  917. data.paramcode = 'frontSetValue2';
  918. data.value = value;
  919. break;
  920. case '12': // 后(B)窗控制
  921. data.paramcode = 'rearSetValue1';
  922. data.value = value;
  923. break;
  924. case '13': // 后(B)窗控制
  925. data.paramcode = 'rearSetValue2';
  926. data.value = value;
  927. break;
  928. }
  929. if (data.paramcode) {
  930. deviceControlApi(data).then((res) => {
  931. // 模拟时开启
  932. if (res.success) {
  933. modalIsShow.value = false;
  934. if (globalConfig.History_Type == 'remote') {
  935. message.success('指令已下发至生产管控平台成功!');
  936. } else {
  937. message.success('指令已下发成功!');
  938. }
  939. } else {
  940. message.error(res.message);
  941. }
  942. });
  943. }
  944. }
  945. let isOpenRunning = false; //开关门动作是否在进行
  946. /** 开关门动画调用 */
  947. let isFrontOpenRunning = false; //开关门动作是否在进行
  948. // let isFrontCloseRunning = false; //开关门动作是否在进行
  949. let isRearOpenRunning = false; //开关门动作是否在进行
  950. // let isRearCloseRunning = false; //开关门动作是否在进行
  951. let isMidOpenRunning = false; //中间门动作是否在进行
  952. // let isMidCloseRunning = false; //中间门动作是否在进行
  953. // 0 关闭 1 正在打开 2 打开 3正在关闭
  954. let frontDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  955. let rearDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  956. let midDeviceState = 0; //记录设备状态,为了与下一次监测数据做比较
  957. function monitorAnimation(selectData) {
  958. const timeScale = 0.005;
  959. // 带风窗 风窗动画
  960. if (selectData['gateStyle'] && selectData['gateStyle'].includes('fm_fc')) playWindowAnimation(selectData);
  961. if (selectData.frontGateOpen == '1' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  962. isFrontOpenRunning = true;
  963. if (frontDeviceState != 1) {
  964. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  965. play(1, timeScale);
  966. frontDeviceState = 1;
  967. frontDoorIsOpen.value = false;
  968. backDoorIsOpen.value = true;
  969. }
  970. }
  971. if (selectData.frontGateOpen == '0' && selectData.frontGateClose == '0' && !isFrontOpenRunning) {
  972. isFrontOpenRunning = true;
  973. if (frontDeviceState != 1) {
  974. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(1, timeScale) : play(1);
  975. play(1, timeScale);
  976. frontDeviceState = 1;
  977. frontDoorIsOpen.value = false;
  978. backDoorIsOpen.value = true;
  979. }
  980. }
  981. if (selectData.frontGateClose == '1' && selectData.frontGateOpen == '0' && isFrontOpenRunning) {
  982. isFrontOpenRunning = false;
  983. if (frontDeviceState != 0) {
  984. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(2, timeScale) : play(2);
  985. play(2, timeScale);
  986. frontDeviceState = 0;
  987. frontDoorIsOpen.value = false;
  988. // backDoorIsOpen.value = false
  989. }
  990. }
  991. if (selectData.rearGateOpen == '1' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  992. isRearOpenRunning = true;
  993. if (rearDeviceState != 1) {
  994. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  995. play(3, timeScale);
  996. rearDeviceState = 1;
  997. backDoorIsOpen.value = false;
  998. frontDoorIsOpen.value = true;
  999. }
  1000. }
  1001. if (selectData.rearGateOpen == '0' && selectData.rearGateClose == '0' && !isRearOpenRunning) {
  1002. isRearOpenRunning = true;
  1003. if (rearDeviceState != 1) {
  1004. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  1005. play(3, timeScale);
  1006. rearDeviceState = 1;
  1007. backDoorIsOpen.value = false;
  1008. frontDoorIsOpen.value = true;
  1009. }
  1010. }
  1011. if (selectData.rearGateClose == '1' && selectData.rearGateOpen == '0' && isRearOpenRunning) {
  1012. isRearOpenRunning = false;
  1013. if (rearDeviceState != 0) {
  1014. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  1015. play(4, timeScale);
  1016. rearDeviceState = 0;
  1017. backDoorIsOpen.value = false;
  1018. }
  1019. }
  1020. if (selectData.midGateOpen == '1' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  1021. isMidOpenRunning = true;
  1022. if (midDeviceState != 1) {
  1023. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  1024. play(8, timeScale);
  1025. midDeviceState = 1;
  1026. backDoorIsOpen.value = false;
  1027. frontDoorIsOpen.value = true;
  1028. }
  1029. }
  1030. if (selectData.midGateOpen == '0' && selectData.midGateClose == '0' && !isMidOpenRunning) {
  1031. isMidOpenRunning = true;
  1032. if (midDeviceState != 1) {
  1033. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(3, timeScale) : play(3);
  1034. play(8, timeScale);
  1035. midDeviceState = 1;
  1036. backDoorIsOpen.value = false;
  1037. frontDoorIsOpen.value = true;
  1038. }
  1039. }
  1040. if (selectData.midGateClose == '1' && selectData.midGateOpen == '0' && isMidOpenRunning) {
  1041. isMidOpenRunning = false;
  1042. if (midDeviceState != 0) {
  1043. // import.meta.env.VITE_GLOB_IS_SIMULATE ? play(4, timeScale) : play(4);
  1044. play(9, timeScale);
  1045. midDeviceState = 0;
  1046. backDoorIsOpen.value = false;
  1047. }
  1048. }
  1049. modelRef.value?.animate?.(selectData.frontGateOpen == '1', selectData.midGateOpen == '1', selectData.rearGateOpen == '1');
  1050. }
  1051. function playWindowAnimation(data, maxarea = 90, isFirst = false) {
  1052. computePlay(data, maxarea, isFirst);
  1053. }
  1054. function handleCancel() {
  1055. modalIsShow.value = false;
  1056. modalTitle.value = '';
  1057. modalType.value = '';
  1058. }
  1059. // // 远程、就地切换
  1060. // function changeType() {
  1061. // const data = {
  1062. // deviceid: selectData.deviceID,
  1063. // devicetype: selectData.deviceType,
  1064. // paramcode: 'autoRoManualControl',
  1065. // value: selectData.autoRoManual,
  1066. // };
  1067. // deviceControlApi(data).then(() => {
  1068. // if (globalConfig.History_Type == 'remote') {
  1069. // message.success('指令已下发至生产管控平台成功!');
  1070. // } else {
  1071. // message.success('指令已下发成功!');
  1072. // }
  1073. // });
  1074. // }
  1075. // async function getDataSource() {
  1076. // dataSource.value = [];
  1077. // const params = await resetFormParam();
  1078. // if (stationType.value !== 'redis') {
  1079. // const result = await defHttp.get({ url: '/safety/ventanalyMonitorData/listdays', params: params });
  1080. // if (result['datalist']['records'].length > 0) {
  1081. // dataSource.value = result['datalist']['records'].map((item: any) => {
  1082. // return Object.assign(item, item['readData']);
  1083. // });
  1084. // } else {
  1085. // dataSource.value = [];
  1086. // }
  1087. // } else {
  1088. // const result = await defHttp.post({ url: '/monitor/history/getHistoryData', params: params });
  1089. // dataSource.value = result['records'] || [];
  1090. // }
  1091. // }
  1092. onMounted(async () => {
  1093. const { query } = unref(currentRoute);
  1094. if (query['deviceType']) deviceType.value = query['deviceType'] as string;
  1095. modelList.value = await getDictItems('gateModel');
  1096. if (globalConfig.is2DModel) {
  1097. await getMonitor(true);
  1098. } else {
  1099. loading.value = true;
  1100. const playerDom = document.getElementById('fm-player1')?.getElementsByClassName('vjs-tech')[0];
  1101. mountedThree(playerDom)
  1102. .then(async () => {
  1103. if (sysOrgCode != 'zmhjhzmy') {
  1104. await getMonitor(true);
  1105. loading.value = false;
  1106. } else {
  1107. // 韩咀无风门设备,只有报警历史数据,无其他数据
  1108. setModelType('fm1').then(async () => {
  1109. loading.value = false;
  1110. dataSource.value = [];
  1111. addMonitorText(selectData);
  1112. });
  1113. }
  1114. })
  1115. .catch(() => {});
  1116. }
  1117. });
  1118. onBeforeUnmount(() => {
  1119. getDeviceBaseList();
  1120. });
  1121. onUnmounted(() => {
  1122. removeCamera();
  1123. if (timer) {
  1124. clearTimeout(timer);
  1125. timer = undefined;
  1126. }
  1127. destroy();
  1128. });
  1129. </script>
  1130. <style lang="less" scoped>
  1131. @import '/@/design/theme.less';
  1132. @import '/@/design/vent/modal.less';
  1133. .scene-box {
  1134. .bottom-tabs-box {
  1135. height: 350px;
  1136. }
  1137. }
  1138. .button-box {
  1139. border: none !important;
  1140. height: 34px !important;
  1141. &:hover {
  1142. background: var(--vent-device-manager-control-btn-hover) !important;
  1143. }
  1144. &::before {
  1145. height: 27px !important;
  1146. background: var(--vent-device-manager-control-btn) !important;
  1147. }
  1148. &::after {
  1149. top: 35px !important;
  1150. }
  1151. }
  1152. :deep(.@{ventSpace}-tabs-tabpane-active) {
  1153. height: 100%;
  1154. }
  1155. ::-webkit-scrollbar-thumb {
  1156. -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  1157. background: #4288a444;
  1158. }
  1159. :deep(.zxm-radio-disabled + span) {
  1160. color: var(--vent-font-color) !important;
  1161. }
  1162. :deep(.zxm-radio-disabled .zxm-radio-inner::after) {
  1163. background-color: #127cb5 !important;
  1164. }
  1165. :deep(.@{ventSpace}-picker-datetime-panel) {
  1166. height: 200px !important;
  1167. overflow-y: auto !important;
  1168. }
  1169. </style>