index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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.fileId" :class="{ selected: item.fileId === selectedFileId }" @click="handleFileClick(item)">
  8. {{ item.fileName }}
  9. </li>
  10. </ul>
  11. </div>
  12. <div class="table-container">
  13. <a-table :columns="columns" :data-source="tableData" size="small" :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 v-else>
  19. <template v-if="record[column.dataIndex] === null">
  20. <span>-</span>
  21. </template>
  22. </template>
  23. </template>
  24. </a-table>
  25. <div class="data-container">
  26. <div id="barChart" class="bar-chart"></div>
  27. <div class="data-content">
  28. <div class="title">煤自燃阶段统计分析</div>
  29. <div class="explain">测点共计{{ total }}个</div>
  30. <div class="progress-label">潜伏期阶段:{{ qfqCount }}</div>
  31. <Progress :percent="qfqPercent" size="default" strokeColor="green" :show-info="true" :format="() => qfqCount" />
  32. <div class="progress-label">缓慢氧化升温阶段:{{ latentCount }}</div>
  33. <Progress :percent="latentPercent" size="default" strokeColor="yellow" :show-info="true" :format="() => latentCount" />
  34. <div class="progress-label">加速氧化升温阶段:{{ selfHeatingCount }}</div>
  35. <Progress :percent="selfHeatingPercent" size="default" strokeColor="orange‌" :show-info="true" :format="() => selfHeatingCount" />
  36. <div class="progress-label">剧烈氧化升温阶段:{{ combustionCount }}</div>
  37. <Progress :percent="combustionPercent" size="default" strokeColor="red" :show-info="true" :format="() => combustionCount" />
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <a-modal style="width: 60%; height: 300px" title="爆炸三角形" v-model:visible="modalVisible" :draggable="true" :footer="null">
  43. <div class="blast-delta-container">
  44. <BlastDelta :posMonitor="posMonitor" style="width: calc(50% - 20px)" />
  45. <BlastDelta1 :posMonitor="posMonitor" style="width: calc(50% - 20px)" />
  46. </div>
  47. </a-modal>
  48. </div>
  49. </template>
  50. <script setup lang="ts">
  51. import { ref, onMounted, computed, shallowRef, reactive, nextTick } from 'vue';
  52. import { columns } from './bundle-table.data';
  53. import { getBundleInfoList, getAllFileList } from './bundle-table.api';
  54. import customHeader from '/@/components/vent/customHeader.vue';
  55. // import { blastDelta } from './modal/blastDelta.vue';
  56. import BlastDelta from './modal/blastDelta.vue';
  57. import BlastDelta1 from './modal/blastDelta1.vue';
  58. import * as echarts from 'echarts';
  59. import { Progress } from 'ant-design-vue';
  60. import { useGlobSetting } from '/@/hooks/setting';
  61. // import 'ant-design-vue/dist/antd.css'; // 引入样式
  62. let selectList = ref<any[]>([]);
  63. let jcddArr = ref<any[]>([]);
  64. let formSearch = reactive({
  65. pageNum: 1,
  66. pageSize: 1000,
  67. fileId: '',
  68. fileName: '',
  69. });
  70. const total = ref(0);
  71. const { sysOrgCode } = useGlobSetting();
  72. const qfqCount = ref(0); // 潜伏期
  73. const latentCount = ref(0); // 缓慢氧化阶段(潜伏期)
  74. const selfHeatingCount = ref(0); // 加速氧化阶段(自热期)
  75. const combustionCount = ref(0); // 剧烈氧化阶段(燃烧期)
  76. const qfqPercent = ref(0); // 潜伏期(潜伏期)
  77. const latentPercent = ref(0); // 缓慢氧化阶段(潜伏期)
  78. const selfHeatingPercent = ref(0); // 加速氧化阶段(自热期)
  79. const combustionPercent = ref(0); // 剧烈氧化阶段(燃烧期)
  80. let tableData = ref<any[]>([]);
  81. let modalVisible = ref(false);
  82. let selectedFileId = ref<string | null>(null);
  83. const posMonitor = shallowRef({});
  84. function updateChart(data: any) {
  85. const chartDom = document.getElementById('barChart');
  86. const myChart = echarts.init(chartDom);
  87. const categories = data.map((item: any) => item.jcdd);
  88. const c2h2MaxValues = data.map((item: any) => parseFloat(item.c2h2_max));
  89. const c2h2AveValues = data.map((item: any) => parseFloat(item.c2h2_ave));
  90. const c2h4MaxValues = data.map((item: any) => parseFloat(item.c2h4_max));
  91. const c2h4AveValues = data.map((item: any) => parseFloat(item.c2h4_ave));
  92. const ch4MaxValues = data.map((item: any) => parseFloat(item.ch4_max));
  93. const ch4AveValues = data.map((item: any) => parseFloat(item.ch4_ave));
  94. const co2MaxValues = data.map((item: any) => parseFloat(item.co2_max));
  95. const co2AveValues = data.map((item: any) => parseFloat(item.co2_ave));
  96. const coMaxValues = data.map((item: any) => parseFloat(item.co_max));
  97. const coAveValues = data.map((item: any) => parseFloat(item.co_ave));
  98. const o2MinValues = data.map((item: any) => parseFloat(item.o2_min));
  99. const o2AveValues = data.map((item: any) => parseFloat(item.o2_ave));
  100. // const n2MaxValues = computed(() => {
  101. // switch (sysOrgCode) {
  102. // case 'sdmtjtdltmk':
  103. // return data.map((item: any) => parseFloat(item.n2_max)); // 大柳塔对应的列配置
  104. // case 'sdmtjtswmk':
  105. // return data.map((item: any) => parseFloat(item.n2_max)); // 上湾对应的列配置
  106. // default:
  107. // return; // 默认情况下返回的列配置
  108. // }
  109. // });
  110. // const n2AveValues = computed(() => {
  111. // switch (sysOrgCode) {
  112. // case 'sdmtjtdltmk':
  113. // return data.map((item: any) => parseFloat(item.n2_ave)); // 大柳塔对应的列配置
  114. // case 'sdmtjtswmk':
  115. // return data.map((item: any) => parseFloat(item.n2_ave)); // 上湾对应的列配置
  116. // default:
  117. // return; // 默认情况下返回的列配置
  118. // }
  119. // });
  120. // const no2MaxValues = computed(() => {
  121. // switch (sysOrgCode) {
  122. // case 'sdmtjtdltmk':
  123. // return data.map((item: any) => parseFloat(item.no2_max)); // 大柳塔对应的列配置
  124. // case 'sdmtjtswmk':
  125. // return data.map((item: any) => parseFloat(item.no2_max)); // 上湾对应的列配置
  126. // default:
  127. // return; // 默认情况下返回的列配置
  128. // }
  129. // });
  130. // const no2AveValues = computed(() => {
  131. // switch (sysOrgCode) {
  132. // case 'sdmtjtdltmk':
  133. // return data.map((item: any) => parseFloat(item.no2_ave)); // 大柳塔对应的列配置
  134. // case 'sdmtjtswmk':
  135. // return data.map((item: any) => parseFloat(item.no2_ave)); // 上湾对应的列配置
  136. // default:
  137. // return; // 默认情况下返回的列配置
  138. // }
  139. // });
  140. const n2MaxValues = data.map((item: any) => parseFloat(item.n2_max));
  141. const n2AveValues = data.map((item: any) => parseFloat(item.n2_ave));
  142. // const no2MaxValues = data.map((item: any) => parseFloat(item.no2_max));
  143. // const no2AveValues = data.map((item: any) => parseFloat(item.no2_ave));
  144. const option = {
  145. title: {
  146. text: '束管日报分析',
  147. textStyle: {
  148. color: '#ffffff', // 设置标题颜色
  149. },
  150. left: 'center', // 水平居中
  151. top: '0', // 设置标题距离顶部的距离
  152. },
  153. tooltip: {
  154. trigger: 'axis',
  155. backgroundColor: 'rgba(28, 72, 105, 0.5)', // 设置 tooltip 背景为透明
  156. textStyle: {
  157. color: '#ffffff', // 设置 tooltip 字体颜色为白色
  158. },
  159. axisPointer: {
  160. type: 'shadow',
  161. label: {
  162. show: true,
  163. backgroundColor: '#1c4869',
  164. },
  165. },
  166. },
  167. legend: {
  168. top: '8%',
  169. textStyle: {
  170. color: '#ffffffff',
  171. },
  172. width: '80%', // 设置图例的宽度
  173. orient: 'horizontal', // 水平布局
  174. pageIconColor: '#ffffff', // 设置翻页图标颜色
  175. pageTextStyle: {
  176. color: '#ffffff', // 设置翻页文字颜色
  177. },
  178. },
  179. xAxis: {
  180. type: 'category',
  181. data: categories,
  182. splitLine: { show: true, lineStyle: { color: 'rgba(28, 72, 105, 0.5)' } },
  183. axisLabel: {
  184. interval: 0, // 显示所有标签
  185. color: '#ffffff', // 设置 x 轴字体颜色
  186. formatter: function (value: string) {
  187. return value.length > 8 ? value.slice(0, 8) + '...' : value; // 截断长标签
  188. },
  189. },
  190. },
  191. yAxis: {
  192. type: 'value',
  193. splitLine: { show: true, lineStyle: { color: 'rgba(28, 72, 105, 0.5)' } },
  194. axisLabel: {
  195. color: '#ffffff',
  196. },
  197. },
  198. grid: {
  199. top: '21%', // 设置 grid 距离顶部的距离,增加间隔
  200. left: '3%',
  201. right: '4%',
  202. bottom: '3%',
  203. containLabel: true,
  204. },
  205. series: [
  206. {
  207. name: 'C₂H₂最大值',
  208. data: c2h2MaxValues,
  209. type: 'bar',
  210. },
  211. {
  212. name: 'C₂H₂平均值',
  213. data: c2h2AveValues,
  214. type: 'bar',
  215. },
  216. {
  217. name: 'C₂H₄最大值',
  218. data: c2h4MaxValues,
  219. type: 'bar',
  220. },
  221. {
  222. name: 'C₂H₄平均值',
  223. data: c2h4AveValues,
  224. type: 'bar',
  225. },
  226. {
  227. name: 'CH₄最大值',
  228. data: ch4MaxValues,
  229. type: 'bar',
  230. },
  231. {
  232. name: 'CH₄平均值',
  233. data: ch4AveValues,
  234. type: 'bar',
  235. },
  236. {
  237. name: 'CO₂最大值',
  238. data: co2MaxValues,
  239. type: 'bar',
  240. },
  241. {
  242. name: 'CO₂平均值',
  243. data: co2AveValues,
  244. type: 'bar',
  245. },
  246. {
  247. name: 'CO最大值',
  248. data: coMaxValues,
  249. type: 'bar',
  250. },
  251. {
  252. name: 'CO平均值',
  253. data: coAveValues,
  254. type: 'bar',
  255. },
  256. {
  257. name: 'O₂最小值',
  258. data: o2MinValues,
  259. type: 'bar',
  260. },
  261. {
  262. name: 'O₂平均值',
  263. data: o2AveValues,
  264. type: 'bar',
  265. },
  266. {
  267. name: 'N₂最大值',
  268. data: n2MaxValues,
  269. type: 'bar',
  270. },
  271. {
  272. name: 'N₂平均值',
  273. data: n2AveValues,
  274. type: 'bar',
  275. },
  276. // {
  277. // name: 'NO₂最大值',
  278. // data: no2MaxValues,
  279. // type: 'bar',
  280. // },
  281. // {
  282. // name: 'NO₂平均值',
  283. // data: no2AveValues,
  284. // type: 'bar',
  285. // },
  286. ],
  287. };
  288. myChart.setOption(option);
  289. }
  290. //跳转到爆炸三角形
  291. function toDetail(record: any) {
  292. posMonitor.value = record;
  293. modalVisible.value = true;
  294. }
  295. //获取束管日报
  296. async function getTableList(params: any) {
  297. let res = await getBundleInfoList({ type: 'bundle', ...params });
  298. const content = res.content;
  299. let contentArr = JSON.parse(content);
  300. // const contentNewArr = computed(() => {
  301. // return contentArr.map((item) => {
  302. // let internalFireWarnLevel = '';
  303. // const co = item.co_ave;
  304. // const co2 = item.co2_ave;
  305. // const c2h4 = item.c2h4_ave;
  306. // const c2h2 = item.c2h2_ave;
  307. // const coRatio = co / co2;
  308. // if (co >= 0 && co <= 13.75) {
  309. // internalFireWarnLevel = '潜伏期阶段';
  310. // } else if (co > 13.75 && co < 67.2 && coRatio < 0.095) {
  311. // internalFireWarnLevel = '缓慢氧化升温阶段';
  312. // } else if ((co >= 67.2 && co < 1606.3) || (coRatio >= 0.095 && coRatio < 0.322) || c2h4 < 2) {
  313. // internalFireWarnLevel = '加速氧化阶段';
  314. // } else if (co >= 1606.3 || coRatio >= 0.322 || c2h4 >= 2 || c2h2 > 0) {
  315. // internalFireWarnLevel = '剧烈氧化阶段';
  316. // }
  317. // return { ...item, internalFireWarnLevel };
  318. // });
  319. // });
  320. total.value = contentArr.length;
  321. qfqCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '潜伏期阶段').length;
  322. latentCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '缓慢氧化升温阶段').length;
  323. selfHeatingCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '加速氧化升温阶段').length;
  324. combustionCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '剧烈氧化升温阶段').length;
  325. qfqPercent.value = (qfqCount.value / total.value) * 100;
  326. latentPercent.value = (latentCount.value / total.value) * 100;
  327. selfHeatingPercent.value = (selfHeatingCount.value / total.value) * 100;
  328. combustionPercent.value = (combustionCount.value / total.value) * 100;
  329. tableData.value = contentArr;
  330. nextTick(() => {
  331. updateChart(contentArr);
  332. });
  333. }
  334. //获取所有文件列表
  335. async function getAllFile() {
  336. let res = await getAllFileList({ type: 'bundle' });
  337. selectList.value = res.records.map((item: any) => ({
  338. fileId: item.fileId,
  339. fileName: item.fileName,
  340. }));
  341. jcddArr.value = res.records.map((item: any) => ({
  342. fileId: item.jcdd,
  343. }));
  344. if (selectList.value.length > 0) {
  345. formSearch.fileId = selectList.value[0].fileId;
  346. getSearch();
  347. }
  348. }
  349. // 处理文件点击事件
  350. function handleFileClick(item: any) {
  351. formSearch.fileId = item.fileId;
  352. formSearch.fileName = item.fileName;
  353. selectedFileId.value = item.fileId;
  354. getSearch();
  355. }
  356. //查询
  357. function getSearch() {
  358. const selectedFile = selectList.value.find((item) => item.fileId === formSearch.fileId);
  359. const params = {
  360. fileId: formSearch.fileId,
  361. fileName: selectedFile ? selectedFile.fileName : '',
  362. };
  363. getTableList(params);
  364. }
  365. onMounted(() => {
  366. getTableList({ type: 'bundle' });
  367. getAllFile().then(() => {
  368. if (selectList.value.length > 0) {
  369. formSearch.fileId = selectList.value[0].fileId;
  370. selectedFileId.value = selectList.value[0].fileId;
  371. getSearch();
  372. }
  373. });
  374. });
  375. </script>
  376. <style lang="less" scoped>
  377. @import '/@/design/theme.less';
  378. .content-container {
  379. display: flex;
  380. width: 100%;
  381. height: 100%;
  382. padding-top: 54px;
  383. }
  384. .file-list {
  385. width: 20%;
  386. padding: 10px;
  387. margin-right: 10px;
  388. margin-bottom: 50px;
  389. border: 1px solid #99e8ff66;
  390. background: #27546e1a;
  391. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  392. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  393. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  394. }
  395. .file-list ul {
  396. list-style: none;
  397. padding: 0;
  398. }
  399. .file-list li {
  400. color: #fff;
  401. padding: 5px;
  402. cursor: pointer;
  403. }
  404. .file-list li:hover,
  405. .file-list li.selected {
  406. background: #1c4869;
  407. }
  408. .table-container {
  409. margin-top: 10px;
  410. width: 80%;
  411. box-sizing: border-box;
  412. }
  413. .data-container {
  414. display: flex;
  415. width: 100%;
  416. height: 100%;
  417. }
  418. .bar-chart {
  419. flex: 3; /* 占据 3/4 的空间 */
  420. width: 100%;
  421. height: 400px;
  422. }
  423. .data-content {
  424. flex: 1; /* 占据 1/4 的空间 */
  425. height: 400px;
  426. display: flex;
  427. flex-direction: column; /* 垂直排列进度条 */
  428. // align-items: center; /* 水平居中 */
  429. margin: 10px;
  430. .title {
  431. font-size: 18px;
  432. font-weight: 600;
  433. color: #fff;
  434. margin-bottom: 20px;
  435. }
  436. .explain {
  437. color: var(--vent-table-action-link);
  438. margin-top: 18px;
  439. }
  440. }
  441. .dustMonitor {
  442. width: 100%;
  443. height: 100%;
  444. padding: 10px 10px 15px 10px;
  445. box-sizing: border-box;
  446. position: relative;
  447. }
  448. .yellow-progress .ant-progress-bg {
  449. background-color: yellow !important;
  450. }
  451. :deep(.zxm-table-thead > tr > th:last-child) {
  452. border-right: 1px solid #91e9fe !important;
  453. }
  454. :deep(.zxm-picker-input > input) {
  455. color: #fff;
  456. }
  457. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  458. border: 1px solid var(--vent-form-item-border) !important;
  459. background-color: #ffffff00 !important;
  460. }
  461. :deep(.zxm-select-selection-item) {
  462. color: #fff !important;
  463. }
  464. .blast-delta-container {
  465. margin: 50px;
  466. display: flex;
  467. justify-content: space-between;
  468. }
  469. .progress {
  470. width: 100%;
  471. height: 20px;
  472. margin-top: 10px;
  473. }
  474. .progress-label {
  475. margin-top: 20px;
  476. text-align: left;
  477. margin-bottom: 5px;
  478. color: #fff;
  479. }
  480. ::deep .progress-text {
  481. color: #fff !important; /* 自定义百分比文字颜色 */
  482. }
  483. </style>