index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <template>
  2. <div class="workPlaceWarn">
  3. <div class="workPlace-left-box">
  4. <basicTree :treeData="treeData" @selectChange="selectChange"></basicTree>
  5. </div>
  6. <div class="workPlace-right-box">
  7. <div style="width:100%;height:100%"
  8. v-if="workBtnList.length != 0 || echartDataGx.xData.length != 0 || echartDataGx.yData.length != 0 || echartDataGx.yData1.length != 0 || card3List.length != 0 || echartData.xData.length != 0 || echartData.yData.length != 0 || echartData.yData1.length != 0">
  9. <!-- 光钎 -->
  10. <div class="top-box-card" v-if="flagShow == 'gx' || flagShow == 'all'">
  11. <basicCard :cardContentList="cardContentList" />
  12. </div>
  13. <div class="top-box-btn" v-if="flagShow == 'gx' || flagShow == 'all'">
  14. <basicWorkBtn :workBtnList="workBtnList" @btnToggle="btnToggle" />
  15. </div>
  16. <div class="center-box" v-if="flagShow == 'gx' || flagShow == 'all'">
  17. <basicEchartLine :gridV="gridV" :echartData="echartDataGx" />
  18. </div>
  19. <!-- 束管 -->
  20. <div class="composite-top-box" v-if="flagShow == 'sg' || flagShow == 'all'">
  21. <basicCard3 :card3List="card3List" :warningLevel="warningLevel" @toggleChange="toggleChange"></basicCard3>
  22. </div>
  23. <div class="composite-bot-box" v-if="flagShow == 'sg' || flagShow == 'all'">
  24. <div class="search-area">
  25. <div class="area-title">束管系统监测</div>
  26. <RangePicker v-model="TimeRange" size="small" style="width: 260px" :show-time="{ format: 'HH:mm:ss' }"
  27. format="YYYY-MM-DD HH:mm:ss" :placeholder="['开始时间', '结束时间']" @change="onDataChange" />
  28. </div>
  29. <div class="content-area">
  30. <basicEchartLine :gridV="gridV" :echartData="echartData"></basicEchartLine>
  31. </div>
  32. </div>
  33. <!-- 通用 -->
  34. <div :class="flagShow == 'sg' ? 'bot-box1' : 'bot-box'">
  35. <div class="bot-box-card" v-for="(item, index) in botCardList" :key="index">
  36. <basicSensor :sensorTitle="item.title" :sensorList="item.sensorList" :headList="headList" />
  37. </div>
  38. </div>
  39. </div>
  40. <div style="display: flex;align-items: center;justify-content: center;width:100%;height:100%;" v-else>
  41. <img style="width:252px; height:172px" src="../../../../assets/images/nodata.png" alt="">
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script lang="ts" setup>
  47. import { ref, reactive, onMounted } from 'vue';
  48. import { getAssetURL } from '../../../../utils/ui';
  49. import basicCard from '../../common/basicCard.vue';
  50. import basicWorkBtn from '../../common/basicWorkBtn.vue';
  51. import basicEchartLine from '../../common/basicEchartLine.vue';
  52. import basicSensor from '../../common/basicSensor.vue';
  53. import basicTree from '../../common/basicTree.vue'
  54. import { getFireAreaInfo, getInfosByAreaCode, getGxcwHistoryDataByPointCode, getYwRealData, getHyRealData, getPlzzRealData, getSgjcPointInfo, getSgjcRealDataByPointCode, getSgjcHistoryData } from './workeFace.api'
  55. import dayjs from 'dayjs';
  56. import { RangePicker, Select } from 'ant-design-vue';
  57. import basicCard3 from '../../common/basicCard3.vue';
  58. let areaCode = ref('')
  59. let warningLevel = ref('')
  60. let flagShow = ref('')
  61. let gxSelect = ref('')
  62. let pointCode = ref('')
  63. let gasType = ref('')
  64. let card3List = reactive<any[]>([])
  65. let TimeRange = ref<any>([dayjs().subtract(60, 'minute').format('YYYY-MM-DD HH:mm:ss'), dayjs().format('YYYY-MM-DD HH:mm:ss')]) //查询时间
  66. let cardContentList = reactive([
  67. { id: 0, imgSrc: getAssetURL('workPlaceWarn/temp.png'), label: '最高温度(℃)', val: '' },
  68. { id: 1, imgSrc: getAssetURL('workPlaceWarn/jd-zdwd.png'), label: '最低温度(℃)', val: '' },
  69. {
  70. id: 2,
  71. imgSrc: getAssetURL('workPlaceWarn/jd-pjwd.png'),
  72. label: '平均温度',
  73. val: '',
  74. },
  75. { id: 3, imgSrc: getAssetURL('workPlaceWarn/dsnd.png'), label: '最高CO浓度(ppm)', val: '' },
  76. ]);
  77. let workBtnList = reactive<any[]>([]);
  78. let botCardList = reactive([
  79. {
  80. title: '烟雾传感器', sensorList: []
  81. },
  82. {
  83. title: '火焰传感器', sensorList: []
  84. },
  85. {
  86. title: '自动喷淋灭火装置', sensorList: []
  87. },
  88. ]);
  89. let headList = reactive([
  90. { id: 0, title: '名称' },
  91. { id: 1, title: '状态' },
  92. { id: 3, title: '时间' },
  93. ]);
  94. //数据随便写的,不符合实际情况,因为懒得改
  95. const treeData = reactive<any[]>([])
  96. let gridV = reactive({
  97. top: '15%',
  98. left: '3%',
  99. right: '3%',
  100. bottom: '10%',
  101. })
  102. let echartData = reactive({
  103. xData: [],
  104. yData: [],
  105. yData1: [],
  106. legendName: ['实时值', '预测值']
  107. })
  108. let echartDataGx = reactive(
  109. {
  110. xData: [],
  111. yData: [],
  112. yData1: [],
  113. legendName: ['最高温度', '最低温度']
  114. }
  115. )
  116. // https获取监测数据
  117. let timer: null | NodeJS.Timeout = null;
  118. function getMonitor() {
  119. timer = setTimeout(
  120. async () => {
  121. //工作面
  122. await getFireAreaInfos()
  123. if (timer) {
  124. timer = null;
  125. }
  126. getMonitor();
  127. },
  128. 5000
  129. );
  130. }
  131. //时间选项切换
  132. function onDataChange(value, dateString) {
  133. TimeRange.value = [dateString[0], dateString[1]]
  134. console.log(TimeRange, 'TimeRange')
  135. }
  136. //获取左侧菜单树
  137. async function getFireAreaInfos() {
  138. const res = await getFireAreaInfo({})
  139. if (res.length != 0) {
  140. treeData.length = 0
  141. res.forEach((el, ind) => {
  142. if (el.areaType == 4) {
  143. treeData.push({ name: el.areaName, value: el.ind, id: el.ind, pid: null, areaCode: el.areaCode, gxcwCnt: el.gxcwCnt, sgjcCnt: el.sgjcCnt, infoTypeTwo: el.infoTypeTwo })
  144. }
  145. })
  146. areaCode.value = areaCode.value ? areaCode.value : treeData[0]['areaCode']
  147. warningLevel.value = treeData[0].warningLevel == 1 ? '低风险' : treeData[0].warningLevel == 2 ? '中风险' : treeData[0].warningLevel == 3 ? '较高风险' : treeData[0].warningLevel == 4 ? '重大风险' : '--'
  148. console.log(treeData, 'treeData-------')
  149. cardContentList[0]['val'] = treeData[0].infoTypeTwo.maxTemperature
  150. cardContentList[1]['val'] = treeData[0].infoTypeTwo.minTemperature
  151. cardContentList[2]['val'] = treeData[0].infoTypeTwo.aveTemperature
  152. cardContentList[3]['val'] = treeData[0].infoTypeTwo.returnAirCornerCO
  153. //获取烟雾传感器数据
  154. getYwRealDataList()
  155. //获取火焰传感器监测数据
  156. getHyRealDataList()
  157. //获取自动喷淋灭火装置数据
  158. getPlzzRealDataList()
  159. if (treeData[0]['gxcwCnt'] > 0 && treeData[0]['sgjcCnt'] > 0) {
  160. flagShow.value = 'all'
  161. //获取工作面光钎条数及测点编号
  162. getInfosByAreaCodeList()
  163. // //获取工作面束管测点编号列表
  164. getSgjcPointInfoList()
  165. } else if (treeData[0]['gxcwCnt'] > 0) {
  166. flagShow.value = 'gx'
  167. //获取光钎条数及测点编号
  168. getInfosByAreaCodeList()
  169. } else if (treeData[0]['sgjcCnt'] > 0) {
  170. flagShow.value = 'sg'
  171. //获取工作面束管测点编号列表
  172. getSgjcPointInfoList()
  173. }
  174. }
  175. }
  176. //点击左侧树节点
  177. function selectChange(treeNode) {
  178. console.log(treeNode, 'treeNode---')
  179. areaCode.value = treeData.filter((v) => v.name == treeNode.node.dataRef.title)[0]['areaCode']
  180. let level = treeData.filter((m) => m.name == treeNode.node.dataRef.title)[0]['warningLevel']
  181. warningLevel.value = level == 1 ? '低风险' : level == 2 ? '中风险' : level == 3 ? '较高风险' : level == 4 ? '重大风险' : '--'
  182. let data = treeData.filter((a) => a.name == treeNode.node.dataRef.title)[0]
  183. cardContentList[0]['val'] = data.infoTypeTwo.maxTemperature
  184. cardContentList[1]['val'] = data.infoTypeTwo.minTemperature
  185. cardContentList[2]['val'] = data.infoTypeTwo.aveTemperature
  186. cardContentList[3]['val'] = data.infoTypeTwo.returnAirCornerCO
  187. //获取烟雾传感器数据
  188. getYwRealDataList()
  189. //获取火焰传感器监测数据
  190. getHyRealDataList()
  191. //获取自动喷淋灭火装置数据
  192. getPlzzRealDataList()
  193. let gxcwCnt = treeData.filter((g) => g.name == treeNode.node.dataRef.title)[0]['gxcwCnt']
  194. let sgjcCnt = treeData.filter((s) => s.name == treeNode.node.dataRef.title)[0]['sgjcCnt']
  195. if (gxcwCnt > 0 && sgjcCnt > 0) {
  196. flagShow.value = 'all'
  197. //获取工作面光钎条数及测点编号
  198. getInfosByAreaCodeList()
  199. //获取工作面束管测点编号列表
  200. getSgjcPointInfoList()
  201. } else if (gxcwCnt > 0) {
  202. flagShow.value = 'gx'
  203. //获取工作面光钎条数及测点编号
  204. getInfosByAreaCodeList()
  205. } else if (sgjcCnt > 0) {
  206. flagShow.value = 'sg'
  207. //获取工作面束管测点编号列表
  208. getSgjcPointInfoList()
  209. }
  210. }
  211. //获取光钎条数及测点编号
  212. async function getInfosByAreaCodeList() {
  213. let res = await getInfosByAreaCode({ areaCode: areaCode.value })
  214. console.log(res, '光钎条数及测点编号')
  215. if (res.length != 0) {
  216. workBtnList.length = 0
  217. res.forEach(el => {
  218. workBtnList.push({
  219. label: el.pointName,
  220. value: el.pointCode,
  221. })
  222. })
  223. gxSelect.value = gxSelect.value ? gxSelect.value : res[0]['pointCode']
  224. //获取光钎测温图表数据
  225. getGxcwHistoryDataByPointCodeList()
  226. }
  227. }
  228. //光钎选项切换
  229. function btnToggle(item) {
  230. console.log(item, 'item----=====')
  231. gxSelect.value = item.value
  232. getGxcwHistoryDataByPointCodeList()
  233. }
  234. //获取光钎测温图表数据
  235. async function getGxcwHistoryDataByPointCodeList() {
  236. let res = await getGxcwHistoryDataByPointCode({ pointCode: gxSelect.value })
  237. console.log(res, '光钎测温图表数据')
  238. echartDataGx.xData.length = 0
  239. echartDataGx.yData.length = 0
  240. echartDataGx.yData1.length = 0
  241. res.time.forEach(el => {
  242. echartDataGx.xData.push(el)
  243. })
  244. res.maxValue.forEach(el => {
  245. echartDataGx.yData.push(el)
  246. })
  247. res.minValue.forEach(el => {
  248. echartDataGx.yData1.push(el)
  249. })
  250. }
  251. //获取烟雾传感器监测数据
  252. async function getYwRealDataList() {
  253. let res = await getYwRealData({ areaCode: areaCode.value })
  254. console.log(res, '烟雾传感器监测数据')
  255. if (res.length != 0) {
  256. botCardList[0].sensorList.length = 0
  257. res.forEach(el => {
  258. el.isOpen = el.isOpen == '0' ? '无烟' : '有烟'
  259. botCardList[0].sensorList.push({ name: el.pointName, status: el.isOpen, times: el.time })
  260. })
  261. }
  262. }
  263. //获取火焰传感器监测数据
  264. async function getHyRealDataList() {
  265. let res = await getHyRealData({ areaCode: areaCode.value })
  266. console.log(res, '火焰传感器监测数据')
  267. if (res.length != 0) {
  268. botCardList[1].sensorList.length = 0
  269. res.forEach(el => {
  270. el.isOpen = el.isOpen == '0' ? '无火' : '有火'
  271. botCardList[1].sensorList.push({ name: el.pointName, status: el.isOpen, times: el.time })
  272. })
  273. }
  274. }
  275. //获取喷淋设备监测数据
  276. async function getPlzzRealDataList() {
  277. let res = await getPlzzRealData({ areaCode: areaCode.value })
  278. console.log(res, '自动喷淋灭火装置数据')
  279. if (res.length != 0) {
  280. botCardList[2].sensorList.length = 0
  281. res.forEach(el => {
  282. el.isOpen = el.isOpen == '0' ? '正常' : '异常'
  283. botCardList[2].sensorList.push({ name: el.pointName, status: el.isOpen, times: el.time })
  284. })
  285. }
  286. }
  287. //获取束管测点编号列表
  288. async function getSgjcPointInfoList() {
  289. let res = await getSgjcPointInfo({ areaCode: areaCode.value })
  290. console.log(res, '束管测点编号列表')
  291. if (res.length != 0) {
  292. pointCode.value = res[0]['pointCode']
  293. //获取束管测点实时数据
  294. getSgjcRealDataByPointCodeList()
  295. }
  296. }
  297. //束管选项切换
  298. function toggleChange(title) {
  299. gasType.value = title
  300. getSgjcHistoryDataList()
  301. }
  302. //获取束管测点实时数据
  303. async function getSgjcRealDataByPointCodeList() {
  304. let res = await getSgjcRealDataByPointCode({ pointCode: pointCode.value })
  305. console.log(res, '束管测点实时数据======')
  306. if (res.length != 0) {
  307. card3List.length = 0
  308. res.forEach(el => {
  309. card3List.push({ title: el.type, ndLabel: '浓度', ndVal: el.currentValue, tLabel: '时间', tVal: el.time, aLabel: '位置', aVal: el.position })
  310. })
  311. gasType.value = gasType.value ? gasType.value : card3List[0]['title']
  312. //获取束管曲线数据
  313. getSgjcHistoryDataList()
  314. }
  315. }
  316. //获取束管曲线数据
  317. async function getSgjcHistoryDataList() {
  318. let res = await getSgjcHistoryData({ pointCode: pointCode.value, type: gasType.value, startTime: TimeRange.value[0], endTime: TimeRange.value[1] })
  319. console.log(res, '束管曲线数据-------')
  320. echartData.xData.length = 0
  321. echartData.yData.length = 0
  322. echartData.yData1.length = 0
  323. res.time.forEach(el => {
  324. echartData.xData.push(el)
  325. })
  326. res.value.forEach(el => {
  327. echartData.yData.push(el)
  328. })
  329. }
  330. onMounted(() => {
  331. getFireAreaInfos()
  332. getMonitor()
  333. })
  334. </script>
  335. <style lang="less" scoped>
  336. .workPlaceWarn {
  337. display: flex;
  338. position: relative;
  339. align-items: center;
  340. justify-content: space-between;
  341. width: calc(100% - 20px);
  342. // height: calc(100vh - 82px);
  343. height: 880px;
  344. margin: 0 10px;
  345. background: #282828;
  346. .workPlace-left-box {
  347. width: 220px;
  348. height: 100%;
  349. background-color: rgb(27 35 39 / 80%);
  350. }
  351. .workPlace-right-box {
  352. box-sizing: border-box;
  353. width: calc(100% - 230px);
  354. height: 100%;
  355. margin-left: 10px;
  356. padding: 15px 10px;
  357. overflow-y: auto;
  358. background-color: rgb(27 35 39 / 80%);
  359. .top-box-card {
  360. width: 100%;
  361. height: 110px;
  362. margin-bottom: 15px;
  363. }
  364. .top-box-btn {
  365. width: 100%;
  366. height: 100px;
  367. }
  368. .center-box {
  369. width: 100%;
  370. height: 260px;
  371. margin-bottom: 15px;
  372. border: 1px solid #1e96cd;
  373. }
  374. .bot-box {
  375. display: flex;
  376. flex-shrink: 0;
  377. justify-content: space-between;
  378. height: calc(100% - 500px);
  379. overflow-x: auto;
  380. .bot-box-card {
  381. width: 540px;
  382. height: 100%;
  383. }
  384. }
  385. .bot-box1 {
  386. display: flex;
  387. flex-shrink: 0;
  388. justify-content: space-between;
  389. height: calc(100% - 545px);
  390. overflow-x: auto;
  391. .bot-box-card {
  392. width: 540px;
  393. height: 100%;
  394. }
  395. }
  396. .composite-top-box {
  397. width: 100%;
  398. height: 235px;
  399. margin-bottom: 15px;
  400. }
  401. .composite-bot-box {
  402. box-sizing: border-box;
  403. width: 100%;
  404. // height: calc(100% - 250px);
  405. height: 280px;
  406. margin-bottom: 15px;
  407. padding: 10px 15px;
  408. border: 1px solid #1e96cd;
  409. background-color: rgb(41 49 53 / 80%);
  410. .search-area {
  411. display: flex;
  412. box-sizing: border-box;
  413. align-items: center;
  414. justify-content: space-between;
  415. height: 30px;
  416. .area-title {
  417. color: #fff;
  418. // font-family: douyuFont;
  419. font-family: "Microsoft YaHei", sans-serif;
  420. font-size: 16px;
  421. }
  422. }
  423. .content-area {
  424. height: calc(100% - 30px);
  425. }
  426. }
  427. }
  428. }
  429. :deep(.vMonitor-picker) {
  430. border: none !important;
  431. background-color: rgb(15 64 88) !important;
  432. box-shadow: none;
  433. color: #a1dff8 !important;
  434. }
  435. :deep(.vMonitor-picker-input >input) {
  436. color: #a1dff8 !important;
  437. text-align: center !important;
  438. }
  439. :deep(.vMonitor-picker-separator) {
  440. color: #a1dff8 !important;
  441. }
  442. :deep(.vMonitor-picker-active-bar) {
  443. display: none !important;
  444. }
  445. :deep(.vMonitor-picker-suffix) {
  446. color: #a1dff8 !important;
  447. }
  448. :deep(.vMonitor-select-selector) {
  449. border: none !important;
  450. background-color: rgb(15 64 88) !important;
  451. color: #a1dff8 !important;
  452. }
  453. :deep(.vMonitor-select-selection-placeholder) {
  454. color: #a1dff8 !important;
  455. }
  456. :deep(.vMonitor-select-arrow) {
  457. color: #a1dff8 !important;
  458. }
  459. </style>