index.vue 18 KB

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