index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="dustMonitor">
  3. <customHeader>粉尘日常监测报表</customHeader>
  4. <div class="select-container">
  5. <span class="select-label">选择文件:</span>
  6. <a-select v-model:value="formSearch.fileId" style="width: 220px" size="small" placeholder="请选择...">
  7. <a-select-option v-for="item in selectList" :key="item.fileId">{{ item.fileName }}</a-select-option>
  8. </a-select>
  9. <a-button type="primary" style="margin-left: 10px" @click="getSearch">查询</a-button>
  10. </div>
  11. <a-table :columns="columns" :data-source="tableData" size="small" :scroll="{ y: 500 }" class="tableW"> </a-table>
  12. </div>
  13. </template>
  14. <script setup lang="ts">
  15. import { ref, onMounted, reactive } from 'vue';
  16. import { columns } from './dust-table.data';
  17. import { getDustInfoList, getAllFileList } from './dsut-table.api';
  18. import customHeader from '/@/components/vent/customHeader.vue';
  19. let tableData = ref<any[]>([]);
  20. let selectList = ref<any[]>([]);
  21. let formSearch = reactive({
  22. pageNum: 1,
  23. pageSize: 1000,
  24. fileId: '',
  25. fileName: '',
  26. });
  27. //获取粉尘监测结果数据
  28. async function getTableList(params: any) {
  29. let res = await getDustInfoList({ type: 'smoke', ...params });
  30. const content = res.content;
  31. let contentArr = JSON.parse(content);
  32. tableData.value = contentArr;
  33. }
  34. //获取所有文件列表
  35. async function getAllFile() {
  36. let res = await getAllFileList({ type: 'smoke' });
  37. selectList.value = res.records.map((item: any) => ({
  38. fileId: item.fileId,
  39. fileName: item.fileName,
  40. }));
  41. }
  42. //查询
  43. function getSearch() {
  44. const selectedFile = selectList.value.find((item) => item.fileId === formSearch.fileId);
  45. const params = {
  46. fileId: formSearch.fileId,
  47. fileName: selectedFile ? selectedFile.fileName : '',
  48. };
  49. getTableList(params);
  50. }
  51. onMounted(() => {
  52. getTableList({ type: 'smoke' });
  53. getAllFile();
  54. });
  55. </script>
  56. <style lang="less" scoped>
  57. @import '/@/design/theme.less';
  58. .dustMonitor {
  59. width: 100%;
  60. height: 100%;
  61. padding: 80px 10px 15px 10px;
  62. box-sizing: border-box;
  63. position: relative;
  64. }
  65. .select-container {
  66. display: flex;
  67. align-items: center;
  68. margin-bottom: 10px;
  69. }
  70. .select-label {
  71. margin-right: 10px;
  72. color: white;
  73. }
  74. .action-link {
  75. color: #1890ff;
  76. cursor: pointer;
  77. }
  78. .dustMonitor {
  79. width: 100%;
  80. height: 100%;
  81. padding: 80px 10px 15px 10px;
  82. box-sizing: border-box;
  83. position: relative;
  84. }
  85. :deep(.zxm-table-thead > tr > th:last-child) {
  86. border-right: 1px solid #91e9fe !important;
  87. }
  88. :deep(.zxm-picker-input > input) {
  89. color: #fff;
  90. }
  91. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  92. border: 1px solid var(--vent-form-item-border) !important;
  93. background-color: #ffffff00 !important;
  94. }
  95. :deep(.zxm-select-selection-item) {
  96. color: #fff !important;
  97. }
  98. </style>