feat(approval): hidden updateForm when approvaled (#1397)
Reviewed-on: daoyoucloud/tachybase#1397 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
This commit is contained in:
parent
021a96e85f
commit
1797292dbc
@ -43,6 +43,10 @@ function InternalFormBlockInitializer({ schema, ...others }) {
|
||||
marginTop: '1.5em',
|
||||
flexWrap: 'wrap',
|
||||
};
|
||||
|
||||
// NOTE: 给表单区域添加 Provider, 方便根据不同进程,控制显示隐藏; ProviderApprovalUpdateForm 在 usage 文件夹里声明和注册
|
||||
result.properties[formKey].properties['grid']['x-decorator'] = 'ProviderApprovalUpdateForm';
|
||||
|
||||
traverseSchema(result, (node) => {
|
||||
if (node['x-uid']) {
|
||||
delete node['x-uid'];
|
||||
|
@ -0,0 +1,11 @@
|
||||
import { APPROVAL_ACTION_STATUS } from '../../../constants';
|
||||
import { useContextApprovalExecutions } from './Pd.ApprovalExecutions';
|
||||
|
||||
export const ProviderApprovalUpdateForm = (props) => {
|
||||
const { status } = useContextApprovalExecutions();
|
||||
if (status === APPROVAL_ACTION_STATUS.PENDING) {
|
||||
return props.children;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
@ -19,6 +19,7 @@ import { ApprovalContext } from '../../approval-common/ApprovalData.provider';
|
||||
import { ContextWithActionEnabled } from '../../approval-common/WithActionEnabled.provider';
|
||||
import { ContextApprovalExecution } from '../common/ApprovalExecution.provider';
|
||||
import { SchemaComponentContextProvider } from '../common/SchemaComponent.provider';
|
||||
import { ProviderApprovalUpdateForm } from './ApprovalUpdateForm.provider';
|
||||
import { ApprovalFormBlockDecorator } from './Dt.ApprovalFormBlock';
|
||||
import { useApprovalDetailBlockProps } from './hooks/useApprovalDetailBlockProps';
|
||||
import { useApprovalFormBlockProps } from './hooks/useApprovalFormBlockProps';
|
||||
@ -98,6 +99,7 @@ export const ViewActionTodosContent = () => {
|
||||
ApprovalActionProvider,
|
||||
ApprovalFormBlockProvider: ApprovalFormBlockDecorator,
|
||||
DetailsBlockProvider,
|
||||
ProviderApprovalUpdateForm,
|
||||
}}
|
||||
scope={{
|
||||
useApprovalDetailBlockProps,
|
||||
|
Loading…
Reference in New Issue
Block a user