index.vue 13 KB

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