index.vue 12 KB

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