fireWork.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <div class="fireWork">
  3. <!-- 顶部区域 -->
  4. <div class="work-nav">
  5. <div class="nav" v-for="(item, index) in topList" :key="index">
  6. <div class="pic" v-if="item.imgSrc">
  7. <img :src="imgUrl" alt="" />
  8. </div>
  9. <div class="content" v-if="item.label && item.value">
  10. <span>{{ item.label }}</span>
  11. <span>{{ item.value }}</span>
  12. </div>
  13. <div class="text" v-if="item.text">{{ item.text }}</div>
  14. <div class="percent" v-if="item.list.length != 0">
  15. <div class="title">{{ item.label }}</div>
  16. <div class="value">
  17. <div class="content-box" v-for="(items, ind) in item.list" :key="ind">
  18. <span style="color: #b3b8cc">{{ `${items.label} :` }}</span>
  19. <span style="color: #3df6ff; margin-left: 10px">{{ `${items.value}%` }}</span>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <!-- 中间区域 -->
  26. <div class="center-echart">
  27. <div class="nav-title">
  28. <div class="title">光纤测温系统温度实时监测</div>
  29. </div>
  30. <div class="echart-box">
  31. <echartLine :echartDataGq="echartDataGq" :maxY="maxY" :echartDw="echartDw" />
  32. </div>
  33. </div>
  34. <!-- 底部区域 -->
  35. <div class="bot-content">
  36. <div class="title">
  37. <div class="text">束管系统监测</div>
  38. <div class="select-box">
  39. <a-select v-model:value="selectData" style="width: 250px" @change="changeSelect">
  40. <a-select-option v-for="file in selectList" :key="file.label" :value="file.value">{{ file.label
  41. }}</a-select-option>
  42. </a-select>
  43. </div>
  44. </div>
  45. <div class="content">
  46. <div class="content-box" v-for="(item, index) in contentList" :key="index">
  47. <div class="box-item" v-for="(items, ind) in item.list" :key="ind" @click="getSgClick(items)">
  48. <div class="content-title">
  49. <span> {{ items.title }}</span>
  50. <span> {{ items.dw }}</span>
  51. </div>
  52. <div class="content-item">
  53. <span>{{ items.label }}</span>
  54. <span class="bolds">{{ items.value }}</span>
  55. </div>
  56. <div class="content-item">
  57. <span>{{ items.label1 }}</span>
  58. <span class="bolds">{{ items.time }}</span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="echart-box">
  64. <echartLine1 :echartDataSg="echartDataSg" :maxY="maxY1" :lengedDataName="echartDataSg.lengedDataName" />
  65. </div>
  66. </div>
  67. </div>
  68. </template>
  69. <script lang="ts" setup>
  70. import { onMounted, ref, reactive, watch, defineProps } from 'vue';
  71. import imgUrl from '../../../../../assets/images/fire/pie.png';
  72. import echartLine from './echartLine.vue';
  73. import echartLine1 from './echartLine1.vue';
  74. import { topList, contentList } from '../common.data';
  75. let props = defineProps({
  76. listData: Object,
  77. });
  78. let selectSj = ref<any[]>([])
  79. let selectData = ref('')
  80. let selectList = reactive<any[]>([])
  81. let maxY1 = ref<any>(0)
  82. let maxY = ref(100);
  83. let echartDw = ref('(­°C)');
  84. //光钎测温-图表数据
  85. let echartDataGq = reactive({
  86. maxData: {
  87. lengedData: '当前温度',
  88. data: [],
  89. },
  90. xData: [],
  91. });
  92. //束管监测-图表数据
  93. let echartDataSg = reactive({
  94. xData: [],
  95. yData: [],
  96. lengedData: 'O₂',
  97. lengedDataName: '(%)',
  98. });
  99. let echartDataSgList = reactive<any[]>([]);
  100. function getmaxY() {
  101. maxY1.value = echartDataSg.yData.reduce((acr, cur) => {
  102. return acr > cur ? acr : cur;
  103. });
  104. maxY1.value = maxY1.value.toString().indexOf('.') == -1 ? maxY1.value.toString() : maxY1.value.toString().substring(0, maxY1.value.toString().indexOf('.'))
  105. if (maxY1.value.length < 2) {
  106. maxY1.value = 10
  107. } else if (maxY1.value.length < 3) {
  108. maxY1.value = (Number(maxY1.value[0]) + 1) * 10
  109. } else if (maxY1.value.length < 4) {
  110. maxY1.value = (Number(maxY1.value[0]) + 1) * 100
  111. } else if (maxY1.value.length < 5) {
  112. maxY1.value = (Number(maxY1.value[0]) + 1) * 1000
  113. } else if (maxY1.value.length < 6) {
  114. maxY1.value = (Number(maxY1.value[0]) + 1) * 10000
  115. }
  116. }
  117. //束管实时数据选项点击
  118. function getSgClick(items) {
  119. echartDataSg.xData.length = 0;
  120. echartDataSg.yData.length = 0;
  121. echartDataSg.lengedData = items.title;
  122. echartDataSg.lengedDataName = items.dw;
  123. switch (items.title) {
  124. case 'O₂':
  125. echartDataSgList.forEach((el) => {
  126. echartDataSg.xData.push(el.time);
  127. echartDataSg.yData.push(el.o2val);
  128. });
  129. getmaxY()
  130. break;
  131. case 'C₂H₄':
  132. echartDataSgList.forEach((el) => {
  133. echartDataSg.xData.push(el.time);
  134. echartDataSg.yData.push(el.ch2val);
  135. });
  136. getmaxY()
  137. break;
  138. case 'CO':
  139. echartDataSgList.forEach((el) => {
  140. echartDataSg.xData.push(el.time);
  141. echartDataSg.yData.push(el.coval);
  142. });
  143. getmaxY()
  144. break;
  145. case 'CH₄':
  146. echartDataSgList.forEach((el) => {
  147. echartDataSg.xData.push(el.time);
  148. echartDataSg.yData.push(el.chval);
  149. });
  150. getmaxY()
  151. break;
  152. case 'CO₂':
  153. echartDataSgList.forEach((el) => {
  154. echartDataSg.xData.push(el.time);
  155. echartDataSg.yData.push(el.co2val);
  156. });
  157. getmaxY()
  158. break;
  159. case 'C₂H₂':
  160. echartDataSgList.forEach((el) => {
  161. echartDataSg.xData.push(el.time);
  162. echartDataSg.yData.push(el.gasval);
  163. });
  164. getmaxY()
  165. break;
  166. }
  167. }
  168. function changeSelect(val) {
  169. selectData.value = val
  170. let data = selectSj.value.filter(v => v.strinstallpos == selectData.value)[0]
  171. contentList[0].list[0].value = data.readData.o2val;
  172. contentList[0].list[1].value = data.readData.ch2val;
  173. contentList[1].list[0].value = data.readData.coval;
  174. contentList[1].list[1].value = data.readData.chval;
  175. contentList[2].list[0].value = data.readData.co2val;
  176. contentList[2].list[1].value = data.readData.gasval;
  177. contentList.forEach((el) => {
  178. el.list.forEach((v) => {
  179. v.time = data.readTime.substring(0, data.readTime.lastIndexOf(':'));
  180. });
  181. });
  182. }
  183. watch(
  184. () => props.listData,
  185. (val, val1) => {
  186. echartDataGq.xData.length = 0;
  187. echartDataGq.maxData.data.length = 0;
  188. echartDataSgList.length = 0;
  189. echartDataSg.xData.length = 0;
  190. echartDataSg.yData.length = 0;
  191. selectList.length = 0
  192. if (JSON.stringify(val) != '{}') {
  193. if (val.fiber.length != 0) {
  194. topList[0].value = val.fiber[0].readData.fmax;
  195. topList[1].value = val.fiber[0].readData.fmin;
  196. topList[2].value = val.fiber[0].readData.favg;
  197. topList[3].text = val.fiber[0].warnFlag ? '报警' : '正常';
  198. JSON.parse(val.fiber[0].readData.fibreTemperature).forEach((el) => {
  199. echartDataGq.xData.push(el.pos);
  200. echartDataGq.maxData.data.push(el.value);
  201. });
  202. } else {
  203. topList[0].value = '--';
  204. topList[1].value = '--';
  205. topList[2].value = '--';
  206. topList[3].text = '正常';
  207. }
  208. if (val.bundletube.length != 0) {
  209. selectSj.value = val.bundletube
  210. selectSj.value.forEach(el => {
  211. selectList.push({ label: el.strinstallpos, value: el.strinstallpos })
  212. })
  213. selectData.value = selectData.value ? selectData.value : selectList[0].value
  214. let dataVal = selectData.value ? selectSj.value.filter(v => v.strinstallpos == selectData.value)[0] : selectSj.value[0];
  215. contentList[0].list[0].value = dataVal.readData.o2val;
  216. contentList[0].list[1].value = dataVal.readData.ch2val;
  217. contentList[1].list[0].value = dataVal.readData.coval;
  218. contentList[1].list[1].value = dataVal.readData.chval;
  219. contentList[2].list[0].value = dataVal.readData.co2val;
  220. contentList[2].list[1].value = dataVal.readData.gasval;
  221. contentList.forEach((el) => {
  222. el.list.forEach((v) => {
  223. v.time = dataVal.readTime.substring(0, dataVal.readTime.lastIndexOf(':'));
  224. });
  225. });
  226. dataVal.history.forEach((el) => {
  227. echartDataSg.xData.push(el.time);
  228. if (echartDataSg.lengedData == 'O₂') {
  229. echartDataSg.yData.push(el.o2val);
  230. } else if (echartDataSg.lengedData == 'C₂H₄') {
  231. echartDataSg.yData.push(el.ch2val);
  232. } else if (echartDataSg.lengedData == 'C₂H₂') {
  233. echartDataSg.yData.push(el.gasval);
  234. } else if (echartDataSg.lengedData == 'CH₄') {
  235. echartDataSg.yData.push(el.chval);
  236. } else if (echartDataSg.lengedData == 'CO') {
  237. echartDataSg.yData.push(el.coval);
  238. } else if (echartDataSg.lengedData == 'CO₂') {
  239. echartDataSg.yData.push(el.co2val);
  240. }
  241. echartDataSgList.push(el);
  242. });
  243. getmaxY()
  244. } else {
  245. contentList[0].list[0].value = '--';
  246. contentList[0].list[1].value = '--';
  247. contentList[1].list[0].value = '--';
  248. contentList[1].list[1].value = '--';
  249. contentList[2].list[0].value = '--';
  250. contentList[2].list[1].value = '--';
  251. contentList.forEach((el) => {
  252. el.list.forEach((v) => {
  253. v.time = '--';
  254. });
  255. });
  256. }
  257. }
  258. },
  259. { deep: true }
  260. );
  261. </script>
  262. <style lang="less" scoped>
  263. .fireWork {
  264. width: 100%;
  265. height: 100%;
  266. padding: 20px;
  267. box-sizing: border-box;
  268. .work-nav {
  269. height: 15%;
  270. width: 100%;
  271. margin-bottom: 20px;
  272. background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
  273. background-size: 100% 100%;
  274. display: flex;
  275. justify-content: space-between;
  276. align-items: center;
  277. .nav {
  278. display: flex;
  279. justify-content: center;
  280. align-items: center;
  281. &:nth-child(1) {
  282. flex: 1;
  283. height: 100%;
  284. border-right: 2px solid;
  285. border-image: linear-gradient(to bottom, transparent, rgba(2, 70, 136, 1), transparent) 1 1 1;
  286. }
  287. &:nth-child(2) {
  288. flex: 1;
  289. height: 100%;
  290. border-right: 2px solid;
  291. border-image: linear-gradient(to bottom, transparent, rgba(2, 70, 136, 1), transparent) 1 1 1;
  292. }
  293. &:nth-child(3) {
  294. flex: 1;
  295. height: 100%;
  296. border-right: 2px solid;
  297. border-image: linear-gradient(to bottom, transparent, rgba(2, 70, 136, 1), transparent) 1 1 1;
  298. }
  299. &:nth-child(4) {
  300. flex: 0.6;
  301. color: #b3b8cc;
  302. font-size: 16px;
  303. height: 100%;
  304. border-right: 2px solid;
  305. border-image: linear-gradient(to bottom, transparent, rgba(2, 70, 136, 1), transparent) 1 1 1;
  306. }
  307. &:nth-child(5) {
  308. flex: 1.4;
  309. height: 100%;
  310. .percent {
  311. width: 100%;
  312. height: 82%;
  313. padding: 0px 20px;
  314. box-sizing: border-box;
  315. display: flex;
  316. flex-direction: column;
  317. justify-content: space-around;
  318. .title {
  319. font-size: 14px;
  320. padding: 5px 0px;
  321. color: #b3b8cc;
  322. text-align: center;
  323. }
  324. .value {
  325. display: flex;
  326. justify-content: space-between;
  327. span {
  328. font-family: 'douyuFont';
  329. font-size: 18px;
  330. }
  331. }
  332. }
  333. }
  334. .pic {
  335. width: 30%;
  336. height: 82%;
  337. img {
  338. width: 100%;
  339. height: 100%;
  340. }
  341. }
  342. .content {
  343. height: 82%;
  344. margin-left: 15px;
  345. color: #fff;
  346. display: flex;
  347. flex-direction: column;
  348. justify-content: space-around;
  349. span {
  350. font-size: 14px;
  351. &:nth-child(1) {
  352. padding: 5px 0px;
  353. color: #b3b8cc;
  354. }
  355. &:nth-child(2) {
  356. font-family: 'douyuFont';
  357. font-size: 16px;
  358. color: #3df6ff;
  359. }
  360. }
  361. }
  362. }
  363. .nav:nth-child(1) .pic {
  364. background: url('../../../../../assets/images/fire/max.svg') no-repeat center;
  365. background-size: 50% 50%;
  366. }
  367. .nav:nth-child(2) .pic {
  368. background: url('../../../../../assets/images/fire/min.svg') no-repeat center;
  369. background-size: 50% 50%;
  370. }
  371. .nav:nth-child(3) .pic {
  372. background: url('../../../../../assets/images/fire/pj.svg') no-repeat center;
  373. background-size: 50% 50%;
  374. }
  375. }
  376. .center-echart {
  377. width: 100%;
  378. height: 32%;
  379. padding: 10px;
  380. margin-bottom: 20px;
  381. box-sizing: border-box;
  382. background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
  383. background-size: 100% 100%;
  384. .nav-title {
  385. height: 30px;
  386. display: flex;
  387. justify-content: space-between;
  388. align-items: center;
  389. .title {
  390. font-family: 'douyuFont';
  391. font-size: 14px;
  392. color: #fff;
  393. // color: #3df6ff;
  394. }
  395. }
  396. .echart-box {
  397. width: 100%;
  398. height: calc(100% - 30px);
  399. }
  400. }
  401. .bot-content {
  402. position: relative;
  403. width: 100%;
  404. height: calc(53% - 40px);
  405. padding: 10px 10px 0px 10px;
  406. box-sizing: border-box;
  407. background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
  408. background-size: 100% 100%;
  409. .title {
  410. height: 35px;
  411. display: flex;
  412. justify-content: space-between;
  413. align-items: center;
  414. margin-bottom: 10px;
  415. .text {
  416. // height: 30px;
  417. // line-height: 30px;
  418. font-family: 'douyuFont';
  419. font-size: 14px;
  420. color: #fff;
  421. }
  422. }
  423. .content {
  424. height: calc(100% - 45px);
  425. display: flex;
  426. flex-direction: column;
  427. justify-content: space-between;
  428. .content-box {
  429. width: 100%;
  430. height: 29%;
  431. display: flex;
  432. justify-content: space-between;
  433. margin-top: 0px !important;
  434. .box-item {
  435. position: relative;
  436. width: 16%;
  437. height: 100%;
  438. background: url('../../../../../assets/images/fire/14174.png') no-repeat center;
  439. background-size: 100% 100%;
  440. cursor: pointer;
  441. .content-title {
  442. position: absolute;
  443. left: 50%;
  444. top: 0;
  445. transform: translate(-50%);
  446. color: #fff;
  447. font-size: 14px;
  448. }
  449. .content-item {
  450. position: absolute;
  451. width: 93%;
  452. height: 27%;
  453. display: flex;
  454. align-items: center;
  455. padding: 0px 10px;
  456. box-sizing: border-box;
  457. background: url('../../../../../assets/images/fire/contetn.png') no-repeat center;
  458. background-size: 100% 100%;
  459. color: #fff;
  460. font-size: 14px;
  461. &:nth-child(2) {
  462. left: 50%;
  463. top: 28%;
  464. transform: translate(-50%);
  465. display: flex;
  466. justify-content: space-between;
  467. }
  468. &:nth-child(3) {
  469. left: 50%;
  470. top: 62%;
  471. transform: translate(-50%);
  472. display: flex;
  473. justify-content: space-between;
  474. }
  475. .bolds {
  476. font-family: 'douyuFont';
  477. color: #3df6ff;
  478. font-size: 12px;
  479. }
  480. }
  481. }
  482. }
  483. }
  484. .echart-box {
  485. position: absolute;
  486. left: 50%;
  487. top: 50px;
  488. transform: translate(-50%, 0);
  489. width: 66%;
  490. height: calc(100% - 50px);
  491. }
  492. }
  493. }
  494. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  495. border: 1px solid #3ad8ff77 !important;
  496. background-color: #ffffff00 !important;
  497. }
  498. :deep(.zxm-select-selection-item) {
  499. color: #fff !important;
  500. }
  501. :deep(.zxm-select-arrow) {
  502. color: #fff;
  503. }
  504. </style>