autodoor.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar :title="name" @leftClick="backPage" :bgImage="backPic">
  5. <view class="u-nav-slot" slot="left">
  6. <u-icon name="arrow-left" size="20"> </u-icon>
  7. </view>
  8. </u-navbar>
  9. <view class="main">
  10. <view class="u-page container">
  11. <div class="button-grid flcard" v-if="this.TabCur == 'gate'">
  12. <u-button type="primary" shape="circle" text="打开前门"></u-button>
  13. <u-button type="primary" shape="circle" text="关闭前门"></u-button>
  14. <u-button type="primary" shape="circle" text="打开后门"></u-button>
  15. <u-button type="primary" shape="circle" text="关闭后门"></u-button>
  16. <u-button type="primary" shape="circle" text="打开前后门"></u-button>
  17. <u-button type="primary" shape="circle" text="关闭前后门"></u-button>
  18. <!-- <div class="additional-div">
  19. <span>控制模式:</span>
  20. <u-checkbox-group
  21. v-model="checked"
  22. iconPlacement="left"
  23. placement="row"
  24. >
  25. <u-checkbox
  26. type="primary"
  27. shape="circle"
  28. label="就地"
  29. style="margin-right: 20rpx"
  30. ></u-checkbox>
  31. <u-checkbox
  32. type="primary"
  33. shape="circle"
  34. label="远程"
  35. ></u-checkbox>
  36. </u-checkbox-group>
  37. </div> -->
  38. </div>
  39. <div class="button-grid flcard" v-if="this.TabCur == 'window'">
  40. <u-button type="primary" shape="circle" text="设定面积"></u-button>
  41. </div>
  42. <div class="flcard door-container" v-if="this.TabCur == 'gate'">
  43. <div class="door">
  44. <div class="left_door" id="leftdoor"></div>
  45. <div class="right_door" id="rightdoor"></div>
  46. <div
  47. style="
  48. position: absolute;
  49. top: 30%;
  50. left: 25%;
  51. transform: translate(-50%);
  52. z-index: 5;
  53. font-weight: 900px;
  54. color: #00ff00;
  55. "
  56. >
  57. <span style="font-size: 30px">前门</span>
  58. </div>
  59. </div>
  60. <div class="door">
  61. <div class="left_door" id="leftdoor1"></div>
  62. <div class="right_door" id="rightdoor2"></div>
  63. <div
  64. style="
  65. position: absolute;
  66. top: 30%;
  67. right: 13%;
  68. transform: translate(-50%);
  69. z-index: 5;
  70. font-weight: 900px;
  71. color: #00ff00;
  72. "
  73. >
  74. <span style="font-size: 30px">后门</span>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="flcard door-container" v-if="this.TabCur == 'window'">
  79. <div class="autowindow_new">
  80. <div
  81. class="window_new_1"
  82. id="subwindowpic11"
  83. :style="`transform: rotateX(${frontAngle}deg)`"
  84. ></div>
  85. <div
  86. class="window_new_2"
  87. id="subwindowpic12"
  88. :style="`transform: rotateX(${frontAngle}deg)`"
  89. ></div>
  90. <div
  91. class="window_new_3"
  92. id="subwindowpic13"
  93. :style="`transform: rotateX(${frontAngle}deg)`"
  94. ></div>
  95. <div
  96. class="window_new_4"
  97. id="subwindowpic14"
  98. :style="`transform: rotateX(${frontAngle}deg)`"
  99. ></div>
  100. <div
  101. class="window_new_5"
  102. id="subwindowpic15"
  103. :style="`transform: rotateX(${frontAngle}deg)`"
  104. ></div>
  105. </div>
  106. <div
  107. style="
  108. position: absolute;
  109. top: 34%;
  110. left: 25%;
  111. transform: translate(-50%);
  112. z-index: 5;
  113. color: #6a7a9b;
  114. "
  115. >
  116. <span style="font-size: 15px; font-weight: 50px">风窗动画</span>
  117. </div>
  118. </div>
  119. <div class="flcard">
  120. <div class="flex-container">
  121. <div
  122. class="itemback"
  123. v-for="(item, index) in typeList"
  124. :key="index"
  125. v-show="item.appShow == 1"
  126. >
  127. <div class="datacardtime" v-if="item.monitorcode == 'readTime'">
  128. <view
  129. class="demo-layout bg-purple-light"
  130. style="margin-top: 10rpx; color: #3787fe"
  131. >
  132. {{ tableData[item.monitorcode] }}
  133. </view>
  134. </div>
  135. <div class="datacard" v-if="item.monitorcode !== 'readTime'">
  136. <div class="left-content">
  137. <view
  138. class="demo-layout bg-purple-light"
  139. style="margin-top: 10rpx; color: #3787fe"
  140. >
  141. {{ tableData[item.monitorcode] }}
  142. </view>
  143. <div class="spacer"></div>
  144. <!-- 间距 -->
  145. <view
  146. class="demo-layout bg-purple-light"
  147. style="color: #677799"
  148. >
  149. {{ item.des }}
  150. </view>
  151. </div>
  152. <div
  153. class="right-content"
  154. :style="{
  155. backgroundImage:
  156. item.monitorcode === 'frontRearDP' ||
  157. item.monitorcode === 'frontRearDifference'
  158. ? 'url(\'../../../../static/model/Pa.png\')'
  159. : item.monitorcode === 'sourcePressure'
  160. ? 'url(\'../../../../static/model/MPa.png\')'
  161. : item.monitorcode === 'frontGateOpen'
  162. ? 'url(\'../../../../static/model/doorNet.png\')'
  163. : item.monitorcode === 'rearGateOpen'
  164. ? 'url(\'../../../../static/model/doorNet.png\')'
  165. : item.monitorcode === 'warnFlag'
  166. ? 'url(\'../../../../static/model/9432.png\')'
  167. : item.monitorcode === 'netStatus'
  168. ? 'url(\'../../../../static/model/9431.png\')'
  169. : item.monitorcode === 'm3'
  170. ? 'url(\'../../../../static/model/windM3.png\')'
  171. : item.monitorcode === 'fsectarea'
  172. ? 'url(\'../../../../static/model/duanArea.png\')'
  173. :item.monitorcode === 'incipientWindSpeed1' || item.monitorcode === 'incipientWindSpeed2' || item.monitorcode === 'incipientWindSpeed3'|| item.monitorcode === 'va'
  174. ? 'url(\'../../../../static/model/fengsu.png\')'
  175. : 'url(\'\')',
  176. backgroundSize: '100% 100%',
  177. }"
  178. ></div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </view>
  184. </view>
  185. </view>
  186. </template>
  187. <script>
  188. import api from "@/api/api";
  189. export default {
  190. data() {
  191. return {
  192. tableData: [], //监测数据
  193. typeList: [], //展示字段
  194. itemId: "", // 初始化 itemId
  195. name: "", // 初始化 name
  196. TabCur: "",
  197. checked: [],
  198. backPic: "url(../../../../static/topnavbar.png)",
  199. frontAngle: "", //风窗打开角度
  200. };
  201. },
  202. onLoad(query) {
  203. // query 中包含传递过来的id
  204. const id = query.id;
  205. const name = query.name;
  206. const type = query.type;
  207. //保存id到 data 中 可以在整个页面中使用
  208. this.itemId = id;
  209. this.name = name;
  210. this.TabCur = type;
  211. this.getShowList();
  212. },
  213. components: {},
  214. watch: {},
  215. created() {
  216. this.getDeviceInfo(this.itemId);
  217. },
  218. methods: {
  219. getShowList() {
  220. const params = {
  221. devicekind: this.TabCur,
  222. pagetype: "detail",
  223. pageNo: 1,
  224. pageSize: 100,
  225. };
  226. new Promise((resolve, reject) => {
  227. api
  228. .getShowColumList(params)
  229. .then((response) => {
  230. if (response.data.code == 200) {
  231. this.typeList = response.data.result.records;
  232. console.log(this.typeList, "返回内容");
  233. } else {
  234. resolve(response);
  235. }
  236. })
  237. .catch((error) => {
  238. console.log("catch===>response", response);
  239. reject(error);
  240. });
  241. });
  242. },
  243. getDeviceInfo(ID) {
  244. let IDString = String(ID); // 将 ID 转换为字符串
  245. new Promise((resolve, reject) => {
  246. api
  247. .getDeviceMonitor({ devicetype: this.TabCur, ids: IDString })
  248. .then((response) => {
  249. if (response.data.code == 200) {
  250. this.tableData =
  251. response.data.result.msgTxt[0].datalist[0].readData;
  252. if (this.tableData.frontGateOpen == 1) {
  253. this.tableData.frontGateOpen = "打开";
  254. } else {
  255. this.tableData.frontGateOpen = "关闭";
  256. }
  257. if (this.tableData.rearGateOpen == 1) {
  258. rearGateOpen = "打开";
  259. } else {
  260. this.tableData.rearGateOpen = "关闭";
  261. }
  262. this.tableData.push(
  263. response.data.result.msgTxt[0].datalist[0].readTime
  264. );
  265. } else {
  266. resolve(response);
  267. }
  268. })
  269. .catch((error) => {
  270. console.log("catch===>response", response);
  271. reject(error);
  272. });
  273. });
  274. },
  275. backPage() {
  276. uni.navigateBack({
  277. delta: 1,
  278. });
  279. },
  280. },
  281. };
  282. </script>
  283. <style>
  284. .top-nav {
  285. background-image: url(../../../../static/topnavbar.png);
  286. background-size: cover; /* 背景图片大小适应 */
  287. height: 100%;
  288. }
  289. .top-nav2 {
  290. background-color: #ffffff;
  291. }
  292. .main {
  293. margin-top: 100rpx;
  294. }
  295. .container {
  296. display: flex;
  297. flex-direction: column;
  298. height: 90vh; /* 设置容器高度为视窗高度 */
  299. }
  300. .button-grid {
  301. display: grid;
  302. grid-template-columns: repeat(4, 1fr);
  303. gap: 5px; /* 可以根据需要调整行列之间的间距 */
  304. }
  305. .flcard {
  306. padding: 20rpx;
  307. background-color: #ffffff;
  308. margin-bottom: 5rpx;
  309. }
  310. .door-container {
  311. display: flex;
  312. }
  313. .door {
  314. background-image: url(../../../../static/door.png);
  315. background-size: 100% 100%;
  316. display: inline-block;
  317. vertical-align: top;
  318. height: 24vh;
  319. flex: 1;
  320. margin-right: 10px; /* 可以根据需要调整间距 */
  321. }
  322. .left_door {
  323. margin-left: 8%;
  324. margin-top: 15%;
  325. width: 42%;
  326. height: calc(19.5vh + 3px);
  327. box-sizing: border-box;
  328. float: left;
  329. z-index: 1;
  330. transition: all 4s ease;
  331. background-image: url(../../../../static/left.png);
  332. background-size: 100% 100%;
  333. }
  334. .right_door {
  335. margin-top: 15%;
  336. width: 42%;
  337. height: calc(19.5vh + 3px);
  338. box-sizing: border-box;
  339. float: left;
  340. z-index: 1;
  341. transition: all 4s ease;
  342. background-image: url(../../../../static/right.png);
  343. background-size: 100% 100%;
  344. }
  345. .left_door {
  346. transform-origin: left center;
  347. border-right: 1px solid rgb(8, 8, 8);
  348. }
  349. .right_door {
  350. transform-origin: right center;
  351. border-left: 1px solid rgb(8, 8, 8);
  352. }
  353. .additional-div {
  354. grid-column: span 2; /* 让附加内容跨越三列 */
  355. display: flex;
  356. align-items: center;
  357. }
  358. .checkbox-group {
  359. margin-left: 10px; /* 可以根据需要调整间距 */
  360. }
  361. .card {
  362. background-color: #ffffff;
  363. margin: auto;
  364. margin-top: 20rpx;
  365. width: 90%;
  366. height: 280rpx;
  367. border: 1rpx solid #000000;
  368. border-radius: 20rpx;
  369. }
  370. .flex-containe {
  371. display: flex;
  372. flex-direction: row;
  373. flex-wrap: wrap;
  374. }
  375. .itemback {
  376. flex: 0 0 calc(33.33% - 10px); /* 使用calc函数计算每个项目的宽度,减去间距 */
  377. margin: 5px; /* 间距设置为5px */
  378. }
  379. .datacardtime {
  380. display: flex;
  381. width: 100%;
  382. flex: 1;
  383. margin: 1%;
  384. float: left;
  385. height: 50rpx;
  386. text-align: center;
  387. background: linear-gradient(
  388. to right,
  389. rgba(55, 135, 254, 0.08),
  390. rgba(4, 184, 255, 0.08),
  391. rgba(60, 161, 237, 0.08)
  392. );
  393. }
  394. .datacard {
  395. display: flex;
  396. width: 48%;
  397. flex: 1;
  398. margin: 1%;
  399. float: left;
  400. height: 100rpx;
  401. text-align: center;
  402. background: linear-gradient(
  403. to right,
  404. rgba(55, 135, 254, 0.08),
  405. rgba(4, 184, 255, 0.08),
  406. rgba(60, 161, 237, 0.08)
  407. );
  408. }
  409. .left-content {
  410. width: 50%;
  411. display: flex;
  412. flex-direction: column;
  413. }
  414. .spacer {
  415. height: 10rpx;
  416. }
  417. .right-content {
  418. width: 50%; /* 右侧内容占据50%宽度 */
  419. background-image: url(../../../../static/model/Pa.png);
  420. background-size: 100% 125%;
  421. }
  422. /*风窗样式*/
  423. div.autowindow_new {
  424. width: 200px;
  425. height: 200px;
  426. background-image: url(../../../../static/window/window-bk.png);
  427. background-size: 100% 100%;
  428. perspective: 800px;
  429. }
  430. /*风窗1 2 3 4*/
  431. div.window_new_1 {
  432. margin-top: 12px;
  433. margin-left: 15px;
  434. width: 170px;
  435. height: 30px;
  436. background-color: crimson;
  437. box-sizing: border-box;
  438. float: left;
  439. z-index: 1;
  440. /* transition: all 2s; */
  441. background-image: url(../../../../static/window/window_new1.png);
  442. background-size: 100% 100%;
  443. }
  444. div.window_new_2 {
  445. margin-top: 2px;
  446. margin-left: 15px;
  447. width: 170px;
  448. height: 29px;
  449. background-color: crimson;
  450. box-sizing: border-box;
  451. float: left;
  452. z-index: 1;
  453. /* transition: all 2s; */
  454. background-image: url(../../../../static/window/window_new1.png);
  455. background-size: 100% 100%;
  456. }
  457. div.window_new_3 {
  458. margin-top: 2px;
  459. margin-left: 15px;
  460. width: 170px;
  461. height: 29px;
  462. background-color: crimson;
  463. box-sizing: border-box;
  464. float: left;
  465. z-index: 1;
  466. /* transition: all 2s; */
  467. background-image: url(../../../../static/window/window_new1.png);
  468. background-size: 100% 100%;
  469. }
  470. div.window_new_4 {
  471. margin-top: 2px;
  472. margin-left: 15px;
  473. width: 170px;
  474. height: 29px;
  475. background-color: crimson;
  476. box-sizing: border-box;
  477. float: left;
  478. z-index: 1;
  479. /* transition: all 2s; */
  480. background-image: url(../../../../static/window/window_new1.png);
  481. background-size: 100% 100%;
  482. }
  483. div.window_new_5 {
  484. margin-top: 2px;
  485. margin-left: 15px;
  486. width: 170px;
  487. height: 29px;
  488. background-color: crimson;
  489. box-sizing: border-box;
  490. float: left;
  491. z-index: 1;
  492. /* transition: all 2s; */
  493. background-image: url(../../../../static/window/window_new1.png);
  494. background-size: 100% 100%;
  495. }
  496. div.window_new_1 {
  497. transition: all 2s ease;
  498. transform-origin: center center;
  499. }
  500. div.window_new_2 {
  501. transition: all 2s ease;
  502. transform-origin: center center;
  503. }
  504. div.window_new_3 {
  505. transition: all 2s ease;
  506. transform-origin: center center;
  507. }
  508. div.window_new_4 {
  509. transition: all 2s ease;
  510. transform-origin: center center;
  511. }
  512. div.window_new_5 {
  513. transition: all 2s ease;
  514. transform-origin: center center;
  515. }
  516. </style>