index.vue 9.3 KB

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