|
|
@@ -1,19 +1,21 @@
|
|
|
import VillageInfoApi, { CommonInfoModel, VillageBulidingInfo, VillageEnvInfo } from "@/api/inhert/VillageInfoApi";
|
|
|
import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo";
|
|
|
-import type { FormDefine, FormDefineItem, IFormItemCallbackAdditionalProps } from "@/components/dynamic";
|
|
|
+import type { FormDefine, FormDefineItem, FormExport, IFormItemCallbackAdditionalProps } from "@/components/dynamic";
|
|
|
import type { FormGroupProps } from "@/components/dynamic/DynamicFormCate.vue";
|
|
|
import type { CheckBoxListProps } from "@/components/dynamic/wrappers/CheckBoxList.vue";
|
|
|
import type { CheckBoxToIntProps } from "@/components/dynamic/wrappers/CheckBoxToInt";
|
|
|
import type { PickerIdFieldProps } from "@/components/dynamic/wrappers/PickerIdField";
|
|
|
+import type { RadioIdFieldProps } from "@/components/dynamic/wrappers/RadioIdField";
|
|
|
import type { FieldProps } from "@/components/form/Field.vue";
|
|
|
import type { PickerFieldProps } from "@/components/form/PickerField.vue";
|
|
|
import type { StepperProps } from "@/components/form/Stepper.vue";
|
|
|
import type { UploaderFieldProps } from "@/components/form/UploaderField.vue";
|
|
|
import type { NewDataModel } from "@imengyu/js-request-transform";
|
|
|
+import type { Ref } from "vue";
|
|
|
|
|
|
-type SingleForm = [NewDataModel, FormDefine]
|
|
|
+type SingleForm = [NewDataModel, (model: Ref<FormExport>) => FormDefine]
|
|
|
|
|
|
-const villageInfoBuildingForm : SingleForm = [VillageBulidingInfo, {
|
|
|
+const villageInfoBuildingForm : SingleForm = [VillageBulidingInfo, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '建筑名称',
|
|
|
@@ -414,8 +416,8 @@ const villageInfoBuildingForm : SingleForm = [VillageBulidingInfo, {
|
|
|
rules: []
|
|
|
},
|
|
|
]
|
|
|
-}]
|
|
|
-const villageInfoFolkCultureForm : SingleForm = [VillageBulidingInfo, {
|
|
|
+})]
|
|
|
+const villageInfoFolkCultureForm : SingleForm = [VillageBulidingInfo, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '名称',
|
|
|
@@ -475,8 +477,8 @@ const villageInfoFolkCultureForm : SingleForm = [VillageBulidingInfo, {
|
|
|
rules: []
|
|
|
},
|
|
|
]
|
|
|
-}];
|
|
|
-const villageInfoFoodProductsForm : SingleForm = [VillageBulidingInfo, {
|
|
|
+})];
|
|
|
+const villageInfoFoodProductsForm : SingleForm = [VillageBulidingInfo, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '名称',
|
|
|
@@ -505,8 +507,8 @@ const villageInfoFoodProductsForm : SingleForm = [VillageBulidingInfo, {
|
|
|
}]
|
|
|
},
|
|
|
]
|
|
|
-}];
|
|
|
-const villageCommonContent : FormDefine = {
|
|
|
+})];
|
|
|
+const villageCommonContent : (model: Ref<FormExport>) => FormDefine = (model) => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '标题',
|
|
|
@@ -551,13 +553,13 @@ const villageCommonContent : FormDefine = {
|
|
|
}]
|
|
|
},
|
|
|
]
|
|
|
-};
|
|
|
+});
|
|
|
|
|
|
//TODO: 关联的文化资源ID
|
|
|
|
|
|
const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
'overview': {
|
|
|
- [1]: [CommonInfoModel, {
|
|
|
+ [1]: [CommonInfoModel, (form) => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '村落名称',
|
|
|
@@ -578,7 +580,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
type: 'text',
|
|
|
defaultValue: '',
|
|
|
params: {
|
|
|
- placeholder: '请输入村落编码',
|
|
|
+ placeholder: '请输入村落编码,例如330106',
|
|
|
},
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
@@ -591,13 +593,16 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
type: 'select-city',
|
|
|
defaultValue: () => [],
|
|
|
params: {
|
|
|
- placeholder: '请选择村落地址',
|
|
|
+ placeholder: '请点击这里选择村落地址或右侧者从地图选择',
|
|
|
+ onSelectedTownship: (v: string, code: string) => {
|
|
|
+ form.value.getFormData().township = v;
|
|
|
+ form.value.getFormData().code = code;
|
|
|
+ }
|
|
|
},
|
|
|
- itemParams: { showRightArrow: true } as FieldProps,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择村落地址',
|
|
|
- }]
|
|
|
+ }],
|
|
|
},
|
|
|
{
|
|
|
label: '村落乡镇',
|
|
|
@@ -615,25 +620,23 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
{
|
|
|
label: '村落类型',
|
|
|
name: 'villageType',
|
|
|
- type: 'select-id',
|
|
|
+ type: 'radio-id',
|
|
|
params: {
|
|
|
loadData: async () =>
|
|
|
(await VillageInfoApi.getCategoryChildList(94))
|
|
|
.map((p) => ({
|
|
|
value: p.id,
|
|
|
text: p.title,
|
|
|
- })),
|
|
|
- placeholder: '请选择村落类型',
|
|
|
- } as PickerIdFieldProps,
|
|
|
- itemParams: { showRightArrow: true } as FieldProps,
|
|
|
+ })),
|
|
|
+ } as RadioIdFieldProps,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: '请选择类型',
|
|
|
}],
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
- [2]: [VillageEnvInfo, {
|
|
|
+ })],
|
|
|
+ [2]: [VillageEnvInfo, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '经纬度',
|
|
|
@@ -735,8 +738,8 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}],
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
- [3]: [CommonInfoModel, {
|
|
|
+ })],
|
|
|
+ [3]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '非遗最高级别',
|
|
|
@@ -833,8 +836,8 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
rules: []
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
- [4]: [CommonInfoModel, {
|
|
|
+ })],
|
|
|
+ [4]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
name: '',
|
|
|
@@ -1031,8 +1034,8 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
- [5]: [CommonInfoModel, {
|
|
|
+ })],
|
|
|
+ [5]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
name: '',
|
|
|
@@ -1089,14 +1092,14 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'cultural': {
|
|
|
[1]: [CommonInfoModel, villageCommonContent],
|
|
|
[2]: [CommonInfoModel, villageCommonContent],
|
|
|
- [3]: [CommonInfoModel, {
|
|
|
+ [3]: [CommonInfoModel, (m) => ({
|
|
|
items: [
|
|
|
- ...(villageCommonContent.items.slice(0, 2)),
|
|
|
+ ...(villageCommonContent(m).items.slice(0, 2)),
|
|
|
{
|
|
|
label: '扫描件或图片',
|
|
|
name: 'images',
|
|
|
@@ -1113,10 +1116,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
},
|
|
|
],
|
|
|
- }],
|
|
|
- [4]: [CommonInfoModel, {
|
|
|
+ })],
|
|
|
+ [4]: [CommonInfoModel, (m) => ({
|
|
|
items: [
|
|
|
- ...villageCommonContent.items,
|
|
|
+ ...villageCommonContent(m).items,
|
|
|
{
|
|
|
label: '视频',
|
|
|
name: 'video',
|
|
|
@@ -1130,10 +1133,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
} as UploaderFieldProps,
|
|
|
},
|
|
|
],
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'story': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '标题',
|
|
|
@@ -1175,10 +1178,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
}
|
|
|
]
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'figure': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '标题',
|
|
|
@@ -1222,10 +1225,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
}
|
|
|
]
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'element': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '名称',
|
|
|
@@ -1361,10 +1364,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
},
|
|
|
]
|
|
|
- }]
|
|
|
+ })]
|
|
|
},
|
|
|
'environment': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '名称',
|
|
|
@@ -1445,7 +1448,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
},
|
|
|
]
|
|
|
- }]
|
|
|
+ })]
|
|
|
},
|
|
|
'building': {
|
|
|
[1]: villageInfoBuildingForm,
|
|
|
@@ -1453,7 +1456,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
[3]: villageInfoBuildingForm,
|
|
|
},
|
|
|
'distribution': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '建筑数量',
|
|
|
@@ -1498,10 +1501,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'relic': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '建筑名称',
|
|
|
@@ -1724,7 +1727,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
rules: []
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'folk_culture': {
|
|
|
[1]: villageInfoFolkCultureForm,
|
|
|
@@ -1734,7 +1737,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
[5]: villageInfoFolkCultureForm,
|
|
|
},
|
|
|
'ich': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '名称及管理编号',
|
|
|
@@ -1942,10 +1945,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}],
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
+ })],
|
|
|
},
|
|
|
'travel_guide': {
|
|
|
- [0]: [CommonInfoModel, {
|
|
|
+ [0]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '入村路线',
|
|
|
@@ -2299,10 +2302,10 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
rules: []
|
|
|
},
|
|
|
]
|
|
|
- }]
|
|
|
+ })],
|
|
|
},
|
|
|
'route': {
|
|
|
- [1]: [CommonInfoModel, {
|
|
|
+ [1]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '游览路线',
|
|
|
@@ -2383,8 +2386,8 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}]
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
- [2]: [CommonInfoModel, {
|
|
|
+ })],
|
|
|
+ [2]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '活动标题',
|
|
|
@@ -2439,8 +2442,8 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
}],
|
|
|
},
|
|
|
]
|
|
|
- }],
|
|
|
- [3]: [CommonInfoModel, {
|
|
|
+ })],
|
|
|
+ [3]: [CommonInfoModel, () => ({
|
|
|
items: [
|
|
|
{
|
|
|
label: '特色',
|
|
|
@@ -2530,7 +2533,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
|
|
|
rules: []
|
|
|
},
|
|
|
]
|
|
|
- }]
|
|
|
+ })]
|
|
|
},
|
|
|
'food_product': {
|
|
|
[1]: villageInfoFoodProductsForm,
|