mirror of
https://gitee.com/JavaLionLi/plus-ui.git
synced 2026-11-02 21:37:00 +08:00
fix 修复 定时事件任务 表单无法查看流程监控问题
This commit is contained in:
parent
c4b85dd36c
commit
85e45a76d4
@ -76,9 +76,10 @@ export function updateVariable(data: { instanceId?: string | number; key?: strin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function flowHisTaskList(businessId: string | number) {
|
export function flowHisTaskList(ids: { businessId?: string | number; instanceId?: string | number }) {
|
||||||
return request<R<FlowHisTaskResult>>({
|
return request<R<FlowHisTaskResult>>({
|
||||||
url: `/workflow/instance/flowHisTaskList/${businessId}?t=${Math.random()}`,
|
url: '/workflow/instance/flowHisTaskList',
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
params: ids
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,14 @@ import { normalizePath } from '@/utils/ruoyi';
|
|||||||
import type { RouterJumpVO } from './types';
|
import type { RouterJumpVO } from './types';
|
||||||
|
|
||||||
export function routerJump(routerJump: RouterJumpVO) {
|
export function routerJump(routerJump: RouterJumpVO) {
|
||||||
|
const query = new URLSearchParams({
|
||||||
|
type: routerJump.type,
|
||||||
|
taskId: String(routerJump.taskId)
|
||||||
|
});
|
||||||
|
if (routerJump.businessId) query.set('id', routerJump.businessId);
|
||||||
|
if (routerJump.instanceId != null) query.set('instanceId', String(routerJump.instanceId));
|
||||||
history.push(
|
history.push(
|
||||||
`${normalizePath(routerJump.formPath || '/workflow/leaveEdit/index')}?${new URLSearchParams({
|
`${normalizePath(routerJump.formPath || '/workflow/leaveEdit/index')}?${query.toString()}`
|
||||||
id: routerJump.businessId,
|
|
||||||
type: routerJump.type,
|
|
||||||
taskId: String(routerJump.taskId)
|
|
||||||
}).toString()}`
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
export interface RouterJumpVO {
|
export interface RouterJumpVO {
|
||||||
businessId: string;
|
businessId: string;
|
||||||
|
instanceId?: string | number;
|
||||||
taskId: string | number;
|
taskId: string | number;
|
||||||
type: string;
|
type: string;
|
||||||
formCustom: string;
|
formCustom: string;
|
||||||
|
|||||||
@ -7,6 +7,8 @@ interface ApprovalButtonProps {
|
|||||||
status?: string;
|
status?: string;
|
||||||
pageType: ApprovalPageType;
|
pageType: ApprovalPageType;
|
||||||
id?: string | number;
|
id?: string | number;
|
||||||
|
businessId?: string | number;
|
||||||
|
instanceId?: string | number;
|
||||||
buttonLoading?: boolean;
|
buttonLoading?: boolean;
|
||||||
onSubmitDraft: () => void;
|
onSubmitDraft: () => void;
|
||||||
onSubmit: () => void;
|
onSubmit: () => void;
|
||||||
@ -19,6 +21,8 @@ export default function ApprovalButton({
|
|||||||
status,
|
status,
|
||||||
pageType,
|
pageType,
|
||||||
id,
|
id,
|
||||||
|
businessId,
|
||||||
|
instanceId,
|
||||||
buttonLoading = false,
|
buttonLoading = false,
|
||||||
onSubmitDraft,
|
onSubmitDraft,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
@ -29,7 +33,7 @@ export default function ApprovalButton({
|
|||||||
const submitButtonShow =
|
const submitButtonShow =
|
||||||
pageType === 'add' || (pageType === 'update' && !!status && ['draft', 'cancel', 'back'].includes(status));
|
pageType === 'add' || (pageType === 'update' && !!status && ['draft', 'cancel', 'back'].includes(status));
|
||||||
const approvalButtonShow = pageType === 'approval' && status === 'waiting';
|
const approvalButtonShow = pageType === 'approval' && status === 'waiting';
|
||||||
const approvalRecordShow = !!id && status !== 'draft';
|
const approvalRecordShow = !!(id || businessId || instanceId) && status !== 'draft';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="workflow-approval-button-bar">
|
<div className="workflow-approval-button-bar">
|
||||||
|
|||||||
@ -15,18 +15,19 @@ import UserNameDisplay from './UserNameDisplay';
|
|||||||
|
|
||||||
interface ApprovalRecordProps {
|
interface ApprovalRecordProps {
|
||||||
businessId?: string | number;
|
businessId?: string | number;
|
||||||
|
instanceId?: string | number;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onOpenChange: (open: boolean) => void;
|
onOpenChange: (open: boolean) => void;
|
||||||
width?: string | number;
|
width?: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ApprovalRecord({ businessId, open, onOpenChange, width = '80%' }: ApprovalRecordProps) {
|
export default function ApprovalRecord({ businessId, instanceId, open, onOpenChange, width = '80%' }: ApprovalRecordProps) {
|
||||||
const dicts = useDict('wf_task_status');
|
const dicts = useDict('wf_task_status');
|
||||||
const [recordList, setRecordList] = useState<FlowHistoryVO[]>([]);
|
const [recordList, setRecordList] = useState<FlowHistoryVO[]>([]);
|
||||||
const [instanceId, setInstanceId] = useState<string | number>();
|
const [recordInstanceId, setRecordInstanceId] = useState<string | number>();
|
||||||
const { loading, runAsync: loadRecords } = useRequest(
|
const { loading, runAsync: loadRecords } = useRequest(
|
||||||
async (nextBusinessId: string | number) => {
|
async (ids: { businessId?: string | number; instanceId?: string | number }) => {
|
||||||
const res = await flowHisTaskList(nextBusinessId);
|
const res = await flowHisTaskList(ids);
|
||||||
const rows = res.data?.list || [];
|
const rows = res.data?.list || [];
|
||||||
const nextRows = await Promise.all(
|
const nextRows = await Promise.all(
|
||||||
rows.map(async row => {
|
rows.map(async row => {
|
||||||
@ -47,17 +48,17 @@ export default function ApprovalRecord({ businessId, open, onOpenChange, width =
|
|||||||
manual: true,
|
manual: true,
|
||||||
onSuccess: data => {
|
onSuccess: data => {
|
||||||
setRecordList(data.rows);
|
setRecordList(data.rows);
|
||||||
setInstanceId(data.instanceId);
|
setRecordInstanceId(data.instanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 打开时清空旧数据并加载 打开弹窗同步外部状态属于合理场景
|
// 打开时清空旧数据并加载 打开弹窗同步外部状态属于合理场景
|
||||||
const resetAndLoad = useCallback(async (nextBusinessId?: string | number) => {
|
const resetAndLoad = useCallback(async (nextBusinessId?: string | number, nextInstanceId?: string | number) => {
|
||||||
setRecordList([]);
|
setRecordList([]);
|
||||||
setInstanceId(undefined);
|
setRecordInstanceId(undefined);
|
||||||
if (nextBusinessId) {
|
if (nextBusinessId || nextInstanceId) {
|
||||||
await loadRecords(nextBusinessId);
|
await loadRecords({ businessId: nextBusinessId, instanceId: nextInstanceId });
|
||||||
}
|
}
|
||||||
}, [loadRecords]);
|
}, [loadRecords]);
|
||||||
|
|
||||||
@ -65,8 +66,8 @@ export default function ApprovalRecord({ businessId, open, onOpenChange, width =
|
|||||||
if (!open) return;
|
if (!open) return;
|
||||||
// 打开弹窗时同步清空旧数据属于与外部状态对齐的合理场景
|
// 打开弹窗时同步清空旧数据属于与外部状态对齐的合理场景
|
||||||
// oxlint-disable-next-line react/set-state-in-effect
|
// oxlint-disable-next-line react/set-state-in-effect
|
||||||
void resetAndLoad(businessId);
|
void resetAndLoad(businessId, instanceId);
|
||||||
}, [businessId, open, resetAndLoad]);
|
}, [businessId, instanceId, open, resetAndLoad]);
|
||||||
|
|
||||||
const downloadAttachment = async (row: OssVO) => {
|
const downloadAttachment = async (row: OssVO) => {
|
||||||
const blob = await downloadOss(row.ossId);
|
const blob = await downloadOss(row.ossId);
|
||||||
@ -153,7 +154,7 @@ export default function ApprovalRecord({ businessId, open, onOpenChange, width =
|
|||||||
label: '流程图',
|
label: '流程图',
|
||||||
children: (
|
children: (
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<FlowChart instanceId={instanceId} />
|
<FlowChart instanceId={recordInstanceId} />
|
||||||
</Spin>
|
</Spin>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export default function WorkflowLeaveEditPage() {
|
|||||||
const query = useMemo(() => new URLSearchParams(location.search), [location.search]);
|
const query = useMemo(() => new URLSearchParams(location.search), [location.search]);
|
||||||
const pageType = (query.get('type') || 'add') as PageType;
|
const pageType = (query.get('type') || 'add') as PageType;
|
||||||
const id = query.get('id');
|
const id = query.get('id');
|
||||||
|
const instanceId = query.get('instanceId') || undefined;
|
||||||
const taskId = query.get('taskId') || '';
|
const taskId = query.get('taskId') || '';
|
||||||
const readonly = pageType === 'view';
|
const readonly = pageType === 'view';
|
||||||
const [flowCode, setFlowCode] = useState('');
|
const [flowCode, setFlowCode] = useState('');
|
||||||
@ -117,7 +118,7 @@ export default function WorkflowLeaveEditPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const openApprovalRecord = () => {
|
const openApprovalRecord = () => {
|
||||||
if (!formId) return;
|
if (!id && !formId && !instanceId) return;
|
||||||
openRecordModal();
|
openRecordModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,6 +183,8 @@ export default function WorkflowLeaveEditPage() {
|
|||||||
status={formStatus}
|
status={formStatus}
|
||||||
pageType={pageType}
|
pageType={pageType}
|
||||||
id={formId}
|
id={formId}
|
||||||
|
businessId={id || undefined}
|
||||||
|
instanceId={instanceId}
|
||||||
buttonLoading={submitLoading}
|
buttonLoading={submitLoading}
|
||||||
onSubmitDraft={() => saveLeave()}
|
onSubmitDraft={() => saveLeave()}
|
||||||
onSubmit={submitFlow}
|
onSubmit={submitFlow}
|
||||||
@ -233,7 +236,7 @@ export default function WorkflowLeaveEditPage() {
|
|||||||
onSubmitted={finishWorkflowAction}
|
onSubmitted={finishWorkflowAction}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ApprovalRecord businessId={formId} open={recordOpen} onOpenChange={setRecordOpen} />
|
<ApprovalRecord businessId={id || formId} instanceId={instanceId} open={recordOpen} onOpenChange={setRecordOpen} />
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ function requestInstanceList(tab: InstanceTab, query: FlowInstanceQuery): Promis
|
|||||||
function openBusinessForm(row: FlowInstanceVO) {
|
function openBusinessForm(row: FlowInstanceVO) {
|
||||||
workflowCommon.routerJump({
|
workflowCommon.routerJump({
|
||||||
businessId: row.businessId,
|
businessId: row.businessId,
|
||||||
|
instanceId: row.id,
|
||||||
taskId: row.id,
|
taskId: row.id,
|
||||||
type: 'view',
|
type: 'view',
|
||||||
formCustom: row.formCustom || 'N',
|
formCustom: row.formCustom || 'N',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user