{data.length ? (
@@ -30,17 +41,17 @@ export const ApprovalItem = observer((props) => {
navigate(`/mobile/approval/${item.id}/page`);
}}
>
-
-
- {item.title}
-
- {item.statusTitle}
-
-
- {item.priorityTitle}
-
-
-
+ {/*
*/}
+
+ {item.title}
+
+ {item.statusTitle}
+
+
+ {item.priorityTitle}
+
+
+ {/* */}
事由:{item.reason}
);
@@ -58,8 +69,7 @@ const approvalTodoListStatus = (item, t) => {
return ApprovalStatusEnums.find((value) => value.value === status);
};
-const changService = (api, setData, user, filter, t) => {
- console.log('🚀 ~ changService ~ filter:', filter);
+const changService = (api, setData, user, filter, t, setDefaultData) => {
api
.request({
url: 'approvals:listCentralized',
@@ -85,7 +95,9 @@ const changService = (api, setData, user, filter, t) => {
return Date.parse(b.createdAt) - Date.parse(a.createdAt);
});
setData(result);
+ setDefaultData(result);
})
+
.catch(() => {
console.error;
});
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx
index ba5b00195..b9fdbe4e7 100644
--- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ApprovalStatus.tsx
@@ -15,7 +15,7 @@ export const ApprovalStatus = observer((props) => {
setVisible(true);
}}
>
- {filter['status'] && filter['status'] !== 'all'
+ {filter?.['status'] && filter?.['status'] !== 'all'
? t(columns.find((item) => item.value === filter['status']).label)
: '申请状态'}
@@ -30,7 +30,7 @@ export const ApprovalStatus = observer((props) => {
onClose={() => {
setVisible(false);
}}
- value={[filter['status'] || 'all']}
+ value={[filter?.['status'] || 'all']}
onConfirm={(e) => {
const changeData = { ...filter };
if (e[0] === 'all') {
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx
new file mode 100644
index 000000000..2206d9aed
--- /dev/null
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/InitiationsItem.tsx
@@ -0,0 +1,69 @@
+import { BlockItem, ExtendCollectionsProvider, css, useAPIClient, useRequest } from '@tachybase/client';
+import React, { useContext, useEffect, useState } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { AutoCenter, Card, Empty, SearchBar, Selector, Space } from 'antd-mobile';
+import { TeamFill } from 'antd-mobile-icons';
+import { observer } from '@tachybase/schema';
+import '../../style/style.css';
+import { InitiationsBlockContext } from '../InitiationsBlock';
+
+export const InitiationsItem = observer((props) => {
+ const { params, tabKey } = props as any;
+ const [options, setOptions] = useState([]);
+ const api = useAPIClient();
+ const navigate = useNavigate();
+ const contextFilter = useContext(InitiationsBlockContext);
+ const filter = contextFilter['key'] === 'initiations' ? contextFilter['inputFilter'] : '';
+
+ useEffect(() => {
+ api
+ .request({
+ url: 'workflows:list',
+ params: { pageSize: 9999, filter: { ...params?.[tabKey] } },
+ })
+ .then((res) => {
+ const option = res?.data?.data.map((value) => {
+ return {
+ ...value,
+ value: value.id,
+ label: (
+
{
+ navigate(`/mobile/${value.title?.replace('审批流:', '') || ''}/approval/${value.id}/page`);
+ }}
+ >
+
+
+
+ {value.title?.replace('审批流:', '') || ''}
+
+ ),
+ };
+ });
+ if (filter && options.length) {
+ const filterData = option.filter((value) => (value.title as string)?.includes(filter));
+ setOptions(filterData);
+ } else {
+ setOptions(option);
+ }
+ })
+ .catch(() => {});
+ }, [params]);
+ return (
+
+
+ {options.length ? (
+
+ ) : (
+
+ )}
+
+
+ );
+});
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx
new file mode 100644
index 000000000..f47f222dd
--- /dev/null
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/UserInitiationsItem.tsx
@@ -0,0 +1,34 @@
+import { BlockItem } from '@tachybase/client';
+import { Space } from 'antd-mobile';
+import React, { useState } from 'react';
+import { observer } from '@tachybase/schema';
+import { ApprovalTemplateType } from '../../component/ApprovalTemplateType';
+import { ApprovalStatus } from './ApprovalStatus';
+import { ApprovalItem } from './ApprovalItem';
+import { ApprovalReachDataType } from '../../component/ApprovalReachDataType';
+import '../../style/style.css';
+
+export const UserInitiationsItem = observer((props) => {
+ const [filter, setFilter] = useState([]);
+ const changeFilter = (data) => {
+ setFilter(data);
+ };
+ const filterProps = {
+ ...props,
+ filter,
+ changeFilter,
+ };
+ return (
+
+
+ {/* 模版类型 */}
+
+ {/* 到达日期 */}
+
+ {/* 审批状态 */}
+
+
+
+
+ );
+});
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx
index c81f97cbb..bbaa9c44f 100644
--- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/component/ViewActionInitiationsContent.tsx
@@ -77,20 +77,22 @@ export const ViewActionInitiationsContent = () => {
{name}
-
+
+
+
);
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 7f37b195a..903ec75d1 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
@@ -1,18 +1,18 @@
import { joinCollectionName, useAPIClient, useBlockRequestContext, useCollection_deprecated } from '@tachybase/client';
import { useField, useForm } from '@tachybase/schema';
import { APPROVAL_ACTION_STATUS } from '../../constants';
-import { useParams } from 'react-router-dom';
+import { useNavigate, useParams } from 'react-router-dom';
+import { Toast } from 'antd-mobile';
export function useCreateSubmit() {
const from = useForm();
const field = useField();
- const { __parent } = useBlockRequestContext();
const collection = useCollection_deprecated();
const contextWe = APPROVAL_ACTION_STATUS.SUBMITTED;
const apiClient = useAPIClient();
const params = useParams();
const { id: workflowId } = params;
-
+ const navigate = useNavigate();
return {
async run() {
try {
@@ -20,7 +20,7 @@ export function useCreateSubmit() {
field.data = field.data || {};
field.data.loading = true;
- await apiClient.resource('approvals').create({
+ const res = await apiClient.resource('approvals').create({
values: {
collectionName: joinCollectionName(collection.dataSource, collection.name),
data: from.values,
@@ -28,13 +28,17 @@ export function useCreateSubmit() {
workflowId: workflowId,
},
});
-
- from.reset();
- field.data.loading = false;
- const service = __parent.service;
- if (service) {
- service.refresh();
+ console.log('🚀 ~ res ~ res:', res);
+ if (res.status === 200) {
+ Toast.show({
+ icon: 'success',
+ content: '提交成功',
+ });
+ from.reset();
+ navigate(`/mobile/approval/${res.data.data.id}/page`);
}
+
+ field.data.loading = false;
} catch (h) {
field.data && (field.data.loading = false);
}
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx
index 545bb3a01..106b767cb 100644
--- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useUpadteSubmit.tsx
@@ -1,20 +1,18 @@
import { useAPIClient, useActionContext } from '@tachybase/client';
-import { useFlowContext } from '@tachybase/plugin-workflow/client';
import { useField, useForm } from '@tachybase/schema';
import _ from 'lodash';
import { useContextApprovalExecution } from '../../context/ApprovalExecution';
import { useContextApprovalStatus } from '../provider/ApplyActionStatus';
+import { Toast } from 'antd-mobile';
export function useUpdateSubmit() {
const from = useForm();
const field = useField();
const { approval } = useContextApprovalExecution();
- const { setVisible, setSubmitted } = useActionContext() as any;
- const { id } = approval;
- const { workflow } = useFlowContext();
+ const { setSubmitted } = useActionContext() as any;
+ const { workflow, id } = approval;
const contextApprovalStatus = useContextApprovalStatus();
const apiClient = useAPIClient();
-
return {
async run() {
try {
@@ -22,7 +20,7 @@ export function useUpdateSubmit() {
_.set(field, ['data', 'loading'], true);
- apiClient.resource('approvals').update({
+ const res = await apiClient.resource('approvals').update({
filterByTk: id,
values: {
collectionName: workflow.config.collection,
@@ -30,10 +28,21 @@ export function useUpdateSubmit() {
status: contextApprovalStatus,
},
});
- setSubmitted(true);
- setVisible(false);
- from.reset();
- _.set(field, ['data', 'loading'], false);
+ if (res.status === 200) {
+ Toast.show({
+ icon: 'success',
+ content: '处理成功',
+ });
+ setTimeout(() => {
+ location.reload();
+ }, 1000);
+ setSubmitted(true);
+ } else {
+ Toast.show({
+ icon: 'fail',
+ content: '处理失败',
+ });
+ }
} catch (m) {
_.set(field, ['data', 'loading'], false);
}
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx
index d5c56b862..2ac62abf2 100644
--- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/initiations/hook/useWithdrawAction.tsx
@@ -1,6 +1,7 @@
import { useAPIClient, useActionContext } from '@tachybase/client';
import { useField } from '@tachybase/schema';
import { useContextApprovalExecution } from '../../context/ApprovalExecution';
+import { Toast } from 'antd-mobile';
// 撤回
export function useWithdrawAction() {
@@ -14,12 +15,25 @@ export function useWithdrawAction() {
field.data = field.data ?? {};
field.data.loading = true;
- await api.resource('approvals').withdraw({
+ const res = await api.resource('approvals').withdraw({
filterByTk: approval.id,
});
- setSubmitted(true);
-
+ if (res.status === 202) {
+ Toast.show({
+ icon: 'success',
+ content: '撤回成功',
+ });
+ setTimeout(() => {
+ location.reload();
+ }, 1000);
+ setSubmitted(true);
+ } else {
+ Toast.show({
+ icon: 'fail',
+ content: '撤回失败',
+ });
+ }
field.data.loading = false;
} catch (v) {
if (field.data) {
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css
index 9c11ca282..07a15cd9e 100644
--- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/style/style.css
@@ -9,7 +9,6 @@
.navBarStyle{
background-color: #ffffff;
- margin-bottom: 10px;
position: fixed;
z-index: 2;
height: 5vh;
@@ -28,8 +27,35 @@
.userInitiationsStyle{
width: 100%;
- margin-top: 10px;
padding: 10px 0 10px 0;
background-color: #ffffff;
+ font-size: 10px;
+ color: #8e8e8e;
}
+.adm-tabs-tab-list{
+ background-color: #ffffff;
+ font-size: 12px;
+}
+
+.blockItem{
+ background-color: #f3f3f3;
+}
+
+ .adm-card-body {
+ padding: 0;
+ }
+
+ .initiationsItemCard{
+ padding: 0px;
+ border-radius: 0px;
+ overflow: hidden;
+ background-color: #f3f3f3;
+ }
+
+ .adm-tabs-content{
+ padding: 0;
+ }
+
+
+
diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx
index 932be9991..c96a4ad88 100644
--- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx
+++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/TodosBlock.tsx
@@ -15,28 +15,18 @@ import { CollectionApprovals } from '../collection/Approvals.collection';
import { CollectionApprovalTodos } from '../collection/ApprovalTodos';
export const TodosBlock = observer((props) => {
- const [tabValue, setTabValue] = useState('pending');
- const [filter, setFilter] = useState({});
+ const [filter, setFilter] = useState({
+ status: PendingStatus,
+ });
+ const [changeInputValue, setChangeInputValue] = useState('');
+ const [input, setInput] = useState('');
const changeFilter = (data) => {
setFilter(data);
};
- useEffect(() => {
- const changeTabs = { ...filter };
- switch (tabValue) {
- case 'pending':
- changeTabs['status'] = PendingStatus;
- break;
- case 'processed':
- changeTabs['status'] = ProcessedStatus;
- break;
- case 'duplicate':
- break;
- }
- setFilter(changeTabs);
- }, [tabValue]);
const filterProps = {
...props,
filter,
+ input,
changeFilter,
};
return (
@@ -48,11 +38,34 @@ export const TodosBlock = observer((props) => {
placeholder="搜索人名,标题、内容"
clearable
style={{ '--background': '#ffffff', padding: '10px' }}
+ onChange={(value) => {
+ if (!value) {
+ setInput(value);
+ }
+ setChangeInputValue(value);
+ }}
+ value={changeInputValue}
+ onSearch={(value) => {
+ setInput(value);
+ }}
/>