tongfeng_dongjin.vue 4.4 KB

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