firstmodel.vue.bak 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view class="container">
  3. <!-- 建议放在外层 -->
  4. <u-navbar
  5. title="设备监测"
  6. @leftClick="devicemenuShow"
  7. :safeAreaInsetTop="false"
  8. >
  9. <view class="u-nav-slot" slot="left">
  10. <u-icon name="list" size="20"> </u-icon>
  11. </view>
  12. </u-navbar>
  13. <view v-show="menushow" class="menupage">
  14. <DeviceMenu @menuClick="menuClick"></DeviceMenu>
  15. </view>
  16. <view v-show="!menushow" class="main">
  17. <view class="u-page">
  18. <u-list>
  19. <u-list-item
  20. class="itemback"
  21. v-for="(item, index) in curlist"
  22. :key="index"
  23. >
  24. <div @tap="openNewPage(item)">
  25. <u-row gutter="5" customStyle="margin-bottom: 10px">
  26. <u-col span="24">
  27. <img style="position: absolute;width: 35rpx;height:35ropx;" class="icon" :src="getIcon(TabCur)" alt="Icon" />
  28. <span class="title">{{item.strinstallpos}}</span>
  29. </u-col>
  30. </u-row>
  31. <u-row gutter="5" customStyle="margin-bottom: 10px">
  32. <u-col span="3" style="margin-right: 5rpx">
  33. <div v-if="item.netStatus == 0" class="error-tag1">
  34. <img
  35. src="'../../../../static/model/connectFalse.svg "
  36. alt=""
  37. class="icon-style"
  38. />
  39. <span style="float: right">断开</span>
  40. </div>
  41. <div v-else class="success-tag">
  42. <img
  43. src="'../../../../static/model/connectTrue.svg "
  44. alt=""
  45. class="icon-style"
  46. />
  47. <span style="float: right">连接</span>
  48. </div>
  49. </u-col>
  50. <u-col span="4">
  51. <div v-if="item.warnFlag == 0" class="success-tag">
  52. <img
  53. src="'../../../../static/model/alarmTrue.svg "
  54. alt=""
  55. class="icon-style"
  56. />
  57. <span style="float: right">{{ item.warnLevel_str }}</span>
  58. </div>
  59. <div v-else class="error-tag">
  60. <img
  61. src="'../../../../static/model/alarmFalse.svg "
  62. alt=""
  63. class="icon-style"
  64. />
  65. <span style="float: right">{{ item.warnDes }}</span>
  66. </div>
  67. </u-col>
  68. <u-col span="5">
  69. <u--text class="timetext" :text="item.readTime"></u--text>
  70. </u-col>
  71. </u-row>
  72. <view v-if="colums[TabCur + '_monitor'] != null">
  73. <view
  74. class="datacard"
  75. v-for="(showitem, index) in colums[TabCur + '_monitor']"
  76. <<<<<<< Updated upstream
  77. :key="index"
  78. v-show="showitem.appShow == 1"
  79. >
  80. <view
  81. class="content"
  82. :style="{
  83. backgroundImage:
  84. showitem.monitorcode === 'frontRearDP' ||
  85. showitem.monitorcode === 'frontRearDifference'
  86. ? 'url(\'../../../../static/model/Pa.png\')'
  87. : showitem.monitorcode === 'sourcePressure'
  88. ? 'url(\'../../../../static/model/MPa.png\')'
  89. : showitem.monitorcode === 'frontGateOpen'
  90. ? 'url(\'../../../../static/model/doorNet.png\')'
  91. : showitem.monitorcode === 'rearGateOpen'
  92. ? 'url(\'../../../../static/model/doorNet.png\')'
  93. : showitem.monitorcode === 'warnFlag'
  94. ? 'url(\'../../../../static/model/9432.png\')'
  95. : showitem.monitorcode === 'netStatus'
  96. ? 'url(\'../../../../static/model/9431.png\')'
  97. : showitem.monitorcode === 'm3'
  98. ? 'url(\'../../../../static/model/windM3.png\')'
  99. : showitem.monitorcode === 'fsectarea'
  100. ? 'url(\'../../../../static/model/duanArea.png\')'
  101. : showitem.monitorcode === 'incipientWindSpeed1' ||
  102. showitem.monitorcode === 'incipientWindSpeed2' ||
  103. showitem.monitorcode === 'incipientWindSpeed3' ||
  104. showitem.monitorcode === 'va'
  105. ? 'url(\'../../../../static/model/fengsu.png\')'
  106. : 'url(\'\')',
  107. backgroundSize: '100% 100%',
  108. }"
  109. >
  110. <view
  111. v-show="
  112. =======
  113. v-show="showitem.appShow == 1 &&
  114. >>>>>>> Stashed changes
  115. showitem.monitorcode != 'strinstallpos' &&
  116. showitem.monitorcode != 'netStatus' &&
  117. showitem.monitorcode != 'warnFlag' &&
  118. showitem.monitorcode != 'readTime' &&
  119. <<<<<<< Updated upstream
  120. showitem.monitorcode != ''
  121. "
  122. >
  123. <view
  124. v-if="
  125. showitem.datatype == 1 &&
  126. item.readData[showitem.monitorcode] !== undefined &&
  127. item.readData[showitem.monitorcode] !== null
  128. "
  129. =======
  130. showitem.monitorcode != '' &&
  131. showitem.monitorcode != null"
  132. >
  133. <view :class="TabCur">
  134. <view style="padding-top:10rpx;padding-bottom: 10rpx;">
  135. <view v-if="showitem.datatype == 1 && showitem.monitorcode == 'doorUse'"
  136. >>>>>>> Stashed changes
  137. class="demo-layout bg-purple-light"
  138. style="margin-top: 10rpx; color: #3787fe;font-size: 30rpx;margin-top: 5rpx;"
  139. >
  140. {{ item[showitem.monitorcode] == '2'?'行人':item[showitem.monitorcode] == '1'?'行车':'-' }}
  141. </view>
  142. <view v-else-if="showitem.datatype == 1"
  143. class="demo-layout bg-purple-light"
  144. style="margin-top: 10rpx; color: #3787fe;font-size: 30rpx;margin-top: 5rpx;"
  145. >
  146. {{ item[showitem.monitorcode] == null || item[showitem.monitorcode] == ''?'-':item[showitem.monitorcode]}}
  147. </view>
  148. <view
  149. v-else-if="
  150. showitem.datatype == 2 &&
  151. item.readData[showitem.monitorcode] !== undefined &&
  152. item.readData[showitem.monitorcode] !== null
  153. "
  154. class="demo-layout bg-purple-light"
  155. style="color: #3787fe;font-size: 30rpx;margin-top: 5rpx;"
  156. >{{ item.readData[showitem.monitorcode]==null || item.readData[showitem.monitorcode] == ''?'-':item.readData[showitem.monitorcode] }}</view
  157. >
  158. <view
  159. v-else
  160. class="demo-layout bg-purple-light"
  161. style="color: #3787fe"
  162. >--</view
  163. >
  164. <view
  165. class="demo-layout bg-purple-light"
  166. style="margin-top: 6rpx; color: #677799;margin-bottom: 5rpx;"
  167. >{{ showitem.des }}</view
  168. >
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. </div>
  174. </u-list-item>
  175. </u-list>
  176. </view>
  177. </view>
  178. </view>
  179. </template>
  180. <script>
  181. import DeviceMenu from "./devicemenu/devicemenu.vue";
  182. import api from "@/api/api";
  183. export default {
  184. data() {
  185. return {
  186. menushow: false,
  187. TabCur: "gate",
  188. curlist: [],
  189. deviceList: {},
  190. scrollLeft: 0,
  191. currentTab: 0,
  192. colums: {},
  193. };
  194. },
  195. components: {
  196. DeviceMenu,
  197. },
  198. props: ["showColum"],
  199. watch: {
  200. showColum(data) {
  201. this.colums = data;
  202. console.log(this.colums);
  203. },
  204. },
  205. created() {
  206. this.colums = this.showColum;
  207. },
  208. mounted() {
  209. this.startTimer();
  210. },
  211. methods: {
  212. startTimer() {
  213. // 每隔一段时间执行某个操作
  214. this.timer = setInterval(() => {
  215. // 执行定时任务
  216. this.loadData(this.TabCur);
  217. console.log("定时任务执行中...");
  218. }, 5000);
  219. },
  220. stopTimer() {
  221. // 停止定时器
  222. clearInterval(this.timer);
  223. },
  224. getIcon(itemValue) {
  225. // 根据itemValue获取对应的图标路径,如果找不到对应关系则返回默认图标
  226. return '/static/sidebar/'+itemValue+".svg";
  227. },
  228. getValueIcon(itemValue) {
  229. // 根据itemValue获取对应的图标路径,如果找不到对应关系则返回默认图标
  230. return '/static/sidebar/'+itemValue+".svg";
  231. },
  232. loadData(type) {
  233. new Promise((resolve, reject) => {
  234. api
  235. .getDeviceMonitor({
  236. devicetype: type,
  237. pagetype: "normal",
  238. filterParams: {},
  239. })
  240. .then((response) => {
  241. if (response.data.code == 200) {
  242. this.deviceList[type] = response.data.result.msgTxt[0].datalist;
  243. this.curlist = this.deviceList[type];
  244. this.curlist.forEach((item) => {
  245. if (item.readData.frontGateOpen == 1) {
  246. item.readData.frontGateOpen = "打开";
  247. } else {
  248. item.readData.frontGateOpen = "关闭";
  249. }
  250. if (item.readData.midGateOpen == 1) {
  251. item.readData.midGateOpen = "打开";
  252. } else {
  253. item.readData.midGateOpen = "关闭";
  254. }
  255. if (item.readData.rearGateOpen == 1) {
  256. item.readData.rearGateOpen = "打开";
  257. } else {
  258. item.readData.rearGateOpen = "关闭";
  259. }
  260. if (item.readData.midGateOpen == 1) {
  261. item.readData.midGateOpen = "打开";
  262. } else {
  263. item.readData.midGateOpen = "关闭";
  264. }
  265. });
  266. } else {
  267. resolve(response);
  268. }
  269. })
  270. .catch((error) => {
  271. console.log("catch===>response", response);
  272. reject(error);
  273. });
  274. });
  275. },
  276. tabSelect(e) {
  277. this.currentTab = e.currentTarget.dataset.id;
  278. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  279. },
  280. devicemenuShow(e) {
  281. this.menushow = true;
  282. },
  283. menuClick(id) {
  284. this.TabCur = id;
  285. // 显示该分类的数据
  286. this.curlist = this.deviceList[this.TabCur];
  287. if (this.curlist == null) {
  288. this.curlist = [];
  289. }
  290. // 选择设备分类,重新获取数据
  291. this.loadData(this.TabCur);
  292. this.menushow = false;
  293. },
  294. openNewPage(params) {
  295. this.$destroy();
  296. uni.navigateTo({
  297. url: `/pages/home/detail/autodoor/autodoor?id=${params.deviceID}&name=${params.strinstallpos}&type=${this.TabCur}`,
  298. });
  299. },
  300. },
  301. destroyed() {
  302. // 停止定时器
  303. this.stopTimer();
  304. },
  305. };
  306. </script>
  307. <style>
  308. .top-nav {
  309. height: 100rpx;
  310. line-height: 100rpx;
  311. background-color: #2aa9f3;
  312. color: #daaaa;
  313. }
  314. .top-nav2 {
  315. background-color: #ffffff;
  316. }
  317. .main {
  318. margin-top: 100rpx;
  319. display: flex;
  320. flex-direction: column;
  321. }
  322. .card {
  323. background-color: #ffffff;
  324. margin: auto;
  325. margin-top: 20rpx;
  326. width: 10%;
  327. height: 280rpx;
  328. border: 1rpx solid #000000;
  329. border-radius: 20rpx;
  330. }
  331. .menupage {
  332. position: absolute;
  333. z-index: 2;
  334. top: 40rpx;
  335. height: calc(100% - 40rpx);
  336. width: 100%;
  337. }
  338. .timetext {
  339. text-align: right;
  340. float: right;
  341. }
  342. .itemback {
  343. padding: 20rpx;
  344. background-color: #ffffff;
  345. margin-bottom: 5rpx;
  346. }
  347. .datacard .content{
  348. width: 30rpx;
  349. height: 30rpx;
  350. left: 0rpx;
  351. top:0rpx;
  352. position: absolute;
  353. }
  354. .datacard {
  355. border-radius: 10rpx;
  356. border: rgba(55, 135, 254, 0.28);
  357. width: 30%;
  358. margin: 1%;
  359. float: left;
  360. height: 105rpx;
  361. text-align: center;
  362. background: linear-gradient(
  363. to right,
  364. rgba(55, 135, 254, 0.08),
  365. rgba(4, 184, 255, 0.08),
  366. rgba(60, 161, 237, 0.08)
  367. );
  368. }
  369. .datacard .gate{
  370. background: linear-gradient(
  371. to right,
  372. rgba(75, 135, 254, 0.08),
  373. rgba(24, 184, 255, 0.08),
  374. rgba(80, 161, 237, 0.08)
  375. );
  376. }
  377. .datacard .window{
  378. background: linear-gradient(
  379. to right,
  380. rgba(55, 125, 254, 0.08),
  381. rgba(4, 164, 255, 0.08),
  382. rgba(60, 131, 237, 0.08)
  383. );
  384. }
  385. .datacard .windrect{
  386. background: linear-gradient(
  387. to right,
  388. rgba(85, 125, 254, 0.08),
  389. rgba(34, 164, 255, 0.08),
  390. rgba(90, 131, 237, 0.08)
  391. );
  392. }
  393. .error-tag {
  394. border-radius: 10%;
  395. display: inline-block;
  396. color: #e90000;
  397. line-height: 50rpx;
  398. font-size: 14px;
  399. text-align: center;
  400. float: left;
  401. width: 180rpx;
  402. height: 50rpx;
  403. padding-right:30rpx;
  404. background-color: rgba(233, 0, 0, 0.2);
  405. }
  406. .error-tag1 {
  407. border-radius: 10%;
  408. display: inline-block;
  409. color: #696969;
  410. line-height: 50rpx;
  411. font-size: 14px;
  412. text-align: center;
  413. margin-top: 10rpx;
  414. float: left;
  415. width: 120rpx;
  416. height: 50rpx;
  417. background-color: rgba(105, 105, 105, 0.2);
  418. }
  419. .success-tag {
  420. border-radius: 10%;
  421. color: #42c000;
  422. line-height: 50rpx;
  423. font-size: 14px;
  424. width: 120rpx;
  425. height: 50rpx;
  426. padding-right:30rpx;
  427. background-color: rgba(226, 250, 214);
  428. }
  429. .icon-style {
  430. margin: 15rpx;
  431. width: 14px;
  432. height: 14px;
  433. }
  434. .title{
  435. margin-left: 40rpx;
  436. float: left;
  437. font-size: 32rpx;
  438. font-weight: 400;
  439. }
  440. </style>