| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- import VillageInfoApi, { CommonInfoModel } from "@/api/inhert/VillageInfoApi";
- import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo";
- import type { PickerIdFieldProps } from "@/components/dynamic/wrappers/PickerIdField";
- import type { FieldProps } from "@/components/form/Field.vue";
- import type { StepperProps } from "@/components/form/Stepper.vue";
- import type { UploaderFieldProps } from "@/components/form/UploaderField.vue";
- import type { SingleForm } from "../forms";
- import { villageCommonContent } from "./common";
- export const vilElementForm : SingleForm = [CommonInfoModel, (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: '(可选)请输入编号',
- },
- },
- {
- label: '年代',
- name: 'age',
- type: 'select-id',
- additionalProps: {
- loadData: async () =>
- (await VillageInfoApi.getCategoryChildList(103))
- .map((p) => ({
- value: p.id,
- text: p.title,
- }))
- ,
- } as PickerIdFieldProps,
- formProps: { showRightArrow: true } as FieldProps,
- rules: [{
- required: true,
- message: '请选择年代',
- }],
- },
- {
- label: '要素类型',
- name: 'elementType',
- type: 'select-id',
- additionalProps: {
- loadData: async () =>
- (await VillageInfoApi.getCategoryChildList(178))
- .map((p) => ({
- value: p.id,
- text: p.title,
- }))
- ,
- } as PickerIdFieldProps,
- formProps: { showRightArrow: true } as FieldProps,
- rules: [{
- required: true,
- message: '请选择要素类型',
- }],
- },
- ]
- },
- {
- label: '详细信息',
- name: 'detailInfo',
- type: 'flat-group',
- childrenColProps: { span: 24 },
- children: [
- {
- label: '环境特点',
- name: 'environment',
- type: 'richtext',
- defaultValue: '',
- additionalProps: {
- placeholder: '请输入环境特点',
- maxLength: 500,
- showWordLimit: true,
- } as FieldProps,
- rules: []
- },
- {
- label: '功能特点',
- name: 'funcFeatures',
- type: 'richtext',
- defaultValue: '',
- additionalProps: {
- placeholder: '请输入功能特点',
- maxLength: 300,
- showWordLimit: true,
- } as FieldProps,
- rules: []
- },
- {
- label: '保存状况',
- name: 'condition',
- type: 'richtext',
- defaultValue: '',
- additionalProps: {
- placeholder: '请输入保存状况',
- maxLength: 500,
- showWordLimit: true,
- } as FieldProps,
- rules: []
- },
- {
- label: '文化故事',
- name: 'story',
- type: 'richtext',
- defaultValue: '',
- additionalProps: {
- placeholder: '请输入文化故事',
- maxLength: 1000,
- showWordLimit: true,
- } as FieldProps,
- rules: []
- },
- {
- label: '图片',
- name: 'images',
- type: 'uploader',
- defaultValue: '',
- additionalProps: {
- upload: useAliOssUploadCo('xiangyuan/element'),
- maxFileSize: 1024 * 1024 * 20,
- maxUploadCount: 20,
- } as UploaderFieldProps,
- rules: []
- },
- ...villageCommonContent(r, {
- title: '环境要素',
- showContent: false,
- showTitle: false,
- }).formItems
- ]
- },
- {
- label: '位置信息',
- name: 'locationInfo',
- type: 'flat-group',
- childrenColProps: { span: 24 },
- children: [
- {
- label: '位置',
- name: 'position',
- type: 'text',
- defaultValue: '',
- additionalProps: {
- placeholder: '请输入位置',
- },
- rules: [{
- required: true,
- message: '请输入位置',
- }]
- },
- {
- label: '经纬度',
- name: 'lonlat',
- type: 'select-lonlat',
- defaultValue: '',
- additionalProps: {},
- formProps: { showRightArrow: true } as FieldProps,
- rules: [{
- required: true,
- message: '请输入经纬度',
- }]
- },
- {
- label: '地址',
- name: 'address',
- type: 'select-address',
- defaultValue: '',
- additionalProps: {},
- rules: [{
- required: true,
- message: '请输入地址',
- }]
- },
- {
- label: '方位',
- name: 'orientation',
- type: 'text',
- defaultValue: '',
- additionalProps: { placeholder: '方位' },
- rules: []
- },
- {
- label: '相对距离',
- name: 'distance',
- type: 'text',
- defaultValue: '',
- additionalProps: { placeholder: '相对距离' },
- rules: []
- },
- {
- name: '',
- label: '平面坐标XY',
- type: 'flat-simple',
- children: [
- {
- label: '',
- name: 'mapX',
- type: 'number',
- defaultValue: 0,
- additionalProps: {
- min: -250,
- max: 250,
- } as StepperProps,
- formProps: {
- labelWidth: '0rpx',
- labelPosition: 'left',
- showBottomBorder: false,
- },
- rules: [{
- required: true,
- message: '请输入X',
- }]
- },
- {
- label: '',
- name: 'mapY',
- type: 'number',
- defaultValue: 0,
- additionalProps: {
- min: -250,
- max: 250,
- } as StepperProps,
- formProps: {
- labelWidth: '0rpx',
- labelPosition: 'left',
- showBottomBorder: false,
- },
- rules: [{
- required: true,
- message: '请输入Y',
- }]
- },
- ]
- },
- ]
- },
- ]
- })]
|