|
@@ -86,57 +86,115 @@ export const formConfig: Config = {
|
|
|
// showPropsForm: false, // 隐藏组件的属性配置
|
|
|
switchType: false, // 是否可以切换类型
|
|
|
showEventForm: false, // 隐藏组件的事件配置
|
|
|
+ showBaseForm: false, // 隐藏组件的基础配置
|
|
|
showCustomProps: false, //是否显示自定义props按钮
|
|
|
// 自定义右侧菜单
|
|
|
componentRule: {
|
|
|
default: {
|
|
|
prepend: true,
|
|
|
- rule(rule) {
|
|
|
+ rule(rule: any) {
|
|
|
return [
|
|
|
{
|
|
|
type: 'input',
|
|
|
- field: 'defaultValue',
|
|
|
- label: '提示词',
|
|
|
- title: '提示词',
|
|
|
+ field: 'title',
|
|
|
+ label: '标题',
|
|
|
+ title: '标题',
|
|
|
on: {
|
|
|
change: (val: string) => {
|
|
|
- rule.value = val
|
|
|
+ rule.title = val
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ field: 'placeholder',
|
|
|
+ label: '提示文本',
|
|
|
+ title: '提示文本',
|
|
|
+ on: {
|
|
|
+ change: (val: string) => {
|
|
|
+ rule.placeholder = val
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'switch',
|
|
|
+ field: 'require',
|
|
|
+ label: '是否必填',
|
|
|
+ title: '是否必填',
|
|
|
+ on: {
|
|
|
+ change(val: any) {
|
|
|
+ console.log(val)
|
|
|
+ rule.$required = !!val
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
]
|
|
|
},
|
|
|
},
|
|
|
- input: (rule) => {
|
|
|
+ input(rule) {
|
|
|
return [
|
|
|
{
|
|
|
- type: 'rc-switch',
|
|
|
- field: 'synchronize_field',
|
|
|
- label: '高级功能',
|
|
|
- title: '高级功能',
|
|
|
- props: {
|
|
|
- rule,
|
|
|
+ type: 'inputNumber',
|
|
|
+ field: 'maxlength',
|
|
|
+ label: '最大输入长度',
|
|
|
+ title: '最大输入长度',
|
|
|
+ on: {
|
|
|
+ change: (val: string) => {
|
|
|
+ console.log(rule)
|
|
|
+ rule!.props!.maxlength = val
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
]
|
|
|
},
|
|
|
-
|
|
|
- textarea: {
|
|
|
- append: true,
|
|
|
- rule(rule) {
|
|
|
- return [
|
|
|
- {
|
|
|
- type: 'rc-switch',
|
|
|
- field: 'synchronize_field',
|
|
|
- label: '高级功能',
|
|
|
- title: '高级功能',
|
|
|
- props: {
|
|
|
- rule,
|
|
|
+ textarea(rule) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: 'inputNumber',
|
|
|
+ field: 'maxlength',
|
|
|
+ label: '最大输入长度',
|
|
|
+ title: '最大输入长度',
|
|
|
+ on: {
|
|
|
+ change: (val: string) => {
|
|
|
+ console.log(rule)
|
|
|
+ rule!.props!.maxlength = val
|
|
|
},
|
|
|
},
|
|
|
- ]
|
|
|
- },
|
|
|
+ },
|
|
|
+ ]
|
|
|
},
|
|
|
+ // input: {
|
|
|
+ // append: true,
|
|
|
+ // rule(rule) {
|
|
|
+ // return [
|
|
|
+ // {
|
|
|
+ // type: 'rc-switch',
|
|
|
+ // field: 'synchronize_field',
|
|
|
+ // label: '高级功能',
|
|
|
+ // title: '高级功能',
|
|
|
+ // props: {
|
|
|
+ // rule,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // textarea: {
|
|
|
+ // append: true,
|
|
|
+ // rule(rule) {
|
|
|
+ // return [
|
|
|
+ // {
|
|
|
+ // type: 'rc-switch',
|
|
|
+ // field: 'synchronize_field',
|
|
|
+ // label: '高级功能',
|
|
|
+ // title: '高级功能',
|
|
|
+ // props: {
|
|
|
+ // rule,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // },
|
|
|
},
|
|
|
// 自定义表单事件
|
|
|
formRule() {
|
|
@@ -190,7 +248,7 @@ const formatOptions = (result: any) => {
|
|
|
const formContentValue = {
|
|
|
field_name: item.title, // 字段名称
|
|
|
field_type: item.type.startsWith('rc-') ? item.type.substring(3) : item.type, // rc- 前缀
|
|
|
- default_text: item.value || '', // 默认文本
|
|
|
+ default_text: item.placeholder || '', // 默认文本
|
|
|
is_required: item.$required ? 1 : 0, // 是否必填
|
|
|
field_options: item.options?.map((op: any) => ({
|
|
|
count: 0,
|
|
@@ -199,6 +257,7 @@ const formatOptions = (result: any) => {
|
|
|
})),
|
|
|
synchronize_field: item.synchronize_field,
|
|
|
submit_count: 0,
|
|
|
+ click_count: 0,
|
|
|
}
|
|
|
|
|
|
if (item.props?.type === 'textarea') {
|