moveable.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <!-- 文化传承 - 可移动文物 -->
  3. <CommonListPage
  4. :title="'可移动文物'"
  5. :prevPage="{ title: '保护传承' }"
  6. :dropDownNames="dropdownNames"
  7. :pageSize="8"
  8. :rowType="2"
  9. :load="loadData"
  10. :loadDetail="loadDetail"
  11. :tagsData="tagsData"
  12. :defaultSelectTag="tagsData[0].id"
  13. detailsPage="/inheritor/artifact-detail"
  14. />
  15. </template>
  16. <script setup lang="ts">
  17. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  18. import MoveableContent from '@/api/inheritor/MoveableContent';
  19. import type { DropDownNames } from '@/components/content/CommonListPage.vue';
  20. import { onMounted, ref } from 'vue';
  21. async function loadDetail(id: number, item: any) {
  22. const res = await MoveableContent.getContentDetail(id);
  23. res.addItems = [
  24. { name: '地理位置', text: item.code, span: 12 },
  25. { name: '建筑时间', text: item.ichTypeText, span: 12 },
  26. { name: '保护级别', text: item.levelText, span: 12 },
  27. ];
  28. return res;
  29. }
  30. async function loadData(
  31. page: number,
  32. pageSize: number,
  33. selectedTag: number,
  34. searchText: string,
  35. dropDownValues: number[]
  36. ) {
  37. const res = await MoveableContent.getContentList(new GetContentListParams().setSelfValues({
  38. crType: selectedTag == 0 ? undefined: selectedTag,
  39. level: dropDownValues[0] == 0 ? undefined: dropDownValues[0],
  40. region: dropDownValues[1] == 0 ? undefined: dropDownValues[1],
  41. keywords: searchText,
  42. }), page, pageSize);
  43. return {
  44. page: page,
  45. total: res.total,
  46. data: res.list.map((item, index) => {
  47. return {
  48. id: item.id,
  49. title: item.title ?? '!!title!!',
  50. desc: item.desc,
  51. image: item.image,
  52. addItems: [
  53. { name: '地理位置', text: item.code, span: 12 },
  54. { name: '建筑时间', text: item.ichTypeText, span: 12 },
  55. { name: '保护级别', text: item.declarationRegion, span: 12 },
  56. ],
  57. };
  58. }),
  59. }
  60. }
  61. const dropdownNames = ref<DropDownNames[]>([]);
  62. //子分类
  63. const tagsData = ref([
  64. { id: 0, name: '全部' },
  65. ]);
  66. onMounted(async () => {
  67. tagsData.value = tagsData.value.concat((await CommonContent.getCategoryList(3)).map((item) => ({
  68. id: item.id,
  69. name: item.title,
  70. })));
  71. dropdownNames.value.push({
  72. options: [{
  73. id: 0,
  74. name: '全部'
  75. }].concat((await CommonContent.getCategoryList(2)).map((item) => ({
  76. id: item.id,
  77. name: item.title,
  78. }))),
  79. defaultSelectedValue: 0,
  80. });
  81. dropdownNames.value.push({
  82. options: [{
  83. id: 0,
  84. name: '全部'
  85. }].concat((await CommonContent.getCategoryList(1)).map((item) => ({
  86. id: item.id,
  87. name: item.title,
  88. }))),
  89. defaultSelectedValue: 0,
  90. });
  91. })
  92. </script>
  93. <style>
  94. </style>