@coding-flow/flow-pc-approval 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +261 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +12 -0
- package/dist/api/record.d.ts +10 -0
- package/dist/api/record.js +48 -0
- package/dist/api/workflow.d.ts +3 -0
- package/dist/api/workflow.js +7 -0
- package/dist/components/flow-approval/components/action/add-audit.d.ts +8 -0
- package/dist/components/flow-approval/components/action/add-audit.js +64 -0
- package/dist/components/flow-approval/components/action/custom.d.ts +8 -0
- package/dist/components/flow-approval/components/action/custom.js +39 -0
- package/dist/components/flow-approval/components/action/delegate.d.ts +8 -0
- package/dist/components/flow-approval/components/action/delegate.js +64 -0
- package/dist/components/flow-approval/components/action/factory.d.ts +11 -0
- package/dist/components/flow-approval/components/action/factory.js +34 -0
- package/dist/components/flow-approval/components/action/pass.d.ts +8 -0
- package/dist/components/flow-approval/components/action/pass.js +88 -0
- package/dist/components/flow-approval/components/action/reject.d.ts +8 -0
- package/dist/components/flow-approval/components/action/reject.js +67 -0
- package/dist/components/flow-approval/components/action/return.d.ts +8 -0
- package/dist/components/flow-approval/components/action/return.js +64 -0
- package/dist/components/flow-approval/components/action/revoke.d.ts +1 -0
- package/dist/components/flow-approval/components/action/revoke.js +26 -0
- package/dist/components/flow-approval/components/action/save.d.ts +8 -0
- package/dist/components/flow-approval/components/action/save.js +20 -0
- package/dist/components/flow-approval/components/action/transfer.d.ts +8 -0
- package/dist/components/flow-approval/components/action/transfer.js +64 -0
- package/dist/components/flow-approval/components/action/type.d.ts +5 -0
- package/dist/components/flow-approval/components/action/type.js +0 -0
- package/dist/components/flow-approval/components/action/urge.d.ts +1 -0
- package/dist/components/flow-approval/components/action/urge.js +23 -0
- package/dist/components/flow-approval/components/custom-style-button.d.ts +9 -0
- package/dist/components/flow-approval/components/custom-style-button.js +41 -0
- package/dist/components/flow-approval/components/flow-node-history.d.ts +9 -0
- package/dist/components/flow-approval/components/flow-node-history.js +37 -0
- package/dist/components/flow-approval/components/flow-time-node.d.ts +13 -0
- package/dist/components/flow-approval/components/flow-time-node.js +145 -0
- package/dist/components/flow-approval/components/form-view-component.d.ts +6 -0
- package/dist/components/flow-approval/components/form-view-component.js +68 -0
- package/dist/components/flow-approval/index.d.ts +14 -0
- package/dist/components/flow-approval/index.js +37 -0
- package/dist/components/flow-approval/layout/body.d.ts +1 -0
- package/dist/components/flow-approval/layout/body.js +150 -0
- package/dist/components/flow-approval/layout/header.d.ts +1 -0
- package/dist/components/flow-approval/layout/header.js +74 -0
- package/dist/components/flow-approval/layout/index.d.ts +3 -0
- package/dist/components/flow-approval/layout/index.js +32 -0
- package/dist/components/flow-approval/typings/index.d.ts +5 -0
- package/dist/components/flow-approval/typings/index.js +6 -0
- package/dist/components/flow-mock/components/todo.d.ts +6 -0
- package/dist/components/flow-mock/components/todo.js +205 -0
- package/dist/components/flow-mock/hooks/use-mock-presenter.d.ts +5 -0
- package/dist/components/flow-mock/hooks/use-mock-presenter.js +24 -0
- package/dist/components/flow-mock/index.d.ts +1 -0
- package/dist/components/flow-mock/index.js +18 -0
- package/dist/components/flow-mock/model.d.ts +5 -0
- package/dist/components/flow-mock/model.js +11 -0
- package/dist/components/flow-mock/presenter.d.ts +11 -0
- package/dist/components/flow-mock/presenter.js +28 -0
- package/dist/components/flow-mock/types.d.ts +4 -0
- package/dist/components/flow-mock/types.js +0 -0
- package/dist/components/flow-title/index.d.ts +6 -0
- package/dist/components/flow-title/index.js +8 -0
- package/dist/components/workflow-select-modal/index.d.ts +8 -0
- package/dist/components/workflow-select-modal/index.js +32 -0
- package/dist/favicon.png +0 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/plugins/view/add-audit-view.d.ts +3 -0
- package/dist/plugins/view/add-audit-view.js +32 -0
- package/dist/plugins/view/delegate-view.d.ts +3 -0
- package/dist/plugins/view/delegate-view.js +32 -0
- package/dist/plugins/view/return-view.d.ts +3 -0
- package/dist/plugins/view/return-view.js +39 -0
- package/dist/plugins/view/sign-key-view.d.ts +3 -0
- package/dist/plugins/view/sign-key-view.js +21 -0
- package/dist/plugins/view/transfer-view.d.ts +3 -0
- package/dist/plugins/view/transfer-view.js +32 -0
- package/package.json +57 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { done, list, notify, todo } from "../../../api/record.js";
|
|
4
|
+
import { WorkflowSelectModal } from "../../workflow-select-modal/index.js";
|
|
5
|
+
import { Table } from "@coding-flow/flow-pc-ui";
|
|
6
|
+
import { Button, Space, Tabs } from "antd";
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
import { ApprovalPanelDrawer } from "../../flow-approval/index.js";
|
|
9
|
+
import { FlowTitle } from "../../flow-title/index.js";
|
|
10
|
+
import { useMockContext } from "@coding-flow/flow-approval-presenter";
|
|
11
|
+
const MockTodoPage = (props)=>{
|
|
12
|
+
const actionAll = react.useRef(null);
|
|
13
|
+
const actionTodo = react.useRef(null);
|
|
14
|
+
const actionDone = react.useRef(null);
|
|
15
|
+
const actionNotify = react.useRef(null);
|
|
16
|
+
const [selectVisible, setSelectVisible] = react.useState(false);
|
|
17
|
+
const [approvalVisible, setApprovalVisible] = react.useState(false);
|
|
18
|
+
const [reviewVisible, setReviewVisible] = react.useState(false);
|
|
19
|
+
const [workflowCode, setWorkflowCode] = react.useState('');
|
|
20
|
+
const [currentRecordId, setCurrentRecordId] = react.useState('');
|
|
21
|
+
const [currentTab, setCurrentTab] = react.useState('todo');
|
|
22
|
+
const mockKey = useMockContext();
|
|
23
|
+
const columns = [
|
|
24
|
+
{
|
|
25
|
+
dataIndex: 'recordId',
|
|
26
|
+
title: '编号'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
dataIndex: 'processId',
|
|
30
|
+
title: '流程编码'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
dataIndex: 'title',
|
|
34
|
+
title: '流程名称',
|
|
35
|
+
render: (value)=>/*#__PURE__*/ jsx(FlowTitle, {
|
|
36
|
+
title: value
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
dataIndex: 'readTime',
|
|
41
|
+
title: '读取状态',
|
|
42
|
+
render: (value)=>value ? '已读' : '未读'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
dataIndex: 'nodeName',
|
|
46
|
+
title: '节点名称'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
dataIndex: 'createTime',
|
|
50
|
+
title: '创建时间',
|
|
51
|
+
render: (text)=>dayjs(text).format('YYYY-MM-DD HH:mm:ss')
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
dataIndex: 'currentOperatorId',
|
|
55
|
+
title: '审批人',
|
|
56
|
+
hidden: true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
dataIndex: 'currentOperatorName',
|
|
60
|
+
title: '审批人'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
dataIndex: 'recordState',
|
|
64
|
+
title: '状态',
|
|
65
|
+
render: (text)=>text ? '已办' : '待办'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
dataIndex: 'option',
|
|
69
|
+
title: '操作',
|
|
70
|
+
render: (_, record)=>{
|
|
71
|
+
if ('todo' === currentTab) return /*#__PURE__*/ jsx(Space, {
|
|
72
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
73
|
+
onClick: ()=>{
|
|
74
|
+
setCurrentRecordId(record.recordId);
|
|
75
|
+
setReviewVisible(false);
|
|
76
|
+
setApprovalVisible(true);
|
|
77
|
+
},
|
|
78
|
+
children: "办理"
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
return /*#__PURE__*/ jsx(Space, {
|
|
82
|
+
children: /*#__PURE__*/ jsx("a", {
|
|
83
|
+
onClick: ()=>{
|
|
84
|
+
setCurrentRecordId(record.recordId);
|
|
85
|
+
setReviewVisible(true);
|
|
86
|
+
setApprovalVisible(true);
|
|
87
|
+
},
|
|
88
|
+
children: "详情"
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
const items = [
|
|
95
|
+
{
|
|
96
|
+
key: 'todo',
|
|
97
|
+
label: '我的待办',
|
|
98
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
99
|
+
rowKey: "id",
|
|
100
|
+
actionType: actionTodo,
|
|
101
|
+
columns: columns,
|
|
102
|
+
request: (request)=>todo(request, mockKey)
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: 'done',
|
|
107
|
+
label: '我的已办',
|
|
108
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
109
|
+
rowKey: "id",
|
|
110
|
+
actionType: actionDone,
|
|
111
|
+
columns: columns,
|
|
112
|
+
request: (request)=>done(request, mockKey)
|
|
113
|
+
})
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: 'notify',
|
|
117
|
+
label: '我的抄送',
|
|
118
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
119
|
+
rowKey: "id",
|
|
120
|
+
actionType: actionNotify,
|
|
121
|
+
columns: columns,
|
|
122
|
+
request: (request)=>notify(request, mockKey)
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: 'all',
|
|
127
|
+
label: '全部流程',
|
|
128
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
129
|
+
rowKey: "id",
|
|
130
|
+
actionType: actionAll,
|
|
131
|
+
columns: columns,
|
|
132
|
+
request: (request)=>list(request, mockKey)
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
const reloadCurrentTab = ()=>{
|
|
137
|
+
if ('all' === currentTab) actionAll.current?.reload();
|
|
138
|
+
if ('done' === currentTab) actionDone.current?.reload();
|
|
139
|
+
if ('todo' === currentTab) actionTodo.current?.reload();
|
|
140
|
+
if ('notify' === currentTab) actionNotify.current?.reload();
|
|
141
|
+
};
|
|
142
|
+
react.useEffect(()=>{
|
|
143
|
+
reloadCurrentTab();
|
|
144
|
+
}, [
|
|
145
|
+
currentTab
|
|
146
|
+
]);
|
|
147
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
148
|
+
children: [
|
|
149
|
+
/*#__PURE__*/ jsx(Tabs, {
|
|
150
|
+
items: items,
|
|
151
|
+
centered: true,
|
|
152
|
+
defaultActiveKey: currentTab,
|
|
153
|
+
onChange: (currentKey)=>{
|
|
154
|
+
setCurrentTab(currentKey);
|
|
155
|
+
},
|
|
156
|
+
tabBarExtraContent: {
|
|
157
|
+
left: /*#__PURE__*/ jsx("h3", {
|
|
158
|
+
children: "模拟流程测试"
|
|
159
|
+
}),
|
|
160
|
+
right: /*#__PURE__*/ jsxs(Space, {
|
|
161
|
+
children: [
|
|
162
|
+
/*#__PURE__*/ jsx(Button, {
|
|
163
|
+
type: 'primary',
|
|
164
|
+
onClick: ()=>{
|
|
165
|
+
setCurrentRecordId('');
|
|
166
|
+
setReviewVisible(false);
|
|
167
|
+
setSelectVisible(true);
|
|
168
|
+
},
|
|
169
|
+
children: "发起流程"
|
|
170
|
+
}, "create"),
|
|
171
|
+
/*#__PURE__*/ jsx(Button, {
|
|
172
|
+
onClick: ()=>{
|
|
173
|
+
props.onCleanMock();
|
|
174
|
+
},
|
|
175
|
+
children: "关闭模拟"
|
|
176
|
+
}, "clean")
|
|
177
|
+
]
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ jsx(WorkflowSelectModal, {
|
|
182
|
+
open: selectVisible,
|
|
183
|
+
onSelect: (code)=>{
|
|
184
|
+
setWorkflowCode(code);
|
|
185
|
+
setSelectVisible(false);
|
|
186
|
+
setApprovalVisible(true);
|
|
187
|
+
},
|
|
188
|
+
onClose: ()=>{
|
|
189
|
+
setSelectVisible(false);
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ jsx(ApprovalPanelDrawer, {
|
|
193
|
+
workflowCode: workflowCode,
|
|
194
|
+
open: approvalVisible,
|
|
195
|
+
recordId: currentRecordId,
|
|
196
|
+
review: reviewVisible,
|
|
197
|
+
onClose: ()=>{
|
|
198
|
+
setApprovalVisible(false);
|
|
199
|
+
reloadCurrentTab();
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
export { MockTodoPage };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { FlowMockPresenter } from "../presenter.js";
|
|
3
|
+
import { FlowMockApiImpl } from "../model.js";
|
|
4
|
+
const useMockPresenter = ()=>{
|
|
5
|
+
const ref = react.useRef(void 0);
|
|
6
|
+
const [state, setState] = react.useState('');
|
|
7
|
+
if (!ref.current) {
|
|
8
|
+
ref.current = new FlowMockPresenter(state, setState, new FlowMockApiImpl());
|
|
9
|
+
ref.current.initState();
|
|
10
|
+
}
|
|
11
|
+
react.useEffect(()=>{
|
|
12
|
+
if (ref.current && state) ref.current.syncState(state);
|
|
13
|
+
}, [
|
|
14
|
+
state
|
|
15
|
+
]);
|
|
16
|
+
react.useEffect(()=>()=>{
|
|
17
|
+
if (state) ref.current?.cleanMock();
|
|
18
|
+
}, []);
|
|
19
|
+
return {
|
|
20
|
+
state: state,
|
|
21
|
+
presenter: ref.current
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export { useMockPresenter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FlowMock: () => import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useMockPresenter } from "./hooks/use-mock-presenter.js";
|
|
4
|
+
import { FlowMockContext } from "@coding-flow/flow-approval-presenter";
|
|
5
|
+
import { MockTodoPage } from "./components/todo.js";
|
|
6
|
+
const FlowMock = ()=>{
|
|
7
|
+
const { state, presenter } = useMockPresenter();
|
|
8
|
+
if (state) return /*#__PURE__*/ jsx(FlowMockContext.Provider, {
|
|
9
|
+
value: state,
|
|
10
|
+
children: /*#__PURE__*/ jsx(MockTodoPage, {
|
|
11
|
+
onCleanMock: ()=>{
|
|
12
|
+
presenter.cleanMock();
|
|
13
|
+
window.close();
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { FlowMock };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cleanMock, mock } from "../../api/workflow.js";
|
|
2
|
+
class FlowMockApiImpl {
|
|
3
|
+
mock = async ()=>{
|
|
4
|
+
const result = await mock();
|
|
5
|
+
if (result.success) return result.data;
|
|
6
|
+
};
|
|
7
|
+
clear = async (mockKey)=>{
|
|
8
|
+
await cleanMock(mockKey);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export { FlowMockApiImpl };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlowMockApi } from "./types";
|
|
2
|
+
import { Dispatch } from "@coding-flow/flow-core";
|
|
3
|
+
export declare class FlowMockPresenter {
|
|
4
|
+
private state;
|
|
5
|
+
private readonly dispatch;
|
|
6
|
+
private readonly api;
|
|
7
|
+
constructor(state: string, dispatch: Dispatch<string>, api: FlowMockApi);
|
|
8
|
+
syncState(state: string): void;
|
|
9
|
+
initState(): void;
|
|
10
|
+
cleanMock(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class FlowMockPresenter {
|
|
2
|
+
state;
|
|
3
|
+
dispatch;
|
|
4
|
+
api;
|
|
5
|
+
constructor(state, dispatch, api){
|
|
6
|
+
this.state = state;
|
|
7
|
+
this.api = api;
|
|
8
|
+
this.dispatch = dispatch;
|
|
9
|
+
}
|
|
10
|
+
syncState(state) {
|
|
11
|
+
this.state = state;
|
|
12
|
+
console.log('syncState', state);
|
|
13
|
+
}
|
|
14
|
+
initState() {
|
|
15
|
+
this.api.mock().then((mock)=>{
|
|
16
|
+
if (mock) {
|
|
17
|
+
console.log('mock initState', mock);
|
|
18
|
+
this.dispatch(mock);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
cleanMock() {
|
|
23
|
+
this.api.clear(this.state).then(()=>{
|
|
24
|
+
this.dispatch('');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export { FlowMockPresenter };
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { options } from "../../api/workflow.js";
|
|
4
|
+
import { Button, Modal, Space } from "antd";
|
|
5
|
+
const WorkflowSelectModal = (props)=>{
|
|
6
|
+
const [option, setOption] = react.useState([]);
|
|
7
|
+
react.useEffect(()=>{
|
|
8
|
+
options().then((res)=>{
|
|
9
|
+
if (res.success) setOption(res.data.list);
|
|
10
|
+
});
|
|
11
|
+
}, []);
|
|
12
|
+
return /*#__PURE__*/ jsx(Modal, {
|
|
13
|
+
open: props.open,
|
|
14
|
+
onCancel: props.onClose,
|
|
15
|
+
title: "请选择发起流程",
|
|
16
|
+
width: "45%",
|
|
17
|
+
footer: false,
|
|
18
|
+
children: /*#__PURE__*/ jsx(Space, {
|
|
19
|
+
style: {
|
|
20
|
+
marginTop: "10px"
|
|
21
|
+
},
|
|
22
|
+
children: option.map((item, index)=>/*#__PURE__*/ jsx(Button, {
|
|
23
|
+
type: 'primary',
|
|
24
|
+
onClick: ()=>{
|
|
25
|
+
props.onSelect?.(item.value);
|
|
26
|
+
},
|
|
27
|
+
children: item.label
|
|
28
|
+
}, index))
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { WorkflowSelectModal };
|
package/dist/favicon.png
ADDED
|
Binary file
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { AddAuditViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Select } from "antd";
|
|
6
|
+
const AddAuditView = (props)=>{
|
|
7
|
+
const AddAuditViewComponent = ViewBindPlugin.getInstance().get(AddAuditViewPluginKey);
|
|
8
|
+
const { state } = useApprovalContext();
|
|
9
|
+
const createOperator = state.flow?.createOperator;
|
|
10
|
+
const options = createOperator ? [
|
|
11
|
+
{
|
|
12
|
+
label: createOperator.name,
|
|
13
|
+
value: createOperator.id
|
|
14
|
+
}
|
|
15
|
+
] : [];
|
|
16
|
+
if (AddAuditViewComponent) return /*#__PURE__*/ jsx(AddAuditViewComponent, {
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
const handleChange = (value)=>{
|
|
20
|
+
props.onChange?.(value);
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/ jsx(Select, {
|
|
23
|
+
placeholder: "请选择加签人员",
|
|
24
|
+
mode: "multiple",
|
|
25
|
+
value: props.value,
|
|
26
|
+
onChange: (value, option)=>{
|
|
27
|
+
handleChange(value);
|
|
28
|
+
},
|
|
29
|
+
options: options
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { AddAuditView };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { DelegateViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Select } from "antd";
|
|
6
|
+
const DelegateView = (props)=>{
|
|
7
|
+
const DelegateViewComponent = ViewBindPlugin.getInstance().get(DelegateViewPluginKey);
|
|
8
|
+
const { state } = useApprovalContext();
|
|
9
|
+
const createOperator = state.flow?.createOperator;
|
|
10
|
+
const options = createOperator ? [
|
|
11
|
+
{
|
|
12
|
+
label: createOperator.name,
|
|
13
|
+
value: createOperator.id
|
|
14
|
+
}
|
|
15
|
+
] : [];
|
|
16
|
+
if (DelegateViewComponent) return /*#__PURE__*/ jsx(DelegateViewComponent, {
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
const handleChange = (value)=>{
|
|
20
|
+
props.onChange?.(value);
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/ jsx(Select, {
|
|
23
|
+
placeholder: "请选择委托人员",
|
|
24
|
+
mode: "multiple",
|
|
25
|
+
value: props.value,
|
|
26
|
+
onChange: (value, option)=>{
|
|
27
|
+
handleChange(value);
|
|
28
|
+
},
|
|
29
|
+
options: options
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { DelegateView };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import react from "react";
|
|
3
|
+
import { ReturnViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Select } from "antd";
|
|
6
|
+
const ReturnView = (props)=>{
|
|
7
|
+
const ReturnViewComponent = ViewBindPlugin.getInstance().get(ReturnViewPluginKey);
|
|
8
|
+
const { state } = useApprovalContext();
|
|
9
|
+
const nodeOptions = react.useMemo(()=>{
|
|
10
|
+
const nodes = state.flow?.nodes || [];
|
|
11
|
+
const currentId = state.flow?.nodeId || '';
|
|
12
|
+
const options = [];
|
|
13
|
+
for (const node of nodes){
|
|
14
|
+
if (currentId === node.id) break;
|
|
15
|
+
if (node.display) options.push({
|
|
16
|
+
label: node.name,
|
|
17
|
+
value: node.id
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return options;
|
|
21
|
+
}, [
|
|
22
|
+
state.flow?.nodes
|
|
23
|
+
]);
|
|
24
|
+
if (ReturnViewComponent) return /*#__PURE__*/ jsx(ReturnViewComponent, {
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
const handleChange = (value)=>{
|
|
28
|
+
props.onChange?.(value);
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/ jsx(Select, {
|
|
31
|
+
placeholder: "请选择退回节点",
|
|
32
|
+
value: props.value,
|
|
33
|
+
onChange: (value, option)=>{
|
|
34
|
+
handleChange(value);
|
|
35
|
+
},
|
|
36
|
+
options: nodeOptions
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export { ReturnView };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { SignKeyViewPluginKey } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Input } from "antd";
|
|
6
|
+
const { TextArea } = Input;
|
|
7
|
+
const SignKeyView = (props)=>{
|
|
8
|
+
const SignKeyViewComponent = ViewBindPlugin.getInstance().get(SignKeyViewPluginKey);
|
|
9
|
+
if (SignKeyViewComponent) return /*#__PURE__*/ jsx(SignKeyViewComponent, {
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
return /*#__PURE__*/ jsx(TextArea, {
|
|
13
|
+
value: props.value,
|
|
14
|
+
placeholder: "请输入审批签名",
|
|
15
|
+
onChange: (event)=>{
|
|
16
|
+
const value = event.target.value;
|
|
17
|
+
props.onChange?.(value);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
export { SignKeyView };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { TransferViewPluginKey, useApprovalContext } from "@coding-flow/flow-approval-presenter";
|
|
4
|
+
import { ViewBindPlugin } from "@coding-flow/flow-core";
|
|
5
|
+
import { Select } from "antd";
|
|
6
|
+
const TransferView = (props)=>{
|
|
7
|
+
const TransferViewComponent = ViewBindPlugin.getInstance().get(TransferViewPluginKey);
|
|
8
|
+
const { state } = useApprovalContext();
|
|
9
|
+
const createOperator = state.flow?.createOperator;
|
|
10
|
+
const options = createOperator ? [
|
|
11
|
+
{
|
|
12
|
+
label: createOperator.name,
|
|
13
|
+
value: createOperator.id
|
|
14
|
+
}
|
|
15
|
+
] : [];
|
|
16
|
+
if (TransferViewComponent) return /*#__PURE__*/ jsx(TransferViewComponent, {
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
const handleChange = (value)=>{
|
|
20
|
+
props.onChange?.(value);
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/ jsx(Select, {
|
|
23
|
+
placeholder: "请选择转办人员",
|
|
24
|
+
mode: "multiple",
|
|
25
|
+
value: props.value,
|
|
26
|
+
onChange: (value, option)=>{
|
|
27
|
+
handleChange(value);
|
|
28
|
+
},
|
|
29
|
+
options: options
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export { TransferView };
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@coding-flow/flow-pc-approval",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "flow-engine pc form approval components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"coding-flow",
|
|
8
|
+
"flow-engine"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/codingapi/flow-frontend",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/codingapi/flow-frontend/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/codingapi/flow-frontend.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"author": "1024lorne@gmail.com",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": ">=18",
|
|
32
|
+
"react-dom": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ant-design/icons": "~6.1.0",
|
|
36
|
+
"@reduxjs/toolkit": "^2.11.2",
|
|
37
|
+
"antd": "^6.2.1",
|
|
38
|
+
"dayjs": "^1.11.19",
|
|
39
|
+
"immer": "^11.1.3",
|
|
40
|
+
"react-redux": "^9.2.0",
|
|
41
|
+
"@coding-flow/flow-core": "0.0.1",
|
|
42
|
+
"@coding-flow/flow-types": "0.0.1",
|
|
43
|
+
"@coding-flow/flow-icons": "0.0.1",
|
|
44
|
+
"@coding-flow/flow-approval-presenter": "0.0.1",
|
|
45
|
+
"@coding-flow/flow-pc-ui": "0.0.1",
|
|
46
|
+
"@coding-flow/flow-pc-form": "0.0.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@coding-flow/flow-types": "0.0.1"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "rslib build",
|
|
53
|
+
"dev": "rslib build --watch",
|
|
54
|
+
"test": "rstest",
|
|
55
|
+
"push": "pnpm run build && pnpm publish --access public"
|
|
56
|
+
}
|
|
57
|
+
}
|