From cb13986a170815c5a21c86033057a8a56d608388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=8E=E4=BF=AE?= <95400047+HughCodeX@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:21:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E7=9A=84=E5=8F=B3=E4=BE=A7=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=9D=A2=E6=9D=BF=E4=B8=AD=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=94=99=E4=B9=B1=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#3300).=20close=20#3268?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VFormDesign/components/ComponentProps.vue | 2 +- .../VFormDesign/components/FormProps.vue | 2 ++ .../VFormDesign/config/formItemPropsConfig.ts | 26 ++++++++++--------- .../modules/FormComponentPanel.vue | 2 +- .../VFormDesign/modules/PropsPanel.vue | 3 +-- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/views/form-design/components/VFormDesign/components/ComponentProps.vue b/src/views/form-design/components/VFormDesign/components/ComponentProps.vue index 2736b37a9..a6ba9ca9a 100644 --- a/src/views/form-design/components/VFormDesign/components/ComponentProps.vue +++ b/src/views/form-design/components/VFormDesign/components/ComponentProps.vue @@ -182,7 +182,7 @@ baseComponentAttrs[formConfig.value.currentItem!.component] && baseComponentAttrs[formConfig.value.currentItem!.component].forEach(async (item) => { if (item.component) { - if (['Switch', 'Checkbox', 'Radio'].includes(item.component)) { + if (['Switch', 'Checkbox', 'Radio'].includes(item.component as string)) { item.category = 'control'; allOptions.value.push(item); } else { diff --git a/src/views/form-design/components/VFormDesign/components/FormProps.vue b/src/views/form-design/components/VFormDesign/components/FormProps.vue index b704f4d0d..d2e2a24b3 100644 --- a/src/views/form-design/components/VFormDesign/components/FormProps.vue +++ b/src/views/form-design/components/VFormDesign/components/FormProps.vue @@ -86,6 +86,8 @@ RadioChangeEvent, Form, FormItem, + RadioButton, + RadioGroup, } from 'ant-design-vue'; const { formConfig } = useFormDesignState(); diff --git a/src/views/form-design/components/VFormDesign/config/formItemPropsConfig.ts b/src/views/form-design/components/VFormDesign/config/formItemPropsConfig.ts index 99b4f76dc..80751b271 100644 --- a/src/views/form-design/components/VFormDesign/config/formItemPropsConfig.ts +++ b/src/views/form-design/components/VFormDesign/config/formItemPropsConfig.ts @@ -1,5 +1,7 @@ import { IAnyObject } from '../../../typings/base-type'; import { baseComponents, customComponents } from '../../../core/formItemConfig'; +import { Input, Select, RadioGroup, Slider } from 'ant-design-vue'; +import { Component } from 'vue'; export const globalConfigState: { span: number } = { span: 24, @@ -7,7 +9,7 @@ export const globalConfigState: { span: number } = { export interface IBaseFormAttrs { name: string; // 字段名 label: string; // 字段标签 - component?: string; // 属性控件 + component?: string | Component; // 属性控件 componentProps?: IAnyObject; // 传递给控件的属性 exclude?: string[]; // 需要排除的控件 includes?: string[]; // 符合条件的组件 @@ -155,7 +157,7 @@ export const advanceFormItemColProps: IBaseFormAttrs[] = [ { name: 'labelCol', label: '标签col', - component: 'Slider', + component: Slider, componentProps: { max: 24, min: 0, @@ -166,7 +168,7 @@ export const advanceFormItemColProps: IBaseFormAttrs[] = [ { name: 'wrapperCol', label: '控件-span', - component: 'Slider', + component: Slider, componentProps: { max: 24, min: 0, @@ -181,7 +183,7 @@ export const baseFormItemProps: IBaseFormAttrs[] = [ // 动态的切换控件的类型 name: 'component', label: '控件-FormItem', - component: 'Select', + component: Select, componentProps: { options: baseComponents .concat(customComponents) @@ -191,7 +193,7 @@ export const baseFormItemProps: IBaseFormAttrs[] = [ { name: 'label', label: '标签', - component: 'Input', + component: Input, componentProps: { type: 'Input', placeholder: '请输入标签', @@ -201,7 +203,7 @@ export const baseFormItemProps: IBaseFormAttrs[] = [ { name: 'field', label: '字段标识', - component: 'Input', + component: Input, componentProps: { type: 'InputTextArea', placeholder: '请输入字段标识', @@ -211,7 +213,7 @@ export const baseFormItemProps: IBaseFormAttrs[] = [ { name: 'helpMessage', label: 'helpMessage', - component: 'Input', + component: Input, componentProps: { placeholder: '请输入提示信息', }, @@ -224,7 +226,7 @@ export const advanceFormItemProps: IBaseFormAttrs[] = [ { name: 'labelAlign', label: '标签对齐', - component: 'RadioGroup', + component: RadioGroup, componentProps: { options: [ { @@ -243,7 +245,7 @@ export const advanceFormItemProps: IBaseFormAttrs[] = [ { name: 'help', label: 'help', - component: 'Input', + component: Input, componentProps: { placeholder: '请输入提示信息', }, @@ -252,7 +254,7 @@ export const advanceFormItemProps: IBaseFormAttrs[] = [ { name: 'extra', label: '额外消息', - component: 'Input', + component: Input, componentProps: { type: 'InputTextArea', placeholder: '请输入额外消息', @@ -262,7 +264,7 @@ export const advanceFormItemProps: IBaseFormAttrs[] = [ { name: 'validateTrigger', label: 'validateTrigger', - component: 'Input', + component: Input, componentProps: { type: 'InputTextArea', placeholder: '请输入validateTrigger', @@ -272,7 +274,7 @@ export const advanceFormItemProps: IBaseFormAttrs[] = [ { name: 'validateStatus', label: '校验状态', - component: 'RadioGroup', + component: RadioGroup, componentProps: { options: [ { diff --git a/src/views/form-design/components/VFormDesign/modules/FormComponentPanel.vue b/src/views/form-design/components/VFormDesign/modules/FormComponentPanel.vue index a7024cfa8..824e4ddc9 100644 --- a/src/views/form-design/components/VFormDesign/modules/FormComponentPanel.vue +++ b/src/views/form-design/components/VFormDesign/modules/FormComponentPanel.vue @@ -131,7 +131,7 @@ } .draggable-box { - height: calc(100vh - 200px); + height: calc(100vh - 120px); // width: 100%; overflow: auto; diff --git a/src/views/form-design/components/VFormDesign/modules/PropsPanel.vue b/src/views/form-design/components/VFormDesign/modules/PropsPanel.vue index 23b0989d1..be78fae0b 100644 --- a/src/views/form-design/components/VFormDesign/modules/PropsPanel.vue +++ b/src/views/form-design/components/VFormDesign/modules/PropsPanel.vue @@ -63,9 +63,8 @@ box-sizing: border-box; form { - position: absolute; width: 100%; - height: calc(100% - 50px); + height: 85vh; margin-right: 10px; overflow-x: hidden; overflow-y: auto;