autodoor.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. <template>
  2. <view style="overflow: auto; height: 100%">
  3. <!-- 建议放在外层 -->
  4. <u-navbar
  5. :title="name"
  6. @leftClick="backPage"
  7. :bgImage="backPic"
  8. :bgStatusImage="backPic0"
  9. >
  10. <view class="u-nav-slot" slot="left">
  11. <u-icon name="arrow-left" size="20"> </u-icon>
  12. </view>
  13. </u-navbar>
  14. <view class="main">
  15. <view class="u-page container">
  16. <div class="button-grid flcard" v-if="this.TabCur == 'gate'">
  17. <u-button
  18. type="primary"
  19. text="打开前门"
  20. @click="showPasswordDialog('frontGateOpen_S')"
  21. ></u-button>
  22. <u-button
  23. type="primary"
  24. text="关闭前门"
  25. @click="showPasswordDialog('frontGateClose_S')"
  26. ></u-button>
  27. <u-button
  28. type="primary"
  29. text="打开后门"
  30. @click="showPasswordDialog('rearGateOpen_S')"
  31. ></u-button>
  32. <u-button
  33. type="primary"
  34. text="关闭后门"
  35. @click="showPasswordDialog('rearGateClose_S')"
  36. ></u-button>
  37. <u-button
  38. type="primary"
  39. text="打开前后门"
  40. @click="showPasswordDialog('sameTimeOpen')"
  41. ></u-button>
  42. <u-button
  43. type="primary"
  44. text="关闭前后门"
  45. @click="showPasswordDialog('sameTimeClose')"
  46. ></u-button>
  47. </div>
  48. <div
  49. class="button-grid flcard"
  50. v-if="this.TabCur == 'window' && this.nwindownum == 1"
  51. >
  52. <u-button
  53. type="primary"
  54. text="设定面积"
  55. @click="showPasswordDialog('frontSetValue')"
  56. ></u-button>
  57. </div>
  58. <div
  59. class="button-grid flcard"
  60. v-if="this.TabCur == 'window' && this.nwindownum == 2"
  61. >
  62. <u-button
  63. type="primary"
  64. text="设定前窗面积"
  65. @click="showPasswordDialog('frontSetValue')"
  66. ></u-button>
  67. <u-button
  68. type="primary"
  69. text="设定后窗面积"
  70. @click="showPasswordDialog('rearSetValue')"
  71. ></u-button>
  72. </div>
  73. <div class="flcard" v-if="this.TabCur == 'gate'">
  74. <doorAnimate
  75. :gatestate1="frontGateStatus"
  76. :gatestate2="midGateStatus"
  77. :gatestate3="rearGateStatus"
  78. :cameralist="cameralist"
  79. :height="height"
  80. :doorcount="ndoorcount"
  81. >
  82. </doorAnimate>
  83. </div>
  84. <div class="flcard" v-if="this.TabCur == 'windrect'">
  85. <windrectAnimate
  86. :state="state"
  87. :title="title"
  88. :videoURL="viedeoUrl"
  89. :height="height"
  90. :type="deviceType"
  91. >
  92. </windrectAnimate>
  93. </div>
  94. <div class="flcard" v-if="this.TabCur == 'fanlocal'">
  95. <fanlocalAnimate
  96. :fan1State="fan1State"
  97. :fan2State="fan2State"
  98. :title="title"
  99. :videoURL="viedeoUrl"
  100. :height="height"
  101. >
  102. </fanlocalAnimate>
  103. </div>
  104. <div class="flcard" v-if="this.TabCur == 'fanmain'">
  105. <fanmainAnimate
  106. ref="fanpage"
  107. style="width: 100%"
  108. :door1="door1"
  109. :topdoor1="topdoor1"
  110. :fundoor1="fundoor1"
  111. :door2="door2"
  112. :topdoor2="topdoor2"
  113. :fundoor2="fundoor2"
  114. :nowfengji="qidongfengji"
  115. ></fanmainAnimate>
  116. </div>
  117. <div
  118. class="flcard"
  119. v-if="this.TabCur == 'window' && this.nwindownum == 1"
  120. >
  121. <windowAnimate
  122. :windowAngle="windowAngle"
  123. :height="height"
  124. :windowcount="nwindownum"
  125. ></windowAnimate>
  126. </div>
  127. <div
  128. class="flcard"
  129. v-if="this.TabCur == 'window' && this.nwindownum == 2"
  130. >
  131. <windowAnimate
  132. :windowAngle="windowAngle"
  133. :windowAngle1="windowAngle1"
  134. :height="height"
  135. :windowcount="nwindownum"
  136. ></windowAnimate>
  137. </div>
  138. <div class="flcard">
  139. <div
  140. class="flex-container"
  141. v-if="TabCur != 'fanlocal' && TabCur != 'fanmain'"
  142. >
  143. <div
  144. class="itemback"
  145. v-for="(item, index) in deviceShowList"
  146. :key="index"
  147. v-show="
  148. item.appShow == 1 &&
  149. item.monitorcode != 'strinstallpos' &&
  150. item.monitorcode != 'netStatus' &&
  151. item.monitorcode != 'warnFlag' &&
  152. item.monitorcode != 'readTime' &&
  153. item.monitorcode != ''
  154. "
  155. >
  156. <div class="datacard">
  157. <div class="left-content">
  158. <view
  159. v-if="item.datatype == 1 && item.monitorcode == 'doorUse'"
  160. class="demo-layout bg-purple-light"
  161. style="margin-top: 60rpx; color: #3787fe"
  162. >
  163. {{
  164. tableData[item.monitorcode] == "2"
  165. ? "行人"
  166. : tableData[item.monitorcode] == "1"
  167. ? "行车"
  168. : "-"
  169. }}
  170. </view>
  171. <view
  172. v-else-if="item.datatype == 1"
  173. class="demo-layout bg-purple-light"
  174. style="margin-top: 60rpx; color: #3787fe"
  175. >
  176. {{
  177. tableData[item.monitorcode] != undefined &&
  178. tableData[item.monitorcode] != null
  179. ? tableData[item.monitorcode]
  180. : "-"
  181. }}
  182. </view>
  183. <view
  184. v-else-if="item.datatype == 2"
  185. class="demo-layout bg-purple-light"
  186. style="margin-top: 60rpx; color: #3787fe"
  187. >
  188. {{
  189. tableData[item.monitorcode] != undefined &&
  190. tableData[item.monitorcode] != null
  191. ? tableData[item.monitorcode]
  192. : "-"
  193. }}
  194. </view>
  195. <div class="spacer"></div>
  196. <!-- 间距 -->
  197. <view
  198. class="demo-layout bg-purple-light"
  199. style="color: #677799"
  200. >
  201. {{ item.des }}
  202. </view>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. <div class="flex-container" v-else-if="TabCur == 'fanmain'">
  208. <div>主机</div>
  209. <div
  210. class="itemback"
  211. v-for="(item, index) in showColum[TabCur + '_monitor_left']"
  212. :key="index"
  213. v-show="item.appShow == 1"
  214. >
  215. <div
  216. class="datacardtime"
  217. v-if="item.monitorcode == 'readTime' && item.datatype == 1"
  218. >
  219. <view
  220. class="demo-layout bg-purple-light"
  221. style="padding: 20rpx; color: #3787fe"
  222. >
  223. {{ readTime }}
  224. </view>
  225. </div>
  226. <div class="datacard" v-if="item.monitorcode !== 'readTime'">
  227. <div class="left-content">
  228. <view
  229. v-if="item.monitorcode == 'netStatus' && item.datatype == 1"
  230. class="demo-layout bg-purple-light"
  231. style="margin-top: 60rpx; color: #3787fe"
  232. >
  233. {{ doorNetStatus == "1" ? "正常" : "异常" }}
  234. </view>
  235. <view
  236. v-else-if="item.datatype == 1"
  237. class="demo-layout bg-purple-light"
  238. style="margin-top: 60rpx; color: #3787fe"
  239. >
  240. {{
  241. tableData[
  242. item.monitorcode.startsWith("Fan")
  243. ? item.monitorcode.replace(/^Fan/, "Fan1")
  244. : item.monitorcode
  245. ] !== undefined &&
  246. tableData[
  247. item.monitorcode.startsWith("Fan")
  248. ? item.monitorcode.replace(/^Fan/, "Fan1")
  249. : item.monitorcode
  250. ] !== null
  251. ? tableData[
  252. item.monitorcode.startsWith("Fan")
  253. ? item.monitorcode.replace(/^Fan/, "Fan1")
  254. : item.monitorcode
  255. ]
  256. : "-"
  257. }}
  258. </view>
  259. <view
  260. v-else-if="item.datatype == 2"
  261. class="demo-layout bg-purple-light"
  262. style="margin-top: 60rpx; color: #3787fe"
  263. >
  264. {{
  265. tableData[
  266. item.monitorcode.startsWith("Fan")
  267. ? item.monitorcode.replace(/^Fan/, "Fan1")
  268. : item.monitorcode
  269. ] !== undefined &&
  270. tableData[
  271. item.monitorcode.startsWith("Fan")
  272. ? item.monitorcode.replace(/^Fan/, "Fan1")
  273. : item.monitorcode
  274. ] !== null
  275. ? tableData[
  276. item.monitorcode.startsWith("Fan")
  277. ? item.monitorcode.replace(/^Fan/, "Fan1")
  278. : item.monitorcode
  279. ]
  280. : "-"
  281. }}
  282. </view>
  283. <div class="spacer"></div>
  284. <!-- 间距 -->
  285. <view
  286. class="demo-layout bg-purple-light"
  287. style="color: #677799"
  288. >
  289. {{ item.des }}
  290. </view>
  291. </div>
  292. </div>
  293. </div>
  294. <div>备机</div>
  295. <div
  296. class="itemback"
  297. v-for="(item, index) in showColum[TabCur + '_monitor_left']"
  298. :key="index"
  299. v-show="item.appShow == 1"
  300. >
  301. <div
  302. class="datacardtime"
  303. v-if="item.monitorcode == 'readTime' && item.datatype == 1"
  304. >
  305. <view
  306. class="demo-layout bg-purple-light"
  307. style="padding: 20rpx; color: #3787fe"
  308. >
  309. {{ readTime }}
  310. </view>
  311. </div>
  312. <div class="datacard" v-if="item.monitorcode !== 'readTime'">
  313. <div class="left-content">
  314. <view
  315. v-if="item.monitorcode == 'netStatus' && item.datatype == 1"
  316. class="demo-layout bg-purple-light"
  317. style="margin-top: 60rpx; color: #3787fe"
  318. >
  319. {{ doorNetStatus == "1" ? "正常" : "异常" }}
  320. </view>
  321. <view
  322. v-else-if="item.datatype == 1"
  323. class="demo-layout bg-purple-light"
  324. style="margin-top: 60rpx; color: #3787fe"
  325. >
  326. {{
  327. tableData[
  328. item.monitorcode.startsWith("Fan")
  329. ? item.monitorcode.replace(/^Fan/, "Fan2")
  330. : item.monitorcode
  331. ] !== undefined &&
  332. tableData[
  333. item.monitorcode.startsWith("Fan")
  334. ? item.monitorcode.replace(/^Fan/, "Fan2")
  335. : item.monitorcode
  336. ] !== null
  337. ? tableData[
  338. item.monitorcode.startsWith("Fan")
  339. ? item.monitorcode.replace(/^Fan/, "Fan2")
  340. : item.monitorcode
  341. ]
  342. : "-"
  343. }}
  344. </view>
  345. <view
  346. v-else-if="item.datatype == 2"
  347. class="demo-layout bg-purple-light"
  348. style="margin-top: 60rpx; color: #3787fe"
  349. >
  350. {{
  351. tableData[
  352. item.monitorcode.startsWith("Fan")
  353. ? item.monitorcode.replace(/^Fan/, "Fan2")
  354. : item.monitorcode
  355. ] !== undefined &&
  356. tableData[
  357. item.monitorcode.startsWith("Fan")
  358. ? item.monitorcode.replace(/^Fan/, "Fan2")
  359. : item.monitorcode
  360. ] !== null
  361. ? tableData[
  362. item.monitorcode.startsWith("Fan")
  363. ? item.monitorcode.replace(/^Fan/, "Fan2")
  364. : item.monitorcode
  365. ]
  366. : "-"
  367. }}
  368. </view>
  369. <div class="spacer"></div>
  370. <!-- 间距 -->
  371. <view
  372. class="demo-layout bg-purple-light"
  373. style="color: #677799"
  374. >
  375. {{ item.des }}
  376. </view>
  377. </div>
  378. </div>
  379. </div>
  380. </div>
  381. <div class="flex-container" v-else-if="TabCur == 'fanlocal'">
  382. <div>主机</div>
  383. <div
  384. class="itemback"
  385. v-for="(item, index) in showColum[TabCur + '_monitor_right']"
  386. :key="index"
  387. v-show="item.appShow == 1"
  388. >
  389. <div
  390. class="datacardtime"
  391. v-if="item.monitorcode == 'readTime' && item.datatype == 1"
  392. >
  393. <view
  394. class="demo-layout bg-purple-light"
  395. style="padding: 20rpx; color: #3787fe"
  396. >
  397. {{ readTime }}
  398. </view>
  399. </div>
  400. <div class="datacard" v-if="item.monitorcode !== 'readTime'">
  401. <div class="left-content">
  402. <view
  403. v-if="item.monitorcode == 'netStatus' && item.datatype == 1"
  404. class="demo-layout bg-purple-light"
  405. style="margin-top: 60rpx; color: #3787fe"
  406. >
  407. {{ doorNetStatus == "1" ? "正常" : "异常" }}
  408. </view>
  409. <view
  410. v-else-if="item.datatype == 1"
  411. class="demo-layout bg-purple-light"
  412. style="margin-top: 60rpx; color: #3787fe"
  413. >
  414. {{
  415. tableData[
  416. item.monitorcode.startsWith("Fan")
  417. ? item.monitorcode.replace(/^Fan/, "Fan1")
  418. : item.monitorcode
  419. ] !== undefined &&
  420. tableData[
  421. item.monitorcode.startsWith("Fan")
  422. ? item.monitorcode.replace(/^Fan/, "Fan1")
  423. : item.monitorcode
  424. ] !== null
  425. ? tableData[
  426. item.monitorcode.startsWith("Fan")
  427. ? item.monitorcode.replace(/^Fan/, "Fan1")
  428. : item.monitorcode
  429. ]
  430. : "-"
  431. }}
  432. </view>
  433. <view
  434. v-else-if="item.datatype == 2"
  435. class="demo-layout bg-purple-light"
  436. style="margin-top: 60rpx; color: #3787fe"
  437. >
  438. {{
  439. tableData[
  440. item.monitorcode.startsWith("Fan")
  441. ? item.monitorcode.replace(/^Fan/, "Fan1")
  442. : item.monitorcode
  443. ] !== undefined &&
  444. tableData[
  445. item.monitorcode.startsWith("Fan")
  446. ? item.monitorcode.replace(/^Fan/, "Fan1")
  447. : item.monitorcode
  448. ] !== null
  449. ? tableData[
  450. item.monitorcode.startsWith("Fan")
  451. ? item.monitorcode.replace(/^Fan/, "Fan1")
  452. : item.monitorcode
  453. ]
  454. : "-"
  455. }}
  456. </view>
  457. <div class="spacer"></div>
  458. <!-- 间距 -->
  459. <view
  460. class="demo-layout bg-purple-light"
  461. style="color: #677799"
  462. >
  463. {{ item.des }}
  464. </view>
  465. </div>
  466. </div>
  467. </div>
  468. <div>备机</div>
  469. <div
  470. class="itemback"
  471. v-for="(item, index) in showColum[TabCur + '_monitor_right']"
  472. :key="index"
  473. v-show="item.appShow == 1"
  474. >
  475. <div
  476. class="datacardtime"
  477. v-if="item.monitorcode == 'readTime' && item.datatype == 1"
  478. >
  479. <view
  480. class="demo-layout bg-purple-light"
  481. style="padding: 20rpx; color: #3787fe"
  482. >
  483. {{ readTime }}
  484. </view>
  485. </div>
  486. <div class="datacard" v-if="item.monitorcode !== 'readTime'">
  487. <div class="left-content">
  488. <view
  489. v-if="item.monitorcode == 'netStatus' && item.datatype == 1"
  490. class="demo-layout bg-purple-light"
  491. style="margin-top: 60rpx; color: #3787fe"
  492. >
  493. {{ doorNetStatus == "1" ? "正常" : "异常" }}
  494. </view>
  495. <view
  496. v-else-if="item.datatype == 1"
  497. class="demo-layout bg-purple-light"
  498. style="margin-top: 60rpx; color: #3787fe"
  499. >
  500. {{
  501. tableData[
  502. item.monitorcode.startsWith("Fan")
  503. ? item.monitorcode.replace(/^Fan/, "Fan2")
  504. : item.monitorcode
  505. ] !== undefined &&
  506. tableData[
  507. item.monitorcode.startsWith("Fan")
  508. ? item.monitorcode.replace(/^Fan/, "Fan2")
  509. : item.monitorcode
  510. ] !== null
  511. ? tableData[
  512. item.monitorcode.startsWith("Fan")
  513. ? item.monitorcode.replace(/^Fan/, "Fan2")
  514. : item.monitorcode
  515. ]
  516. : "-"
  517. }}
  518. </view>
  519. <view
  520. v-else-if="item.datatype == 2"
  521. class="demo-layout bg-purple-light"
  522. style="margin-top: 60rpx; color: #3787fe"
  523. >
  524. {{
  525. tableData[
  526. item.monitorcode.startsWith("Fan")
  527. ? item.monitorcode.replace(/^Fan/, "Fan2")
  528. : item.monitorcode
  529. ] !== undefined &&
  530. tableData[
  531. item.monitorcode.startsWith("Fan")
  532. ? item.monitorcode.replace(/^Fan/, "Fan2")
  533. : item.monitorcode
  534. ] !== null
  535. ? tableData[
  536. item.monitorcode.startsWith("Fan")
  537. ? item.monitorcode.replace(/^Fan/, "Fan2")
  538. : item.monitorcode
  539. ]
  540. : "-"
  541. }}
  542. </view>
  543. <div class="spacer"></div>
  544. <!-- 间距 -->
  545. <view
  546. class="demo-layout bg-purple-light"
  547. style="color: #677799"
  548. >
  549. {{ item.des }}
  550. </view>
  551. </div>
  552. </div>
  553. </div>
  554. </div>
  555. </div>
  556. </view>
  557. </view>
  558. <u-popup :show="show" mode="bottom" :safeAreaInsetBottom="false">
  559. <div class="containers">
  560. <view class="passWordName">
  561. <view
  562. class="title"
  563. style="margin-top: 15px"
  564. v-if="this.TabCur == 'window'"
  565. >风窗面积</view
  566. >
  567. <u-input
  568. class="passArea"
  569. style="margin-top: 15px; border-color: #2a94ff"
  570. v-model="windowArea"
  571. type="text"
  572. v-if="this.TabCur == 'window'"
  573. ></u-input>
  574. </view>
  575. <view class="passWordInput">
  576. <view style="margin-top: 15px" class="title">输入密码</view>
  577. <u-input
  578. style="margin-top: 15px; border-color: #2a94ff"
  579. v-model="password"
  580. type="password"
  581. ></u-input
  582. ></view>
  583. </div>
  584. <view class="btns">
  585. <u-button
  586. style="margin: 20px"
  587. type="primary"
  588. @click="confirmPassword()"
  589. color="linear-gradient(to right, rgb(53, 138, 254), rgb(38, 171, 244))"
  590. >确认</u-button
  591. >
  592. <u-button
  593. style="margin: 20px"
  594. type="primary"
  595. :plain="true"
  596. @click="cancelPassword()"
  597. >取消</u-button
  598. >
  599. </view>
  600. </u-popup>
  601. </view>
  602. </template>
  603. <script>
  604. import api from "@/api/api";
  605. import initDictOptions from "@/common/util/dictUtil.js";
  606. import doorAnimate from "../doorAnimate/doorAnimate.vue";
  607. import windowAnimate from "../windowAnimate/windowAnimate.vue";
  608. import windrectAnimate from "../windrectAnimate/windrectAnimate.vue";
  609. import fanlocalAnimate from "../fanlocalAnimate/fanlocalAnimate2.vue";
  610. import fanmainAnimate from "../fanmainAnimate/fanmainAnimate.vue";
  611. export default {
  612. data() {
  613. return {
  614. tableData: {}, //监测数据
  615. typeList: [], //展示字段
  616. itemId: "", // 初始化 itemId
  617. name: "", // 初始化 name
  618. deviceid: "", //初始化设备id
  619. TabCur: "",
  620. checked: [],
  621. backPic0: "url(/static/topnavbar0.png)",
  622. backPic: "url(/static/topnavbar.png)",
  623. frontAngle: "", //风窗打开角度
  624. nwindownum: "", //风窗道数
  625. ndoorcount: "", //风门道数
  626. deviceType: "", //设备类型
  627. show: false, //密码弹窗是否显示
  628. password: "", //控制设备密码
  629. paramcode: "", //控制字段
  630. height: "200px",
  631. popupStyle: {
  632. // 弹窗样式
  633. "background-color": "#fff",
  634. padding: "20px",
  635. "box-shadow": "0 2px 4px rgba(0, 0, 0, 0.1)",
  636. },
  637. frontGateStatus: "", //前门状态
  638. rearGateStatus: "", //后门状态
  639. midGateStatus: "", //状态
  640. doorNetStatus: "", //风门通信状态
  641. warnFlag: "", //风门报警
  642. readTime: "", //时间
  643. windowAngle: 0, //前窗打开角度
  644. windowAngle1: 0, //后窗打开角度
  645. windowArea: "", //风窗面积设定值
  646. viedeoUrl: "", //监控url
  647. sign: "",
  648. title: "测风设备",
  649. fan1State: "",
  650. fan2State: "",
  651. deviceid: "", //ID
  652. cameralist: [], //摄像数据
  653. showColum: {},
  654. deviceShowList: [],
  655. };
  656. },
  657. onLoad(query) {
  658. //保存id到 data 中 可以在整个页面中使用
  659. this.itemId = query.id;
  660. this.name = query.name;
  661. this.TabCur = query.type;
  662. this.ndoorcount = 2;
  663. },
  664. components: {
  665. doorAnimate,
  666. windowAnimate,
  667. windrectAnimate,
  668. fanlocalAnimate,
  669. fanmainAnimate,
  670. },
  671. created() {
  672. this.getShowColum();
  673. this.getDeviceInfo(this.itemId);
  674. this.getVideoUrlById(this.itemId);
  675. },
  676. mounted() {
  677. this.startTimer();
  678. },
  679. methods: {
  680. startTimer() {
  681. this.timer = setInterval(() => {
  682. // 执行定时任务
  683. this.getDeviceInfo(this.itemId);
  684. }, 5000);
  685. },
  686. stopTimer() {
  687. // 停止定时器
  688. clearInterval(this.timer);
  689. },
  690. // 返回上一个页面
  691. backPage() {
  692. this.$destroy();
  693. uni.navigateBack({
  694. delta: 1,
  695. });
  696. },
  697. getShowColum() {
  698. new Promise((resolve, reject) => {
  699. api
  700. .getShowColum({})
  701. .then((response) => {
  702. if (response.data.code == 200) {
  703. var showlist = response.data.result;
  704. this.$store.commit("SET_SHOWCOLUM", showlist);
  705. this.showColum = showlist;
  706. const key = this.TabCur + "_monitor";
  707. const key1 = this.deviceType + "_monitor";
  708. if (this.showColum[key1].length > 0) {
  709. this.deviceShowList = this.showColum[key1];
  710. } else {
  711. this.deviceShowList = this.showColum[key];
  712. }
  713. // this.deviceShowList = this.showColum[key];
  714. } else {
  715. resolve(response);
  716. }
  717. })
  718. .catch((error) => {
  719. console.log("catch===>response", response);
  720. reject(error);
  721. });
  722. });
  723. },
  724. // //获取app展示字段数据
  725. // getShowList(type) {
  726. // const params = {
  727. // devicekind: type,
  728. // pagetype: "detail",
  729. // pageNo: 1,
  730. // pageSize: 100,
  731. // };
  732. // new Promise((resolve, reject) => {
  733. // api
  734. // .getShowColumList(params)
  735. // .then((response) => {
  736. // if (response.data.code == 200) {
  737. // this.typeList = response.data.result.records;
  738. // } else {
  739. // resolve(response);
  740. // }
  741. // })
  742. // .catch((error) => {
  743. // reject(error);
  744. // });
  745. // });
  746. // },
  747. //获取详情数据
  748. getDeviceInfo(ID) {
  749. let IDString = String(ID); // 将 ID 转换为字符串
  750. new Promise((resolve, reject) => {
  751. api
  752. .getDeviceMonitor({ devicetype: this.TabCur, ids: IDString })
  753. .then((response) => {
  754. if (
  755. response.data.code == 200 &&
  756. response.data.result.msgTxt[0].datalist.length > 0
  757. ) {
  758. var result = response.data.result.msgTxt[0].datalist[0];
  759. let newData = { ...result, ...result.readData };
  760. this.tableData = newData;
  761. if (this.tableData["frontGateClose"] == "1") {
  762. this.tableData.frontGateOpen = "关闭";
  763. } else if (this.tableData["frontGateClose"] == "0") {
  764. this.tableData.frontGateOpen = "打开";
  765. } else {
  766. this.tableData.frontGateOpen = "关闭";
  767. }
  768. if (this.tableData["midGateClose"] == "1") {
  769. this.tableData.midGateOpen = "关闭";
  770. } else if (this.tableData["midGateClose"] == "0") {
  771. this.tableData.midGateOpen = "打开";
  772. } else {
  773. this.tableData.midGateOpen = "关闭";
  774. }
  775. if (this.tableData["rearGateClose"] == "1") {
  776. this.tableData.rearGateOpen = "关闭";
  777. } else if (this.tableData["rearGateClose"] == "0") {
  778. this.tableData.rearGateOpen = "打开";
  779. } else {
  780. this.tableData.rearGateOpen = "关闭";
  781. }
  782. this.fan1State = result.readData.Fan1StartStatus;
  783. this.fan2State = result.readData.Fan2StartStatus;
  784. this.nwindownum = result.nwindownum;
  785. this.ndoorcount = result.ndoorcount;
  786. this.deviceType = result.deviceType;
  787. this.state = result.readData.sign;
  788. this.frontGateStatus = this.tableData.frontGateOpen;
  789. this.midGateStatus = this.tableData.midGateOpen;
  790. this.rearGateStatus = this.tableData.rearGateOpen;
  791. this.doorNetStatus = result.netStatus;
  792. this.warnFlag = result.warnLevel_str;
  793. this.readTime = result.readTime;
  794. this.qidongfengji = result.readData.Fan1StartStatus
  795. ? result.readData.Fan1StartStatus
  796. : result.readData.Fan2StartStatus;
  797. var maxarea = result.maxarea;
  798. this.windowAngle =
  799. (this.tableData.forntArea / maxarea) * 100 * 0.9;
  800. this.windowAngle1 =
  801. (this.tableData.rearArea / maxarea) * 100 * 0.9;
  802. this.deviceid = result.deviceID;
  803. this.$forceUpdate();
  804. } else {
  805. resolve(response);
  806. }
  807. })
  808. .catch((error) => {
  809. reject(error);
  810. });
  811. });
  812. },
  813. //获取监控URL 通过ID获取
  814. getVideoUrlById(ID) {
  815. let IDString = String(ID); // 将 ID 转换为字符串
  816. new Promise((resolve, reject) => {
  817. api
  818. .getCameraById({ deviceid: IDString })
  819. .then((response) => {
  820. if (response.data.code == 200) {
  821. if (response.data.result.records.length > 0) {
  822. this.cameralist = response.data.result.records[0];
  823. }
  824. } else {
  825. resolve(response);
  826. }
  827. })
  828. .catch((error) => {
  829. reject(error);
  830. });
  831. });
  832. },
  833. //设备控制
  834. ctrlDevice(pass) {
  835. let IDString = String(this.itemId); // 将 ID 转换为字符串
  836. const params = {
  837. deviceid: IDString,
  838. devicetype: this.deviceType,
  839. paramcode: this.paramcode,
  840. password: pass,
  841. value: this.windowArea,
  842. };
  843. new Promise((resolve, reject) => {
  844. api
  845. .controlDevice(params)
  846. .then((response) => {
  847. if (response.data.code == 200) {
  848. this.getDeviceInfo(IDString);
  849. // console.log("操作成功");
  850. } else {
  851. resolve(response);
  852. }
  853. })
  854. .catch((error) => {
  855. reject(error);
  856. });
  857. });
  858. },
  859. // 显示密码输入弹窗
  860. showPasswordDialog(controlCode) {
  861. this.paramcode = controlCode;
  862. this.show = true;
  863. },
  864. // 取消密码输入
  865. cancelPassword() {
  866. this.show = false;
  867. },
  868. confirmPassword() {
  869. this.ctrlDevice(this.password);
  870. // 发起请求后关闭密码输入弹窗
  871. this.show = false;
  872. },
  873. },
  874. destroyed() {
  875. // 停止定时器
  876. this.stopTimer();
  877. },
  878. };
  879. </script>
  880. <style lang="scss" scoped>
  881. .top-nav {
  882. background-image: url(../../../../static/topnavbar.png);
  883. background-size: cover; /* 背景图片大小适应 */
  884. height: 100%;
  885. }
  886. .top-nav2 {
  887. background-color: #ffffff;
  888. }
  889. .main {
  890. margin-top: 80px;
  891. }
  892. .container {
  893. display: flex;
  894. flex-direction: column;
  895. }
  896. .button-grid {
  897. display: grid;
  898. grid-template-columns: repeat(4, 1fr);
  899. gap: 5px; /* 可以根据需要调整行列之间的间距 */
  900. }
  901. .fanContent {
  902. display: flex;
  903. flex-direction: column;
  904. margin-top: 10rpx;
  905. margin-bottom: 10rpx;
  906. }
  907. .top,
  908. .bottom {
  909. flex: 1; /* 各占 50% */
  910. }
  911. .flcard {
  912. padding: 20rpx;
  913. background-color: #ffffff;
  914. margin-bottom: 5rpx;
  915. }
  916. .additional-div {
  917. grid-column: span 2; /* 让附加内容跨越三列 */
  918. display: flex;
  919. align-items: center;
  920. }
  921. .checkbox-group {
  922. margin-left: 10px; /* 可以根据需要调整间距 */
  923. }
  924. .card {
  925. background-color: #ffffff;
  926. margin: auto;
  927. margin-top: 20rpx;
  928. width: 90%;
  929. height: 280rpx;
  930. border: 1rpx solid #000000;
  931. border-radius: 20rpx;
  932. }
  933. .flex-containe {
  934. display: flex;
  935. flex-direction: row;
  936. flex-wrap: wrap;
  937. }
  938. .itemback {
  939. flex: 0 0 calc(33.33% - 10px); /* 使用calc函数计算每个项目的宽度,减去间距 */
  940. margin: 5px; /* 间距设置为5px */
  941. }
  942. .datacardtime {
  943. display: flex;
  944. width: 100%;
  945. flex: 1;
  946. margin: 1%;
  947. float: left;
  948. height: 50px;
  949. line-height: 29px;
  950. text-align: center;
  951. background: linear-gradient(
  952. to right,
  953. rgba(55, 135, 254, 0.08),
  954. rgba(4, 184, 255, 0.08),
  955. rgba(60, 161, 237, 0.08)
  956. );
  957. }
  958. .datacard {
  959. display: flex;
  960. width: 48%;
  961. flex: 1;
  962. margin: 1%;
  963. float: left;
  964. height: 180rpx;
  965. text-align: center;
  966. background: linear-gradient(
  967. to right,
  968. rgba(55, 135, 254, 0.08),
  969. rgba(4, 184, 255, 0.08),
  970. rgba(60, 161, 237, 0.08)
  971. );
  972. }
  973. .left-content {
  974. width: 100%;
  975. display: flex;
  976. flex-direction: column;
  977. }
  978. .spacer {
  979. height: 10rpx;
  980. }
  981. .right-content {
  982. width: 50%; /* 右侧内容占据50%宽度 */
  983. background-image: url(../../../../static/model/Pa.png);
  984. background-size: 100% 125%;
  985. }
  986. /*风窗样式*/
  987. div.autowindow_new {
  988. width: 200px;
  989. height: 200px;
  990. background-image: url(../../../../static/window/window-bk.png);
  991. background-size: 100% 100%;
  992. perspective: 800px;
  993. }
  994. /*风窗1 2 3 4*/
  995. div.window_new_1 {
  996. margin-top: 12px;
  997. margin-left: 15px;
  998. width: 170px;
  999. height: 30px;
  1000. background-color: crimson;
  1001. box-sizing: border-box;
  1002. float: left;
  1003. z-index: 1;
  1004. /* transition: all 2s; */
  1005. background-image: url(../../../../static/window/window_new1.png);
  1006. background-size: 100% 100%;
  1007. }
  1008. div.window_new_2 {
  1009. margin-top: 2px;
  1010. margin-left: 15px;
  1011. width: 170px;
  1012. height: 29px;
  1013. background-color: crimson;
  1014. box-sizing: border-box;
  1015. float: left;
  1016. z-index: 1;
  1017. /* transition: all 2s; */
  1018. background-image: url(../../../../static/window/window_new1.png);
  1019. background-size: 100% 100%;
  1020. }
  1021. div.window_new_3 {
  1022. margin-top: 2px;
  1023. margin-left: 15px;
  1024. width: 170px;
  1025. height: 29px;
  1026. background-color: crimson;
  1027. box-sizing: border-box;
  1028. float: left;
  1029. z-index: 1;
  1030. /* transition: all 2s; */
  1031. background-image: url(../../../../static/window/window_new1.png);
  1032. background-size: 100% 100%;
  1033. }
  1034. div.window_new_4 {
  1035. margin-top: 2px;
  1036. margin-left: 15px;
  1037. width: 170px;
  1038. height: 29px;
  1039. background-color: crimson;
  1040. box-sizing: border-box;
  1041. float: left;
  1042. z-index: 1;
  1043. /* transition: all 2s; */
  1044. background-image: url(../../../../static/window/window_new1.png);
  1045. background-size: 100% 100%;
  1046. }
  1047. div.window_new_5 {
  1048. margin-top: 2px;
  1049. margin-left: 15px;
  1050. width: 170px;
  1051. height: 29px;
  1052. background-color: crimson;
  1053. box-sizing: border-box;
  1054. float: left;
  1055. z-index: 1;
  1056. /* transition: all 2s; */
  1057. background-image: url(../../../../static/window/window_new1.png);
  1058. background-size: 100% 100%;
  1059. }
  1060. div.window_new_1 {
  1061. transition: all 2s ease;
  1062. transform-origin: center center;
  1063. }
  1064. div.window_new_2 {
  1065. transition: all 2s ease;
  1066. transform-origin: center center;
  1067. }
  1068. div.window_new_3 {
  1069. transition: all 2s ease;
  1070. transform-origin: center center;
  1071. }
  1072. div.window_new_4 {
  1073. transition: all 2s ease;
  1074. transform-origin: center center;
  1075. }
  1076. div.window_new_5 {
  1077. transition: all 2s ease;
  1078. transform-origin: center center;
  1079. }
  1080. .btns {
  1081. display: flex;
  1082. }
  1083. .containers {
  1084. background-color: #fff;
  1085. }
  1086. .passWordName {
  1087. margin: 20px;
  1088. display: flex;
  1089. flex-direction: row;
  1090. justify-content: space-around;
  1091. }
  1092. .title {
  1093. margin-right: 20px;
  1094. line-height: 40px;
  1095. }
  1096. .passWordInput {
  1097. margin: 20px;
  1098. display: flex;
  1099. flex-direction: row;
  1100. justify-content: space-around;
  1101. }
  1102. .passArea {
  1103. border-color: red;
  1104. }
  1105. </style>