index.vue 49 KB

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