diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx index db099c748..990bb78cd 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx @@ -24,7 +24,8 @@ export const TabApprovalItem = observer((props) => { } else if (collectionName === 'users_jobs') { changeUsersJobsService(api, t, cm, compile, input, setData, params?.[tabKey], filter); } else if (collectionName === 'workflowNotice') { - changeWorkflowNoticeService(api, t, cm, compile, input, setData, params?.[tabKey], filter); + const user = await api.request({ url: 'users:list', params: { pageSize: 99999 } }); + changeWorkflowNoticeService(api, t, cm, compile, input, setData, params?.[tabKey], filter, user?.data?.data); } }, [filter, params, input]); @@ -95,6 +96,7 @@ const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setDa const statusType = approvalTodoListStatus(item, t); const categoryTitle = item.workflow.title.replace('审批流:', ''); const collectionName = item.workflow?.config?.collection || item.execution?.context?.collectionName; + const summary = Object.entries(item.summary)?.map(([key, value]) => { const field = cm.getCollectionField(`${collectionName}.${key}`); return { @@ -167,7 +169,7 @@ const changeUsersJobsService = (api, t, cm, compile, input, setData, params, fil }); }; -export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData, params, filter) => { +export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData, params, filter, user) => { api .request({ url: 'workflowNotice:listCentralized', @@ -205,9 +207,10 @@ export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData, value: (Object.prototype.toString.call(value) === '[object Object]' ? value?.['name'] : value) || '', }; }); + const nickName = user.find((userItem) => userItem.id === item.snapshot?.createdById)?.nickname; return { ...item, - title: `${item.user?.nickname}的${categoryTitle}`, + title: `${nickName}的${categoryTitle}`, categoryTitle: categoryTitle, statusTitle: t(statusType.label), statusColor: statusType.color, diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx index 1c6e8ab24..0a7121c32 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx @@ -24,6 +24,7 @@ import { MobileProvider } from '@tachybase/plugin-mobile-client/client'; import { observer } from '@tachybase/schema'; import { ContextApprovalExecution } from '../../context/ApprovalExecution'; +import { useWorkflowNoticeFormBlockProps } from '../hook/useFormBlockProps'; import { usePropsNoticeDetail } from '../hook/usePropsNoticeDetail'; // 审批-抄送-查看: 内容 @@ -93,7 +94,7 @@ export const ViewTodosWorkflowNoticeContent = observer((props) => { }} scope={{ usePropsNoticeDetail, - useDetailsBlockProps: useFormBlockContext, + useDetailsBlockProps: useWorkflowNoticeFormBlockProps, }} schema={{ type: 'void', diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useFormBlockProps.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useFormBlockProps.tsx index f598ef44f..5938142a3 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useFormBlockProps.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/hook/useFormBlockProps.tsx @@ -52,3 +52,16 @@ export function useUserJobsFormBlockProps() { return { form }; } + +export const useWorkflowNoticeFormBlockProps = () => { + const ctx = useFormBlockContext(); + const { snapshot } = useContextApprovalExecution(); + useEffect(() => { + if (!ctx?.service?.loading) { + ctx.form?.setInitialValues(snapshot); + } + }, [snapshot]); + return { + form: ctx.form, + }; +}; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx index 17627ca3e..78a28d551 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx @@ -10,7 +10,7 @@ type ComposedInput = ((props: InputProps) => React.ReactNode) & { export const MInput: ComposedInput = connect( Input, mapProps((props) => { - return { placeholder: '请输入内容', clearable: true, ...props, style: { '--font-size': '12px' } }; + return { placeholder: '请输入内容', clearable: true, ...props, style: { '--font-size': '12px', ...props?.style } }; }), mapReadPretty((props) => { return {props.value}; @@ -20,7 +20,7 @@ export const MInput: ComposedInput = connect( const MTextArea = connect( TextArea, mapProps((props) => { - return { ...props, placeholder: '请输入内容', clearable: true, style: { '--font-size': '12px' } }; + return { ...props, placeholder: '请输入内容', clearable: true, style: { '--font-size': '12px', ...props?.style } }; }), mapReadPretty((props) => { return