autodoor.vue 40 KB

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