knowledgeWarehouse.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <Dialog custom-show type="xl" title="知识库列表" hide-footer @close="closeDialog">
  3. <!-- 表格组件 -->
  4. <div class="common-table">
  5. <div class="table-header">
  6. <div class="td">报告编号</div>
  7. <div class="td">报告名称</div>
  8. <div class="td">主题词</div>
  9. <div class="td">事件类型</div>
  10. <div class="td">摘要</div>
  11. <div class="td">来源单位</div>
  12. <div class="td">发布时间</div>
  13. </div>
  14. <div v-for="(item, index) in tableData" :key="index" class="tr">
  15. <div class="td">{{ item.reportId }}</div>
  16. <div class="td">{{ item.reportName }}</div>
  17. <div class="td">{{ item.subject }}</div>
  18. <div class="td">
  19. <dict-tag :options="mm_event_type" :value="item.eventType" />
  20. </div>
  21. <div class="td">{{ item.summary }}</div>
  22. <div class="td">{{ item.publishingUnit }}</div>
  23. <div class="td">{{ item.publishDate }}</div>
  24. </div>
  25. </div>
  26. <div class="footer">
  27. <el-pagination
  28. background
  29. :hide-on-single-page="true"
  30. :total="total"
  31. :page-size="queryParams.pageSize"
  32. :current-page="queryParams.pageNum"
  33. @current-change="handleChangePage"
  34. />
  35. </div>
  36. </Dialog>
  37. </template>
  38. <script setup lang="ts">
  39. import { reactive } from 'vue';
  40. import { fetchReports } from '@/api/knowledge/index';
  41. import { parseTime } from '@/utils/ruoyi';
  42. const emit = defineEmits(['update:show']);
  43. const closeDialog = () => {
  44. emit('update:show', false);
  45. };
  46. const proxy = getCurrentInstance()?.proxy;
  47. const { mm_event_type } = toRefs<any>(
  48. proxy?.useDict('mm_event_type')
  49. );
  50. const queryParams = reactive({
  51. pageNum: 1,
  52. pageSize: 10,
  53. sortBy: 'publishDate',
  54. sortOrder: 'desc'
  55. });
  56. let total = ref(0);
  57. const tableData = ref([]);
  58. const handleChangePage = (newNum) => {
  59. queryParams.pageNum = newNum;
  60. getList();
  61. };
  62. // getLists是获取列表数据的方法
  63. const getList = async () => {
  64. fetchReports(queryParams).then((res) => {
  65. let data = res.data;
  66. data.forEach((item) => {
  67. item.publishDate = parseTime(item.publishDate, '{y}-{m}-{d} {h}:{i}:{s}');
  68. });
  69. total.value = res.total;
  70. tableData.value = data;
  71. });
  72. };
  73. onMounted(() => {
  74. getList();
  75. });
  76. </script>
  77. <style lang="scss" scoped>
  78. .footer {
  79. height: 64px;
  80. display: flex;
  81. justify-content: flex-end;
  82. margin: 30px 0;
  83. .pagination-container {
  84. height: 64px;
  85. margin: 0;
  86. }
  87. :deep(.el-pagination__total) {
  88. color: #a7ccdf;
  89. font-size: 32px;
  90. }
  91. :deep(.el-pagination) {
  92. .btn-next,
  93. .btn-prev {
  94. background-color: transparent;
  95. border: none;
  96. .el-icon {
  97. font-size: 22px;
  98. color: #a7ccdf;
  99. }
  100. }
  101. .btn-prev:disabled,
  102. .btn-next:disabled {
  103. background-color: transparent;
  104. border: none;
  105. }
  106. .el-pager li {
  107. width: 64px;
  108. height: 64px;
  109. line-height: 64px;
  110. text-align: center;
  111. font-size: 38px;
  112. color: #a7ccdf;
  113. background-color: #0e3064;
  114. border: 1px solid #0c57a7;
  115. margin: 0 6px;
  116. &:hover {
  117. background-color: #038dff;
  118. border: 1px solid #038dff;
  119. }
  120. }
  121. .el-pager li.is-active {
  122. background-color: #038dff;
  123. border: 1px solid #038dff;
  124. }
  125. .el-pagination__goto {
  126. font-size: 38px;
  127. color: #a7ccdf;
  128. }
  129. }
  130. }
  131. </style>