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
{props.value}
; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/AntdSelect.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/AntdSelect.tsx index 44ebfde15..ebf99c17a 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/AntdSelect.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/AntdSelect.tsx @@ -43,7 +43,7 @@ export const AntdSelect = observer((props) => { let inputValue = ''; if (isArray(value)) { value.forEach((item, index) => { - inputValue += `${item.label}${value.length - 1 === index ? '' : ','}`; + inputValue += `${item[fieldNamesLabel]}${value.length - 1 === index ? '' : ', '}`; }); } else if (value && typeof value === 'object') { inputValue = value[fieldNamesLabel]; @@ -133,7 +133,7 @@ export const AntdSelect = observer((props) => { style={{ color: '#c5c5c5' }} > {value?.length || (value && !isArray(value)) ? ( - + ) : ( {fieldSchema['x-disabled'] ? '' : '请选择内容'} )} diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/Select.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/Select.tsx index fc18ea6bc..ee94cfc0f 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/Select.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Select/Select.tsx @@ -57,8 +57,9 @@ export const MSelect = connect( } else { let redValue = ''; if (isArray(value)) { - redValue = value.reduce((prev, curr) => { - return prev + curr?.[fieldNamesLabel]; + redValue = value.reduce((prev, curr, index) => { + const currContext = value.length - 1 === index ? '' : ', '; + return prev + curr?.[fieldNamesLabel] + currContext; }, ''); } else { redValue = value?.[fieldNamesLabel] || '';