fix: 修复移动端审批查看人名显示undefined,抄送人列表名字不正确 (#1164)
Reviewed-on: daoyoucloud/tachybase#1164 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
d7a3142ada
commit
c31608b8cb
@ -24,7 +24,8 @@ export const TabApprovalItem = observer((props) => {
|
|||||||
} else if (collectionName === 'users_jobs') {
|
} else if (collectionName === 'users_jobs') {
|
||||||
changeUsersJobsService(api, t, cm, compile, input, setData, params?.[tabKey], filter);
|
changeUsersJobsService(api, t, cm, compile, input, setData, params?.[tabKey], filter);
|
||||||
} else if (collectionName === 'workflowNotice') {
|
} 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]);
|
}, [filter, params, input]);
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setDa
|
|||||||
const statusType = approvalTodoListStatus(item, t);
|
const statusType = approvalTodoListStatus(item, t);
|
||||||
const categoryTitle = item.workflow.title.replace('审批流:', '');
|
const categoryTitle = item.workflow.title.replace('审批流:', '');
|
||||||
const collectionName = item.workflow?.config?.collection || item.execution?.context?.collectionName;
|
const collectionName = item.workflow?.config?.collection || item.execution?.context?.collectionName;
|
||||||
|
|
||||||
const summary = Object.entries(item.summary)?.map(([key, value]) => {
|
const summary = Object.entries(item.summary)?.map(([key, value]) => {
|
||||||
const field = cm.getCollectionField(`${collectionName}.${key}`);
|
const field = cm.getCollectionField(`${collectionName}.${key}`);
|
||||||
return {
|
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
|
api
|
||||||
.request({
|
.request({
|
||||||
url: 'workflowNotice:listCentralized',
|
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) || '',
|
value: (Object.prototype.toString.call(value) === '[object Object]' ? value?.['name'] : value) || '',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
const nickName = user.find((userItem) => userItem.id === item.snapshot?.createdById)?.nickname;
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
title: `${item.user?.nickname}的${categoryTitle}`,
|
title: `${nickName}的${categoryTitle}`,
|
||||||
categoryTitle: categoryTitle,
|
categoryTitle: categoryTitle,
|
||||||
statusTitle: t(statusType.label),
|
statusTitle: t(statusType.label),
|
||||||
statusColor: statusType.color,
|
statusColor: statusType.color,
|
||||||
|
@ -24,6 +24,7 @@ import { MobileProvider } from '@tachybase/plugin-mobile-client/client';
|
|||||||
import { observer } from '@tachybase/schema';
|
import { observer } from '@tachybase/schema';
|
||||||
|
|
||||||
import { ContextApprovalExecution } from '../../context/ApprovalExecution';
|
import { ContextApprovalExecution } from '../../context/ApprovalExecution';
|
||||||
|
import { useWorkflowNoticeFormBlockProps } from '../hook/useFormBlockProps';
|
||||||
import { usePropsNoticeDetail } from '../hook/usePropsNoticeDetail';
|
import { usePropsNoticeDetail } from '../hook/usePropsNoticeDetail';
|
||||||
|
|
||||||
// 审批-抄送-查看: 内容
|
// 审批-抄送-查看: 内容
|
||||||
@ -93,7 +94,7 @@ export const ViewTodosWorkflowNoticeContent = observer((props) => {
|
|||||||
}}
|
}}
|
||||||
scope={{
|
scope={{
|
||||||
usePropsNoticeDetail,
|
usePropsNoticeDetail,
|
||||||
useDetailsBlockProps: useFormBlockContext,
|
useDetailsBlockProps: useWorkflowNoticeFormBlockProps,
|
||||||
}}
|
}}
|
||||||
schema={{
|
schema={{
|
||||||
type: 'void',
|
type: 'void',
|
||||||
|
@ -52,3 +52,16 @@ export function useUserJobsFormBlockProps() {
|
|||||||
|
|
||||||
return { form };
|
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,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -10,7 +10,7 @@ type ComposedInput = ((props: InputProps) => React.ReactNode) & {
|
|||||||
export const MInput: ComposedInput = connect(
|
export const MInput: ComposedInput = connect(
|
||||||
Input,
|
Input,
|
||||||
mapProps((props) => {
|
mapProps((props) => {
|
||||||
return { placeholder: '请输入内容', clearable: true, ...props, style: { '--font-size': '12px' } };
|
return { placeholder: '请输入内容', clearable: true, ...props, style: { '--font-size': '12px', ...props?.style } };
|
||||||
}),
|
}),
|
||||||
mapReadPretty((props) => {
|
mapReadPretty((props) => {
|
||||||
return <span style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{props.value}</span>;
|
return <span style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{props.value}</span>;
|
||||||
@ -20,7 +20,7 @@ export const MInput: ComposedInput = connect(
|
|||||||
const MTextArea = connect(
|
const MTextArea = connect(
|
||||||
TextArea,
|
TextArea,
|
||||||
mapProps((props) => {
|
mapProps((props) => {
|
||||||
return { ...props, placeholder: '请输入内容', clearable: true, style: { '--font-size': '12px' } };
|
return { ...props, placeholder: '请输入内容', clearable: true, style: { '--font-size': '12px', ...props?.style } };
|
||||||
}),
|
}),
|
||||||
mapReadPretty((props) => {
|
mapReadPretty((props) => {
|
||||||
return <div style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{props.value}</div>;
|
return <div style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{props.value}</div>;
|
||||||
|
@ -43,7 +43,7 @@ export const AntdSelect = observer((props) => {
|
|||||||
let inputValue = '';
|
let inputValue = '';
|
||||||
if (isArray(value)) {
|
if (isArray(value)) {
|
||||||
value.forEach((item, index) => {
|
value.forEach((item, index) => {
|
||||||
inputValue += `${item.label}${value.length - 1 === index ? '' : ','}`;
|
inputValue += `${item[fieldNamesLabel]}${value.length - 1 === index ? '' : ', '}`;
|
||||||
});
|
});
|
||||||
} else if (value && typeof value === 'object') {
|
} else if (value && typeof value === 'object') {
|
||||||
inputValue = value[fieldNamesLabel];
|
inputValue = value[fieldNamesLabel];
|
||||||
@ -133,7 +133,7 @@ export const AntdSelect = observer((props) => {
|
|||||||
style={{ color: '#c5c5c5' }}
|
style={{ color: '#c5c5c5' }}
|
||||||
>
|
>
|
||||||
{value?.length || (value && !isArray(value)) ? (
|
{value?.length || (value && !isArray(value)) ? (
|
||||||
<MInput value={inputValue} disabled={fieldSchema['x-disabled']} />
|
<MInput style={{ '--color': '#1e8bf1' }} value={inputValue} disabled={fieldSchema['x-disabled']} />
|
||||||
) : (
|
) : (
|
||||||
<Space>{fieldSchema['x-disabled'] ? '' : '请选择内容'}</Space>
|
<Space>{fieldSchema['x-disabled'] ? '' : '请选择内容'}</Space>
|
||||||
)}
|
)}
|
||||||
|
@ -57,8 +57,9 @@ export const MSelect = connect(
|
|||||||
} else {
|
} else {
|
||||||
let redValue = '';
|
let redValue = '';
|
||||||
if (isArray(value)) {
|
if (isArray(value)) {
|
||||||
redValue = value.reduce((prev, curr) => {
|
redValue = value.reduce((prev, curr, index) => {
|
||||||
return prev + curr?.[fieldNamesLabel];
|
const currContext = value.length - 1 === index ? '' : ', ';
|
||||||
|
return prev + curr?.[fieldNamesLabel] + currContext;
|
||||||
}, '');
|
}, '');
|
||||||
} else {
|
} else {
|
||||||
redValue = value?.[fieldNamesLabel] || '';
|
redValue = value?.[fieldNamesLabel] || '';
|
||||||
|
Loading…
Reference in New Issue
Block a user