diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx index 41e389a98..37e984d53 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalItem.tsx @@ -95,18 +95,26 @@ const changService = (api, setData, user, filter, t, setDefaultData, cm, compile const statusType = approvalTodoListStatus(item, t); const categoryTitle = item.workflow.title; 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)?.forEach(([key, value]) => { const field = cm.getCollectionField(`${collectionName}.${key}`); let resonValue = value; if (field.type === 'date' && value) { resonValue = dayjs(value as string).format('YYYY-MM-DD HH:mm:ss'); } - - return { - label: compile(field?.uiSchema?.title || key), - value: - (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', - }; + if (key === 'createdAt') { + summary.unshift({ + label: compile(field?.uiSchema?.title || key), + value: + (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', + }); + } else { + summary.push({ + label: compile(field?.uiSchema?.title || key), + value: + (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', + }); + } }); return { ...item, diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx index 3ad12cb89..b51924f79 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useCreateSubmit.tsx @@ -27,7 +27,8 @@ export function useCreateSubmit() { from.submit(); field.data = field.data || {}; field.data.loading = true; - + delete from.values['createdAt']; + delete from.values['updatedAt']; const res = await apiClient.resource('approvals').create({ values: { collectionName: joinCollectionName(collection.dataSource, collection.name), 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 634b67e88..8d956d806 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 @@ -109,18 +109,26 @@ const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setDa const categoryTitle = item.workflow.title; 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)?.forEach(([key, value]) => { const field = cm.getCollectionField(`${collectionName}.${key}`); let resonValue = value; if (field.type === 'date' && value) { resonValue = dayjs(value as string).format('YYYY-MM-DD HH:mm:ss'); } - - return { - label: compile(field?.uiSchema?.title || key), - value: - (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', - }; + if (key === 'createdAt') { + summary.unshift({ + label: compile(field?.uiSchema?.title || key), + value: + (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', + }); + } else { + summary.push({ + label: compile(field?.uiSchema?.title || key), + value: + (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', + }); + } }); const nickName = item.snapshot.createdBy?.nickname || item.execution?.context?.data.createdBy?.nickname; return { @@ -227,17 +235,26 @@ export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData, ); const categoryTitle = item.workflow.title; const collectionName = item.collectionName; - const summary = Object.entries(item.summary).map(([key, value]) => { + const summary = []; + Object.entries(item.summary)?.forEach(([key, value]) => { const field = cm.getCollectionField(`${collectionName}.${key}`); let resonValue = value; if (field.type === 'date' && value) { resonValue = dayjs(value as string).format('YYYY-MM-DD HH:mm:ss'); } - return { - label: compile(field?.uiSchema?.title || key), - value: - (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', - }; + if (key === 'createdAt') { + summary.unshift({ + label: compile(field?.uiSchema?.title || key), + value: + (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', + }); + } else { + summary.push({ + label: compile(field?.uiSchema?.title || key), + value: + (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', + }); + } }); const statusType = ApprovalStatusEnums.find((value) => value.value === item.approval?.status); const nickName = user.find((userItem) => userItem.id === item.snapshot?.createdById)?.nickname; diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/apply-button/hooks/useSubmitCreate.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/apply-button/hooks/useSubmitCreate.tsx index 47d477374..a704a5f44 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/apply-button/hooks/useSubmitCreate.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/apply-button/hooks/useSubmitCreate.tsx @@ -28,7 +28,8 @@ export function useSubmitCreate() { from.submit(); field.data = field.data || {}; field.data.loading = true; - + delete from.values['createdAt']; + delete from.values['updatedAt']; await apiClient.resource('approvals').create({ values: { collectionName: joinCollectionName(collection.dataSource, collection.name),