beltTunDustHome.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <a-spin tip="Loading..." :spinning="loading">
  3. <div class="monitor-container">
  4. <div class="lr left-box vent-margin-t-10">
  5. <div class="fire-analysis1">
  6. <div class="analysis-item warning3">
  7. <div class="title">粉尘风险预警</div>
  8. <div class="value">高风险</div>
  9. </div>
  10. </div>
  11. <div class="base-info">
  12. <div class="base-item">
  13. <div class="title">喷雾总数</div>
  14. <div class="value len">20个</div>
  15. </div>
  16. <div class="base-item">
  17. <div class="title">当日粉尘最大值</div>
  18. <div class="value">3.2mg/m³</div>
  19. </div>
  20. </div>
  21. <ventBox1 class="vent-margin-t-20">
  22. <template #title>
  23. <div>粉尘监测与分析<a class="a-detail">(详情)</a></div>
  24. </template>
  25. <template #container>
  26. <div class="">
  27. <div class="vent-flex-row vent-margin-l-5">
  28. <div class="vent-flex-row">
  29. <SvgIcon class="icon vent-margin-r-5" size="13" name="alarm-temperature" />
  30. <span>是否报警:</span>
  31. </div>
  32. <div class="vent-flex-row vent-margin-l-10">
  33. <div class="vent-breathe-yc vent-margin-r-8"></div>
  34. <div>正常</div>
  35. </div>
  36. </div>
  37. <div class="warning-state-detail">
  38. 报警产生于 <span class="state-color">2013-05-24 15:52:42</span> 时刻 <span class="state-color">皮带巷转载点粉尘监测1</span>
  39. </div>
  40. </div>
  41. </template>
  42. </ventBox1>
  43. <div class="item-box vent-margin-t-10">
  44. <LivePlayer id="fm-player1" style="height: 220px" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  45. </div>
  46. </div>
  47. <div class="lr right-box">
  48. <ventBox1 class="vent-margin-t-10">
  49. <template #title>
  50. <div>通风参数监测</div>
  51. </template>
  52. <template #container>
  53. <div class="input-item vent-flex-row">
  54. <div>设备控制:</div>
  55. <div class="vent-flex-row btn-box">
  56. <div class="btn btn1">一键启动</div>
  57. <div class="btn btn2">一键停止</div>
  58. </div>
  59. </div>
  60. <a-table
  61. :columns="dustColumns"
  62. :data-source="dustDataSource"
  63. :pagination="false"
  64. size="small"
  65. maxWidth="340"
  66. :scroll="{ x: 'max-content', y: 200 }"
  67. >
  68. <template #bodyCell="{ column, record }">
  69. <template v-if="column.dataIndex === 'warnFlag'">
  70. <span v-if="record['warnFlag'] == 0" style="color: #00ff00">链接</span>
  71. <span v-else style="color: #ff0000"> {{ record.warnDes }}</span>
  72. </template>
  73. <template v-if="column.dataIndex === 'action'">
  74. <a-switch v-model:checked="openDust" @change="handleDust(record)" />
  75. </template>
  76. </template>
  77. </a-table>
  78. </template>
  79. </ventBox1>
  80. </div>
  81. </div>
  82. </a-spin>
  83. </template>
  84. <script setup lang="ts">
  85. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps } from 'vue';
  86. import { list } from '../beltTun.api';
  87. import ventBox1 from '/@/components/vent/ventBox1.vue';
  88. import { SvgIcon } from '/@/components/Icon';
  89. import { dustColumns, dustMonitorColumns } from '../beltTun.data';
  90. import LivePlayer from '@liveqing/liveplayer-v3';
  91. const props = defineProps({
  92. deviceId: {
  93. type: String,
  94. require: true,
  95. },
  96. });
  97. const player1 = ref(null);
  98. const loading = ref(false);
  99. const flvURL1 = () => {
  100. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  101. };
  102. // 默认初始是第一行
  103. const openDust = ref(false);
  104. const beltTunSource = ref({});
  105. const beltTunHistorySource = ref([]);
  106. const dustDataSource = ref([]);
  107. // 监测数据
  108. const selectData = reactive({});
  109. function handleDust(record) {
  110. //
  111. }
  112. // https获取监测数据
  113. let timer: null | NodeJS.Timeout = null;
  114. function getMonitor(flag?) {
  115. if (Object.prototype.toString.call(timer) === '[object Null]') {
  116. timer = setTimeout(
  117. async () => {
  118. if (props.deviceId) {
  119. const data = await getDataSource(props.deviceId);
  120. Object.assign(selectData, data);
  121. }
  122. if (timer) {
  123. timer = null;
  124. }
  125. await getMonitor();
  126. loading.value = false;
  127. },
  128. flag ? 0 : 1000
  129. );
  130. }
  131. }
  132. async function getDataSource(systemID) {
  133. const res = await list({ devicetype: 'sys', systemID, type: 'dustS' });
  134. const result = res.deviceInfo;
  135. for (const key in result) {
  136. const item = result[key];
  137. // ''.startsWith
  138. if (item.type.startsWith('dust')) {
  139. // 风门
  140. dustDataSource.value = item['datalist'].filter((data: any) => {
  141. const readData = data.readData;
  142. return Object.assign(data, readData);
  143. });
  144. }
  145. }
  146. loading.value = false;
  147. beltTunHistorySource.value = res['sysInfo']['history'];
  148. beltTunSource.value = Object.assign(res['sysInfo'], res['sysInfo']['readData']);
  149. }
  150. function toDetail() {}
  151. function changeType(e: Event, item) {
  152. item.value = e.target?.value;
  153. }
  154. onBeforeMount(() => {});
  155. onMounted(async () => {
  156. loading.value = true;
  157. timer = null;
  158. await getMonitor(true);
  159. });
  160. onUnmounted(() => {
  161. if (timer) {
  162. clearTimeout(timer);
  163. timer = undefined;
  164. }
  165. });
  166. </script>
  167. <style lang="less" scoped>
  168. @import '/@/design/vent/modal.less';
  169. @import '../../comment/less/workFace.less';
  170. @ventSpace: zxm;
  171. .base-info {
  172. display: flex;
  173. justify-content: space-between;
  174. color: #fff;
  175. padding: 0 5px;
  176. margin-top: 20px;
  177. .base-item {
  178. width: calc(50% - 8px);
  179. display: flex;
  180. flex-direction: column;
  181. align-items: center;
  182. font-size: 17px;
  183. border: 1px solid;
  184. border-image: linear-gradient(45deg, #00e5ff92, #006fa684, #00e5ff22, #006fa614) 1;
  185. .title {
  186. width: 100%;
  187. background: #00e5ff52;
  188. background: linear-gradient(45deg, #006ea652, #00f2ff42);
  189. text-align: center;
  190. line-height: 45px;
  191. }
  192. .value {
  193. width: 100%;
  194. background: #006ea622;
  195. text-align: center;
  196. line-height: 45px;
  197. font-family: 'douyuFont';
  198. color: #1bf5fd;
  199. padding-top: 5px;
  200. }
  201. }
  202. }
  203. .dust-fan-monitor {
  204. display: flex;
  205. flex-wrap: wrap;
  206. }
  207. .dust-max {
  208. flex: 1;
  209. display: flex;
  210. align-items: center;
  211. background-image: linear-gradient(to right, #00f2ff42, #006ea600);
  212. border-left: 4px solid #5df7ff88;
  213. margin-top: 10px;
  214. margin-left: 8px;
  215. .icon-style {
  216. background: #25536f;
  217. padding-left: 6px;
  218. margin-right: 10px;
  219. padding-right: 6px;
  220. }
  221. .value {
  222. font-family: 'douyuFont';
  223. font-weight: 600;
  224. font-size: 14px;
  225. color: #28dce4;
  226. margin-right: 10px;
  227. margin-left: 30px;
  228. }
  229. .max-data {
  230. width: calc(100% - 85px);
  231. display: flex;
  232. margin-left: 5px;
  233. margin-right: 30px;
  234. .title {
  235. font-size: 16px;
  236. }
  237. }
  238. }
  239. .dust-fan-monitor-item {
  240. width: 152px;
  241. height: 70px;
  242. display: flex;
  243. flex-direction: column;
  244. justify-content: center;
  245. align-items: center;
  246. border: 1px solid rgba(25, 251, 255, 0.4);
  247. box-shadow: inset 0 0 20px rgba(0, 197, 255, 0.4);
  248. background: rgba(0, 0, 0, 0.06666667);
  249. margin-bottom: 5px;
  250. padding: 8px 0;
  251. &:nth-child(2n) {
  252. margin-left: 12px;
  253. }
  254. .title {
  255. color: #5dfaff;
  256. }
  257. .unit {
  258. font-size: 13px;
  259. color: #ffffffaa;
  260. }
  261. .value {
  262. color: #ffb212;
  263. }
  264. }
  265. .fault {
  266. .title {
  267. color: #c4fdff;
  268. }
  269. .value {
  270. // color: #FFB212;
  271. color: #61ddb1;
  272. }
  273. }
  274. </style>