index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  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 = data.map((item: any) => parseFloat(item.n2_max));
  101. const n2AveValues = data.map((item: any) => parseFloat(item.n2_ave));
  102. const no2MaxValues = data.map((item: any) => parseFloat(item.no2_max));
  103. const no2AveValues = data.map((item: any) => parseFloat(item.no2_ave));
  104. const option = {
  105. title: {
  106. text: '束管日报分析',
  107. textStyle: {
  108. color: '#ffffff', // 设置标题颜色
  109. },
  110. left: 'center', // 水平居中
  111. top: '0', // 设置标题距离顶部的距离
  112. },
  113. tooltip: {
  114. trigger: 'axis',
  115. backgroundColor: 'rgba(28, 72, 105, 0.5)', // 设置 tooltip 背景为透明
  116. textStyle: {
  117. color: '#ffffff', // 设置 tooltip 字体颜色为白色
  118. },
  119. axisPointer: {
  120. type: 'shadow',
  121. label: {
  122. show: true,
  123. backgroundColor: '#1c4869',
  124. },
  125. },
  126. },
  127. legend: {
  128. top: '8%',
  129. textStyle: {
  130. color: '#ffffffff',
  131. },
  132. width: '80%', // 设置图例的宽度
  133. orient: 'horizontal', // 水平布局
  134. pageIconColor: '#ffffff', // 设置翻页图标颜色
  135. pageTextStyle: {
  136. color: '#ffffff', // 设置翻页文字颜色
  137. },
  138. },
  139. xAxis: {
  140. type: 'category',
  141. data: categories,
  142. splitLine: { show: true, lineStyle: { color: 'rgba(28, 72, 105, 0.5)' } },
  143. axisLabel: {
  144. interval: 0, // 显示所有标签
  145. color: '#ffffff', // 设置 x 轴字体颜色
  146. formatter: function (value: string) {
  147. return value.length > 8 ? value.slice(0, 8) + '...' : value; // 截断长标签
  148. },
  149. },
  150. },
  151. yAxis: {
  152. type: 'value',
  153. splitLine: { show: true, lineStyle: { color: 'rgba(28, 72, 105, 0.5)' } },
  154. axisLabel: {
  155. color: '#ffffff',
  156. },
  157. },
  158. grid: {
  159. top: '21%', // 设置 grid 距离顶部的距离,增加间隔
  160. left: '3%',
  161. right: '4%',
  162. bottom: '3%',
  163. containLabel: true,
  164. },
  165. series: [
  166. {
  167. name: 'C₂H₂最大值',
  168. data: c2h2MaxValues,
  169. type: 'bar',
  170. },
  171. {
  172. name: 'C₂H₂平均值',
  173. data: c2h2AveValues,
  174. type: 'bar',
  175. },
  176. {
  177. name: 'C₂H₄最大值',
  178. data: c2h4MaxValues,
  179. type: 'bar',
  180. },
  181. {
  182. name: 'C₂H₄平均值',
  183. data: c2h4AveValues,
  184. type: 'bar',
  185. },
  186. {
  187. name: 'CH₄最大值',
  188. data: ch4MaxValues,
  189. type: 'bar',
  190. },
  191. {
  192. name: 'CH₄平均值',
  193. data: ch4AveValues,
  194. type: 'bar',
  195. },
  196. {
  197. name: 'CO₂最大值',
  198. data: co2MaxValues,
  199. type: 'bar',
  200. },
  201. {
  202. name: 'CO₂平均值',
  203. data: co2AveValues,
  204. type: 'bar',
  205. },
  206. {
  207. name: 'CO最大值',
  208. data: coMaxValues,
  209. type: 'bar',
  210. },
  211. {
  212. name: 'CO平均值',
  213. data: coAveValues,
  214. type: 'bar',
  215. },
  216. {
  217. name: 'O₂最小值',
  218. data: o2MinValues,
  219. type: 'bar',
  220. },
  221. {
  222. name: 'O₂平均值',
  223. data: o2AveValues,
  224. type: 'bar',
  225. },
  226. {
  227. name: 'N₂最大值',
  228. data: n2MaxValues,
  229. type: 'bar',
  230. },
  231. {
  232. name: 'N₂平均值',
  233. data: n2AveValues,
  234. type: 'bar',
  235. },
  236. {
  237. name: 'NO₂最大值',
  238. data: no2MaxValues,
  239. type: 'bar',
  240. },
  241. {
  242. name: 'NO₂平均值',
  243. data: no2AveValues,
  244. type: 'bar',
  245. },
  246. ],
  247. };
  248. myChart.setOption(option);
  249. }
  250. //跳转到爆炸三角形
  251. function toDetail(record: any) {
  252. posMonitor.value = record;
  253. modalVisible.value = true;
  254. }
  255. //获取束管日报
  256. async function getTableList(params: any) {
  257. let res = await getBundleInfoList({ type: 'bundle', ...params });
  258. const content = res.content;
  259. let contentArr = JSON.parse(content);
  260. const contentNewArr = computed(() => {
  261. return contentArr.map((item) => {
  262. let internalFireWarnLevel = '';
  263. const co = item.co_ave;
  264. const co2 = item.co2_ave;
  265. const c2h4 = item.c2h4_ave;
  266. const c2h2 = item.c2h2_ave;
  267. const coRatio = co / co2;
  268. if (co >= 0 && co <= 13.75) {
  269. internalFireWarnLevel = '潜伏期阶段';
  270. } else if (co > 13.75 && co < 67.2 && coRatio < 0.095) {
  271. internalFireWarnLevel = '缓慢氧化升温阶段';
  272. } else if ((co >= 67.2 && co < 1606.3) || (coRatio >= 0.095 && coRatio < 0.322) || c2h4 < 2) {
  273. internalFireWarnLevel = '加速氧化阶段';
  274. } else if (co >= 1606.3 || coRatio >= 0.322 || c2h4 >= 2 || c2h2 > 0) {
  275. internalFireWarnLevel = '剧烈氧化阶段';
  276. }
  277. return { ...item, internalFireWarnLevel };
  278. });
  279. });
  280. total.value = contentArr.length;
  281. qfqCount.value = contentNewArr.value.filter((item: any) => item.internalFireWarnLevel === '潜伏期阶段').length;
  282. latentCount.value = contentNewArr.value.filter((item: any) => item.internalFireWarnLevel === '缓慢氧化升温阶段').length;
  283. selfHeatingCount.value = contentNewArr.value.filter((item: any) => item.internalFireWarnLevel === '加速氧化阶段').length;
  284. combustionCount.value = contentNewArr.value.filter((item: any) => item.internalFireWarnLevel === '剧烈氧化阶段').length;
  285. qfqPercent.value = (qfqCount.value / total.value) * 100;
  286. latentPercent.value = (latentCount.value / total.value) * 100;
  287. selfHeatingPercent.value = (selfHeatingCount.value / total.value) * 100;
  288. combustionPercent.value = (combustionCount.value / total.value) * 100;
  289. tableData.value = contentNewArr.value;
  290. nextTick(() => {
  291. updateChart(contentArr);
  292. });
  293. }
  294. //获取所有文件列表
  295. async function getAllFile() {
  296. let res = await getAllFileList({ type: 'bundle' });
  297. selectList.value = res.records.map((item: any) => ({
  298. fileId: item.fileId,
  299. fileName: item.fileName,
  300. }));
  301. jcddArr.value = res.records.map((item: any) => ({
  302. fileId: item.jcdd,
  303. }));
  304. if (selectList.value.length > 0) {
  305. formSearch.fileId = selectList.value[0].fileId;
  306. getSearch();
  307. }
  308. }
  309. // 处理文件点击事件
  310. function handleFileClick(item: any) {
  311. formSearch.fileId = item.fileId;
  312. formSearch.fileName = item.fileName;
  313. selectedFileId.value = item.fileId;
  314. getSearch();
  315. }
  316. //查询
  317. function getSearch() {
  318. const selectedFile = selectList.value.find((item) => item.fileId === formSearch.fileId);
  319. const params = {
  320. fileId: formSearch.fileId,
  321. fileName: selectedFile ? selectedFile.fileName : '',
  322. };
  323. getTableList(params);
  324. }
  325. onMounted(() => {
  326. getTableList({ type: 'bundle' });
  327. getAllFile().then(() => {
  328. if (selectList.value.length > 0) {
  329. formSearch.fileId = selectList.value[0].fileId;
  330. selectedFileId.value = selectList.value[0].fileId;
  331. getSearch();
  332. }
  333. });
  334. });
  335. </script>
  336. <style lang="less" scoped>
  337. @import '/@/design/theme.less';
  338. .content-container {
  339. display: flex;
  340. width: 100%;
  341. height: 100%;
  342. padding-top: 54px;
  343. }
  344. .file-list {
  345. width: 20%;
  346. padding: 10px;
  347. margin-right: 10px;
  348. margin-bottom: 50px;
  349. border: 1px solid #99e8ff66;
  350. background: #27546e1a;
  351. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  352. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  353. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  354. }
  355. .file-list ul {
  356. list-style: none;
  357. padding: 0;
  358. }
  359. .file-list li {
  360. color: #fff;
  361. padding: 5px;
  362. cursor: pointer;
  363. }
  364. .file-list li:hover,
  365. .file-list li.selected {
  366. background: #1c4869;
  367. }
  368. .table-container {
  369. margin-top: 10px;
  370. width: 80%;
  371. box-sizing: border-box;
  372. }
  373. .data-container {
  374. display: flex;
  375. width: 100%;
  376. height: 100%;
  377. }
  378. .bar-chart {
  379. flex: 3; /* 占据 3/4 的空间 */
  380. width: 100%;
  381. height: 400px;
  382. }
  383. .data-content {
  384. flex: 1; /* 占据 1/4 的空间 */
  385. height: 400px;
  386. display: flex;
  387. flex-direction: column; /* 垂直排列进度条 */
  388. // align-items: center; /* 水平居中 */
  389. margin: 10px;
  390. .title {
  391. font-size: 18px;
  392. font-weight: 600;
  393. color: #fff;
  394. margin-bottom: 20px;
  395. }
  396. .explain {
  397. color: var(--vent-table-action-link);
  398. margin-top: 18px;
  399. }
  400. }
  401. .dustMonitor {
  402. width: 100%;
  403. height: 100%;
  404. padding: 10px 10px 15px 10px;
  405. box-sizing: border-box;
  406. position: relative;
  407. }
  408. .yellow-progress .ant-progress-bg {
  409. background-color: yellow !important;
  410. }
  411. :deep(.zxm-table-thead > tr > th:last-child) {
  412. border-right: 1px solid #91e9fe !important;
  413. }
  414. :deep(.zxm-picker-input > input) {
  415. color: #fff;
  416. }
  417. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  418. border: 1px solid var(--vent-form-item-border) !important;
  419. background-color: #ffffff00 !important;
  420. }
  421. :deep(.zxm-select-selection-item) {
  422. color: #fff !important;
  423. }
  424. .blast-delta-container {
  425. margin: 50px;
  426. display: flex;
  427. justify-content: space-between;
  428. }
  429. .progress {
  430. width: 100%;
  431. height: 20px;
  432. margin-top: 10px;
  433. }
  434. .progress-label {
  435. margin-top: 20px;
  436. text-align: left;
  437. margin-bottom: 5px;
  438. color: #fff;
  439. }
  440. ::deep .progress-text {
  441. color: #fff !important; /* 自定义百分比文字颜色 */
  442. }
  443. </style>