快乐的梦鱼 месяцев назад: 2
Родитель
Сommit
7a75e9a70f

+ 1 - 0
src/api/inhert/VillageApi.ts

@@ -108,6 +108,7 @@ export class VolunteerInfo extends DataModel<VolunteerInfo> {
   typeText = '';
   sexText = '';
   statusText = '';
+  catalogIds = [] as number[];
   collectModule = [] as string[];
   collectModuleText = '';
 }

+ 4 - 0
src/api/inhert/VillageInfoApi.ts

@@ -196,6 +196,7 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
     subKey: string|undefined,
     villageId: number,
     villageVolunteerId: number,
+    catalogId?: number|undefined,
     id?: number, 
     modelClassCreator: (new () => T) = CommonInfoModel as any
   ) {
@@ -211,6 +212,7 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
     subKey: string|undefined,
     villageId: number,
     villageVolunteerId: number,
+    catalogId?: number|undefined,
     modelClassCreator: (new () => T) = VillageListItem as any 
   ) {
     return (this.post(`/village/collect/list`, {
@@ -250,6 +252,7 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
     subId: number,
     villageId: number,
     villageVolunteerId: number,
+    catalogId: number|undefined,
     data: T,
   ) {
     const res : Record<string, any> = {
@@ -257,6 +260,7 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
       collect_module_id: collectModuleId,
       village_id: villageId,
       village_volunteer_id: villageVolunteerId,
+      catalog_id: catalogId,
     };
     if (subKey)
       res[subKey] = subId;

+ 4 - 3
src/pages/dig/components/CollectModuleList.vue

@@ -36,7 +36,7 @@ import TaskList from '../components/TaskList.vue';
 import VillageApi from '@/api/inhert/VillageApi';
 
 const { goForm } = useTaskEntryForm();
-const { canCollect, getCollectModuleInternalNameById } = useCollectStore();
+const { canCollect, canCollectCatalog, getCollectModuleInternalNameById } = useCollectStore();
 
 const props = defineProps<{
   villageId: number,
@@ -67,14 +67,15 @@ async function loadList() {
           const formDefine = collectModuleInternalName ? getVillageInfoForm(collectModuleInternalName, -1) : undefined;
           return {
             ...item,
-            enable: true,
+            enable: canCollectCatalog(item.id),
             catalogItem: item,
             goForm: collectModuleInternalName ? [ 
               collectModuleInternalName, 
               item.typeId ?? -1, 
               formDefine?.[2].typeName, 
               collectModuleInternalName === 'overview' ? 'common' : undefined,
-              item.title 
+              item.title,
+              item.id
             ] as TaskMenuDefGoForm : undefined,
             onClick: () => {
               if (item.haschild) {

+ 2 - 1
src/pages/dig/components/TaskList.vue

@@ -52,7 +52,8 @@ defineProps({
       :radius="40" 
       :touchable="enable"
       @click="$emit('click')"
-    >去完成</Button>
+      :text="enable ? '去完成' : '未开放'"
+    />
     <view v-else></view>
   </FlexRow>
 </template>

+ 5 - 1
src/pages/dig/forms/common.vue

@@ -66,6 +66,7 @@ let currentFormInfo : SingleForm|null = null;
 const { querys } = useLoadQuerys({ 
   villageId: 0,  
   villageVolunteerId: 0,
+  catalogId: 0,
   subType: '',
   subId: 0,
   subKey: '',
@@ -100,7 +101,8 @@ const { querys } = useLoadQuerys({
           undefined, 
           undefined, 
           querys.villageId, 
-          querys.villageVolunteerId
+          querys.villageVolunteerId,
+          querys.catalogId,
         );
         if (list?.length > 0)
           findId = list[0].id;
@@ -112,6 +114,7 @@ const { querys } = useLoadQuerys({
         querys.subKey,
         querys.villageId, 
         querys.villageVolunteerId,
+        querys.catalogId,
         findId,
         model,
       );
@@ -161,6 +164,7 @@ async function submit() {
       querys.value.subId,
       querys.value.villageId,
       querys.value.villageVolunteerId,
+      querys.value.catalogId,
       formModel.value as CommonInfoModel,
     );
     deleteLocalSave();

+ 4 - 2
src/pages/dig/forms/composeable/TaskEntryForm.ts

@@ -7,11 +7,12 @@ export function useTaskEntryForm() {
     villageVolunteerId: 0,
   });
   
-  function goForm(subType: string, subId: number, subKey = 'type', type = 'list', subTitle = '') {
+  function goForm(subType: string, subId: number, subKey = 'type', type = 'list', subTitle = '', catalogId : number|undefined = undefined) {
     navTo('/pages/dig/forms/' + type, {
       id: type === 'common' ? 1 : undefined,
       villageId: querys.value.villageId,  
       villageVolunteerId: querys.value.villageVolunteerId,  
+      catalogId,
       subType,
       subId,
       subKey,
@@ -24,11 +25,12 @@ export function useTaskEntryForm() {
   }
 }
 
-export function goFormStatic(villageId: number, villageVolunteerId: number, subType: string, subId: number, subKey = 'type', type = 'list', subTitle = '') {
+export function goFormStatic(villageId: number, villageVolunteerId: number, subType: string, subId: number, subKey = 'type', type = 'list', subTitle = '', catalogId : number|undefined = undefined) {
   navTo('/pages/dig/forms/' + type, {
     id: type === 'common' ? 1 : undefined,
     villageId,  
     villageVolunteerId,  
+    catalogId,
     subType,
     subId,
     subKey,

+ 2 - 0
src/pages/dig/forms/list.vue

@@ -134,6 +134,7 @@ function goDetail(id: number) {
     id,
     villageId: querys.value.villageId,
     villageVolunteerId: querys.value.villageVolunteerId,
+    catalogId: querys.value.catalogId,
     subType: querys.value.subType,
     subKey: querys.value.subKey,
     subId: querys.value.subId,
@@ -147,6 +148,7 @@ function search() {
 const { querys } = useLoadQuerys({ 
   villageId: 0,  
   villageVolunteerId: 0,
+  catalogId: 0,
   subType: '',
   subKey: '',
   subId: 0,

+ 33 - 33
src/pages/dig/forms/tasks.ts

@@ -2,7 +2,7 @@ export type TaskMenuDefGroup = {
   banner: string;
   list: TaskMenuDefItem[];
 }
-export type TaskMenuDefGoForm = [string, number, string|undefined, string|undefined, string|undefined];
+export type TaskMenuDefGoForm = [string, number, string|undefined, string|undefined, string|undefined, number|undefined];
 export type TaskMenuDefItem = {
   title: string;
   desc: string;
@@ -45,7 +45,7 @@ export const TaskRootDef : TaskMenuDefItem[] = [
     icon: 'icon-task-custom-1',
     enable: 'ich',
     name: 'ich',
-    goForm: [ 'ich', 0, undefined, undefined, '非物质文化遗产项目' ],
+    goForm: [ 'ich', 0, undefined, undefined, '非物质文化遗产项目', undefined ],
   },
   {
     title: '环境格局',
@@ -124,28 +124,28 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '村落内传统建筑分布情况',
         icon: 'icon-task-building-1',
         enable: 'distribution',
-        goForm: [ 'distribution', 0, undefined, undefined, '建筑分布' ],
+        goForm: [ 'distribution', 0, undefined, undefined, '建筑分布', undefined ],
       },
       {
         title: '文物建筑',
         desc: '历史、艺术、科学价值',
         icon: 'icon-task-building-2',
         enable: 'building',
-        goForm: [ 'building', 1, 'nature', undefined, '文物建筑' ],
+        goForm: [ 'building', 1, 'nature', undefined, '文物建筑', undefined ],
       },
       {
         title: '历史建筑',
         desc: '重大历史事件记录',
         icon: 'icon-task-building-3',
         enable: 'building',
-        goForm: [ 'building', 2, 'nature', undefined, '历史建筑' ],
+        goForm: [ 'building', 2, 'nature', undefined, '历史建筑', undefined ],
       },
       {
         title: '重要传统建筑',
         desc: '重要传统建筑的信息',
         icon: 'icon-task-building-4',
         enable: 'building',
-        goForm: [ 'building', 3, 'nature', undefined, '重要传统建筑' ],
+        goForm: [ 'building', 3, 'nature', undefined, '重要传统建筑', undefined ],
       },
     ],
   },
@@ -157,35 +157,35 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '欢庆与传承并重的文化盛宴',
         icon: 'icon-task-custom-2',
         enable: 'folk_culture',
-        goForm: [ 'folk_culture', 1, 'folkCultureType', undefined, '节庆活动' ],
+        goForm: [ 'folk_culture', 1, 'folkCultureType', undefined, '节庆活动', undefined ],
       },
       {
         title: '祭祀崇礼',
         desc: '对先贤与自然的崇高致敬',
         icon: 'icon-task-custom-3',
         enable: 'folk_culture',
-        goForm: [ 'folk_culture', 2, 'folkCultureType', undefined, '祭祀崇礼' ],
+        goForm: [ 'folk_culture', 2, 'folkCultureType', undefined, '祭祀崇礼', undefined ],
       },
       {
         title: '婚丧嫁娶',
         desc: '生命礼赞与文化传承的双重奏鸣',
         icon: 'icon-task-custom-4',
         enable: 'folk_culture',
-        goForm: [ 'folk_culture', 3, 'folkCultureType', undefined, '婚丧嫁娶' ],
+        goForm: [ 'folk_culture', 3, 'folkCultureType', undefined, '婚丧嫁娶', undefined ],
       },
       {
         title: '地方方言',
         desc: '历史沉淀的语言瑰宝',
         icon: 'icon-task-custom-5',
         enable: 'folk_culture',
-        goForm: [ 'folk_culture', 4, 'folkCultureType', undefined, '地方方言' ],
+        goForm: [ 'folk_culture', 4, 'folkCultureType', undefined, '地方方言', undefined ],
       },
       {
         title: '特色文化',
         desc: '民族精神的鲜明烙印',
         icon: 'icon-task-custom-6',
         enable: 'folk_culture',
-        goForm: [ 'folk_culture', 5, 'folkCultureType', undefined, '特色文化' ],
+        goForm: [ 'folk_culture', 5, 'folkCultureType', undefined, '特色文化', undefined ],
       },
     ],
   },
@@ -197,21 +197,21 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '村落建立与发展历程',
         icon: 'icon-task-environment-1',
         enable: 'environment',
-        goForm: [ 'environment', 0, undefined, undefined, '自然环境' ],
+        goForm: [ 'environment', 0, undefined, undefined, '自然环境', undefined ],
       },
       {
         title: '文物古迹',
         desc: '重要历史文献资料',
         icon: 'icon-task-environment-5',
         enable: 'relic',
-        goForm: [ 'relic', 0, undefined, undefined, '文物古迹' ],
+        goForm: [ 'relic', 0, undefined, undefined, '文物古迹', undefined ],
       },
       {
         title: '历史环境要素',
         desc: '村民口述历史记录',
         icon: 'icon-task-environment-6',
         enable: 'element',
-        goForm: [ 'element', 0, undefined, undefined, '历史环境要素' ],
+        goForm: [ 'element', 0, undefined, undefined, '历史环境要素', undefined ],
       },
     ],
   },
@@ -223,14 +223,14 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '乡村繁荣的多元支柱',
         icon: 'icon-task-food-1',
         enable: 'food_product',
-        goForm: [ 'food_product', 1, 'productType', undefined, '农副产品' ],
+        goForm: [ 'food_product', 1, 'productType', undefined, '农副产品', undefined ],
       },
       {
         title: '特色美食',
         desc: '给味蕾探索带来无限惊喜',
         icon: 'icon-task-food-2',
         enable: 'food_product',
-        goForm: [ 'food_product', 3, 'productType', undefined, '特色美食' ],
+        goForm: [ 'food_product', 3, 'productType', undefined, '特色美食', undefined ],
       },
     ],
   },
@@ -242,49 +242,49 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '村落建立与发展历程',
         icon: 'icon-task-history-1',
         enable: 'cultural',
-        goForm: [ 'cultural', 1, 'culturalType', undefined, '建村历史' ],
+        goForm: [ 'cultural', 1, 'culturalType', undefined, '建村历史', undefined ],
       },
       {
         title: '历史人物',
         desc: '重要历史人物事迹',
         icon: 'icon-task-history-2',
         enable: 'cultural',
-        goForm: [ 'figure', 0, undefined, undefined, '历史人物' ],
+        goForm: [ 'figure', 0, undefined, undefined, '历史人物', undefined ],
       },
       {
         title: '历史事件',
         desc: '重大历史事件记录',
         icon: 'icon-task-history-3',
         enable: 'cultural',
-        goForm: [ 'cultural', 2, 'culturalType', undefined, '历史事件' ],
+        goForm: [ 'cultural', 2, 'culturalType', undefined, '历史事件', undefined ],
       },
       {
         title: '掌故轶事',
         desc: '民间传说与历史故事',
         icon: 'icon-task-history-4',
         enable: 'story',
-        goForm: [ 'story', 0, undefined, undefined, '掌故轶事' ],
+        goForm: [ 'story', 0, undefined, undefined, '掌故轶事', undefined ],
       },
       {
         title: '历史文献',
         desc: '重要历史文献资料',
         icon: 'icon-task-history-5',
         enable: 'cultural',
-        goForm: [ 'cultural', 3, 'culturalType', undefined, '历史文献' ],
+        goForm: [ 'cultural', 3, 'culturalType', undefined, '历史文献', undefined ],
       },
       {
         title: '口述历史',
         desc: '村民口述历史记录',
         icon: 'icon-task-history-6',
         enable: 'cultural',
-        goForm: [ 'cultural', 4, 'culturalType', undefined, '口述历史' ],
+        goForm: [ 'cultural', 4, 'culturalType', undefined, '口述历史', undefined ],
       },
       {
         title: '口述人管理',
         desc: '口述人管理登记',
         icon: 'icon-task-history-1',
         enable: 'cultural',
-        goForm: [ 'speaker', 1, undefined, undefined, '口述人管理' ],
+        goForm: [ 'speaker', 1, undefined, undefined, '口述人管理', undefined ],
       },
     ],
   },
@@ -296,21 +296,21 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '文化交流的开放窗口',
         icon: 'icon-task-mine-1',
         enable: 'food_product',
-        goForm: [ 'food_product', 4, 'productType', undefined, '商业集市' ],
+        goForm: [ 'food_product', 4, 'productType', undefined, '商业集市', undefined ],
       },
       {
         title: '服装服饰',
         desc: '艺术与功能交织的时尚篇章',
         icon: 'icon-task-mine-2',
         enable: 'food_product',
-        goForm: [ 'food_product', 5, 'productType', undefined, '服装服饰' ],
+        goForm: [ 'food_product', 5, 'productType', undefined, '服装服饰', undefined ],
       },
       {
         title: '运输工具',
         desc: '历史的运输工具',
         icon: 'icon-task-mine-2',
         enable: 'food_product',
-        goForm: [ 'food_product', 6, 'productType', undefined, '运输工具' ],
+        goForm: [ 'food_product', 6, 'productType', undefined, '运输工具', undefined ],
       },
     ],
   },
@@ -322,35 +322,35 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '村落行政区域划分及变迁',
         icon: 'icon-task-summary-1',
         enable: 'overview',
-        goForm: [ 'overview', 1, undefined, 'common', '行政区划' ],
+        goForm: [ 'overview', 1, undefined, 'common', '行政区划', undefined ],
       },
       {
         title: '村落综述',
         desc: '村落整体概况介绍',
         icon: 'icon-task-summary-5',
         enable: 'overview',
-        goForm: [ 'overview', 5, undefined, 'common', '村落综述' ],
+        goForm: [ 'overview', 5, undefined, 'common', '村落综述', undefined ],
       },
       {
         title: '地理信息',
         desc: '地理位置和自然环境特征',
         icon: 'icon-task-summary-2',
         enable: 'overview',
-        goForm: [ 'overview', 2, undefined, 'common', '地理信息' ],
+        goForm: [ 'overview', 2, undefined, 'common', '地理信息', undefined ],
       },
       {
         title: '建设与保护',
         desc: '村落发展与文化遗产保护',
         icon: 'icon-task-summary-3',
         enable: 'overview',
-        goForm: [ 'overview', 3, undefined, 'common', '建设与保护' ],
+        goForm: [ 'overview', 3, undefined, 'common', '建设与保护', undefined ],
       },
       {
         title: '人口与经济',
         desc: '人口与经济情况',
         icon: 'icon-task-summary-4',
         enable: 'overview',
-        goForm: [ 'overview', 4, undefined, 'common', '人口与经济' ],
+        goForm: [ 'overview', 4, undefined, 'common', '人口与经济', undefined ],
       },
     ],
   },
@@ -362,14 +362,14 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
         desc: '',
         icon: 'icon-task-trip-3',
         enable: 'travel_guide',
-        goForm: [ 'travel_guide', 0, undefined, undefined, '旅游导览' ],
+        goForm: [ 'travel_guide', 0, undefined, undefined, '旅游导览', undefined ],
       },
       {
         title: '旅游路线',
         desc: '',
         icon: 'icon-task-trip-1',
         enable: 'route',
-        goForm: [ 'route', 0, undefined, undefined, '旅游路线' ],
+        goForm: [ 'route', 0, undefined, undefined, '旅游路线', undefined ],
       },
     ],
   },

+ 8 - 0
src/store/collect.ts

@@ -6,11 +6,17 @@ import VillageApi from '@/api/inhert/VillageApi';
 
 export const useCollectStore = defineStore('collect', () => {
   const collectableModules = ref(new Map<string, number>());
+  const collectableCatalogs = ref<number[]>([]);
   const authStore = useAuthStore();
 
   function setCollectableModules(modules: Map<string, number>) {
     collectableModules.value = modules;
   }
+  function canCollectCatalog(catalogId: number) {
+    if (authStore.isAdmin)
+      return true;
+    return collectableCatalogs.value.includes(catalogId);
+  }
   function canCollect(module: string) {
     if (authStore.isAdmin)
       return true;
@@ -48,6 +54,7 @@ export const useCollectStore = defineStore('collect', () => {
     }
     for (const key of needRemoveKeys)
       collectableModulesMap.delete(key);
+    collectableCatalogs.value = res.catalogIds || [];
     setCollectableModules(collectableModulesMap);
   }
   
@@ -60,6 +67,7 @@ export const useCollectStore = defineStore('collect', () => {
     getCollectModuleInternalNameById,
     getCollectModuleId,
     canCollect,
+    canCollectCatalog,
     loadCollectableModules,
   }
 })