autodoor.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145
  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 showColum[TabCur + '_monitor_left']"
  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 showColum[TabCur + '_monitor_left']"
  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 showColum[TabCur + '_monitor_right']"
  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 showColum[TabCur + '_monitor_right']"
  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. isFirstRequest: true, // 是否是第一次请求
  675. fanMsStatus: true,
  676. qidongfengji: "1",
  677. fanMsStatus: true, //true抽风,false反风
  678. door1: 0, //风门1# 1打开 0 关闭
  679. topdoor1: 0, //水平风门1# 1打开 0 关闭
  680. fundoor1: 0, //蝶阀1# 1打开 0 关闭
  681. door2: 0, //风门2# 1打开 0 关闭
  682. topdoor2: 0, //水平风门2# 1打开 0 关闭
  683. fundoor2: 0, //蝶阀2# 1打开 0 关闭
  684. };
  685. },
  686. onLoad(query) {
  687. //保存id到 data 中 可以在整个页面中使用
  688. this.itemId = query.id;
  689. this.name = query.name;
  690. this.TabCur = query.type;
  691. this.ndoorcount = 2;
  692. },
  693. components: {
  694. doorAnimate,
  695. windowAnimate,
  696. windrectAnimate,
  697. fanlocalAnimate,
  698. fanmainAnimate,
  699. },
  700. created() {
  701. this.getShowColum();
  702. if (this.isFirstRequest) {
  703. this.getDeviceInfo(this.itemId);
  704. }
  705. },
  706. mounted() {
  707. this.startTimer();
  708. },
  709. methods: {
  710. startTimer() {
  711. this.timer = setInterval(() => {
  712. // 执行定时任务
  713. this.getDeviceInfo(this.itemId);
  714. }, 5000);
  715. },
  716. stopTimer() {
  717. // 停止定时器
  718. clearInterval(this.timer);
  719. },
  720. // 返回上一个页面
  721. backPage() {
  722. this.$destroy();
  723. uni.navigateBack({
  724. delta: 1,
  725. });
  726. },
  727. getShowColum() {
  728. new Promise((resolve, reject) => {
  729. api
  730. .getShowColum({})
  731. .then((response) => {
  732. if (response.data.code == 200) {
  733. var showlist = response.data.result;
  734. this.$store.commit("SET_SHOWCOLUM", showlist);
  735. this.showColum = showlist;
  736. const key = this.TabCur + "_monitor";
  737. const key1 = this.deviceType + "_monitor";
  738. if (this.showColum?.[key1]?.length > 0) {
  739. this.deviceShowList = this.showColum[key1];
  740. } else {
  741. this.deviceShowList = this.showColum[key] ?? [];
  742. }
  743. // this.deviceShowList = this.showColum[key];
  744. } else {
  745. resolve(response);
  746. }
  747. })
  748. .catch((error) => {
  749. console.log("catch===>response", response);
  750. reject(error);
  751. });
  752. });
  753. },
  754. //获取详情数据
  755. getDeviceInfo(ID) {
  756. let IDString = String(ID); // 将 ID 转换为字符串
  757. new Promise((resolve, reject) => {
  758. api
  759. .getDeviceMonitor({ devicetype: this.TabCur, ids: IDString })
  760. .then((response) => {
  761. if (
  762. response.data.code == 200 &&
  763. response.data.result.msgTxt[0].datalist.length > 0
  764. ) {
  765. var result = response.data.result.msgTxt[0].datalist[0];
  766. let newData = { ...result, ...result.readData };
  767. this.tableData = newData;
  768. if (this.isFirstRequest) {
  769. this.cameras = result.cameras;
  770. this.getVideoUrlById(this.cameras);
  771. this.isFirstRequest = false; // 设置为 false,表示已经请求过数据
  772. }
  773. if (this.tableData["frontGateClose"] == "1") {
  774. this.tableData.frontGateOpen = "关闭";
  775. } else if (this.tableData["frontGateClose"] == "0") {
  776. this.tableData.frontGateOpen = "打开";
  777. } else {
  778. this.tableData.frontGateOpen = "关闭";
  779. }
  780. if (this.tableData["midGateClose"] == "1") {
  781. this.tableData.midGateOpen = "关闭";
  782. } else if (this.tableData["midGateClose"] == "0") {
  783. this.tableData.midGateOpen = "打开";
  784. } else {
  785. this.tableData.midGateOpen = "关闭";
  786. }
  787. if (this.tableData["rearGateClose"] == "1") {
  788. this.tableData.rearGateOpen = "关闭";
  789. } else if (this.tableData["rearGateClose"] == "0") {
  790. this.tableData.rearGateOpen = "打开";
  791. } else {
  792. this.tableData.rearGateOpen = "关闭";
  793. }
  794. this.fan1State = result.readData.Fan1StartStatus;
  795. this.fan2State = result.readData.Fan2StartStatus;
  796. this.nwindownum = result.nwindownum;
  797. this.ndoorcount = result.ndoorcount;
  798. this.deviceType = result.deviceType;
  799. this.state = result.readData.sign;
  800. this.frontGateStatus = this.tableData.frontGateOpen;
  801. this.midGateStatus = this.tableData.midGateOpen;
  802. this.rearGateStatus = this.tableData.rearGateOpen;
  803. this.doorNetStatus = result.netStatus;
  804. this.warnFlag = result.warnLevel_str;
  805. this.readTime = result.readTime;
  806. this.qidongfengji = "1";
  807. this.fundoor1 = 1;
  808. this.door1 = 1;
  809. this.topdoor1 = 1;
  810. this.fundoor2 = 0;
  811. this.door2 = 0;
  812. this.topdoor2 = 0;
  813. var maxarea = result.maxarea;
  814. this.windowAngle =
  815. (this.tableData.forntArea / maxarea) * 100 * 0.9;
  816. this.windowAngle1 =
  817. (this.tableData.rearArea / maxarea) * 100 * 0.9;
  818. this.deviceid = result.deviceID;
  819. this.$forceUpdate();
  820. } else {
  821. resolve(response);
  822. }
  823. })
  824. .catch((error) => {
  825. reject(error);
  826. });
  827. });
  828. },
  829. //获取监控URL 通过ID获取
  830. getVideoUrlById(data) {
  831. this.cameraList = []; // 清空摄像头列表
  832. data.forEach((item) => {
  833. const isHttp =
  834. item.addr?.startsWith("http://") || item.addr?.startsWith("https://");
  835. if (isHttp) {
  836. this.cameraList.push(item);
  837. } else {
  838. this.getVideoUrlByCode(item.addr);
  839. }
  840. });
  841. },
  842. getVideoUrlByCode(ID) {
  843. new Promise((resolve, reject) => {
  844. api
  845. .getCameraByCode({ cameraCode: ID, videoType: "" })
  846. .then((response) => {
  847. if (response.data.code == 200) {
  848. const addr = response.data.result.url;
  849. this.cameraList.push({
  850. addr: addr,
  851. cameraCode: ID,
  852. });
  853. } else {
  854. resolve(response);
  855. }
  856. })
  857. .catch((error) => {
  858. reject(error);
  859. });
  860. });
  861. },
  862. //设备控制
  863. ctrlDevice(pass) {
  864. let IDString = String(this.itemId); // 将 ID 转换为字符串
  865. const params = {
  866. deviceid: IDString,
  867. devicetype: this.deviceType,
  868. paramcode: this.paramcode,
  869. password: pass,
  870. value: this.windowArea,
  871. };
  872. new Promise((resolve, reject) => {
  873. api
  874. .controlDevice(params)
  875. .then((response) => {
  876. if (response.data.code == 200) {
  877. this.getDeviceInfo(IDString);
  878. // console.log("操作成功");
  879. } else {
  880. resolve(response);
  881. }
  882. })
  883. .catch((error) => {
  884. reject(error);
  885. });
  886. });
  887. },
  888. // 显示密码输入弹窗
  889. showPasswordDialog(controlCode) {
  890. this.paramcode = controlCode;
  891. this.show = true;
  892. },
  893. // 取消密码输入
  894. cancelPassword() {
  895. this.show = false;
  896. },
  897. confirmPassword() {
  898. this.ctrlDevice(this.password);
  899. // 发起请求后关闭密码输入弹窗
  900. this.show = false;
  901. },
  902. },
  903. destroyed() {
  904. // 停止定时器
  905. this.stopTimer();
  906. },
  907. };
  908. </script>
  909. <style lang="scss" scoped>
  910. .top-nav {
  911. background-image: url(../../../../static/topnavbar.png);
  912. background-size: cover; /* 背景图片大小适应 */
  913. height: 100%;
  914. }
  915. .top-nav2 {
  916. background-color: #ffffff;
  917. }
  918. .main {
  919. margin-top: 80px;
  920. }
  921. .container {
  922. display: flex;
  923. flex-direction: column;
  924. }
  925. .button-grid {
  926. display: grid;
  927. grid-template-columns: repeat(4, 1fr);
  928. gap: 5px; /* 可以根据需要调整行列之间的间距 */
  929. }
  930. .fanContent {
  931. display: flex;
  932. flex-direction: column;
  933. margin-top: 10rpx;
  934. margin-bottom: 10rpx;
  935. }
  936. .top,
  937. .bottom {
  938. flex: 1; /* 各占 50% */
  939. }
  940. .flcard {
  941. padding: 20rpx;
  942. background-color: #ffffff;
  943. margin-bottom: 5rpx;
  944. }
  945. .additional-div {
  946. grid-column: span 2; /* 让附加内容跨越三列 */
  947. display: flex;
  948. align-items: center;
  949. }
  950. .checkbox-group {
  951. margin-left: 10px; /* 可以根据需要调整间距 */
  952. }
  953. .card {
  954. background-color: #ffffff;
  955. margin: auto;
  956. margin-top: 20rpx;
  957. width: 90%;
  958. height: 280rpx;
  959. border: 1rpx solid #000000;
  960. border-radius: 20rpx;
  961. }
  962. .flex-containe {
  963. display: flex;
  964. flex-direction: row;
  965. flex-wrap: wrap;
  966. }
  967. .itemback {
  968. flex: 0 0 calc(33.33% - 10px); /* 使用calc函数计算每个项目的宽度,减去间距 */
  969. margin: 5px; /* 间距设置为5px */
  970. }
  971. .datacardtime {
  972. display: flex;
  973. width: 100%;
  974. flex: 1;
  975. margin: 1%;
  976. float: left;
  977. height: 50px;
  978. line-height: 29px;
  979. text-align: center;
  980. background: linear-gradient(
  981. to right,
  982. rgba(55, 135, 254, 0.08),
  983. rgba(4, 184, 255, 0.08),
  984. rgba(60, 161, 237, 0.08)
  985. );
  986. }
  987. .datacard {
  988. display: flex;
  989. width: 48%;
  990. flex: 1;
  991. margin: 1%;
  992. float: left;
  993. height: 180rpx;
  994. text-align: center;
  995. background: linear-gradient(
  996. to right,
  997. rgba(55, 135, 254, 0.08),
  998. rgba(4, 184, 255, 0.08),
  999. rgba(60, 161, 237, 0.08)
  1000. );
  1001. }
  1002. .left-content {
  1003. width: 100%;
  1004. display: flex;
  1005. flex-direction: column;
  1006. }
  1007. .spacer {
  1008. height: 10rpx;
  1009. }
  1010. .right-content {
  1011. width: 50%; /* 右侧内容占据50%宽度 */
  1012. background-image: url(../../../../static/model/Pa.png);
  1013. background-size: 100% 125%;
  1014. }
  1015. /*风窗样式*/
  1016. div.autowindow_new {
  1017. width: 200px;
  1018. height: 200px;
  1019. background-image: url(../../../../static/window/window-bk.png);
  1020. background-size: 100% 100%;
  1021. perspective: 800px;
  1022. }
  1023. /*风窗1 2 3 4*/
  1024. div.window_new_1 {
  1025. margin-top: 12px;
  1026. margin-left: 15px;
  1027. width: 170px;
  1028. height: 30px;
  1029. background-color: crimson;
  1030. box-sizing: border-box;
  1031. float: left;
  1032. z-index: 1;
  1033. /* transition: all 2s; */
  1034. background-image: url(../../../../static/window/window_new1.png);
  1035. background-size: 100% 100%;
  1036. }
  1037. div.window_new_2 {
  1038. margin-top: 2px;
  1039. margin-left: 15px;
  1040. width: 170px;
  1041. height: 29px;
  1042. background-color: crimson;
  1043. box-sizing: border-box;
  1044. float: left;
  1045. z-index: 1;
  1046. /* transition: all 2s; */
  1047. background-image: url(../../../../static/window/window_new1.png);
  1048. background-size: 100% 100%;
  1049. }
  1050. div.window_new_3 {
  1051. margin-top: 2px;
  1052. margin-left: 15px;
  1053. width: 170px;
  1054. height: 29px;
  1055. background-color: crimson;
  1056. box-sizing: border-box;
  1057. float: left;
  1058. z-index: 1;
  1059. /* transition: all 2s; */
  1060. background-image: url(../../../../static/window/window_new1.png);
  1061. background-size: 100% 100%;
  1062. }
  1063. div.window_new_4 {
  1064. margin-top: 2px;
  1065. margin-left: 15px;
  1066. width: 170px;
  1067. height: 29px;
  1068. background-color: crimson;
  1069. box-sizing: border-box;
  1070. float: left;
  1071. z-index: 1;
  1072. /* transition: all 2s; */
  1073. background-image: url(../../../../static/window/window_new1.png);
  1074. background-size: 100% 100%;
  1075. }
  1076. div.window_new_5 {
  1077. margin-top: 2px;
  1078. margin-left: 15px;
  1079. width: 170px;
  1080. height: 29px;
  1081. background-color: crimson;
  1082. box-sizing: border-box;
  1083. float: left;
  1084. z-index: 1;
  1085. /* transition: all 2s; */
  1086. background-image: url(../../../../static/window/window_new1.png);
  1087. background-size: 100% 100%;
  1088. }
  1089. div.window_new_1 {
  1090. transition: all 2s ease;
  1091. transform-origin: center center;
  1092. }
  1093. div.window_new_2 {
  1094. transition: all 2s ease;
  1095. transform-origin: center center;
  1096. }
  1097. div.window_new_3 {
  1098. transition: all 2s ease;
  1099. transform-origin: center center;
  1100. }
  1101. div.window_new_4 {
  1102. transition: all 2s ease;
  1103. transform-origin: center center;
  1104. }
  1105. div.window_new_5 {
  1106. transition: all 2s ease;
  1107. transform-origin: center center;
  1108. }
  1109. .btns {
  1110. display: flex;
  1111. }
  1112. .containers {
  1113. background-color: #fff;
  1114. }
  1115. .passWordName {
  1116. margin: 20px;
  1117. display: flex;
  1118. flex-direction: row;
  1119. justify-content: space-around;
  1120. }
  1121. .title {
  1122. margin-right: 20px;
  1123. line-height: 40px;
  1124. }
  1125. .passWordInput {
  1126. margin: 20px;
  1127. display: flex;
  1128. flex-direction: row;
  1129. justify-content: space-around;
  1130. }
  1131. .passArea {
  1132. border-color: red;
  1133. }
  1134. .monitor-content {
  1135. display: flex;
  1136. flex-direction: column;
  1137. }
  1138. </style>