index.vue 12 KB

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