|
|
@@ -25,67 +25,71 @@ export type SingleForm = [NewDataModel, (formRef: Ref<IDynamicFormRef>) => IDyna
|
|
|
order?: number,
|
|
|
id?: number,
|
|
|
}]
|
|
|
-export type GroupForm = Record<number, SingleForm>
|
|
|
+export type GroupForm = Record<number, SingleForm>;
|
|
|
|
|
|
-export const CollectableModulesNameMapping : Record<string, string> = {
|
|
|
- 'overview': '村落概况',
|
|
|
- 'distribution': '建筑分布',
|
|
|
- 'building': '传统建筑',
|
|
|
- 'folk_culture': '民俗文化',
|
|
|
- 'food_product': '美食物产',
|
|
|
- 'route': '旅游路线',
|
|
|
- 'travel_guide': '旅游导览',
|
|
|
- 'element': '环境要素',
|
|
|
- 'environment': '环境格局',
|
|
|
- 'relic': '文物古迹',
|
|
|
- 'cultural': '历史文化',
|
|
|
- 'figure': '历史人物',
|
|
|
- 'ich': '非遗',
|
|
|
- 'story': '掌故轶事',
|
|
|
- 'spots': '风景名胜',
|
|
|
- 'speaker': '口述者',
|
|
|
- 'collect': '随手记',
|
|
|
-}
|
|
|
+export const CollectableModulesIdMap : Record<string, number> = {
|
|
|
+ 'overview': 11,
|
|
|
+ 'cultural': 2,
|
|
|
+ 'story': 14,
|
|
|
+ 'spots': 13,
|
|
|
+ 'speaker': 17,
|
|
|
+ 'figure': 7,
|
|
|
+ 'element': 5,
|
|
|
+ 'environment': 6,
|
|
|
+ 'building': 16,
|
|
|
+ 'distribution': 4,
|
|
|
+ 'relic': 3,
|
|
|
+ 'folk_culture': 8,
|
|
|
+ 'food_product': 9,
|
|
|
+ 'route': 12,
|
|
|
+ 'travel_guide': 15,
|
|
|
+ 'ich': 10,
|
|
|
+ 'collect': 18,
|
|
|
+ 'glory': 23,
|
|
|
+};
|
|
|
|
|
|
-const villageInfoForm : Record<string, GroupForm> = {
|
|
|
- 'overview': villageInfoOverviewForm,
|
|
|
- 'cultural': villageInfoCulture,
|
|
|
- 'story': {
|
|
|
+/**
|
|
|
+ * 采集模块ID到表单定义的映射
|
|
|
+ */
|
|
|
+const villageInfoForm : Record<number, GroupForm> = {
|
|
|
+ 11: villageInfoOverviewForm,//村落概况
|
|
|
+ 2: villageInfoCulture,//历史文化
|
|
|
+ 14: {//掌故轶事
|
|
|
[0]: villageInfoStoryFormItems
|
|
|
},
|
|
|
- 'spots': {
|
|
|
+ 13: {//风景名胜
|
|
|
[0]: villageInfoSpotsFormItems,
|
|
|
},
|
|
|
- 'speaker': {
|
|
|
+ 17: {//口述者
|
|
|
[1]: villageInfoSpeakerForm,
|
|
|
},
|
|
|
- 'figure': {
|
|
|
+ 7: {//历史人物
|
|
|
[0]: villageInfoFigureFormItems,
|
|
|
},
|
|
|
- 'element': {
|
|
|
+ 5: {//环境要素
|
|
|
[0]: vilElementForm,
|
|
|
},
|
|
|
- 'environment': {
|
|
|
+ 6: {//环境格局
|
|
|
[0]: villageInfoEnvironmentForm
|
|
|
},
|
|
|
- 'building': {
|
|
|
+ 16: {//传统建筑
|
|
|
[1]: villageInfoBuildingForm('文物建筑'),
|
|
|
[2]: villageInfoBuildingForm('历史建筑'),
|
|
|
[3]: villageInfoBuildingForm('重要传统建筑'),
|
|
|
},
|
|
|
- 'distribution': { [0]: villageInfoDistributionForm },
|
|
|
- 'relic': { [0]: villageInfoRelicForm },
|
|
|
- 'folk_culture': {
|
|
|
+ 4: { [0]: villageInfoDistributionForm },//建筑分布
|
|
|
+ 3: { [0]: villageInfoRelicForm },//文物古迹
|
|
|
+ 8: {//民俗文化
|
|
|
[1]: villageInfoFolkCultureForm('节庆活动'),
|
|
|
[2]: villageInfoFolkCultureForm('祭祀崇礼'),
|
|
|
[3]: villageInfoFolkCultureForm('婚丧嫁娶'),
|
|
|
[4]: villageInfoFolkCultureForm('地方方言'),
|
|
|
[5]: villageInfoFolkCultureForm('特色文化'),
|
|
|
},
|
|
|
- 'ich': { [0]: ichFormItems },
|
|
|
- 'travel_guide': { [0]: villageInfoTravelGuideForm },
|
|
|
- 'route': { [0]: villageInfoRouteForm },
|
|
|
- 'food_product': {
|
|
|
+ 10: { [0]: ichFormItems },//非遗
|
|
|
+ 15: { [0]: villageInfoTravelGuideForm },//旅游导览
|
|
|
+ 12: { [0]: villageInfoRouteForm },//旅游路线
|
|
|
+ 9: {//美食物产
|
|
|
[1]: villageInfoFoodProductsForm('农副产品'),
|
|
|
[2]: villageInfoFoodProductsForm('食品产品'),
|
|
|
[3]: villageInfoFoodProductsForm('特色美食'),
|
|
|
@@ -93,7 +97,7 @@ const villageInfoForm : Record<string, GroupForm> = {
|
|
|
[5]: villageInfoFoodProductsForm('服装服饰'),
|
|
|
[6]: villageInfoFoodProductsForm('运输工具'),
|
|
|
},
|
|
|
- 'collect': {
|
|
|
+ 18: {//18
|
|
|
[1]: [CommonInfoModel, (r) => ({
|
|
|
formItems: [
|
|
|
{
|
|
|
@@ -128,18 +132,50 @@ const villageInfoForm : Record<string, GroupForm> = {
|
|
|
]
|
|
|
}), { title: '随手记', typeName: '', }]
|
|
|
},
|
|
|
+ 23: {//乡源荣光
|
|
|
+ [1]: [CommonInfoModel, (r) => ({
|
|
|
+ formItems: [
|
|
|
+ {
|
|
|
+ label: '标题',
|
|
|
+ name: 'name',
|
|
|
+ type: 'text',
|
|
|
+ defaultValue: '',
|
|
|
+ additionalProps: {
|
|
|
+ placeholder: '请输入标题',
|
|
|
+ } as FieldProps,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入标题',
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '描述',
|
|
|
+ name: 'desc',
|
|
|
+ type: 'textarea',
|
|
|
+ defaultValue: '',
|
|
|
+ additionalProps: {
|
|
|
+ placeholder: '请输入描述',
|
|
|
+ } as FieldProps,
|
|
|
+ },
|
|
|
+ ...villageCommonContent(r, {
|
|
|
+ title: '记录',
|
|
|
+ showTitle: false,
|
|
|
+ }).formItems
|
|
|
+ ]
|
|
|
+ }), { title: '乡源荣光', typeName: '', }]
|
|
|
+ },
|
|
|
}
|
|
|
|
|
|
-export function getVillageInfoForm(subType: string, subId: number) {
|
|
|
- const group = villageInfoForm[subType];
|
|
|
+export function getVillageInfoForm(collectModuleId: number, subId: number) {
|
|
|
+ const group = villageInfoForm[collectModuleId];
|
|
|
if (!group)
|
|
|
- throw new Error('未定义的表单类型: ' + subType);
|
|
|
+ throw new Error('未定义的表单类型: ' + collectModuleId);
|
|
|
if (subId === -1)
|
|
|
return mergeFormItems(group);
|
|
|
return group[subId];
|
|
|
}
|
|
|
-export function getVillageInfoFormIds(subType: string) {
|
|
|
- return Object.keys(villageInfoForm[subType]).map((k) => Number(k));
|
|
|
+export function getVillageInfoFormIds(collectModuleId: number) {
|
|
|
+ return Object.keys(villageInfoForm[collectModuleId]).map((k) => Number(k));
|
|
|
}
|
|
|
|
|
|
export function mergeFormItems(group: GroupForm) {
|