浏览代码

📦 作品提交修改

快乐的梦鱼 1 周之前
父节点
当前提交
d1987b4a72

+ 30 - 0
src/api/inheritor/InheritorContent.ts

@@ -326,6 +326,7 @@ export class InheritorWorkInfo extends DataModel<InheritorWorkInfo> {
     this.setNameMapperCase('Camel', 'Snake');
     this._convertTable = {
       collectionTime: { clientSide: 'dayjs', serverSide: 'string' },
+      type: { clientSide: 'number', serverSide: 'number' },
     };
     this._convertKeyType = (key, direction) => {
       if (key.endsWith('Text') || key.endsWith('_text')) {
@@ -334,6 +335,12 @@ export class InheritorWorkInfo extends DataModel<InheritorWorkInfo> {
           serverSide: 'undefined',
         };
       }
+      if (key.endsWith('At')) {
+        return {
+          clientSide: 'string',
+          serverSide: 'undefined',
+        };
+      }
     };
     this._afterSolveServer = (self) => {
     };
@@ -342,6 +349,7 @@ export class InheritorWorkInfo extends DataModel<InheritorWorkInfo> {
   }
 
   id = 0;
+  modelId = 16;
   category = '';
   feature = '';
   otherName = '';
@@ -640,6 +648,28 @@ export class InheritorContentApi extends AppServerRequestModule<DataModel> {
     })
   }  
 
+  async getIchWorksInfo(data: {
+    ichId: number,
+    page?: number,
+    pageSize?: number,
+  }) {
+    return this.post('/ich/inheritor/works', {
+      ich_id: data.ichId,
+      page: data.page,
+      pageSize: data.pageSize,
+    }, '获取项目作品列表', undefined).then((res) => {
+      return transformArrayDataModel<InheritorWorkInfo>(InheritorWorkInfo, res.data2.data, 'data2');
+    })
+  }
+  async getIchWorksDetail(id: number) {
+    return this.post('/ich/inheritor/info', {
+      id,
+      model_id: 16,
+    }, '获取项目作品详情', undefined).then((res) => {
+      return transformDataModel<InheritorWorkInfo>(InheritorWorkInfo, res.data2);
+    })
+  }
+
   async getIchInfo(id: number|undefined) {
     return await this.getBaseInfo(id, IchInfo);
   }

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

@@ -27,6 +27,26 @@
  }
 }
 
