autodoor.vue 39 KB

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