import VillageInfoApi, { CommonInfoModel, VillageBulidingInfo } from "@/api/inhert/VillageInfoApi"; import type { CheckBoxListProps } from "@/components/dynamic/wrappers/CheckBoxList.vue"; import type { PickerIdFieldProps } from "@/components/dynamic/wrappers/PickerIdField"; import type { FieldProps } from "@/components/form/Field.vue"; import type { SingleForm } from "../forms"; import type { UploaderFieldProps } from "@/components/form/UploaderField.vue"; import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo"; import { villageCommonContent } from "./common"; export function villageInfoBuildingForm(title: string) : SingleForm { return [VillageBulidingInfo, (r) => ({ formItems: [ { label: '基础信息', name: 'baseInfo', type: 'flat-group', childrenColProps: { span: 24 }, children: [ { label: '建筑名称', name: 'name', type: 'text', defaultValue: '', additionalProps: { placeholder: '请输入建筑名称', }, rules: [{ required: true, message: '请输入建筑名称', }] }, { label: '建筑编码', name: 'code', type: 'text', defaultValue: '', additionalProps: { placeholder: '请输入建筑编码', }, rules: [{ required: true, message: '请输入建筑编码', }] }, { label: '产权归属', name: 'ownership', type: 'select-id', additionalProps: { loadData: async () => (await VillageInfoApi.getCategoryChildList(152)) .map((p) => ({ value: p.id, text: p.title, })) , } as PickerIdFieldProps, formProps: { showRightArrow: true } as FieldProps, rules: [{ required: true, message: '请选择产权归属', }], }, { label: '位置', name: 'position', type: 'text', defaultValue: '', additionalProps: { placeholder: '请输入位置', }, rules: [{ required: true, message: '请输入位置', }] }, { label: '建筑类型', name: 'buildingType', type: 'select-id', additionalProps: { loadData: async () => (await VillageInfoApi.getCategoryChildList(163)) .map((p) => ({ value: p.id, text: p.title, })) , } as PickerIdFieldProps, formProps: { showRightArrow: true } as FieldProps, rules: [{ required: true, message: '请选择建筑类型', }], }, { label: '其他建筑类型', name: 'otherBuildingType', type: 'text', defaultValue: '', additionalProps: { placeholder: '其他建筑类型' }, show: { callback: (_, m) => m.buildingType == 170 }, rules: [{ required: true, message: '请输入其他建筑类型', }] }, ] }, { label: '简介和故事', name: 'extraInfo', type: 'flat-group', childrenColProps: { span: 24 }, children: [ { label: '建筑中的故事', name: 'story', type: 'richtext', defaultValue: '', additionalProps: { placeholder: '请输入建筑中的故事', maxLength: 5000, showWordLimit: true, }, rules: [{ required: true, message: '请输入建筑中的故事', }] }, { label: '功能特点', name: 'funcFeatures', type: 'richtext', defaultValue: '', additionalProps: { placeholder: '请输入功能特点', maxLength: 5000, showWordLimit: true, }, rules: [] }, ...villageCommonContent(r, { title: title, showContent: false, showTitle: false, }).formItems ] }, { label: '详细信息', name: 'detailsInfo', type: 'flat-group', childrenColProps: { span: 24 }, children: [ { label: '保护级别', name: 'protectionLevel', type: 'select-id', additionalProps: { loadData: async () => (await VillageInfoApi.getCategoryChildList(171)) .map((p) => ({ value: p.id, text: p.title, })) , } as PickerIdFieldProps, formProps: { showRightArrow: true } as FieldProps, rules: [{ required: true, message: '请选择建筑类型', }], }, { label: '其他保护级别', name: 'otherProtectionLevel', type: 'text', defaultValue: '', show: { callback: (_, m) => m.protectionLevel == 177 }, additionalProps: { placeholder: '其他保护级别' }, rules: [{ required: true, message: '请输入其他保护级别', }] }, { label: '总占地面积', name: 'area', type: 'text', defaultValue: '', additionalProps: { placeholder: '请输入总占地面积', }, rules: [{ required: true, message: '请输入总占地面积', }] }, { label: '建筑面积', name: 'buildingArea', type: 'text', defaultValue: '', additionalProps: { placeholder: '请输入建筑面积', }, rules: [{ required: true, message: '请输入建筑面积', }] }, { label: '建筑层数', name: 'floor', type: 'number', defaultValue: 0, additionalProps: { min: 0, max: 1000, }, rules: [{ required: true, message: '请输入建筑层数', }] }, { label: '所含建筑幢数', name: 'num', type: 'number', defaultValue: 0, additionalProps: { min: 0, max: 1000, }, rules: [{ required: true, message: '请输入所含建筑幢数', }] }, { label: '始建时间(年)', name: 'age', type: 'number', defaultValue: 2025, additionalProps: { min: -50000, max: 2000, }, rules: [{ required: true, message: '请输入始建时间', }] }, { label: '承重结构(多选)', name: 'bearingType', type: 'check-box-list', additionalProps: { multiple: true, loadData: async () => (await VillageInfoApi.getCategoryChildList(246)) .map((p) => ({ value: p.id, text: p.title, })) , } as CheckBoxListProps, defaultValue: [], rules: [{ required: true, message: '请选择类型', }], }, { label: '其他承重结构类型', name: 'otherBearing', type: 'text', defaultValue: '', additionalProps: { placeholder: '其他承重结构类型' }, rules: [] }, { label: '居民建筑类型', name: 'residentialBuildingType', type: 'text', defaultValue: '', additionalProps: { placeholder: '居民建筑类型' }, rules: [] }, { label: '修缮过程', name: 'repairProcess', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '修缮过程', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '建筑风貌', name: 'architecturalStyle', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '建筑风貌', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '院落布局', name: 'layout', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '院落布局', maxLength: 5000, showWordLimit: true, }, rules: [] }, ] }, { label: '建筑做法', name: 'detailsInfo', type: 'flat-group', childrenColProps: { span: 24 }, children: [ { label: '屋面形式(多选)', name: 'roofForm', type: 'check-box-list', additionalProps: { multiple: true, loadData: async () => (await VillageInfoApi.getCategoryChildList(264)) .map((p) => ({ value: p.id, text: p.title, })) , } as CheckBoxListProps, defaultValue: [], rules: [], }, { label: '屋面形式说明', name: 'roofDescribe', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '屋面形式说明', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '围护墙体(多选)', name: 'wallType', type: 'check-box-list', additionalProps: { multiple: true, loadData: async () => (await VillageInfoApi.getCategoryChildList(271)) .map((p) => ({ value: p.id, text: p.title, })) , } as CheckBoxListProps, defaultValue: [], rules: [], }, { label: '围护墙体说明', name: 'otherBuildingType', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '围护墙体说明', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '地面做法(多选)', name: 'floorType', type: 'check-box-list', additionalProps: { multiple: true, loadData: async () => (await VillageInfoApi.getCategoryChildList(258)) .map((p) => ({ value: p.id, text: p.title, })) , } as CheckBoxListProps, defaultValue: [], rules: [], }, { label: '地面做法说明', name: 'floorDescribe', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '地面做法说明', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '特殊工艺做法', name: 'specialProcess', type: 'text', defaultValue: '', additionalProps: { placeholder: '特殊工艺做法' }, rules: [] }, ] }, { label: '建筑用途', name: 'detailsInfo', type: 'flat-group', childrenColProps: { span: 24 }, children: [ { label: '历史功能', name: 'funcHistory', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '历史功能', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '现状用途(多选)', name: 'purpose', type: 'check-box-list', additionalProps: { multiple: true, loadData: async () => (await VillageInfoApi.getCategoryChildList(252)) .map((p) => ({ value: p.id, text: p.title, })) , } as CheckBoxListProps, defaultValue: [], rules: [], }, { label: '其他现状用途', name: 'otherPurpose', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '其他现状用途', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '改扩建情况及维修状况', name: 'repair', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '改扩建情况及维修状况', maxLength: 5000, showWordLimit: true, }, rules: [] }, { label: '改扩建情况及维修状况说明', name: 'repairDescribe', type: 'textarea', defaultValue: '', additionalProps: { placeholder: '改扩建情况及维修状况说明', maxLength: 5000, showWordLimit: true, }, rules: [] }, ] }, ] }), { title: title, typeName: 'nature' }] } export const villageInfoDistributionForm : SingleForm = [CommonInfoModel, (r) => ({ formItems: [ { label: '建筑数量', name: 'num', type: 'number', defaultValue: '', additionalProps: { min: 0, max: 100, }, rules: [{ required: true, message: '请输入建筑数量', }] }, { label: '分布图', name: 'distribution', type: 'uploader', defaultValue: '', additionalProps: { upload: useAliOssUploadCo('xiangyuan/distribution'), maxFileSize: 1024 * 1024 * 20, single: true, } as UploaderFieldProps, rules: [{ required: true, message: '请上传分布图', }] }, { label: '营造智慧', name: 'wisdom', type: 'richtext', defaultValue: '', additionalProps: { placeholder: '请输入营造智慧', maxLength: 5000, showWordLimit: true, }, rules: [{ required: true, message: '请输入营造智慧', }] }, ...villageCommonContent(r, { title: '建筑分布', showContent: false, showTitle: false, }).formItems ] }), { title: '建筑分布', typeName: '', }]