autodoor.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  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 deviceback" 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 deviceback" 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 deviceback" 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 deviceback" 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 deviceback" 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
  124. class="flcard deviceback"
  125. v-for="(item, index) in cameraList"
  126. :key="index"
  127. >
  128. <video
  129. style="margin-left: 50px"
  130. id="myVideo"
  131. controls
  132. show-loading
  133. autoplay
  134. class="r-video"
  135. :vslide-gesture="true"
  136. :vslide-gesture-in-fullscreen="true"
  137. :src="item.addr"
  138. ></video>
  139. </div>
  140. </div>
  141. <div class="flcard">
  142. <div
  143. class="flex-container"
  144. v-if="TabCur != 'fanlocal' && TabCur != 'fanmain'"
  145. >
  146. <view
  147. class="datacard"
  148. v-for="(item, index) in deviceShowList"
  149. :key="index"
  150. v-show="
  151. item.appShow == 1 &&
  152. item.monitorcode != 'strinstallpos' &&
  153. item.monitorcode != 'netStatus' &&
  154. item.monitorcode != 'warnFlag' &&
  155. item.monitorcode != 'readTime' &&
  156. item.monitorcode != ''
  157. "
  158. >
  159. <view
  160. class="TabCurCSS"
  161. style="
  162. padding-top: 10rpx;
  163. padding-bottom: 10rpx;
  164. display: flex;
  165. flex-direction: column;
  166. height: 100%;
  167. "
  168. >
  169. <view
  170. v-if="item.datatype == 1 && item.monitorcode == 'doorUse'"
  171. class="demo-layout bg-purple-light"
  172. style="
  173. color: #3787fe;
  174. font-size: 30rpx;
  175. font-weight: bold;
  176. margin-left: 20rpx;
  177. text-align: left;
  178. "
  179. >
  180. {{
  181. tableData[item.monitorcode] == "2"
  182. ? "行人"
  183. : tableData[item.monitorcode] == "1"
  184. ? "行车"
  185. : "-"
  186. }}
  187. </view>
  188. <view
  189. v-else-if="item.datatype == 1"
  190. class="demo-layout bg-purple-light"
  191. style="
  192. color: #3787fe;
  193. font-size: 30rpx;
  194. font-weight: bold;
  195. margin-left: 20rpx;
  196. text-align: left;
  197. "
  198. >
  199. {{
  200. tableData[item.monitorcode] != undefined &&
  201. tableData[item.monitorcode] != null
  202. ? tableData[item.monitorcode]
  203. : "-"
  204. }}
  205. </view>
  206. <view
  207. v-else-if="item.datatype == 2"
  208. class="demo-layout bg-purple-light"
  209. style="
  210. color: #3787fe;
  211. font-size: 30rpx;
  212. font-weight: bold;
  213. margin-left: 20rpx;
  214. text-align: left;
  215. "
  216. >
  217. {{
  218. tableData[item.monitorcode] != undefined &&
  219. tableData[item.monitorcode] != null
  220. ? tableData[item.monitorcode]
  221. : "-"
  222. }}
  223. </view>
  224. <view
  225. class="demo-layout bg-purple-light"
  226. style="
  227. margin-top: 20rpx;
  228. color: #677799;
  229. margin-left: 20rpx;
  230. text-align: left;
  231. "
  232. >
  233. {{ item.des }}
  234. </view>
  235. </view>
  236. <!-- <div class="right-content"></div> -->
  237. </view>
  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="TabCurCSS">
  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="TabCurCSS">
  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="TabCurCSS">
  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="TabCurCSS">
  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: #fff;
  1013. margin-bottom: 20rpx;
  1014. }
  1015. .deviceback {
  1016. background: linear-gradient(
  1017. to right,
  1018. rgba(75, 135, 254, 0.08),
  1019. rgba(24, 184, 255, 0.08),
  1020. rgba(80, 161, 237, 0.08)
  1021. );
  1022. }
  1023. .additional-div {
  1024. grid-column: span 2; /* 让附加内容跨越三列 */
  1025. display: flex;
  1026. align-items: center;
  1027. }
  1028. .checkbox-group {
  1029. margin-left: 10px; /* 可以根据需要调整间距 */
  1030. }
  1031. .card {
  1032. background-color: #ffffff;
  1033. margin: auto;
  1034. margin-top: 20rpx;
  1035. width: 90%;
  1036. height: 280rpx;
  1037. border: 1rpx solid #000000;
  1038. border-radius: 20rpx;
  1039. }
  1040. .flex-containe {
  1041. display: flex;
  1042. flex-direction: row;
  1043. flex-wrap: wrap;
  1044. }
  1045. .datacardtime {
  1046. display: flex;
  1047. width: 100%;
  1048. flex: 1;
  1049. margin: 1%;
  1050. float: left;
  1051. height: 50px;
  1052. line-height: 29px;
  1053. text-align: center;
  1054. background: linear-gradient(
  1055. to right,
  1056. rgba(55, 135, 254, 0.08),
  1057. rgba(4, 184, 255, 0.08),
  1058. rgba(60, 161, 237, 0.08)
  1059. );
  1060. }
  1061. .datacard {
  1062. border-radius: 10rpx;
  1063. border: rgba(55, 135, 254, 0.28);
  1064. width: 47%;
  1065. margin: 1%;
  1066. float: left;
  1067. height: 75px;
  1068. text-align: center;
  1069. background-image: url("/static/dataBg.png");
  1070. background-size: 40% 100%;
  1071. background-position: right;
  1072. background-repeat: no-repeat;
  1073. }
  1074. .datacard .TabCurCSS {
  1075. background: linear-gradient(
  1076. to right,
  1077. rgba(75, 135, 254, 0.08),
  1078. rgba(24, 184, 255, 0.08),
  1079. rgba(80, 161, 237, 0.08)
  1080. );
  1081. }
  1082. .left-content {
  1083. padding-top: 10rpx;
  1084. padding-bottom: 10rpx;
  1085. display: flex;
  1086. flex-direction: column;
  1087. height: 100%;
  1088. }
  1089. .spacer {
  1090. height: 10rpx;
  1091. }
  1092. .right-content {
  1093. width: 50%; /* 右侧内容占据50%宽度 */
  1094. background-image: url("/static/dataBg.png");
  1095. background-size: 100% 125%;
  1096. }
  1097. /*风窗样式*/
  1098. div.autowindow_new {
  1099. width: 200px;
  1100. height: 200px;
  1101. background-image: url(../../../../static/window/window-bk.png);
  1102. background-size: 100% 100%;
  1103. perspective: 800px;
  1104. }
  1105. /*风窗1 2 3 4*/
  1106. div.window_new_1 {
  1107. margin-top: 12px;
  1108. margin-left: 15px;
  1109. width: 170px;
  1110. height: 30px;
  1111. background-color: crimson;
  1112. box-sizing: border-box;
  1113. float: left;
  1114. z-index: 1;
  1115. /* transition: all 2s; */
  1116. background-image: url(../../../../static/window/window_new1.png);
  1117. background-size: 100% 100%;
  1118. }
  1119. div.window_new_2 {
  1120. margin-top: 2px;
  1121. margin-left: 15px;
  1122. width: 170px;
  1123. height: 29px;
  1124. background-color: crimson;
  1125. box-sizing: border-box;
  1126. float: left;
  1127. z-index: 1;
  1128. /* transition: all 2s; */
  1129. background-image: url(../../../../static/window/window_new1.png);
  1130. background-size: 100% 100%;
  1131. }
  1132. div.window_new_3 {
  1133. margin-top: 2px;
  1134. margin-left: 15px;
  1135. width: 170px;
  1136. height: 29px;
  1137. background-color: crimson;
  1138. box-sizing: border-box;
  1139. float: left;
  1140. z-index: 1;
  1141. /* transition: all 2s; */
  1142. background-image: url(../../../../static/window/window_new1.png);
  1143. background-size: 100% 100%;
  1144. }
  1145. div.window_new_4 {
  1146. margin-top: 2px;
  1147. margin-left: 15px;
  1148. width: 170px;
  1149. height: 29px;
  1150. background-color: crimson;
  1151. box-sizing: border-box;
  1152. float: left;
  1153. z-index: 1;
  1154. /* transition: all 2s; */
  1155. background-image: url(../../../../static/window/window_new1.png);
  1156. background-size: 100% 100%;
  1157. }
  1158. div.window_new_5 {
  1159. margin-top: 2px;
  1160. margin-left: 15px;
  1161. width: 170px;
  1162. height: 29px;
  1163. background-color: crimson;
  1164. box-sizing: border-box;
  1165. float: left;
  1166. z-index: 1;
  1167. /* transition: all 2s; */
  1168. background-image: url(../../../../static/window/window_new1.png);
  1169. background-size: 100% 100%;
  1170. }
  1171. div.window_new_1 {
  1172. transition: all 2s ease;
  1173. transform-origin: center center;
  1174. }
  1175. div.window_new_2 {
  1176. transition: all 2s ease;
  1177. transform-origin: center center;
  1178. }
  1179. div.window_new_3 {
  1180. transition: all 2s ease;
  1181. transform-origin: center center;
  1182. }
  1183. div.window_new_4 {
  1184. transition: all 2s ease;
  1185. transform-origin: center center;
  1186. }
  1187. div.window_new_5 {
  1188. transition: all 2s ease;
  1189. transform-origin: center center;
  1190. }
  1191. .btns {
  1192. display: flex;
  1193. }
  1194. .containers {
  1195. background-color: #fff;
  1196. }
  1197. .passWordName {
  1198. margin: 20px;
  1199. display: flex;
  1200. flex-direction: row;
  1201. justify-content: space-around;
  1202. }
  1203. .title {
  1204. margin-right: 20px;
  1205. line-height: 40px;
  1206. }
  1207. .passWordInput {
  1208. margin: 20px;
  1209. display: flex;
  1210. flex-direction: row;
  1211. justify-content: space-around;
  1212. }
  1213. .passArea {
  1214. border-color: red;
  1215. }
  1216. .monitor-content {
  1217. display: flex;
  1218. flex-direction: column;
  1219. }
  1220. </style>