CommonListPage.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <!-- 资讯详情页 -->
  3. <div class="main-background">
  4. <div class="nav-placeholder"></div>
  5. <!-- 新闻 -->
  6. <section class="main-section main-background main-background-type0 small-h">
  7. <div class="content mb-2">
  8. <!-- 路径 -->
  9. <a-breadcrumb>
  10. <a-breadcrumb-item><a href="javascript:;" @click="navTo('/')">首页</a></a-breadcrumb-item>
  11. <a-breadcrumb-item v-if="prevPage"><a href="javascript:;" @click="prevPage.url ? navTo(prevPage.url) : back()">{{ prevPage.title }}</a></a-breadcrumb-item>
  12. <a-breadcrumb-item>{{ title }}</a-breadcrumb-item>
  13. </a-breadcrumb>
  14. </div>
  15. <CommonListBlock v-bind="props"></CommonListBlock>
  16. </section>
  17. </div>
  18. </template>
  19. <script setup lang="ts">
  20. import { type PropType } from 'vue';
  21. import { usePageAction } from '@/composeable/PageAction';
  22. import CommonListBlock from './CommonListBlock.vue';
  23. import type { DropdownCommonItem, DropDownNames } from './CommonListBlock.vue';
  24. export type { DropdownCommonItem, DropDownNames }
  25. const { navTo, back } = usePageAction();
  26. const props = defineProps({
  27. title: {
  28. type: String,
  29. default: '',
  30. },
  31. prevPage: {
  32. type: Object as PropType<{
  33. title: string,
  34. url?: string,
  35. }>,
  36. default: null,
  37. },
  38. dropDownNames: {
  39. type: Object as PropType<DropDownNames[]>,
  40. default: null,
  41. },
  42. showSearch: {
  43. type: Boolean,
  44. default: true,
  45. },
  46. showTableSwitch: {
  47. type: Boolean,
  48. default: false,
  49. },
  50. tableSwitchOptions: {
  51. type: Object,
  52. default: () => ({}),
  53. },
  54. tagsData: {
  55. type: Object as PropType<{
  56. id: number,
  57. name: string,
  58. }[]>,
  59. default: null,
  60. },
  61. pageSize: {
  62. type: Number,
  63. default: 8,
  64. },
  65. rowCount: {
  66. type: Number,
  67. default: 2,
  68. },
  69. rowType: {
  70. type: Number,
  71. default: 1,
  72. },
  73. defaultSelectTag: {
  74. type: Number,
  75. default: 1,
  76. },
  77. load: {
  78. type: Function as PropType<(
  79. page: number,
  80. pageSize: number,
  81. selectedTag: number,
  82. searchText: string,
  83. dropDownValues: number[],
  84. ) => Promise<{
  85. page: number,
  86. total: number,
  87. data: any[],
  88. }>>,
  89. required: true,
  90. },
  91. showDetail: {
  92. type: Function as PropType<(item: any) => void>,
  93. default: null,
  94. },
  95. /**
  96. * 点击详情跳转页面路径
  97. */
  98. detailsPage: {
  99. type: String,
  100. default: '/news/detail'
  101. },
  102. /**
  103. * 详情跳转页面参数
  104. */
  105. detailsParams: {
  106. type: Object as PropType<Record<string, any>>,
  107. default: () => ({})
  108. },
  109. defaultImage: {
  110. type: String,
  111. default: ''
  112. },
  113. })
  114. </script>
  115. <style lang="scss">
  116. @use "@/assets/scss/colors";
  117. .search-icon {
  118. width: 25px;
  119. height: 25px;
  120. cursor: pointer;
  121. color: colors.$primary-color;
  122. }
  123. </style>