SoundStatistics.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="page_container">
  3. <base-title title="防爆扩音" />
  4. <div class="page_content">
  5. <div class="person_num_box">
  6. <div class="item" v-for="item of fbkyList" :key="item.id">
  7. <div class="left">
  8. <img src="~@/assets/imgs/maps/img_wqr.png" @click="openInfo(item)" />
  9. <span class="totle">{{ item.count }}</span>
  10. <span class="text">数量</span>
  11. </div>
  12. <div class="divider"></div>
  13. <div class="right">
  14. <div class="position">{{ item.name }}</div>
  15. <div class="rymain">
  16. <div class="tag">
  17. <el-tag
  18. class="select-tag"
  19. v-for="it in item.list"
  20. size="small"
  21. :key="it.id"
  22. :type="it.id"
  23. effect="dark"
  24. >
  25. {{ it.name }}
  26. </el-tag>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import BaseTitle from "./BaseTitle.vue";
  37. export default {
  38. name: "Weather",
  39. components: { BaseTitle },
  40. data() {
  41. return {
  42. fbkyList: [
  43. {
  44. id: "1",
  45. name: "都匀末站",
  46. count: 9,
  47. list: [
  48. { id: "1", name: "大门口" },
  49. { id: "2", name: "工艺区" },
  50. ],
  51. },
  52. {
  53. id: "2",
  54. name: "凯口清管站",
  55. count: 6,
  56. list: [
  57. { id: "1", name: "大门口" },
  58. { id: "2", name: "工艺区" },
  59. ],
  60. },
  61. {
  62. id: "3",
  63. name: "独山首站",
  64. count: 6,
  65. list: [
  66. { id: "1", name: "大门口" },
  67. { id: "2", name: "工艺区" },
  68. ],
  69. },
  70. ],
  71. };
  72. },
  73. mounted() {
  74. this.init();
  75. this.startMqtt();
  76. },
  77. methods: {
  78. init() {
  79. this.fbkyList[0].count = FBKYLIST.filter(
  80. (e) => e.buildId == "002001" && e.type == "扩音喇叭"
  81. ).length;
  82. this.fbkyList[1].count = FBKYLIST.filter(
  83. (e) => e.buildId == "002002" && e.type == "扩音喇叭"
  84. ).length;
  85. this.fbkyList[2].count = FBKYLIST.filter(
  86. (e) => e.buildId == "002003" && e.type == "扩音喇叭"
  87. ).length;
  88. this.fbkyList[0].list = FBKYLIST.filter(
  89. (e) => e.buildId == "002001" && e.type == "扩音喇叭"
  90. );
  91. this.fbkyList[1].list = FBKYLIST.filter(
  92. (e) => e.buildId == "002002" && e.type == "扩音喇叭"
  93. );
  94. this.fbkyList[2].list = FBKYLIST.filter(
  95. (e) => e.buildId == "002003" && e.type == "扩音喇叭"
  96. );
  97. console.log("防爆扩音系统设备统计", this.fbkyList);
  98. },
  99. openInfo(item) {},
  100. startMqtt() {
  101. const topics = [
  102. "DataCommunication/TagData/xxx",
  103. "DataCommunication/TagData/xxx",
  104. "DataCommunication/TagData/xxx",
  105. "DataCommunication/TagData/xxx",
  106. "DataCommunication/TagData/xxx",
  107. "DataCommunication/TagData/xxx",
  108. ];
  109. const _this = this;
  110. this.$store.dispatch("mqtt/subscribe", {
  111. topic: topics,
  112. onMessage: (topic, message, packet) => {
  113. const content = message.toString();
  114. const data = JSON.parse(content);
  115. if (topic.startsWith("DataCommunication/TagData/")) {
  116. const topicIndex = topics.indexOf(topic);
  117. if (topicIndex > -1) {
  118. _this.weatherList[topicIndex] = data.Value;
  119. _this.weatherList[topicIndex] = data.Unit;
  120. }
  121. }
  122. },
  123. });
  124. this.$once("hook:beforeDestroy", () => {
  125. this.$store.dispatch("mqtt/unsubscribe", topics);
  126. });
  127. },
  128. },
  129. };
  130. </script>
  131. <style lang="less" scoped>
  132. .page_container {
  133. width: 410px;
  134. z-index: 2;
  135. .page_content {
  136. width: 100%;
  137. height: 210px;
  138. .person_num_box {
  139. width: 100%;
  140. height: auto;
  141. overflow: hidden;
  142. .item {
  143. margin-top: 6px;
  144. margin-left: 6px;
  145. height: 48%;
  146. display: flex;
  147. position: relative;
  148. .left {
  149. width: 18%;
  150. height: 100%;
  151. text-align: center;
  152. margin-right: 8px;
  153. display: flex;
  154. flex-direction: column;
  155. justify-content: center;
  156. align-items: center;
  157. img {
  158. width: 80px;
  159. height: 80px;
  160. }
  161. .totle {
  162. margin-top: -72px;
  163. font-size: 20px;
  164. color: #ffffff;
  165. letter-spacing: 1.26px;
  166. text-shadow: 0 0 10px rgba(0, 180, 255, 0.5);
  167. font-weight: 700;
  168. }
  169. .text {
  170. margin-top: -4px;
  171. font-size: 14px;
  172. color: #ffffff;
  173. letter-spacing: 0;
  174. text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  175. font-weight: 400;
  176. }
  177. }
  178. .divider {
  179. width: 1%;
  180. }
  181. .right {
  182. width: 80%;
  183. height: 70px;
  184. position: relative;
  185. .position {
  186. font-family: 优设标题黑;
  187. font-size: 16px;
  188. color: #ffffff;
  189. letter-spacing: 1.29px;
  190. position: absolute;
  191. z-index: 99;
  192. background-image: linear-gradient(180deg, #eeeeee, #5cd5ff);
  193. -webkit-background-clip: text;
  194. background-clip: text;
  195. color: transparent;
  196. font-weight: 400;
  197. padding-left: 10px;
  198. margin-top: -7px;
  199. }
  200. .rymain {
  201. max-height: 110px;
  202. width: 100%;
  203. height: calc(100% - 14px);
  204. position: absolute;
  205. bottom: 0;
  206. opacity: 0.9;
  207. background-image: linear-gradient(
  208. 270deg,
  209. rgba(0, 24, 46, 0.1) 0%,
  210. #00487b 98%
  211. );
  212. font-size: 12px;
  213. overflow: auto;
  214. color: #b3c0d4;
  215. .tag {
  216. .select-tag {
  217. margin: 2px;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. }
  224. }
  225. }
  226. </style>