index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <div class="dustMonitor">
  3. <customHeader>色谱仪报表分析</customHeader>
  4. <div class="content-container">
  5. <div class="file-list">
  6. <ul>
  7. <li v-for="item in selectList" :key="item.id" :class="{ selected: item.id === selectedFileId }" @click="handleFileClick(item)">
  8. {{ item.fileName }}
  9. </li>
  10. </ul>
  11. </div>
  12. <div class="table-container">
  13. <a-table :columns="computedColumns" :data-source="tableData" size="small" :pagination="false" :scroll="{ y: 300 }" class="tableW">
  14. <template #bodyCell="{ column, record }">
  15. <template v-if="column.dataIndex === 'action'">
  16. <a class="action-link" @click="toDetail(record)">数据分析</a>
  17. </template>
  18. </template>
  19. </a-table>
  20. <div class="data-container">
  21. <div id="lineChart" class="line-chart"></div>
  22. <div class="data-content">
  23. <div class="title">煤自燃阶段统计分析</div>
  24. <div class="explain">测点共计{{ total }}个</div>
  25. <div class="progress-label">潜伏期阶段:{{ qfqCount }}</div>
  26. <Progress :percent="qfqPercent" size="default" strokeColor="green" :show-info="true" :format="() => qfqCount" />
  27. <div class="progress-label">缓慢氧化升温阶段:{{ latentCount }}</div>
  28. <Progress :percent="latentPercent" size="default" strokeColor="yellow" :show-info="true" :format="() => latentCount" />
  29. <div class="progress-label">加速氧化升温阶段:{{ selfHeatingCount }}</div>
  30. <Progress :percent="selfHeatingPercent" size="default" strokeColor="orange‌" :show-info="true" :format="() => selfHeatingCount" />
  31. <div class="progress-label">剧烈氧化升温阶段:{{ combustionCount }}</div>
  32. <Progress :percent="combustionPercent" size="default" strokeColor="red" :show-info="true" :format="() => combustionCount" />
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <a-modal style="width: 600px; height: 300px" title="爆炸三角形" v-model:visible="modalVisible" :draggable="true" :footer="null">
  38. <div class="blast-delta-container">
  39. <BlastDelta :posMonitor="posMonitor" />
  40. </div>
  41. </a-modal>
  42. </div>
  43. </template>
  44. <script setup lang="ts">
  45. import { ref, onMounted, computed, reactive, shallowRef } from 'vue';
  46. import { columns, Hjtcolumns, Bdcolumns, Bltcolumns, Sgtcolumns, Yjlcolumns } from './bundleSpy-table.data';
  47. import { getbundleSpyInfoList, getAllFileList, getAllFileListById } from './bundleSpy-table.api';
  48. import customHeader from '/@/components/vent/customHeader.vue';
  49. import * as echarts from 'echarts';
  50. import BlastDelta from './modal/blastDelta.vue';
  51. import { Progress } from 'ant-design-vue';
  52. import { useGlobSetting } from '/@/hooks/setting';
  53. // import 'ant-design-vue/dist/antd.css'; // 引入样式
  54. let selectList = ref<any[]>([]);
  55. let formSearch = reactive({
  56. pageNum: 1,
  57. pageSize: 1000,
  58. id: '',
  59. fileName: '',
  60. });
  61. const total = ref(0);
  62. const { sysOrgCode } = useGlobSetting();
  63. const qfqCount = ref(0); // 潜伏期
  64. const latentCount = ref(0); // 缓慢氧化阶段(潜伏期)
  65. const selfHeatingCount = ref(0); // 加速氧化阶段(自热期)
  66. const combustionCount = ref(0); // 剧烈氧化阶段(燃烧期)
  67. const qfqPercent = ref(0); // 潜伏期(潜伏期)
  68. const latentPercent = ref(0); // 缓慢氧化阶段(潜伏期)
  69. const selfHeatingPercent = ref(0); // 加速氧化阶段(自热期)
  70. const combustionPercent = ref(0); // 剧烈氧化阶段(燃烧期)
  71. let tableData = ref<any[]>([]);
  72. let selectedFileId = ref<string | null>(null);
  73. let modalVisible = ref(false);
  74. const posMonitor = shallowRef({});
  75. const computedColumns = computed(() => {
  76. switch (sysOrgCode) {
  77. case 'sdmtjtdltmkhjtj':
  78. return Hjtcolumns; // 活鸡兔对应的列配置
  79. case 'sdmtjtBdmk':
  80. return Bdcolumns; // 保德对应的列配置
  81. case 'sdmtjtbltmk':
  82. return Bltcolumns; // 补连塔对应的列配置
  83. case 'sdmtjtsgtmk':
  84. return Sgtcolumns; // 石圪台对应的列配置
  85. case 'sdmtjtyjlmk':
  86. return Yjlcolumns; // 榆家梁对应的列配置
  87. default:
  88. return Bdcolumns; // 默认情况下返回的列配置
  89. }
  90. });
  91. //获取色谱仪报表
  92. async function getTableList(params: any) {
  93. let res = await getbundleSpyInfoList({ type: 'bundleSpy', ...params });
  94. const content = res.content;
  95. let contentArr = JSON.parse(content);
  96. // const contentNewArr = computed(() => {
  97. // return contentArr.map((item) => {
  98. // let internalFireWarnLevel = '';
  99. // const co = item.co_ave;
  100. // const co2 = item.co2_ave;
  101. // const c2h4 = item.c2h4_ave;
  102. // const c2h2 = item.c2h2_ave;
  103. // const coRatio = co / co2;
  104. // if (co >= 0 && co <= 13.75) {
  105. // internalFireWarnLevel = '潜伏期阶段';
  106. // } else if (co > 13.75 && co < 67.2 && coRatio < 0.095) {
  107. // internalFireWarnLevel = '缓慢氧化升温阶段';
  108. // } else if ((co >= 67.2 && co < 1606.3) || (coRatio >= 0.095 && coRatio < 0.322) || c2h4 < 2) {
  109. // internalFireWarnLevel = '加速氧化阶段';
  110. // } else if (co >= 1606.3 || coRatio >= 0.322 || c2h4 >= 2 || c2h2 > 0) {
  111. // internalFireWarnLevel = '剧烈氧化阶段';
  112. // }
  113. // return { ...item, internalFireWarnLevel };
  114. // });
  115. // });
  116. total.value = contentArr.length;
  117. qfqCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '潜伏期阶段').length;
  118. latentCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '缓慢氧化升温阶段').length;
  119. selfHeatingCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '加速氧化升温阶段').length;
  120. combustionCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '剧烈氧化升温阶段').length;
  121. qfqPercent.value = (qfqCount.value / total.value) * 100;
  122. latentPercent.value = (latentCount.value / total.value) * 100;
  123. selfHeatingPercent.value = (selfHeatingCount.value / total.value) * 100;
  124. combustionPercent.value = (combustionCount.value / total.value) * 100;
  125. tableData.value = contentArr;
  126. updateChart(contentArr);
  127. }
  128. async function getTableListById(params: any) {
  129. let res = await getAllFileListById({ ...params });
  130. const content = res.content;
  131. let contentArr = JSON.parse(content);
  132. total.value = contentArr.length;
  133. qfqCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '潜伏期阶段').length;
  134. latentCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '缓慢氧化升温阶段').length;
  135. selfHeatingCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '加速氧化升温阶段').length;
  136. combustionCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '剧烈氧化升温阶段').length;
  137. qfqPercent.value = (qfqCount.value / total.value) * 100;
  138. latentPercent.value = (latentCount.value / total.value) * 100;
  139. selfHeatingPercent.value = (selfHeatingCount.value / total.value) * 100;
  140. combustionPercent.value = (combustionCount.value / total.value) * 100;
  141. tableData.value = contentArr;
  142. updateChart(contentArr);
  143. }
  144. //跳转到爆炸三角形
  145. function toDetail(record: any) {
  146. posMonitor.value = record;
  147. console.log(posMonitor.value);
  148. modalVisible.value = true;
  149. }
  150. //折线图
  151. function updateChart(data: any) {
  152. const chartDom = document.getElementById('lineChart');
  153. const myChart = echarts.init(chartDom);
  154. const categories = data.map((item: any) => item.jcdd);
  155. const c2h2AveValues = data.map((item: any) => parseFloat(item.c2h2_ave));
  156. const c2h4AveValues = data.map((item: any) => parseFloat(item.c2h4_ave));
  157. const ch4AveValues = data.map((item: any) => parseFloat(item.ch4_ave));
  158. const co2AveValues = data.map((item: any) => parseFloat(item.co2_ave));
  159. const coAveValues = data.map((item: any) => parseFloat(item.co_ave));
  160. const o2AveValues = data.map((item: any) => parseFloat(item.o2_ave));
  161. const n2AveValues = data.map((item: any) => parseFloat(item.n2_ave));
  162. const c2h6AveValues = data.map((item: any) => parseFloat(item.c2h6_ave));
  163. const c3h8AveValues = data.map((item: any) => parseFloat(item.c3h8_ave));
  164. const ch4AveBqValues = data.map((item: any) => parseFloat(item.ch4_ave_bq));
  165. const o2AveBqValues = data.map((item: any) => parseFloat(item.o2_ave_bq));
  166. const getSeriesConfig = (sysOrgCode) => {
  167. switch (sysOrgCode) {
  168. case 'sdmtjtdltmkhjtj':
  169. return [
  170. {
  171. name: 'CH₄闭内',
  172. data: ch4AveValues,
  173. yAxisIndex: 1,
  174. type: 'bar',
  175. },
  176. {
  177. name: 'O₂闭内',
  178. data: ch4AveValues,
  179. yAxisIndex: 1,
  180. type: 'bar',
  181. },
  182. {
  183. name: 'CO₂闭内',
  184. data: co2AveValues,
  185. yAxisIndex: 1,
  186. type: 'bar',
  187. },
  188. {
  189. name: 'CO闭内',
  190. data: coAveValues,
  191. yAxisIndex: 1,
  192. type: 'bar',
  193. },
  194. {
  195. name: 'CH₄闭前',
  196. data: ch4AveBqValues,
  197. yAxisIndex: 1,
  198. type: 'bar',
  199. },
  200. {
  201. name: 'O₂闭前',
  202. data: o2AveBqValues,
  203. yAxisIndex: 1,
  204. type: 'bar',
  205. },
  206. ];
  207. case 'sdmtjtBdmk':
  208. return [
  209. {
  210. name: 'O₂',
  211. data: o2AveValues,
  212. yAxisIndex: 0,
  213. type: 'bar',
  214. },
  215. {
  216. name: 'N₂',
  217. data: n2AveValues,
  218. yAxisIndex: 0,
  219. type: 'bar',
  220. },
  221. {
  222. name: 'CO',
  223. data: coAveValues,
  224. yAxisIndex: 1,
  225. type: 'bar',
  226. },
  227. {
  228. name: 'CO₂',
  229. data: co2AveValues,
  230. yAxisIndex: 1,
  231. type: 'bar',
  232. },
  233. {
  234. name: 'CH₄',
  235. data: ch4AveValues,
  236. yAxisIndex: 1,
  237. type: 'bar',
  238. },
  239. {
  240. name: 'C2H6',
  241. data: c2h6AveValues,
  242. yAxisIndex: 1,
  243. type: 'bar',
  244. },
  245. {
  246. name: 'C3H8',
  247. data: c3h8AveValues,
  248. yAxisIndex: 1,
  249. type: 'bar',
  250. },
  251. {
  252. name: 'C₂H₄',
  253. data: c2h4AveValues,
  254. type: 'bar',
  255. yAxisIndex: 1,
  256. },
  257. {
  258. name: 'C₂H₂',
  259. data: c2h2AveValues,
  260. type: 'bar',
  261. yAxisIndex: 1,
  262. },
  263. ];
  264. case 'sdmtjtyjlmk':
  265. return [
  266. {
  267. name: 'O₂',
  268. data: o2AveValues,
  269. yAxisIndex: 0,
  270. type: 'bar',
  271. },
  272. {
  273. name: 'N₂',
  274. data: n2AveValues,
  275. yAxisIndex: 0,
  276. type: 'bar',
  277. },
  278. {
  279. name: 'CO',
  280. data: coAveValues,
  281. yAxisIndex: 1,
  282. type: 'bar',
  283. },
  284. {
  285. name: 'CO₂',
  286. data: co2AveValues,
  287. yAxisIndex: 1,
  288. type: 'bar',
  289. },
  290. {
  291. name: 'CH₄',
  292. data: ch4AveValues,
  293. yAxisIndex: 1,
  294. type: 'bar',
  295. },
  296. {
  297. name: 'C2H6',
  298. data: c2h6AveValues,
  299. yAxisIndex: 1,
  300. type: 'bar',
  301. },
  302. {
  303. name: 'C₂H₄',
  304. data: c2h4AveValues,
  305. type: 'bar',
  306. yAxisIndex: 1,
  307. },
  308. {
  309. name: 'C₂H₂',
  310. data: c2h2AveValues,
  311. type: 'bar',
  312. yAxisIndex: 1,
  313. },
  314. ];
  315. default:
  316. return [
  317. {
  318. name: 'C₂H₂',
  319. data: c2h2AveValues,
  320. type: 'bar',
  321. yAxisIndex: 1,
  322. },
  323. {
  324. name: 'C₂H₄',
  325. data: c2h4AveValues,
  326. type: 'bar',
  327. yAxisIndex: 1,
  328. },
  329. {
  330. name: 'CH₄',
  331. data: ch4AveValues,
  332. yAxisIndex: 1,
  333. type: 'bar',
  334. },
  335. {
  336. name: 'CO₂',
  337. data: co2AveValues,
  338. yAxisIndex: 1,
  339. type: 'bar',
  340. },
  341. {
  342. name: 'CO',
  343. data: coAveValues,
  344. yAxisIndex: 1,
  345. type: 'bar',
  346. },
  347. {
  348. name: 'O₂',
  349. data: o2AveValues,
  350. yAxisIndex: 0,
  351. type: 'bar',
  352. },
  353. {
  354. name: 'N₂',
  355. data: n2AveValues,
  356. yAxisIndex: 0,
  357. type: 'bar',
  358. },
  359. {
  360. name: 'C2H6',
  361. data: c2h6AveValues,
  362. yAxisIndex: 1,
  363. type: 'bar',
  364. },
  365. ];
  366. }
  367. };
  368. const seriesConfig = getSeriesConfig(sysOrgCode);
  369. const option = {
  370. tooltip: {
  371. trigger: 'axis',
  372. backgroundColor: 'rgba(28, 72, 105, 0.5)', // 设置 tooltip 背景为透明
  373. textStyle: {
  374. color: '#ffffff', // 设置 tooltip 字体颜色为白色
  375. },
  376. axisPointer: {
  377. label: {
  378. show: true,
  379. backgroundColor: '#071c44',
  380. },
  381. },
  382. },
  383. legend: {
  384. top: '5%',
  385. textStyle: {
  386. color: '#ffffffff',
  387. },
  388. width: '80%', // 设置图例的宽度
  389. orient: 'horizontal', // 水平布局
  390. pageIconColor: '#ffffff', // 设置翻页图标颜色
  391. pageTextStyle: {
  392. color: '#ffffff', // 设置翻页文字颜色
  393. },
  394. },
  395. xAxis: {
  396. type: 'category',
  397. data: categories,
  398. splitLine: { show: true, lineStyle: { color: 'rgba(28, 72, 105, 0.5)' } },
  399. axisLabel: {
  400. interval: 0, // 显示所有标签
  401. color: '#ffffff', // 设置 x 轴字体颜色
  402. formatter: function (value: string) {
  403. return value.length > 12 ? value.slice(0, 12) + '...' : value; // 截断长标签
  404. },
  405. },
  406. },
  407. yAxis: [
  408. {
  409. type: 'value',
  410. name: 'O₂/N₂',
  411. max: 100,
  412. splitLine: { show: true, lineStyle: { color: 'rgba(21,80,126,.5)' } },
  413. axisLabel: {
  414. color: '#ffffff',
  415. },
  416. },
  417. {
  418. type: 'value',
  419. name: '其他气体',
  420. splitLine: { show: true, lineStyle: { color: 'rgba(21,80,126,.5)' } },
  421. axisLabel: {
  422. color: '#ffffff', // 设置 y 轴字体颜色
  423. },
  424. },
  425. ],
  426. dataZoom: [
  427. {
  428. type: 'slider', // 会创建一个滑块来选择要显示的区域
  429. start: 0, // 初始选中范围的起始百分比
  430. end: (5 / categories.length) * 100, // 初始选中范围的结束百分比,根据数据条数调整
  431. minSpan: (5 / categories.length) * 100, // 最小选中范围,根据数据条数调整
  432. maxSpan: (5 / categories.length) * 100, // 最大选中范围,根据数据条数调整
  433. show: true,
  434. height: 10, // 设置滑块高度
  435. bottom: 1, // 设置滑块距离容器底部的距离
  436. borderColor: 'transparent', // 设置边框颜色为透明
  437. backgroundColor: '#F6F7FB', // 设置背景颜色
  438. handleIcon: 'path://M512,512m-448,0a448,448,0,1,0,896,0a448,448,0,1,0,-896,0Z', // 设置手柄图标为圆形
  439. handleColor: '#C2D2FF', // 设置手柄颜色
  440. handleSize: 13, // 设置手柄大小
  441. handleStyle: {
  442. borderColor: '#C2D2FF', // 设置手柄边框颜色
  443. },
  444. fillerColor: '#C2D2FF', // 设置选中范围的填充颜色
  445. },
  446. ],
  447. grid: {
  448. top: '21%', // 设置 grid 距离顶部的距离,增加间隔
  449. left: '3%',
  450. right: '4%',
  451. bottom: '3%',
  452. containLabel: true,
  453. },
  454. series: seriesConfig,
  455. };
  456. myChart.setOption(option);
  457. }
  458. //获取所有文件列表
  459. async function getAllFile() {
  460. let res = await getAllFileList({ type: 'bundleSpy' });
  461. selectList.value = res.records.map((item: any) => ({
  462. id: item.id,
  463. fileName: item.fileName,
  464. }));
  465. if (selectList.value.length > 0) {
  466. formSearch.id = selectList.value[0].id;
  467. getSearch();
  468. }
  469. }
  470. // 处理文件点击事件
  471. function handleFileClick(item: any) {
  472. formSearch.id = item.id;
  473. formSearch.fileName = item.fileName;
  474. selectedFileId.value = item.id;
  475. getSearch();
  476. }
  477. //查询
  478. function getSearch() {
  479. // const selectedFile = selectList.value.find((item) => item.id === formSearch.id);
  480. const params = {
  481. id: formSearch.id,
  482. // fileName: selectedFile ? selectedFile.fileName : '',
  483. };
  484. getTableListById(params);
  485. }
  486. onMounted(() => {
  487. getTableList({ type: 'bundleSpy' });
  488. getAllFile().then(() => {
  489. if (selectList.value.length > 0) {
  490. formSearch.id = selectList.value[0].id;
  491. selectedFileId.value = selectList.value[0].id;
  492. getSearch();
  493. }
  494. });
  495. });
  496. </script>
  497. <style lang="less" scoped>
  498. @import '/@/design/theme.less';
  499. .content-container {
  500. display: flex;
  501. width: 100%;
  502. height: 100%;
  503. padding-top: 54px;
  504. }
  505. .file-list {
  506. width: 20%;
  507. padding: 10px;
  508. margin-right: 10px;
  509. margin-bottom: 50px;
  510. border: 1px solid #99e8ff66;
  511. background: #27546e1a;
  512. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  513. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  514. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  515. }
  516. .file-list ul {
  517. list-style: none;
  518. padding: 0;
  519. }
  520. .file-list li {
  521. color: #fff;
  522. padding: 5px;
  523. cursor: pointer;
  524. }
  525. .file-list li:hover,
  526. .file-list li.selected {
  527. background: #1c4869;
  528. }
  529. .table-container {
  530. margin-top: 10px;
  531. width: 80%;
  532. box-sizing: border-box;
  533. }
  534. .dustMonitor {
  535. width: 100%;
  536. height: 100%;
  537. padding: 10px 10px 15px 10px;
  538. box-sizing: border-box;
  539. position: relative;
  540. }
  541. :deep(.zxm-table-thead > tr > th:last-child) {
  542. border-right: 1px solid #91e9fe !important;
  543. }
  544. :deep(.zxm-picker-input > input) {
  545. color: #fff;
  546. }
  547. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  548. border: 1px solid var(--vent-form-item-border) !important;
  549. background-color: #ffffff00 !important;
  550. }
  551. :deep(.zxm-select-selection-item) {
  552. color: #fff !important;
  553. }
  554. .data-container {
  555. margin-top: 40px;
  556. display: flex;
  557. width: 100%;
  558. height: 100%;
  559. }
  560. .line-chart {
  561. flex: 3; /* 占据 3/4 的空间 */
  562. width: 100%;
  563. height: 400px;
  564. }
  565. .data-content {
  566. flex: 1; /* 占据 1/4 的空间 */
  567. height: 400px;
  568. display: flex;
  569. flex-direction: column; /* 垂直排列进度条 */
  570. // align-items: center; /* 水平居中 */
  571. margin: 10px;
  572. .title {
  573. font-size: 18px;
  574. font-weight: 600;
  575. color: #fff;
  576. margin-bottom: 20px;
  577. }
  578. .explain {
  579. color: var(--vent-table-action-link);
  580. margin-top: 18px;
  581. }
  582. }
  583. .progress {
  584. width: 100%;
  585. height: 20px;
  586. margin-top: 10px;
  587. }
  588. .progress-label {
  589. margin-top: 20px;
  590. text-align: left;
  591. margin-bottom: 5px;
  592. color: #fff;
  593. }
  594. ::deep .progress-text {
  595. color: #fff !important; /* 自定义百分比文字颜色 */
  596. }
  597. .blast-delta-container {
  598. margin: 50px;
  599. }
  600. .yellow-progress .ant-progress-bg {
  601. background-color: yellow !important;
  602. }
  603. :deep(.zxm-table-thead > tr > th:last-child) {
  604. border-right: 1px solid #91e9fe !important;
  605. }
  606. </style>