增加审批组件
This commit is contained in:
parent
15d3720f5f
commit
099b979ce7
@ -44,11 +44,11 @@ export const applicationsConfig: DataSourceConfig = {
|
||||
params: { enabled: true },
|
||||
transform: (data: any[]) => {
|
||||
return data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
code: item.code,
|
||||
label: item.appName, // ✅ 修正:使用 appName
|
||||
value: item.appCode,
|
||||
code: item.appCode, // ✅ 修正:使用 appCode
|
||||
projectGroupId: item.projectGroupId,
|
||||
description: item.description
|
||||
description: item.appDesc || item.description // ✅ 修正:使用 appDesc
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
@ -6,6 +6,18 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import { Modal } from 'antd';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogPortal,
|
||||
AlertDialogOverlay,
|
||||
} from '@/components/ui/alert-dialog';
|
||||
import { FormRenderer, type FormRendererRef } from '@/components/FormDesigner';
|
||||
import type { FormDefinitionResponse } from '@/pages/Form/Definition/types';
|
||||
import type { WorkflowDefinition } from '../types';
|
||||
@ -32,6 +44,7 @@ const StartWorkflowModal: React.FC<StartWorkflowModalProps> = ({
|
||||
}) => {
|
||||
const formRef = useRef<FormRendererRef>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [showCancelConfirm, setShowCancelConfirm] = useState(false);
|
||||
|
||||
// 处理提交
|
||||
const handleSubmit = async (formData: Record<string, any>) => {
|
||||
@ -58,14 +71,14 @@ const StartWorkflowModal: React.FC<StartWorkflowModalProps> = ({
|
||||
|
||||
// 处理取消
|
||||
const handleCancel = () => {
|
||||
Modal.confirm({
|
||||
title: '确认取消',
|
||||
content: '工作流将不会启动,确定要取消吗?',
|
||||
onOk: () => {
|
||||
setShowCancelConfirm(true);
|
||||
};
|
||||
|
||||
// 确认取消
|
||||
const confirmCancel = () => {
|
||||
formRef.current?.reset();
|
||||
setShowCancelConfirm(false);
|
||||
onClose();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 处理表单提交触发
|
||||
@ -87,26 +100,28 @@ const StartWorkflowModal: React.FC<StartWorkflowModalProps> = ({
|
||||
const { schema } = formDefinition;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
title={`启动工作流:${workflowDefinition.name}`}
|
||||
title={formDefinition.name || `启动工作流:${workflowDefinition.name}`}
|
||||
open={open}
|
||||
onCancel={handleCancel}
|
||||
width={schema.formConfig.formWidth || 600}
|
||||
footer={[
|
||||
<Button key="reset" variant="outline" onClick={() => formRef.current?.reset()}>
|
||||
footer={
|
||||
<div style={{ display: 'flex', gap: '8px', justifyContent: 'flex-end' }}>
|
||||
<Button variant="outline" onClick={() => formRef.current?.reset()}>
|
||||
重置
|
||||
</Button>,
|
||||
<Button key="cancel" variant="outline" onClick={handleCancel}>
|
||||
</Button>
|
||||
<Button variant="outline" onClick={handleCancel}>
|
||||
取消
|
||||
</Button>,
|
||||
</Button>
|
||||
<Button
|
||||
key="submit"
|
||||
onClick={handleTriggerSubmit}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? '启动中...' : '启动工作流'}
|
||||
</Button>,
|
||||
]}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
destroyOnClose
|
||||
>
|
||||
<FormRenderer
|
||||
@ -131,6 +146,26 @@ const StartWorkflowModal: React.FC<StartWorkflowModalProps> = ({
|
||||
<div><strong>表单版本:</strong>v{formDefinition.formVersion}</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
{/* 取消确认对话框 - 设置更高的 z-index 确保在 Modal 之上 */}
|
||||
<AlertDialog open={showCancelConfirm} onOpenChange={setShowCancelConfirm}>
|
||||
<AlertDialogPortal>
|
||||
<AlertDialogOverlay style={{ zIndex: 1050 }} />
|
||||
<AlertDialogContent style={{ zIndex: 1051 }}>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>确认取消</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
工作流将不会启动,确定要取消吗?
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel onClick={() => setShowCancelConfirm(false)}>返回</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={confirmCancel}>确定取消</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialogPortal>
|
||||
</AlertDialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user