index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div class="dustMonitor">
  3. <customHeader>束管日报表</customHeader>
  4. <a-table :columns="columns" :data-source="tableData" size="small" :scroll="{ y: 500 }" class="tableW"> </a-table>
  5. </div>
  6. </template>
  7. <script setup lang="ts">
  8. import { ref, onMounted } from 'vue';
  9. import { columns } from './bundle-table.data';
  10. import { getBundleInfoList } from './bundle-table.api';
  11. import customHeader from '/@/components/vent/customHeader.vue';
  12. let tableData = ref<any[]>([]);
  13. //获取粉尘监测结果数据
  14. async function getTableList() {
  15. let res = await getBundleInfoList({ type: 'bundle' });
  16. console.log('API 返回的数据:', res); // 打印 API 返回的完整数据
  17. if (res && res.result && typeof res.result.content === 'string') {
  18. try {
  19. let content = JSON.parse(res.result.content);
  20. if (Array.isArray(content)) {
  21. content.forEach((element) => {
  22. element.zygx = '生产\n检修'; // 新增 zygx 字段
  23. });
  24. tableData.value = content;
  25. } else {
  26. console.error('解析后的 content 不是一个数组:', content);
  27. }
  28. } catch (error) {
  29. console.error('解析 content 字符串时出错:', error);
  30. }
  31. }
  32. }
  33. onMounted(() => {
  34. getTableList();
  35. });
  36. </script>
  37. <style lang="less" scoped>
  38. @import '/@/design/theme.less';
  39. .dustMonitor {
  40. width: 100%;
  41. height: 100%;
  42. padding: 80px 10px 15px 10px;
  43. box-sizing: border-box;
  44. position: relative;
  45. }
  46. :deep(.zxm-table-thead > tr > th:last-child) {
  47. border-right: 1px solid #91e9fe !important;
  48. }
  49. :deep(.zxm-picker-input > input) {
  50. color: #fff;
  51. }
  52. :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
  53. border: 1px solid var(--vent-form-item-border) !important;
  54. background-color: #ffffff00 !important;
  55. }
  56. :deep(.zxm-select-selection-item) {
  57. color: #fff !important;
  58. }
  59. </style>