admin-works.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <!-- 传承人作品 -->
  3. <div class="about main-background main-background-type0">
  4. <div class="nav-placeholder">
  5. </div>
  6. <!-- 表单 -->
  7. <section class="main-section large">
  8. <div class="content">
  9. <div class="title">
  10. <h2>传承人作品管理</h2>
  11. </div>
  12. <EmptyToRecord title="作品" :loader="worksData" :showEdited="false" :showAdd="false">
  13. <a-list item-layout="horizontal" :data-source="worksData?.content.value || []">
  14. <template #renderItem="{ item }">
  15. <a-list-item>
  16. <a-list-item-meta
  17. :title="item.title"
  18. :description="item.desc"
  19. >
  20. <template #avatar>
  21. <a-avatar :src="item.image" />
  22. </template>
  23. </a-list-item-meta>
  24. <template #actions>
  25. <a key="list-loadmore-edit" @click="handleGoWork(item)">编辑</a>
  26. </template>
  27. </a-list-item>
  28. </template>
  29. </a-list>
  30. </EmptyToRecord>
  31. </div>
  32. </section>
  33. </div>
  34. </template>
  35. <script setup lang="ts">
  36. import { useRoute, useRouter } from 'vue-router';
  37. import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
  38. import EmptyToRecord from '@/components/parts/EmptyToRecord.vue';
  39. import InheritorContent, { InheritorWorkInfo } from '@/api/inheritor/InheritorContent';
  40. const router = useRouter();
  41. const route = useRoute();
  42. const worksData = useSimpleDataLoader(async () => {
  43. const inheritorId = route.query.inheritorId ? parseFloat(route.query.inheritorId as string) : undefined;
  44. return (await InheritorContent.getInheritorInfo(inheritorId)).works;
  45. })
  46. function handleGoWork(item: InheritorWorkInfo) {
  47. router.push({ name: 'FormWork', query: {
  48. inheritorId: route.query.inheritorId,
  49. id: item.id
  50. } })
  51. }
  52. </script>