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 1ee6211ee..ae00d1a23 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 @@ -19,9 +19,8 @@ export const TabApprovalItem = observer((props) => { const navigate = useNavigate(); const cm = useCollectionManager(); useAsyncEffect(async () => { - const { data: user } = await api.request({ url: 'users:list', params: { pageSize: 999, appends: ['roles'] } }); if (collectionName === 'approvalRecords') { - changeApprovalRecordsService(api, params?.[tabKey], filter, user, cm, compile, t, setData, input); + changeApprovalRecordsService(api, params?.[tabKey], filter, cm, compile, t, setData, input); } else if (collectionName === 'users_jobs') { changeUsersJobsService(api, t, cm, compile, input, setData, params?.[tabKey], filter); } @@ -83,19 +82,18 @@ const approvalTodoListStatus = (item, t) => { } }; -const changeApprovalRecordsService = (api, params, filter, user, cm, compile, t, setData, input) => { +const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setData, input) => { api .request({ url: 'approvalRecords:listCentralized', params: { pageSize: 9999, - appends: ['execution', 'job', 'node', 'workflow'], + appends: ['execution', 'job', 'node', 'workflow', 'user'], filter: { ...params, ...filter }, }, }) .then((res) => { const result = res.data?.data.map((item) => { - const itemUser = user.data.find((value) => value.id === item.userId); const priorityType = ApprovalPriorityType.find((priorityItem) => priorityItem.value === item.snapshot.priority); const statusType = approvalTodoListStatus(item, t); const categoryTitle = item.workflow.title.replace('审批流:', ''); @@ -109,7 +107,7 @@ const changeApprovalRecordsService = (api, params, filter, user, cm, compile, t, }); return { ...item, - title: `${itemUser.nickname}的${categoryTitle}`, + title: `${item.snapshot.createdBy.nickname}的${categoryTitle}`, categoryTitle: categoryTitle, statusTitle: t(statusType.label), statusColor: statusType.color, diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomColor.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomColor.tsx new file mode 100644 index 000000000..6d7acf1bc --- /dev/null +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomColor.tsx @@ -0,0 +1,17 @@ +const customColor = { + red: '#fc9792', + magenta: '#ffa3cc', + volcano: '#ffb38b', + orange: '#ffcf86', + gold: '#ffe184', + lime: '#e7ff84', + + green: '#aee884', + cyan: '#7ce5d9', + blue: '#86c3ff', + geekblue: '#a3bfff', + purple: '#cda3f6', + default: '#d4d4d4', +}; + +export const getMobileColor = (color: string) => customColor[color]; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/form/CustomComponent.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomComponent.tsx similarity index 100% rename from packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/form/CustomComponent.tsx rename to packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomComponent.tsx diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx index f1408d872..f202b9238 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx @@ -4,6 +4,8 @@ import { connect, isValid, mapProps, mapReadPretty, useField } from '@tachybase/ import { Checkbox, CheckboxGroupProps, CheckboxProps, Tag } from 'antd-mobile'; +import { getMobileColor } from '../../../CustomColor'; + type ComposedCheckBox = React.FC & { Group?: any; }; @@ -59,7 +61,7 @@ MCheckbox.Group = connect( {dataSource .filter((option) => option.value == value) .map((option, key) => ( - + {option.label} ))} diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Radio/Radio.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Radio/Radio.tsx index bb3201f47..1078ad31c 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Radio/Radio.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Radio/Radio.tsx @@ -4,6 +4,8 @@ import { connect, isValid, mapProps, mapReadPretty, useField } from '@tachybase/ import { Radio, RadioGroupProps, RadioProps, Tag } from 'antd-mobile'; +import { getMobileColor } from '../../../CustomColor'; + type ComposedRadio = React.FC & { Group?: any; }; @@ -55,11 +57,13 @@ MRadio.Group = connect(
{dataSource .filter((option) => option.value == value) - .map((option, key) => ( - - {option.label} - - ))} + .map((option, key) => { + return ( + + {option.label} + + ); + })}
); }), diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/collection-field/CollectionField.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/collection-field/CollectionField.tsx index 739055226..c4c7f47c9 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/collection-field/CollectionField.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/collection-field/CollectionField.tsx @@ -11,8 +11,8 @@ import { connect, Field, merge, useField, useFieldSchema } from '@tachybase/sche import { concat } from 'lodash'; +import { canMobileField } from '../../CustomComponent'; import { useIsMobile } from '../../hooks'; -import { canMobileField } from '../form/CustomComponent'; type Props = { component: any; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/form/MobileFormItemInitializers.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/form/MobileFormItemInitializers.tsx index 4be7e2dc9..2c646b3c8 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/form/MobileFormItemInitializers.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/form/MobileFormItemInitializers.tsx @@ -11,8 +11,8 @@ import { } from '@tachybase/client'; import { Schema, useForm } from '@tachybase/schema'; +import { canMobileField } from '../../CustomComponent'; import { useIsMobile } from '../../hooks'; -import { canMobileField } from './CustomComponent'; export const useFormItemInitializerFields = (options?: any) => { const { name, currentFields } = useCollection_deprecated(); diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/index.ts b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/index.ts index a4a9472ee..44e6478f8 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/index.ts +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/index.ts @@ -3,3 +3,5 @@ export * from './components'; export * from './scopes'; export * from './hooks'; export * from './provider'; +export * from './CustomColor'; +export * from './CustomComponent';