fix: 完善手机端审批功能 (#1247)
Reviewed-on: daoyoucloud/tachybase#1247 Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
c12b30ffef
commit
eb8528d44c
@ -165,11 +165,12 @@ const getStepsResult = (result, t) => {
|
||||
status['color'] = approvalActionStatus?.color || approvalStatus?.color || 'default';
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(stepItem).includes(value.nodeId ? value.nodeId.toString() : '')) {
|
||||
stepItem[value.nodeId].description.push({
|
||||
userName: value.user.nickname,
|
||||
status,
|
||||
date: value.status === 0 ? '' : dayjs(value.execution.updatedAt).format('YYYY-MM-DD hh:mm:ss'),
|
||||
date: value.status === 0 ? '' : dayjs(value.updatedAt).format('YYYY-MM-DD hh:mm:ss'),
|
||||
});
|
||||
} else {
|
||||
stepItem[value.nodeId || value.node?.title || t(status['label'])] = {
|
||||
@ -179,12 +180,7 @@ const getStepsResult = (result, t) => {
|
||||
{
|
||||
userName: value.user.nickname,
|
||||
status,
|
||||
date:
|
||||
value.status === 0
|
||||
? ''
|
||||
: dayjs(
|
||||
value.nodeId ? value.execution?.updatedAt : value.execution?.createdAt || value.updatedAt,
|
||||
).format('YYYY-MM-DD hh:mm:ss'),
|
||||
date: value.status === 0 ? '' : dayjs(value.updatedAt).format('YYYY-MM-DD hh:mm:ss'),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -93,14 +93,14 @@ export const TodosBlock = observer((props) => {
|
||||
schema={tabDuplicateSchema(t, props, fieldSchema['x-uid'])}
|
||||
/>
|
||||
</Tabs.Tab>
|
||||
<Tabs.Tab title={t('Executed')} key="executed">
|
||||
{/* <Tabs.Tab title={t('Executed')} key="executed">
|
||||
<SchemaComponent
|
||||
components={{
|
||||
TabExecutedItem,
|
||||
}}
|
||||
schema={tabExecutedSchema(t, props, fieldSchema['x-uid'])}
|
||||
/>
|
||||
</Tabs.Tab>
|
||||
</Tabs.Tab> */}
|
||||
</Tabs>
|
||||
</todosContext.Provider>
|
||||
</BlockItem>
|
||||
|
@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import { useAPIClient, useCollectionManager, useCompile } from '@tachybase/client';
|
||||
import { ExecutionStatusOptionsMap } from '@tachybase/plugin-workflow/client';
|
||||
import { observer } from '@tachybase/schema';
|
||||
import { dayjs } from '@tachybase/utils/client';
|
||||
|
||||
import { useAsyncEffect } from 'ahooks';
|
||||
import { Empty, List, Space, Tag } from 'antd-mobile';
|
||||
@ -45,10 +46,13 @@ export const TabApprovalItem = observer((props) => {
|
||||
{/* <Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}> */}
|
||||
<Space block>
|
||||
{item.title}
|
||||
<Tag color={item.statusColor} fill="outline">
|
||||
{item.statusIcon}
|
||||
{item.statusTitle}
|
||||
</Tag>
|
||||
{item.statusTitle ? (
|
||||
<Tag color={item.statusColor} fill="outline">
|
||||
{item.statusIcon}
|
||||
{item.statusTitle}
|
||||
</Tag>
|
||||
) : null}
|
||||
|
||||
<Tag color={item.priorityColor} fill="outline">
|
||||
{item.priorityTitle}
|
||||
</Tag>
|
||||
@ -99,9 +103,15 @@ const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setDa
|
||||
|
||||
const summary = Object.entries(item.summary)?.map(([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');
|
||||
}
|
||||
|
||||
return {
|
||||
label: compile(field?.uiSchema?.title || key),
|
||||
value: (Object.prototype.toString.call(value) === '[object Object]' ? value?.['name'] : value) || '',
|
||||
value:
|
||||
(Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '',
|
||||
};
|
||||
});
|
||||
const nickName = item.snapshot.createdBy?.nickname || item.execution?.context?.data.createdBy?.nickname;
|
||||
@ -116,7 +126,11 @@ const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setDa
|
||||
priorityColor: priorityType.color,
|
||||
};
|
||||
});
|
||||
const filterResult = result.filter((value) => value.title.includes(input));
|
||||
const filterResult = result.filter((value) => {
|
||||
const reason = value?.reason.find((reasonItem) => reasonItem?.value.toString().includes(input));
|
||||
return value.title.includes(input) || reason;
|
||||
});
|
||||
|
||||
filterResult.sort((a, b) => {
|
||||
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
||||
});
|
||||
@ -157,7 +171,10 @@ const changeUsersJobsService = (api, t, cm, compile, input, setData, params, fil
|
||||
priorityColor: priorityType.color,
|
||||
};
|
||||
});
|
||||
const filterResult = result.filter((value) => value.title.includes(input));
|
||||
const filterResult = result.filter((value) => {
|
||||
const reason = value?.reason.find((reasonItem) => reasonItem?.value.toString().includes(input));
|
||||
return value.title.includes(input) || reason;
|
||||
});
|
||||
|
||||
filterResult.sort((a, b) => {
|
||||
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
||||
@ -197,14 +214,18 @@ export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData,
|
||||
const priorityType = ApprovalPriorityType.find(
|
||||
(priorityItem) => priorityItem.value === item.snapshot?.priority,
|
||||
);
|
||||
const statusType = approvalStatusOptions.find((value) => value.value === item.status);
|
||||
const categoryTitle = item.workflow.title.replace('审批流:', '');
|
||||
const collectionName = item.collectionName;
|
||||
const summary = Object.entries(item.summary).map(([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');
|
||||
}
|
||||
return {
|
||||
label: compile(field?.uiSchema?.title || key),
|
||||
value: (Object.prototype.toString.call(value) === '[object Object]' ? value?.['name'] : value) || '',
|
||||
value:
|
||||
(Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '',
|
||||
};
|
||||
});
|
||||
const nickName = user.find((userItem) => userItem.id === item.snapshot?.createdById)?.nickname;
|
||||
@ -212,15 +233,18 @@ export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData,
|
||||
...item,
|
||||
title: `${nickName}的${categoryTitle}`,
|
||||
categoryTitle: categoryTitle,
|
||||
statusTitle: t(statusType.label),
|
||||
statusColor: statusType.color,
|
||||
statusTitle: null,
|
||||
statusColor: null,
|
||||
reason: summary,
|
||||
priorityTitle: priorityType.label,
|
||||
priorityColor: priorityType.color,
|
||||
};
|
||||
});
|
||||
|
||||
const filterResult = result.filter((value) => value.title.includes(input));
|
||||
const filterResult = result.filter((value) => {
|
||||
const reason = value?.reason.find((reasonItem) => reasonItem?.value.toString().includes(input));
|
||||
return value.title.includes(input) || reason;
|
||||
});
|
||||
|
||||
filterResult.sort((a, b) => {
|
||||
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
||||
|
@ -6,7 +6,6 @@ import { Space } from 'antd-mobile';
|
||||
|
||||
import { ApprovalReachDataType } from '../../component/ApprovalReachDataType';
|
||||
import { ApprovalTemplateType } from '../../component/ApprovalTemplateType';
|
||||
import { PendingStatus } from '../../constants';
|
||||
import { useTodosContext } from '../provider/todosContext';
|
||||
import { TabApplicantType } from './TabApplicantType';
|
||||
import { TabApprovalItem } from './TabApprovalItem';
|
||||
|
@ -35,7 +35,7 @@ export const AntdSelect = observer((props) => {
|
||||
const cm = useCollectionManager();
|
||||
const collection = useCollection();
|
||||
const [fieldServiceFilter] = useFieldServiceFilter(service?.params);
|
||||
const [filter, setFilter] = useState(fieldServiceFilter);
|
||||
const [filter, setFilter] = useState({});
|
||||
const api = useAPIClient();
|
||||
const [selectValue, setSelectValue] = useState(value);
|
||||
const fieldNamesLabel = fieldNames?.label || 'label';
|
||||
@ -54,7 +54,7 @@ export const AntdSelect = observer((props) => {
|
||||
resource: collectionName,
|
||||
action: 'list',
|
||||
params: {
|
||||
filter,
|
||||
filter: { ...fieldServiceFilter?.filter, ...filter },
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user