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';
|
status['color'] = approvalActionStatus?.color || approvalStatus?.color || 'default';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(stepItem).includes(value.nodeId ? value.nodeId.toString() : '')) {
|
if (Object.keys(stepItem).includes(value.nodeId ? value.nodeId.toString() : '')) {
|
||||||
stepItem[value.nodeId].description.push({
|
stepItem[value.nodeId].description.push({
|
||||||
userName: value.user.nickname,
|
userName: value.user.nickname,
|
||||||
status,
|
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 {
|
} else {
|
||||||
stepItem[value.nodeId || value.node?.title || t(status['label'])] = {
|
stepItem[value.nodeId || value.node?.title || t(status['label'])] = {
|
||||||
@ -179,12 +180,7 @@ const getStepsResult = (result, t) => {
|
|||||||
{
|
{
|
||||||
userName: value.user.nickname,
|
userName: value.user.nickname,
|
||||||
status,
|
status,
|
||||||
date:
|
date: value.status === 0 ? '' : dayjs(value.updatedAt).format('YYYY-MM-DD hh:mm:ss'),
|
||||||
value.status === 0
|
|
||||||
? ''
|
|
||||||
: dayjs(
|
|
||||||
value.nodeId ? value.execution?.updatedAt : value.execution?.createdAt || 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'])}
|
schema={tabDuplicateSchema(t, props, fieldSchema['x-uid'])}
|
||||||
/>
|
/>
|
||||||
</Tabs.Tab>
|
</Tabs.Tab>
|
||||||
<Tabs.Tab title={t('Executed')} key="executed">
|
{/* <Tabs.Tab title={t('Executed')} key="executed">
|
||||||
<SchemaComponent
|
<SchemaComponent
|
||||||
components={{
|
components={{
|
||||||
TabExecutedItem,
|
TabExecutedItem,
|
||||||
}}
|
}}
|
||||||
schema={tabExecutedSchema(t, props, fieldSchema['x-uid'])}
|
schema={tabExecutedSchema(t, props, fieldSchema['x-uid'])}
|
||||||
/>
|
/>
|
||||||
</Tabs.Tab>
|
</Tabs.Tab> */}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</todosContext.Provider>
|
</todosContext.Provider>
|
||||||
</BlockItem>
|
</BlockItem>
|
||||||
|
@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { useAPIClient, useCollectionManager, useCompile } from '@tachybase/client';
|
import { useAPIClient, useCollectionManager, useCompile } from '@tachybase/client';
|
||||||
import { ExecutionStatusOptionsMap } from '@tachybase/plugin-workflow/client';
|
import { ExecutionStatusOptionsMap } from '@tachybase/plugin-workflow/client';
|
||||||
import { observer } from '@tachybase/schema';
|
import { observer } from '@tachybase/schema';
|
||||||
|
import { dayjs } from '@tachybase/utils/client';
|
||||||
|
|
||||||
import { useAsyncEffect } from 'ahooks';
|
import { useAsyncEffect } from 'ahooks';
|
||||||
import { Empty, List, Space, Tag } from 'antd-mobile';
|
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%' }}> */}
|
{/* <Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}> */}
|
||||||
<Space block>
|
<Space block>
|
||||||
{item.title}
|
{item.title}
|
||||||
<Tag color={item.statusColor} fill="outline">
|
{item.statusTitle ? (
|
||||||
{item.statusIcon}
|
<Tag color={item.statusColor} fill="outline">
|
||||||
{item.statusTitle}
|
{item.statusIcon}
|
||||||
</Tag>
|
{item.statusTitle}
|
||||||
|
</Tag>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<Tag color={item.priorityColor} fill="outline">
|
<Tag color={item.priorityColor} fill="outline">
|
||||||
{item.priorityTitle}
|
{item.priorityTitle}
|
||||||
</Tag>
|
</Tag>
|
||||||
@ -99,9 +103,15 @@ const changeApprovalRecordsService = (api, params, filter, cm, compile, t, setDa
|
|||||||
|
|
||||||
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}`);
|
||||||
|
let resonValue = value;
|
||||||
|
if (field.type === 'date' && value) {
|
||||||
|
resonValue = dayjs(value as string).format('YYYY-MM-DD');
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: compile(field?.uiSchema?.title || key),
|
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;
|
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,
|
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) => {
|
filterResult.sort((a, b) => {
|
||||||
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
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,
|
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) => {
|
filterResult.sort((a, b) => {
|
||||||
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
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(
|
const priorityType = ApprovalPriorityType.find(
|
||||||
(priorityItem) => priorityItem.value === item.snapshot?.priority,
|
(priorityItem) => priorityItem.value === item.snapshot?.priority,
|
||||||
);
|
);
|
||||||
const statusType = approvalStatusOptions.find((value) => value.value === item.status);
|
|
||||||
const categoryTitle = item.workflow.title.replace('审批流:', '');
|
const categoryTitle = item.workflow.title.replace('审批流:', '');
|
||||||
const collectionName = item.collectionName;
|
const collectionName = item.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}`);
|
||||||
|
let resonValue = value;
|
||||||
|
if (field.type === 'date' && value) {
|
||||||
|
resonValue = dayjs(value as string).format('YYYY-MM-DD');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
label: compile(field?.uiSchema?.title || key),
|
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;
|
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,
|
...item,
|
||||||
title: `${nickName}的${categoryTitle}`,
|
title: `${nickName}的${categoryTitle}`,
|
||||||
categoryTitle: categoryTitle,
|
categoryTitle: categoryTitle,
|
||||||
statusTitle: t(statusType.label),
|
statusTitle: null,
|
||||||
statusColor: statusType.color,
|
statusColor: null,
|
||||||
reason: summary,
|
reason: summary,
|
||||||
priorityTitle: priorityType.label,
|
priorityTitle: priorityType.label,
|
||||||
priorityColor: priorityType.color,
|
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) => {
|
filterResult.sort((a, b) => {
|
||||||
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
||||||
|
@ -6,7 +6,6 @@ import { Space } from 'antd-mobile';
|
|||||||
|
|
||||||
import { ApprovalReachDataType } from '../../component/ApprovalReachDataType';
|
import { ApprovalReachDataType } from '../../component/ApprovalReachDataType';
|
||||||
import { ApprovalTemplateType } from '../../component/ApprovalTemplateType';
|
import { ApprovalTemplateType } from '../../component/ApprovalTemplateType';
|
||||||
import { PendingStatus } from '../../constants';
|
|
||||||
import { useTodosContext } from '../provider/todosContext';
|
import { useTodosContext } from '../provider/todosContext';
|
||||||
import { TabApplicantType } from './TabApplicantType';
|
import { TabApplicantType } from './TabApplicantType';
|
||||||
import { TabApprovalItem } from './TabApprovalItem';
|
import { TabApprovalItem } from './TabApprovalItem';
|
||||||
|
@ -35,7 +35,7 @@ export const AntdSelect = observer((props) => {
|
|||||||
const cm = useCollectionManager();
|
const cm = useCollectionManager();
|
||||||
const collection = useCollection();
|
const collection = useCollection();
|
||||||
const [fieldServiceFilter] = useFieldServiceFilter(service?.params);
|
const [fieldServiceFilter] = useFieldServiceFilter(service?.params);
|
||||||
const [filter, setFilter] = useState(fieldServiceFilter);
|
const [filter, setFilter] = useState({});
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const [selectValue, setSelectValue] = useState(value);
|
const [selectValue, setSelectValue] = useState(value);
|
||||||
const fieldNamesLabel = fieldNames?.label || 'label';
|
const fieldNamesLabel = fieldNames?.label || 'label';
|
||||||
@ -54,7 +54,7 @@ export const AntdSelect = observer((props) => {
|
|||||||
resource: collectionName,
|
resource: collectionName,
|
||||||
action: 'list',
|
action: 'list',
|
||||||
params: {
|
params: {
|
||||||
filter,
|
filter: { ...fieldServiceFilter?.filter, ...filter },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user