autodoor.vue 35 KB

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