Pārlūkot izejas kodu

📦 传习所列表

快乐的梦鱼 3 dienas atpakaļ
vecāks
revīzija
cc5ee241f9

+ 14 - 1
src/api/inheritor/InheritorContent.ts

@@ -530,7 +530,7 @@ export class InheritorContentApi extends AppServerRequestModule<DataModel> {
   async getBaseInfo<T extends DataModel>(id: number|undefined, newDataModel: new () => T) {
     return (await this.post('/ich/inheritor/baseInfo', {
       model_id: new newDataModel().modelId,
-      id,
+      content_id: id,
     }, '基础表信息', undefined, newDataModel)).data as T;
   }
   /**
@@ -648,6 +648,19 @@ export class InheritorContentApi extends AppServerRequestModule<DataModel> {
     })
   }  
 
+  async getIchSeminarInfo(data: {
+    ichId?: number,
+    page?: number,
+    pageSize?: number,
+  }) {
+    return this.post('/ich/inheritor/sites', {
+      ich_id: data.ichId,
+      page: data.page,
+      pageSize: data.pageSize,
+    }, '获取传习所列表', undefined).then((res) => {
+      return transformArrayDataModel<SeminarInfo>(SeminarInfo, transformSomeToArray(res.data2), 'data2');
+    })
+  }
   async getIchWorksInfo(data: {
     ichId: number,
     page?: number,

+ 1 - 0
src/assets/scss/fix.scss

@@ -36,6 +36,7 @@
     margin-bottom: 0.8rem;      // 条目间距
     padding: 1rem 1.2rem;       // 内边距,可按需调整
     transition: box-shadow 0.2s;
+    border: 1px solid #eeeeee;
 
     &:last-child {
       margin-bottom: 0;         // 最后一条去掉底边距

+ 25 - 12
src/pages/admin.vue

@@ -48,32 +48,27 @@
                 <AdminItemState :item="item" />
                 <a-button type="link" @click.stop="router.push({ name: 'FormIch', query: { id: item.id } })">编辑</a-button>
                 <a-button type="link" @click.stop="handleGoWorks(item)">非遗项目作品</a-button>
+                <a-button type="link" @click.stop="handleGoSeminar(item)">关联传习所</a-button>
               </template>
             </CommonListBlock>
           </a-tab-pane>
-          <a-tab-pane key="3" tab="传习所">
+          <a-tab-pane key="3" tab="传习所列表">
             <div class="d-flex justify-content-end">
-              <a-button type="primary" :disabled="true" @click="router.push({ name: 'FormWork' })">+ 新增</a-button>
+              <a-button type="primary" @click="router.push({ name: 'FormSeminar' })">+ 新增</a-button>
             </div>
             <CommonListBlock 
               :showTotal="true"
               :rowCount="1"
               :rowType="5"
-              :dropDownNames="[{
-                options: categoryData.content.value ?? [],
-                label: '分类',
-                defaultSelectedValue: 0,
-              }]"
               :load="(page: number, pageSize: number, _, searchText: string, dropDownValues: number[]) => loadSeminarData(page, pageSize, dropDownValues, searchText)"
-              :showDetail="(item) => router.push({ name: 'FormIch', query: { id: item.id } })"
-              >
+              :showDetail="(item) => router.push({ name: 'FormSeminar', query: { id: item.id } })"
+            >
               <template #itemRight="{ item }">
-                <AdminItemState :item="item" />
-                <a-button type="link" @click.stop="router.push({ name: 'FormIch', query: { id: item.id } })">编辑</a-button>
+                <a-button type="link" @click.stop="router.push({ name: 'FormSeminar', query: { id: item.id } })">编辑</a-button>
               </template>
             </CommonListBlock>
           </a-tab-pane>
-          <a-tab-pane key="4" tab="重点区域">
+          <a-tab-pane v-if="false" key="4" tab="重点区域">
             <div class="d-flex justify-content-end">
               <a-button type="primary" :disabled="true" @click="router.push({ name: 'FormWork' })">+ 新增</a-button>
             </div>
@@ -194,6 +189,19 @@ async function loadIchData(page: number, pageSize: number, dropDownValues: numbe
   }
 }
 async function loadSeminarData(page: number, pageSize: number, dropDownValues: number[], searchText: string) {
+  if (page === 1) {
+    const res = await InheritorContent.getIchSeminarInfo({
+      ichId: undefined,
+    });
+    return {
+      page,
+      total: res.length,
+      data: res.map((item) => ({
+        ...item,
+        desc: item.address,
+      })),
+    }
+  }
   return {
     page,
     total: 0,
@@ -236,6 +244,11 @@ async function handleCopyAccount(item: GetContentListItem) {
 
 }
 
+function handleGoSeminar(item: GetContentListItem) {
+  router.push({ name: 'AdminSeminar', query: { 
+    ichId: item.id,
+  } })
+}
 function handleGoWorks(item: GetContentListItem) {
   router.push({ name: 'AdminWorks', query: { 
     ichId: item.id,

+ 74 - 0
src/pages/admin/seminar.vue

@@ -0,0 +1,74 @@
+<template>
+  <!-- 传习所 -->
+  <div class="about main-background main-background-type0">
+    <div class="nav-placeholder">
+    </div>
+    <!-- 表单 -->
+    <section class="main-section large">
+      <div class="content">
+        <div class="title">
+          <h2>传习所管理</h2>
+        </div>
+
+        <EmptyToRecord title="传习所" :loader="worksData" :showEdited="false" :showAdd="false">
+          <div class="d-flex justify-content-between p-2">
+            <a-button @click="router.back" :icon="h(ArrowLeftOutlined)">返回</a-button>
+            <a-button type="primary" @click="handleNewSeminar">+ 新增</a-button>
+          </div>
+          <a-list class="light-round" item-layout="horizontal" :data-source="worksData?.content.value || []">
+            <template #renderItem="{ item }">
+              <a-list-item>
+                <a-list-item-meta
+                  :title="item.title"
+                  :description="item.address"
+                >
+                  <template #avatar>
+                    <a-avatar :src="item.image" />
+                  </template>
+                </a-list-item-meta>
+                <template #actions>
+                  <a key="list-loadmore-edit" @click="handleGoSeminar(item)">编辑</a>
+                </template>
+              </a-list-item>
+            </template>
+          </a-list>
+        </EmptyToRecord>
+      </div>
+    </section>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { useRoute, useRouter } from 'vue-router';
+import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
+import EmptyToRecord from '@/components/parts/EmptyToRecord.vue';
+import InheritorContent, { InheritorWorkInfo } from '@/api/inheritor/InheritorContent';
+import { ArrowLeftOutlined } from '@ant-design/icons-vue';
+import { h } from 'vue';
+
+const router = useRouter();
+const route = useRoute();
+
+const worksData = useSimpleDataLoader(async () => {
+  const ichId = route.query.ichId ? parseFloat(route.query.ichId as string) : undefined;
+  return (await InheritorContent.getIchSeminarInfo({
+    ichId: ichId!,
+    page: 1,
+    pageSize: 100,
+  }));
+})
+
+function handleNewSeminar() {
+  router.push({ name: 'FormSeminar', query: { 
+    ichId: route.query.ichId,
+  } })
+}
+
+function handleGoSeminar(item: InheritorWorkInfo) {
+  router.push({ name: 'FormSeminar', query: { 
+    ichId: route.query.ichId,
+    id: item.id 
+  } })
+}
+
+</script>

+ 7 - 0
src/pages/admin-works.vue

@@ -11,6 +11,10 @@
         </div>
 
         <EmptyToRecord title="作品" :loader="worksData" :showEdited="false" :showAdd="false">
+          <div class="d-flex justify-content-between p-2">
+            <a-button @click="router.back" :icon="h(ArrowLeftOutlined)">返回</a-button>
+            <div></div>
+          </div>
           <a-list class="light-round" item-layout="horizontal" :data-source="worksData?.content.value || []">
             <template #renderItem="{ item }">
               <a-list-item>
@@ -39,6 +43,9 @@ import { useRoute, useRouter } from 'vue-router';
 import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
 import EmptyToRecord from '@/components/parts/EmptyToRecord.vue';
 import InheritorContent, { InheritorWorkInfo } from '@/api/inheritor/InheritorContent';
+import { ArrowLeftOutlined } from '@ant-design/icons-vue';
+import { h } from 'vue';
+
 
 const router = useRouter();
 const route = useRoute();

+ 2 - 2
src/pages/forms/seminar.vue

@@ -292,8 +292,8 @@ const formExtendOptions = ref<IDynamicFormOptions>({
 });
 
 async function loadData(id: number|undefined) {
-  formModel.value = await InheritorContent.getSeminarInfo(id);
-  formModel.value.expandInfo = await InheritorContent.getSeminarExpandInfo(id);
+  formModel.value = id ? await InheritorContent.getSeminarInfo(id) : new SeminarInfo();
+  formModel.value.expandInfo = id ? await InheritorContent.getSeminarExpandInfo(id) : new SeminarExpandInfo();
   formExtendModel.value = formModel.value.expandInfo || new SeminarExpandInfo(); 
 }
 

+ 7 - 2
src/router/index.ts

@@ -41,9 +41,14 @@ const router = createRouter({
       component: () => import('@/pages/admin.vue'),
     },
     {
-      path: '/admin-works',
+      path: '/admin/works',
       name: 'AdminWorks',
-      component: () => import('@/pages/admin-works.vue'),
+      component: () => import('@/pages/admin/works.vue'),
+    },
+    {
+      path: '/admin/seminar',
+      name: 'AdminSeminar',
+      component: () => import('@/pages/admin/seminar.vue'),
     },
     {
       path: '/change-password',