+.ant-list.light-round {
+  padding: 0.4rem;
+
+  .ant-list-item {
+    background-color: #fff;     // 每条背景白色
+    border-radius: 8px;         // 圆角
+    margin-bottom: 0.8rem;      // 条目间距
+    padding: 1rem 1.2rem;       // 内边距,可按需调整
+    transition: box-shadow 0.2s;
+
+    &:last-child {
+      margin-bottom: 0;         // 最后一条去掉底边距
+    }
+
+    &:hover {
+      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
+    }
+  }
+}
+
 @media screen and (max-width: 768px) {
   .dynamic-form-group {
     padding: 25px;

+ 10 - 2
src/components/content/CommonListBlock.vue

@@ -89,8 +89,8 @@
               :src="item.image || defaultImage" alt="新闻图片" 
             />
             <TitleDescBlock
-              :title="item.title"
-              :desc="item.desc"
+              :title="item[props.titleKey]"
+              :desc="item[props.descKey]"
             >
               <template #addon>
                 <div v-if="item.bottomTags" class="tags">
@@ -165,6 +165,14 @@ const props = defineProps({
     type: String,
     default: '',
   },
+  titleKey: {
+    type: String,
+    default: 'title',
+  },
+  descKey: {
+    type: String,
+    default: 'desc',
+  },
   show: {
     type: Boolean,
     default: true,

+ 8 - 4
src/pages/admin-works.vue

@@ -11,7 +11,7 @@
         </div>
 
         <EmptyToRecord title="作品" :loader="worksData" :showEdited="false" :showAdd="false">
-          <a-list item-layout="horizontal" :data-source="worksData?.content.value || []">
+          <a-list class="light-round" item-layout="horizontal" :data-source="worksData?.content.value || []">
             <template #renderItem="{ item }">
               <a-list-item>
                 <a-list-item-meta
@@ -44,13 +44,17 @@ const router = useRouter();
 const route = useRoute();
 
 const worksData = useSimpleDataLoader(async () => {
-  const inheritorId = route.query.inheritorId ? parseFloat(route.query.inheritorId as string) : undefined;
-  return (await InheritorContent.getInheritorInfo(inheritorId)).works;
+  const ichId = route.query.ichId ? parseFloat(route.query.ichId as string) : undefined;
+  return (await InheritorContent.getIchWorksInfo({
+    ichId: ichId!,
+    page: 1,
+    pageSize: 100,
+  }));
 })
 
 function handleGoWork(item: InheritorWorkInfo) {
   router.push({ name: 'FormWork', query: { 
-    inheritorId: route.query.inheritorId,
+    ichId: route.query.ichId,
     id: item.id 
   } })
 }

+ 2 - 2
src/pages/admin.vue

@@ -31,7 +31,6 @@
                 <AdminItemState :item="item" />
                 <a-button type="link">编辑</a-button>
                 <a-button type="link" @click.stop="handleCopyAccount(item)">传承人账号</a-button>
-                <a-button type="link" @click.stop="handleGoWorks(item)">传承人作品</a-button>
               </template>
             </CommonListBlock>
           </a-tab-pane>
@@ -54,6 +53,7 @@
               <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="handleGoWorks(item)">非遗项目作品</a-button>
               </template>
             </CommonListBlock>
           </a-tab-pane>
@@ -187,7 +187,7 @@ async function handleCopyAccount(item: GetContentListItem) {
 
 function handleGoWorks(item: GetContentListItem) {
   router.push({ name: 'AdminWorks', query: { 
-    inheritorId: item.id 
+    ichId: item.id,
   } })
 }
 </script>

+ 2 - 1
src/pages/forms/form.vue

@@ -89,6 +89,7 @@
         :showSearch="false"
         :rowCount="1"
         :rowType="6"
+        titleKey="_title"
         :load="(page: number, pageSize: number, _, searchText: string, dropDownValues: number[]) => loadHistoryData(page, pageSize, dropDownValues, searchText)"
         detailsPage="none"
       >
@@ -281,7 +282,7 @@ async function loadHistoryData(page: number, pageSize: number, dropDownValues: n
     page,
     total: res.total,
     data: res.data.map((p) => {
-      p.title = `提交人:${p.nickname}`;
+      p._title = p.nickname ? `提交人:${p.nickname}` : p.title;
       p.desc = `提交时间:${p.updatedAt}`;
       return p;
     }),

+ 3 - 1
src/pages/forms/plans.vue

@@ -14,7 +14,9 @@ import { useRoute } from 'vue-router';
 import Form from './form.vue';
 import InheritorContent, { PlanInfo } from '@/api/inheritor/InheritorContent';
 import type { IDynamicFormOptions } from '@imengyu/vue-dynamic-form';
+import { useAuthStore } from '@/stores/auth';
 
+const authStore = useAuthStore();
 const formModel = ref(new PlanInfo()) as Ref<PlanInfo>;
 const formOptions = ref<IDynamicFormOptions>({
   formLabelCol: { span: 6 },
@@ -30,7 +32,7 @@ const formOptions = ref<IDynamicFormOptions>({
       { label: '依据说明', name: 'desc', type: 'text-area', additionalProps: { placeholder: '请输入依据说明' } },
       { label: '预期目标', name: 'target', type: 'text-area', additionalProps: { placeholder: '请输入预期目标' } },
       { label: '保护单位自筹资金', name: 'unit', type: 'number', additionalProps: { placeholder: '请输入保护单位自筹资金', min: 0, precision: 2 } },
-      { label: '地方(部门)投入资金', name: 'department', type: 'number', additionalProps: { placeholder: '请输入地方(部门)投入资金', min: 0, precision: 2 } }
+      { label: '地方(部门)投入资金', name: 'department', type: 'number', additionalProps: { placeholder: '请输入地方(部门)投入资金', min: 0, precision: 2 } },
   ],
   formRules: {
     name: [{ required: true, message: '请输入预算项目名称' }],

+ 22 - 25
src/pages/forms/works.vue

@@ -93,26 +93,26 @@ const formOptions = ref<IDynamicFormOptions>({
               maxCount: 20 
             } as UploadImageFormItemProps 
           },
-        { 
-          label: '审核人员', name: 'text1', type: 'static-text', 
-          additionalProps: {
-            text: '黄念旭,李向群,卢志明',
-            style: { color: '#999', }
-          }
-        },
-        { 
-          label: '审核状态', name: 'text2', type: 'static-text', 
-          additionalProps: {
-            text: '暂未审核',
-            style: { color: '#999', }
-          }
-        },
-        { 
-          label: '填报人', name: 'text3', type: 'static-text', 
-          additionalProps: {
-            text: authStore.userInfo?.nickname ,
-          }
-        },
+          { 
+            label: '审核人员', name: 'text1', type: 'static-text', 
+            additionalProps: {
+              text: '黄念旭,李向群,卢志明',
+              style: { color: '#999', }
+            }
+          },
+          { 
+            label: '审核状态', name: 'text2', type: 'static-text', 
+            additionalProps: {
+              text: '暂未审核',
+              style: { color: '#999', }
+            }
+          },
+          { 
+            label: '填报人', name: 'text3', type: 'static-text', 
+            additionalProps: {
+              text: authStore.userInfo?.nickname ,
+            }
+          },
         ]
       },
       /* {
@@ -156,12 +156,9 @@ const formOptions = ref<IDynamicFormOptions>({
 const route = useRoute();
 
 async function loadData() {
-  const inheritorId = route.query.inheritorId ? parseFloat(route.query.inheritorId as string) : undefined;
   const id = parseFloat(route.query.id as string);
-  if (id) {
-    const works = await InheritorContent.getInheritorInfo(inheritorId);
-    formModel.value = works.works.find((item) => item.id === id) || new InheritorWorkInfo();
-  }
+  if (id)
+    formModel.value = await InheritorContent.getIchWorksDetail(id);
 }
 async function handleSave(data: InheritorWorkInfo) {
   data.ichId = route.query.id ? parseFloat(route.query.id as string) : undefined;

+ 9 - 3
src/pages/inheritor.vue

@@ -123,11 +123,11 @@
             </EmptyToRecord>
           </a-tab-pane>
           <a-tab-pane key="4" tab="作品">
-            <EmptyToRecord title="作品" buttonText="新增作品" :loader="inheritorData" :showEdited="false" @edit="router.push({ name: 'FormWork' })">
+            <EmptyToRecord title="作品" buttonText="新增作品" :loader="ichData" :showEdited="false" @edit="router.push({ name: 'FormWork' })">
               <div class="d-flex justify-content-end">
                 <a-button type="primary" @click="router.push({ name: 'FormWork' })">+ 新增</a-button>
               </div>
-              <a-list item-layout="horizontal" :data-source="inheritorData?.content.value?.works || []">
+              <a-list class="light-round" item-layout="horizontal" :data-source="worksData || []">
                 <template #renderItem="{ item }">
                   <a-list-item>
                     <a-list-item-meta
@@ -186,7 +186,7 @@
 <script setup lang="ts">
 import { onMounted, ref, watch } from 'vue';
 import { useRoute, useRouter } from 'vue-router';
-import type { IchInfo, InheritorInfo, PlanInfo, SeminarInfo } from '@/api/inheritor/InheritorContent';
+import type { IchInfo, InheritorInfo, InheritorWorkInfo, PlanInfo, SeminarInfo } from '@/api/inheritor/InheritorContent';
 import InheritorContent from '@/api/inheritor/InheritorContent';
 import ImageGrid from '@/components/content/ImageGrid.vue';
 import SimplePointedMap from '@/components/content/SimplePointedMap.vue';
@@ -201,6 +201,7 @@ const router = useRouter();
 const route = useRoute();
 const activeKey = ref(route.query.tab as string || '1');
 const planData = ref<PlanInfo[]>([]);
+const worksData = ref<InheritorWorkInfo[]>([]);
 const showInMessage = ref(false);
 
 watch(activeKey, (newValue) => {
@@ -210,6 +211,11 @@ watch(activeKey, (newValue) => {
 const ichData = useSimpleDataLoader(async () => {
   const data = await InheritorContent.getIchInfo(undefined);
   planData.value = await InheritorContent.getPlanList(data.id);
+  worksData.value = await InheritorContent.getIchWorksInfo({
+    ichId: data.id,
+    page: 1,
+    pageSize: 100,
+  });
   return data;
 });
 const inheritorData = useSimpleDataLoader<InheritorInfo|null>(async () => {