tongfeng_xijin.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div>
  3. <!-- <topimg></topimg> -->
  4. <!-- <div v-if="show">
  5. <van-nav-bar title="西井通风系统" left-arrow @click-left="onClickLeft" />
  6. </div> -->
  7. <div class="top_title">
  8. <div class="topleft" @click="onClickLeft" ><</div>
  9. <div class="toptitle">西井通风系统</div>
  10. </div>
  11. <div class="img">
  12. <img src="../../../assets/images/tongfeng.png" alt="">
  13. <h1>西井通风系统</h1>
  14. <p>{{ nowTime }}</p>
  15. </div>
  16. <!-- <plcdata></plcdata> -->
  17. <div>
  18. <div class="content" v-for="item in data">
  19. <div class="top">
  20. <div class="left">{{ item.name }}</div>
  21. <div class="right" v-if="item.run!=0" style="background-color: #27ae60;">运行</div>
  22. <div class="right" v-else style="background-color: red;">停止</div>
  23. </div>
  24. <div class="data">
  25. <ul>
  26. <li v-for="list in item.list" v-if="list.tag_value!=0" v-show="show">
  27. <div class="title">{{ list.tag_name }}</div>
  28. <div class="num">
  29. {{
  30. list.tag_value.substring(0, list.tag_value.indexOf(".") + 3)
  31. }}
  32. </div>
  33. </li>
  34. </ul>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. // import topimg from "@/components/zdh/topimg.vue";
  42. export default {
  43. name: "tongfeng_xijin",
  44. // components: { topimg },
  45. data() {
  46. return {
  47. data: "",
  48. show:true,
  49. nowTime:''
  50. };
  51. },
  52. methods: {
  53. async getData() {
  54. const { data: res } = await this.$http.post(
  55. "http://nmjt.nxjiewei.com:8011/api/automate/mine_ventilate/get_list",
  56. { mine_id: "zaoquan", type: 2 }
  57. );
  58. console.log(res.content.data);
  59. this.data = res.content.data;
  60. },
  61. onClickLeft() {
  62. // console.log('sssssssss');
  63. // api.sendEvent({name:"closeWindow"});
  64. window.close()
  65. },
  66. getNowFormatDate() {
  67. var now = new Date();
  68. var year = now.getFullYear(); //获取年份
  69. var month = now.getMonth(); //获取月份
  70. var date = now.getDate(); //获取日期
  71. var day = now.getDay(); //获取星期
  72. var hour = now.getHours(); //获取小时
  73. var minute = now.getMinutes(); //获取分钟
  74. // if(minute.length<=1){
  75. // minute="0"+minute;
  76. // }
  77. // console.log(minute.length);
  78. var seconds =
  79. now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds(); //获取秒
  80. month = month + 1;
  81. var arr_week = new Array(
  82. "星期日",
  83. "星期一",
  84. "星期二",
  85. "星期三",
  86. "星期四",
  87. "星期五",
  88. "星期六"
  89. );
  90. var week = arr_week[day];
  91. var time =
  92. year +
  93. "年" +
  94. month +
  95. "月" +
  96. date +
  97. "日 " +
  98. week +
  99. " " +
  100. hour +
  101. ":" +
  102. minute +
  103. ":" +
  104. seconds;
  105. this.nowTime= time;
  106. },
  107. },
  108. mounted() {
  109. this.getData();
  110. this.infos = setInterval(this.getData, 5000);
  111. this.date=setInterval(this.getNowFormatDate, 1000);
  112. },
  113. beforeDestroy() {
  114. clearInterval(this.infos);
  115. clearInterval(this.date);
  116. },
  117. };
  118. </script>
  119. <style scoped>
  120. .van-nav-bar {
  121. background: #39f;
  122. }
  123. .van-nav-bar__title {
  124. color: #fff;
  125. }
  126. .van-nav-bar .van-icon {
  127. color: #fff;
  128. }
  129. .img{
  130. height: 180px;
  131. position: relative;
  132. }
  133. img{
  134. width: 100%;
  135. height: 100%;
  136. }
  137. h1{
  138. color: #FFFFFF;
  139. position: absolute;
  140. top: 5px;
  141. left: 50%;
  142. transform: translate(-50%);
  143. text-shadow: 5px 5px 4px #0E0E0E;
  144. font-size: 30px;
  145. margin: 0;
  146. }
  147. p{
  148. position: absolute;
  149. right: 5px;
  150. /* left: 10px; */
  151. color: #FFFFFF;
  152. bottom: 0px;
  153. margin: 0px;
  154. }
  155. .content {
  156. font-weight: 400;
  157. background-color: #ffffff;
  158. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.14);
  159. border-radius: 5px;
  160. margin: 5px;
  161. background-color: #2873ff;
  162. }
  163. .top {
  164. background-color: #ffffff;
  165. display: flex;
  166. justify-content: space-between;
  167. align-items: center;
  168. /* padding: 10px; */
  169. height: 33px;
  170. margin-left: 5px;
  171. border-bottom: 1px #f3f3f3 solid;
  172. padding: 10px;
  173. }
  174. /* span{
  175. background-color: #2873FF;
  176. width: 9px;
  177. height: 33px;
  178. } */
  179. .left {
  180. height: 33px;
  181. line-height: 33px;
  182. /* margin-left: 10px; */
  183. }
  184. .right {
  185. width: 63px;
  186. height: 20px;
  187. /* background-color: #27ae60; */
  188. border-radius: 2px;
  189. color: #ffffff;
  190. text-align: center;
  191. font-size: 14px;
  192. line-height: 14px;
  193. font-weight: 400;
  194. padding-top: 6px;
  195. }
  196. .data {
  197. background-color: #ffffff;
  198. padding: 0 10px;
  199. }
  200. /* ul{
  201. } */
  202. li {
  203. /* margin-right: 5%; */
  204. /* float: left; */
  205. height: 39px;
  206. /* line-height: 39px; */
  207. display: flex;
  208. justify-content: space-between;
  209. align-items: center;
  210. padding: 10px 0px;
  211. border-bottom: 1px #f3f3f3 solid;
  212. }
  213. li div {
  214. height: 17px;
  215. padding-bottom: 3px;
  216. }
  217. .num {
  218. padding-top: 3px;
  219. width: 80px;
  220. text-align: center;
  221. background-color: #2873ff;
  222. color: #fff;
  223. }
  224. .top_title{
  225. padding-top: 25px;
  226. background-color: #009fe8;
  227. display: flex;
  228. }
  229. .toptitle{
  230. width: 100%;
  231. height: 50px;
  232. line-height: 50px;
  233. text-align: center;
  234. color: #FFFFFF;
  235. font-weight: bolder;
  236. font-size: 20px;
  237. }
  238. .topleft{
  239. position: relative;
  240. left: 15px;
  241. color: #FFFFFF;
  242. line-height: 50px;
  243. font-size: 24px;
  244. }
  245. </style>