fix: 完善审批摘要内容 (#1051)

Co-authored-by: sealday <zhanglin@daoyoucloud.com>
Reviewed-on: daoyoucloud/tachybase#1051
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-05-24 14:54:39 +08:00 committed by sealday
parent bbef80eea0
commit f3353379ce

View File

@ -1,13 +1,13 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { mergeFilter, useAPIClient, useCollectionManager, useCompile, useRequest } from '@tachybase/client'; import { useAPIClient, useCollectionManager, useCompile } from '@tachybase/client';
import { connect, observer, useFieldSchema } from '@tachybase/schema'; import { observer } from '@tachybase/schema';
import { useAsyncEffect } from 'ahooks'; import { useAsyncEffect } from 'ahooks';
import { Badge, Empty, List, Space, Tag } from 'antd-mobile'; import { Empty, List, Space, Tag } from 'antd-mobile';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { APPROVAL_STATUS, ApprovalPriorityType, approvalStatusOptions } from '../../constants'; import { APPROVAL_STATUS, ApprovalPriorityType, approvalStatusOptions } from '../../constants';
import { tval, useTranslation } from '../../locale'; import { useTranslation } from '../../locale';
export const TabApprovalItem = observer((props) => { export const TabApprovalItem = observer((props) => {
const { filter, params, input } = props as any; const { filter, params, input } = props as any;
@ -17,6 +17,7 @@ export const TabApprovalItem = observer((props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const compile = useCompile(); const compile = useCompile();
const navigate = useNavigate(); const navigate = useNavigate();
const cm = useCollectionManager();
useEffect(() => { useEffect(() => {
if (input && defData.length) { if (input && defData.length) {
const filterData = defData.filter((value) => value.title.includes(input)); const filterData = defData.filter((value) => value.title.includes(input));
@ -44,10 +45,12 @@ export const TabApprovalItem = observer((props) => {
); );
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 summary = Object.entries(item.summary).map(([key, value]) => { const summary = Object.entries(item.summary).map(([key, value]) => {
const field = cm.getCollectionField(`${collectionName}.${key}`);
return { return {
label: compile(key), label: compile(field?.uiSchema?.title || key),
value: value?.['name'] || value || '', value: (Object.prototype.toString.call(value) === '[object Object]' ? value?.['name'] : value) || '',
}; };
}); });
return { return {