index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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: 500 }" class="tableW"> </a-table>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script setup lang="ts">
  19. import { ref, onMounted, reactive } from 'vue';
  20. import { columns } from './bundleSpy-table.data';
  21. import { getbundleSpyInfoList, getAllFileList } from './bundleSpy-table.api';
  22. import customHeader from '/@/components/vent/customHeader.vue';
  23. let selectList = ref<any[]>([]);
  24. let formSearch = reactive({
  25. pageNum: 1,
  26. pageSize: 1000,
  27. fileId: '',
  28. fileName: '',
  29. });
  30. let tableData = ref<any[]>([]);
  31. let selectedFileId = ref<string | null>(null);
  32. //获取色谱仪报表
  33. async function getTableList(params: any) {
  34. let res = await getbundleSpyInfoList({ type: 'bundleSpy', ...params });
  35. const content = res.content;
  36. let contentArr = JSON.parse(content);
  37. tableData.value = contentArr;
  38. }
  39. //获取所有文件列表
  40. async function getAllFile() {
  41. let res = await getAllFileList({ type: 'bundleSpy' });
  42. selectList.value = res.records.map((item: any) => ({
  43. fileId: item.fileId,
  44. fileName: item.fileName,
  45. }));
  46. if (selectList.value.length > 0) {
  47. formSearch.fileId = selectList.value[0].fileId;
  48. getSearch();
  49. }
  50. }
  51. // 处理文件点击事件
  52. function handleFileClick(item: any) {
  53. formSearch.fileId = item.fileId;
  54. formSearch.fileName = item.fileName;
  55. selectedFileId.value = item.fileId;
  56. getSearch();
  57. }
  58. //查询
  59. function getSearch() {
  60. const selectedFile = selectList.value.find((item) => item.fileId === formSearch.fileId);
  61. const params = {
  62. fileId: formSearch.fileId,
  63. fileName: selectedFile ? selectedFile.fileName : '',
  64. };
  65. getTableList(params);
  66. }
  67. onMounted(() => {
  68. getTableList({ type: 'bundleSpy' });
  69. getAllFile().then(() => {
  70. if (selectList.value.length > 0) {
  71. formSearch.fileId = selectList.value[0].fileId;
  72. selectedFileId.value = selectList.value[0].fileId;
  73. getSearch();
  74. }
  75. });
  76. });
  77. </script>
  78. <style lang="less" scoped>
  79. @import '/@/design/theme.less';
  80. .content-container {
  81. display: flex;
  82. width: 100%;
  83. height: 100%;
  84. }
  85. .file-list {
  86. width: 20%;
  87. padding: 10px;
  88. margin-right: 10px;
  89. margin-bottom: 50px;
  90. border: 1px solid #99e8ff66;
  91. background: #27546e1a;
  92. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  93. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  94. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  95. }
  96. .file-list ul {
  97. list-style: none;
  98. padding: 0;
  99. }
  100. .file-list li {
  101. color: #fff;
  102. padding: 5px;
  103. cursor: pointer;
  104. }
  105. .file-list li:hover,
  106. .file-list li.selected {
  107. background: #26adfc1a;
  108. }
  109. .table-container {
  110. margin-top: 10px;
  111. width: 80%;
  112. box-sizing: border-box;
  113. }
  114. .dustMonitor {
  115. width: 100%;
  116. height: 100%;
  117. padding: 10px 10px 15px 10px;
  118. box-sizing: border-box;
  119. position: relative;
  120. }
  121. :deep(.zxm-table-thead > tr > th:last-child) {
  122. border-right: 1px solid #91e9fe !important;
  123. }
  124. :deep(.zxm-picker-input > input) {
  125. color: #fff;
  126. }
  127. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  128. border: 1px solid var(--vent-form-item-border) !important;
  129. background-color: #ffffff00 !important;
  130. }
  131. :deep(.zxm-select-selection-item) {
  132. color: #fff !important;
  133. }
  134. </style>