fix: 修改执行处理没有显示数据,把审核内容和流程放在同一页面 (#1077)
Reviewed-on: daoyoucloud/tachybase#1077 Co-authored-by: wangjiahui <wwwjh0710@163.com> Co-committed-by: wangjiahui <wwwjh0710@163.com>
This commit is contained in:
parent
15fd844617
commit
f054e56647
@ -1,4 +1,4 @@
|
|||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
RemoteSchemaComponent,
|
RemoteSchemaComponent,
|
||||||
SchemaComponent,
|
SchemaComponent,
|
||||||
@ -6,21 +6,16 @@ import {
|
|||||||
useAPIClient,
|
useAPIClient,
|
||||||
useDestroyAction,
|
useDestroyAction,
|
||||||
useFormBlockContext,
|
useFormBlockContext,
|
||||||
useRecord,
|
|
||||||
useRequest,
|
|
||||||
} from '@tachybase/client';
|
} from '@tachybase/client';
|
||||||
import { DetailsBlockProvider, FlowContext } from '@tachybase/plugin-workflow/client';
|
import { DetailsBlockProvider } from '@tachybase/plugin-workflow/client';
|
||||||
import { useFieldSchema, useForm } from '@tachybase/schema';
|
import { useForm } from '@tachybase/schema';
|
||||||
|
|
||||||
import { Result, Spin } from 'antd';
|
|
||||||
import { NavBar, Skeleton, TabBar } from 'antd-mobile';
|
import { NavBar, Skeleton, TabBar } from 'antd-mobile';
|
||||||
import { FileOutline, UserContactOutline } from 'antd-mobile-icons';
|
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { ContextApprovalExecution } from '../../context/ApprovalExecution';
|
import { ContextApprovalExecution } from '../../context/ApprovalExecution';
|
||||||
import { FormBlockProvider } from '../../context/FormBlock';
|
import { FormBlockProvider } from '../../context/FormBlock';
|
||||||
import { SchemaComponentContextProvider } from '../../context/SchemaComponent';
|
import { SchemaComponentContextProvider } from '../../context/SchemaComponent';
|
||||||
import { ContextWithActionEnabled } from '../../context/WithActionEnabled';
|
|
||||||
import { useTranslation } from '../../locale';
|
import { useTranslation } from '../../locale';
|
||||||
import { useFormBlockProps } from '../hook/useFormBlockProps';
|
import { useFormBlockProps } from '../hook/useFormBlockProps';
|
||||||
import { useUpdateSubmit } from '../hook/useUpadteSubmit';
|
import { useUpdateSubmit } from '../hook/useUpadteSubmit';
|
||||||
@ -37,10 +32,8 @@ export const ViewActionUserInitiationsContent = () => {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
const { actionEnabled } = useContext(ContextWithActionEnabled);
|
|
||||||
const [noDate, setNoDate] = useState(false);
|
const [noDate, setNoDate] = useState(false);
|
||||||
const [recordData, setRecordDate] = useState({});
|
const [recordData, setRecordDate] = useState({});
|
||||||
const [currContext, setCurrContext] = useState('formContext');
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -96,16 +89,7 @@ export const ViewActionUserInitiationsContent = () => {
|
|||||||
<div className="approvalContext">
|
<div className="approvalContext">
|
||||||
{Object.keys(recordData).length && !noDate ? (
|
{Object.keys(recordData).length && !noDate ? (
|
||||||
<ContextApprovalExecution.Provider value={recordData}>
|
<ContextApprovalExecution.Provider value={recordData}>
|
||||||
{UserInitiationsComponent(workflow?.config.applyForm, t, currContext)}
|
{UserInitiationsComponent(workflow?.config.applyForm)}
|
||||||
<TabBar
|
|
||||||
onChange={(item) => {
|
|
||||||
setCurrContext(item);
|
|
||||||
}}
|
|
||||||
className="tabsBarStyle"
|
|
||||||
>
|
|
||||||
<TabBar.Item key="formContext" icon={<FileOutline />} title="申请内容" />
|
|
||||||
{actionEnabled ? null : <TabBar.Item key="approval" icon={<UserContactOutline />} title="审批处理" />}
|
|
||||||
</TabBar>
|
|
||||||
</ContextApprovalExecution.Provider>
|
</ContextApprovalExecution.Provider>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
@ -119,7 +103,7 @@ export const ViewActionUserInitiationsContent = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const UserInitiationsComponent = (applyDetail, t, currContext) => {
|
const UserInitiationsComponent = (applyDetail) => {
|
||||||
const formContextSchema = {
|
const formContextSchema = {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'MobileProvider',
|
'x-component': 'MobileProvider',
|
||||||
@ -141,21 +125,6 @@ const UserInitiationsComponent = (applyDetail, t, currContext) => {
|
|||||||
noForm: true,
|
noForm: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const approvalSchema = {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'MobileProvider',
|
|
||||||
properties: {
|
|
||||||
page: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'MPage',
|
|
||||||
'x-designer': 'MPage.Designer',
|
|
||||||
'x-component-props': {},
|
|
||||||
properties: {
|
|
||||||
process: {
|
process: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-decorator': 'CardItem',
|
'x-decorator': 'CardItem',
|
||||||
@ -187,7 +156,7 @@ const UserInitiationsComponent = (applyDetail, t, currContext) => {
|
|||||||
useWithdrawAction,
|
useWithdrawAction,
|
||||||
useDestroyAction,
|
useDestroyAction,
|
||||||
}}
|
}}
|
||||||
schema={currContext === 'formContext' ? formContextSchema : approvalSchema}
|
schema={formContextSchema}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -57,7 +57,7 @@ export const TabApprovalItem = observer((props) => {
|
|||||||
</Tag>
|
</Tag>
|
||||||
</Space>
|
</Space>
|
||||||
{/* </Badge> */}
|
{/* </Badge> */}
|
||||||
{item.reason.map((reasonItem, index) => {
|
{item.reason?.map((reasonItem, index) => {
|
||||||
return <Space block key={index}>{`${reasonItem.label}:${reasonItem.value}`}</Space>;
|
return <Space block key={index}>{`${reasonItem.label}:${reasonItem.value}`}</Space>;
|
||||||
})}
|
})}
|
||||||
</List.Item>
|
</List.Item>
|
||||||
@ -146,14 +146,6 @@ const changeUsersJobsService = (api, t, cm, compile, input, setData, params, fil
|
|||||||
);
|
);
|
||||||
const statusType = ExecutionStatusOptions.find((value) => value.value === item.status);
|
const statusType = ExecutionStatusOptions.find((value) => value.value === item.status);
|
||||||
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.execution?.context?.summary).map(([key, value]) => {
|
|
||||||
const field = cm.getCollectionField(`${collectionName}.${key}`);
|
|
||||||
return {
|
|
||||||
label: compile(field?.uiSchema?.title || key),
|
|
||||||
value: (Object.prototype.toString.call(value) === '[object Object]' ? value?.['name'] : value) || '',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
title: `${item.user?.nickname}的${categoryTitle}`,
|
title: `${item.user?.nickname}的${categoryTitle}`,
|
||||||
@ -161,12 +153,13 @@ const changeUsersJobsService = (api, t, cm, compile, input, setData, params, fil
|
|||||||
statusTitle: t(statusType.label),
|
statusTitle: t(statusType.label),
|
||||||
statusColor: statusType.color,
|
statusColor: statusType.color,
|
||||||
statusIcon: statusType.icon,
|
statusIcon: statusType.icon,
|
||||||
reason: summary,
|
reason: [],
|
||||||
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) => value.title.includes(input));
|
||||||
|
|
||||||
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';
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
RemoteSchemaComponent,
|
RemoteSchemaComponent,
|
||||||
SchemaComponent,
|
SchemaComponent,
|
||||||
SchemaComponentProvider,
|
SchemaComponentProvider,
|
||||||
useAPIClient,
|
useAPIClient,
|
||||||
useFormBlockContext,
|
useFormBlockContext,
|
||||||
useRecord,
|
|
||||||
useRequest,
|
|
||||||
} from '@tachybase/client';
|
} from '@tachybase/client';
|
||||||
import { DetailsBlockProvider } from '@tachybase/plugin-workflow/client';
|
import { DetailsBlockProvider } from '@tachybase/plugin-workflow/client';
|
||||||
|
|
||||||
import { Result } from 'antd';
|
import { Result } from 'antd';
|
||||||
import { NavBar, Skeleton, TabBar } from 'antd-mobile';
|
import { NavBar, Skeleton, TabBar } from 'antd-mobile';
|
||||||
import { CouponOutline, FileOutline, ScanCodeOutline, UserContactOutline } from 'antd-mobile-icons';
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { ContextApprovalExecution } from '../../context/ApprovalExecution';
|
import { ContextApprovalExecution } from '../../context/ApprovalExecution';
|
||||||
import { FormBlockProvider } from '../../context/FormBlock';
|
import { FormBlockProvider } from '../../context/FormBlock';
|
||||||
import { SchemaComponentContextProvider } from '../../context/SchemaComponent';
|
import { SchemaComponentContextProvider } from '../../context/SchemaComponent';
|
||||||
import { ContextWithActionEnabled } from '../../context/WithActionEnabled';
|
|
||||||
import { useTranslation } from '../../locale';
|
import { useTranslation } from '../../locale';
|
||||||
import { useApprovalDetailBlockProps } from '../hook/useApprovalDetailBlockProps';
|
import { useApprovalDetailBlockProps } from '../hook/useApprovalDetailBlockProps';
|
||||||
import { useApprovalFormBlockProps } from '../hook/useApprovalFormBlockProps';
|
import { useApprovalFormBlockProps } from '../hook/useApprovalFormBlockProps';
|
||||||
@ -35,14 +31,12 @@ import { MobileProvider } from '@tachybase/plugin-mobile-client/client';
|
|||||||
// 审批-待办-查看: 内容
|
// 审批-待办-查看: 内容
|
||||||
export const ViewActionTodosContent = () => {
|
export const ViewActionTodosContent = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { actionEnabled } = useContext(ContextWithActionEnabled);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const [noDate, setNoDate] = useState(false);
|
const [noDate, setNoDate] = useState(false);
|
||||||
const [recordData, setRecordDate] = useState({});
|
const [recordData, setRecordDate] = useState({});
|
||||||
const [currContext, setCurrContext] = useState('formContext');
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
api
|
api
|
||||||
.request({
|
.request({
|
||||||
@ -110,16 +104,7 @@ export const ViewActionTodosContent = () => {
|
|||||||
<div className="approvalContext">
|
<div className="approvalContext">
|
||||||
{Object.keys(recordData).length && !noDate ? (
|
{Object.keys(recordData).length && !noDate ? (
|
||||||
<ContextApprovalExecution.Provider value={recordData}>
|
<ContextApprovalExecution.Provider value={recordData}>
|
||||||
{todosComponent(node?.config.applyDetail, t, currContext)}
|
{todosComponent(node?.config.applyDetail)}
|
||||||
<TabBar
|
|
||||||
onChange={(item) => {
|
|
||||||
setCurrContext(item);
|
|
||||||
}}
|
|
||||||
className="tabsBarStyle"
|
|
||||||
>
|
|
||||||
<TabBar.Item key="formContext" icon={<FileOutline />} title="申请内容" />
|
|
||||||
{actionEnabled ? null : <TabBar.Item key="approval" icon={<UserContactOutline />} title="审批处理" />}
|
|
||||||
</TabBar>
|
|
||||||
</ContextApprovalExecution.Provider>
|
</ContextApprovalExecution.Provider>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
@ -132,7 +117,7 @@ export const ViewActionTodosContent = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const todosComponent = (applyDetail, t, currContext) => {
|
const todosComponent = (applyDetail) => {
|
||||||
const formContextSchema = {
|
const formContextSchema = {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'MobileProvider',
|
'x-component': 'MobileProvider',
|
||||||
@ -154,21 +139,6 @@ const todosComponent = (applyDetail, t, currContext) => {
|
|||||||
noForm: true,
|
noForm: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const approvalSchema = {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'MobileProvider',
|
|
||||||
properties: {
|
|
||||||
page: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'MPage',
|
|
||||||
'x-designer': 'MPage.Designer',
|
|
||||||
'x-component-props': {},
|
|
||||||
properties: {
|
|
||||||
process: {
|
process: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-decorator': 'CardItem',
|
'x-decorator': 'CardItem',
|
||||||
@ -199,7 +169,7 @@ const todosComponent = (applyDetail, t, currContext) => {
|
|||||||
useDetailsBlockProps: useFormBlockContext,
|
useDetailsBlockProps: useFormBlockContext,
|
||||||
useSubmit,
|
useSubmit,
|
||||||
}}
|
}}
|
||||||
schema={currContext === 'formContext' ? formContextSchema : approvalSchema}
|
schema={formContextSchema}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user