123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- import { FormSchema } from '/@/components/Table';
- import { getBaiduAdd, getSprotProject } from '/@/api/common/api';
- import { h } from 'vue';
- import { JAreaSelect } from '/@/components/Form';
- import { InputGroup, Input, Button, message } from 'ant-design-vue';
- export const formSchema: FormSchema[] = [
- {
- label: '',
- field: 'id',
- component: 'Input',
- show: false,
- },
- {
- field: 'type',
- label: '业务类型',
- component: 'Select',
- componentProps: {
- options: [
- { label: '学校', value: 0 },
- { label: '体育馆', value: 1 },
- ],
- },
- required: true,
- },
- {
- field: 'name',
- label: '营业名称',
- component: 'Input',
- required: true,
- },
- {
- field: 'province',
- label: '营业地址',
- component: 'JAreaSelect',
- slot: 'address',
- required: true,
- },
- {
- field: 'address',
- label: '详细地址',
- component: 'Input',
- required: true,
- render: ({ model }) => {
- return h(
- InputGroup,
- {
- compact: true,
- },
- () => [
- h(Input, {
- value: model['address'],
- style: 'width: calc(100% - 70px)',
- onChange: (e) => {
- model['address'] = e.target.value;
- },
- }),
- h(
- Button,
- {
- onClick: async () => {
- if (!model['address'] || !model['province']) return message.warning('请输入地址');
- const res = await getBaiduAdd({ address: `${model['province']}${model['city']}${model['area']}${model['address']}` });
- model['latitude'] = res.latitude;
- model['longitude'] = res.longitude;
- },
- },
- () => '定位'
- ),
- ]
- );
- },
- },
- {
- field: 'province',
- label: '',
- component: 'JAreaSelect',
- show: false,
- },
- {
- field: 'city',
- label: '',
- component: 'JAreaSelect',
- show: false,
- },
- {
- field: 'area',
- label: '',
- component: 'JAreaSelect',
- show: false,
- },
- {
- field: 'longitude',
- label: '经度',
- component: 'Input',
- required: true,
- colProps: {
- sm: 8,
- },
- componentProps: {
- placeholder: '输入详细地址后点击定位,自动填充',
- },
- },
- {
- field: 'latitude',
- label: '维度',
- component: 'Input',
- required: true,
- colProps: {
- sm: 8,
- },
- componentProps: {
- placeholder: '输入详细地址后点击定位,自动填充',
- },
- },
- {
- field: 'title1',
- colSlot: 'title1',
- label: '',
- component: 'RangePicker',
- labelWidth: 0,
- },
- {
- field: 'runStatus',
- label: '经营状态',
- component: 'RadioGroup',
- required: true,
- componentProps: {
- options: [
- { label: '营业', value: 0 },
- { label: '休息', value: 1 },
- ],
- },
- defaultValue: 0,
- },
- {
- field: 'runType',
- label: '营业时间',
- component: 'RadioGroup',
- required: true,
- componentProps: {
- options: [
- { label: '全天', value: 0 },
- { label: '自定义', value: 1 },
- ],
- },
- ifShow(model) {
- return model.model['runStatus'] == 0;
- },
- defaultValue: 0,
- colProps: { span: 8 },
- },
- {
- label: '',
- component: 'RangeTime',
- field: 'Time',
- colProps: { span: 6 },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model['runType'] == 1;
- },
- },
- {
- field: 'phone',
- label: '客服电话',
- component: 'Input',
- required: true,
- slot: 'phone',
- },
- {
- field: 'facility',
- label: '设施/服务',
- component: 'JCheckbox',
- required: true,
- componentProps: {
- dictCode: 'facilities_service',
- },
- },
- {
- field: 'categoryId',
- label: '运动项目',
- component: 'ApiSelect',
- required: true,
- componentProps: {
- api: getSprotProject,
- params: {
- pageSize: 50,
- },
- labelField: 'name',
- valueField: 'id',
- resultField: 'records',
- mode: 'multiple',
- // options: sportList.records.map((it) => {
- // return {
- // label: it.name,
- // value: it.id,
- // };
- // }),
- },
- },
- {
- field: 'title3',
- colSlot: 'title3',
- label: '',
- component: 'RangePicker',
- labelWidth: 0,
- },
- {
- field: 'video',
- label: '视频',
- component: 'Input',
- slot: 'VideoUpload',
- },
- {
- field: 'cover',
- label: '图片',
- component: 'JImageUpload',
- required: true,
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- },
- {
- field: 'title4',
- colSlot: 'title4',
- label: '',
- component: 'RangePicker',
- labelWidth: 0,
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- {
- field: 'before',
- label: '图片(前)',
- component: 'JImageUpload',
- colProps: { xl: 12 },
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- {
- field: 'after',
- label: '图片(后)',
- component: 'JImageUpload',
- colProps: { xl: 12 },
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- {
- field: 'left',
- label: '图片(左)',
- component: 'JImageUpload',
- colProps: { xl: 12 },
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- {
- field: 'right',
- label: '图片(右)',
- component: 'JImageUpload',
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- colProps: { xl: 12 },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- {
- field: 'up',
- label: '图片(上)',
- component: 'JImageUpload',
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- colProps: { xl: 12 },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- {
- field: 'down',
- label: '图片(下)',
- component: 'JImageUpload',
- componentProps: {
- tipText: '支持单张上传;宽高比为5:4,且宽高均大于480px,大小5M以内。',
- },
- colProps: { xl: 12 },
- ifShow(renderCallbackParams) {
- return renderCallbackParams.model.type == 1;
- },
- },
- ];
|