diff --git a/src/steps/form/index.tsx b/src/steps/form/index.tsx index 5be24f068f51c1210dbba4e48eaa5d87f2f7fb52..27debc884e7aebb4c56d66c25caa4cde4987e33f 100644 --- a/src/steps/form/index.tsx +++ b/src/steps/form/index.tsx @@ -79,6 +79,7 @@ export interface ActionConfig { type: 'submit' | 'cancel' | 'ccms', label: string, mode: 'normal' | 'primary' | 'link', + submitValidate: boolean condition?: ConditionConfig handle?: OperationConfig callback?: { @@ -620,6 +621,7 @@ export default class FormStep extends Step { onClick: () => this.handleCancel() })) } else { + const submitValidate = actions[index].submitValidate const OperationHelperWrapper = { this.renderButtonComponent({ label: actions[index].label || '', mode: actions[index].mode, - onClick + onClick: submitValidate + ? async () => { + await this.handleValidations() + console.info('表单参数信息', this.submitData, this.state.formValue, this.formData) + if (this.canSubmit) { + onClick() + } + } + : onClick }) )} @@ -645,7 +655,7 @@ export default class FormStep extends Step { } } } - + if (ready) { return ( diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index a3a5dbd5e306c1cb473818dd941fb6f2aa0bacda..44071b1d7968cf6e30e5b03e52f95d66dc79c074 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -62,7 +62,9 @@ export interface TableCCMSOperationConfig { type: 'ccms' page: any target: 'current' | 'page' | 'open' | 'handle' + historyTpye?: 'replace' targetURL: string + width: string data: { [key: string]: ParamConfig } params?: { field: string, data: ParamConfig }[] callback?: boolean @@ -98,6 +100,7 @@ interface TableOperationConfirmConfig { export interface ITable { title: string | null primary: string + width: string data: { [field: string]: any }[] columns: ITableColumn[] pagination?: { @@ -213,6 +216,7 @@ interface TableState { operation: { enable: boolean target: 'current' | 'handle' + width: string title: string visible: boolean config: CCMSConfig @@ -245,6 +249,7 @@ export default class TableStep extends Step { enable: false, target: 'current', title: '', + width: '400px', visible: false, config: {}, data: {}, @@ -322,6 +327,7 @@ export default class TableStep extends Step { operation: { enable: true, target: operation.handle.target, + width: operation.handle.width, title: operation.label, visible: true, config: operationConfig, @@ -337,7 +343,11 @@ export default class TableStep extends Step { if (this.props.handlePageRedirect) { this.props.handlePageRedirect(`${targetURL}${targetKey}`) } else { - window.location.href = `${targetURL}${targetKey}` + if (operation.handle.historyTpye === 'replace') { + window.location.replace(`${targetURL}${targetKey}`) + } else { + window.location.href = `${targetURL}${targetKey}` + } } } else if (operation.handle.target === 'open') { const sourceURL = await this.props.loadPageFrameURL(operation.handle.page) @@ -502,6 +512,7 @@ export default class TableStep extends Step { operation: { enable: operationEnable, target: operationTarget, + width: operationWidth, title: operationTitle, visible: operationVisible, config: operationConfig, @@ -518,6 +529,7 @@ export default class TableStep extends Step { const props: ITable = { title: label, + width, primary, data: getDate, columns: (columns || []).filter((column) => column.field !== undefined && column.field !== '').map((column, index) => { @@ -702,11 +714,11 @@ export default class TableStep extends Step { {operationEnable && ( operationTarget === 'current' ? ( - this.renderOperationModal({ - title: operationTitle, - width, - visible: operationVisible, - children: ( + this.renderOperationModal({ + title: operationTitle, + width: operationWidth, + visible: operationVisible, + children: ( { } }} /> - ), - onClose: () => { - const { operation } = this.state - operation.enable = false - operation.visible = false - this.setState({ operation }) - } - }) - ) + ), + onClose: () => { + const { operation } = this.state + operation.enable = false + operation.visible = false + this.setState({ operation }) + } + }) + ) : ( { } }} /> - ) + ) )} )