fireWork.vue 16 KB

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