autodoor.vue 41 KB

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