Commit 6d237289 authored by cuiwenlong7's avatar cuiwenlong7
Browse files

feat:步骤、筛选表单显隐确定取消按钮、自定义文案

Showing with 19 additions and 4 deletions
+19 -4
......@@ -20,6 +20,10 @@ export interface FilterConfig extends StepConfig {
type: 'filter'
fields?: FieldConfigs[]
defaultValue?: ParamConfig
hiddenSubmit?: boolean // 是否隐藏确认按钮
hiddenReset?: boolean // 是否隐藏重置按钮
submitText?: string // 自定义确认按钮文本
resetText?: string // 自定义重置按钮文本
}
/**
......@@ -33,8 +37,10 @@ export interface FilterConfig extends StepConfig {
* - children: 表单内容
*/
export interface IFilter {
onSubmit: () => Promise<any>
onReset: () => Promise<any>
onSubmit?: () => Promise<any>
onReset?: () => Promise<any>
submitText?: string // 自定义确认按钮文本
resetText?: string // 自定义重置按钮文本
children: React.ReactNode[]
}
......@@ -59,6 +65,7 @@ export interface IFilterItem {
description?: string
message?: string
visitable: boolean
fieldType: string
children: React.ReactNode
}
......@@ -419,8 +426,10 @@ export default class FilterStep extends Step<FilterConfig, FilterState> {
<React.Fragment>
{/* 渲染表单 */}
{this.renderComponent({
onSubmit: async () => this.handleSubmit(),
onReset: async () => this.handleReset(),
onSubmit: this.props.config?.hiddenSubmit ? undefined : async () => this.handleSubmit(),
onReset: this.props.config?.hiddenReset ? undefined : async () => this.handleReset(),
submitText: this.props.config?.submitText,
resetText: this.props.config?.resetText,
children: fields.map((formFieldConfig, formFieldIndex) => {
if (!ConditionHelper(formFieldConfig.condition, { record: formValue, data, step })) {
this.formFieldsMounted[formFieldIndex] = false
......
......@@ -27,6 +27,8 @@ export interface FormConfig extends StepConfig {
defaultValue?: ParamConfig,
hiddenSubmit?: boolean // 是否隐藏提交按钮
hiddenCancel?: boolean // 是否隐藏取消按钮
submitText?: string // 自定义确认按钮文本
cancelText?: string // 自定义取消按钮文本
}
/**
......@@ -44,6 +46,8 @@ export interface IForm {
onSubmit?: () => Promise<any>
onCancel?: () => Promise<any>
children: React.ReactNode[]
submitText?: string // 自定义确认按钮文本
cancelText?: string // 自定义取消按钮文本
}
/**
......@@ -411,6 +415,8 @@ export default class FormStep extends Step<FormConfig, FormState> {
layout,
onSubmit: this.props.config.hiddenSubmit ? undefined : async () => this.handleSubmit(),
onCancel: this.props.config.hiddenCancel ? undefined : async () => this.handleCancel(),
submitText: this.props.config?.submitText,
cancelText: this.props.config?.cancelText,
children: fields.map((formFieldConfig, formFieldIndex) => {
if (!ConditionHelper(formFieldConfig.condition, { record: formValue, data, step })) {
return null
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment