gbflowengine 0.1.0 → 0.1.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.
Files changed (79) hide show
  1. package/README.md +271 -271
  2. package/dist/gbflowengine.css +1 -1
  3. package/dist/gbflowengine.js +8232 -6913
  4. package/dist/gbflowengine.js.map +1 -1
  5. package/dist/gbflowengine.umd.cjs +2 -2
  6. package/dist/gbflowengine.umd.cjs.map +1 -1
  7. package/package.json +85 -84
  8. package/src/center/DefinitionInspect.vue +291 -291
  9. package/src/center/FlowCenter.vue +33 -33
  10. package/src/center/index.js +29 -29
  11. package/src/center/storage.js +748 -748
  12. package/src/core/flow/condition.js +160 -160
  13. package/src/core/flow/customNode.js +385 -385
  14. package/src/core/flow/defaults.js +124 -124
  15. package/src/core/flow/flowConstant.js +265 -265
  16. package/src/core/flow/flowNodeUtils.js +29 -29
  17. package/src/core/flow/index.js +47 -47
  18. package/src/core/flow/node.js +44 -44
  19. package/src/core/flow/nodeFactory.js +58 -58
  20. package/src/core/flow/prediction.js +325 -325
  21. package/src/core/flow/schema.js +864 -864
  22. package/src/definition/FlowDefinitionDesigner.vue +338 -338
  23. package/src/definition/index.js +9 -9
  24. package/src/index.js +39 -39
  25. package/src/storage.js +200 -200
  26. package/src/testing/FlowTestPanel.vue +2502 -2502
  27. package/src/testing/UserConfigDrawer.vue +376 -376
  28. package/src/testing/diagram/FlowProgressDiagram.vue +318 -318
  29. package/src/testing/diagramModel.js +517 -517
  30. package/src/testing/index.js +23 -23
  31. package/src/testing/mock.js +246 -246
  32. package/src/testing/oaExecutors.js +51 -51
  33. package/src/testing/oaSeed.js +467 -467
  34. package/src/testing/sample.js +412 -412
  35. package/src/testing/seed.js +122 -122
  36. package/src/utils/format.js +27 -27
  37. package/src/visual/FlowCanvas.vue +440 -440
  38. package/src/visual/NodeProgressDetail.vue +43 -43
  39. package/src/visual/NodeStatusBadge.vue +17 -17
  40. package/src/visual/NodeWrap.vue +46 -46
  41. package/src/visual/ScWorkflow.vue +49 -49
  42. package/src/visual/SelectDialog.vue +459 -459
  43. package/src/visual/conditionHelpers.js +116 -116
  44. package/src/visual/index.js +6 -6
  45. package/src/visual/nodes/AddNode.vue +222 -222
  46. package/src/visual/nodes/ApproverNode.vue +347 -347
  47. package/src/visual/nodes/BranchNode.vue +441 -441
  48. package/src/visual/nodes/CustomNode.vue +339 -339
  49. package/src/visual/nodes/EndNode.vue +21 -21
  50. package/src/visual/nodes/PassNode.vue +100 -100
  51. package/src/visual/nodes/PromoterNode.vue +134 -134
  52. package/src/visual/nodes/RejectNode.vue +100 -100
  53. package/src/visual/nodes/SendNode.vue +151 -151
  54. package/src/visual/styles.scss +879 -879
  55. package/src/visual/useScNodeStatus.js +18 -18
  56. package/src/workbench/OaWorkbench.vue +1341 -1341
  57. package/src/workbench/components/ApprovalWorkspace.vue +2090 -2090
  58. package/src/workbench/components/CategoryIcon.vue +74 -74
  59. package/src/workbench/components/NotificationIcon.vue +73 -73
  60. package/src/workbench/components/ProcessSteps.vue +557 -557
  61. package/src/workbench/components/ResubmitDialog.vue +227 -227
  62. package/src/workbench/components/SidebarNav.vue +138 -138
  63. package/src/workbench/components/StartFlowDialog.vue +1058 -1058
  64. package/src/workbench/components/UserAvatar.vue +68 -68
  65. package/src/workbench/model.js +1080 -1080
  66. package/src/workbench/pages/DesignPage.vue +798 -798
  67. package/src/workbench/pages/HomePage.vue +1050 -1050
  68. package/src/workbench/pages/MonitorPage.vue +1029 -1029
  69. package/src/workbench/pages/NotificationsPage.vue +554 -554
  70. package/src/workbench/pages/RequestsPage.vue +644 -644
  71. package/src/workbench/pages/TaskCenterPage.vue +1155 -1155
  72. package/src/workbench/pages/TemplatesPage.vue +680 -680
  73. package/src/workbench/styles.scss +555 -555
  74. package/types/center.d.ts +5 -5
  75. package/types/core.d.ts +479 -479
  76. package/types/definition.d.ts +4 -4
  77. package/types/index.d.ts +34 -34
  78. package/types/testing.d.ts +20 -20
  79. package/types/visual.d.ts +20 -20
@@ -1,223 +1,223 @@
1
- <template>
2
- <div class="add-node-btn-box" v-if="!readonly">
3
- <div class="add-node-btn">
4
- <el-popover placement="right-start" :width="270" trigger="click" :hide-after="0" :show-after="0">
5
- <template #reference>
6
- <el-button type="primary" :icon="Plus" circle />
7
- </template>
8
- <div class="add-node-popover-body">
9
- <ul>
10
- <li v-if="allow.type1">
11
- <div class="fc-add-icon" style="color: #ff943e" @click="addType(FlowNodeType.APPROVE)">
12
- <el-icon><UserFilled /></el-icon>
13
- </div>
14
- <p>审批节点</p>
15
- </li>
16
- <li v-if="allow.type2">
17
- <div class="fc-add-icon" style="color: #3296fa" @click="addType(FlowNodeType.CC)">
18
- <el-icon><Promotion /></el-icon>
19
- </div>
20
- <p>抄送节点</p>
21
- </li>
22
- <li v-if="allow.type7">
23
- <div class="fc-add-icon" style="color: #6f5cf1" @click="addType(FlowNodeType.CUSTOM)">
24
- <el-icon><SetUp /></el-icon>
25
- </div>
26
- <p>自定义节点</p>
27
- </li>
28
- <li v-if="allow.type4">
29
- <div class="fc-add-icon" style="color: #15bc83" @click="addType(FlowNodeType.BRANCH)">
30
- <el-icon><Share /></el-icon>
31
- </div>
32
- <p>条件分支</p>
33
- </li>
34
- <li v-if="allow.type5">
35
- <div class="fc-add-icon" style="color: #1bc47d" @click="addType(FlowNodeType.PARALLEL)">
36
- <el-icon><Grid /></el-icon>
37
- </div>
38
- <p>并行分支</p>
39
- </li>
40
- <li v-if="allow.type6">
41
- <div class="fc-add-icon" style="color: #ff8a80" @click="addType(FlowNodeType.INCLUSIVE)">
42
- <el-icon><Connection /></el-icon>
43
- </div>
44
- <p>包容分支</p>
45
- </li>
46
- <template v-if="allowTerminal">
47
- <li>
48
- <div class="fc-add-icon" style="color: #1bc47d" @click="addType(FlowNodeType.PASS)">
49
- <el-icon><Select /></el-icon>
50
- </div>
51
- <p>直接通过</p>
52
- </li>
53
- <li>
54
- <div class="fc-add-icon" style="color: #f54a4a" @click="addType(FlowNodeType.REJECT)">
55
- <el-icon><Close /></el-icon>
56
- </div>
57
- <p>直接拒绝</p>
58
- </li>
59
- </template>
60
- </ul>
61
- </div>
62
- </el-popover>
63
- </div>
64
- </div>
65
- <div class="add-node-btn-box" v-else>
66
- <div class="add-node-btn"></div>
67
- </div>
68
- </template>
69
-
70
- <script setup>
71
- import { computed, inject } from 'vue'
72
- import {
73
- Close,
74
- Connection,
75
- Grid,
76
- Plus,
77
- Promotion,
78
- Select,
79
- SetUp,
80
- Share,
81
- UserFilled
82
- } from '@element-plus/icons-vue'
83
- import {
84
- FlowNodeType,
85
- createCustomNodeConfig,
86
- generateNodeId
87
- } from '../../core/flow/index.js'
88
-
89
- defineOptions({ name: 'ScAddNode' })
90
-
91
- const props = defineProps({
92
- modelValue: { type: Object, default: null },
93
- parentNode: { type: Object, default: null },
94
- readonly: { type: Boolean, default: false }
95
- })
96
-
97
- const emit = defineEmits(['update:modelValue'])
98
-
99
- const readonlyAll = inject('scReadonly', false)
100
-
101
- const isReadonly = computed(() => props.readonly || readonlyAll.value === true)
102
-
103
- // Parallel / inclusive are only offered outside conditions, matching the
104
- // original designer's placement rules.
105
- const allow = computed(() => ({
106
- type1: true,
107
- type2: true,
108
- type4: true,
109
- type5: props.parentNode?.type !== FlowNodeType.CONDITION,
110
- type6: props.parentNode?.type !== FlowNodeType.CONDITION,
111
- type7: true
112
- }))
113
-
114
- const allowTerminal = computed(() => {
115
- const parent = props.parentNode
116
- if (!parent) return false
117
- if (![FlowNodeType.CONDITION, FlowNodeType.INCLUSIVE_BRANCH].includes(parent.type)) return false
118
- const child = parent.childNode
119
- return !child || child.type === FlowNodeType.END
120
- })
121
-
122
- const createConditionNode = (name, isDefaultCondition = false) => ({
123
- nodeId: generateNodeId(),
124
- nodeName: name,
125
- type: FlowNodeType.CONDITION,
126
- conditions: [],
127
- isDefaultCondition,
128
- childNode: null
129
- })
130
-
131
- const addType = (type) => {
132
- let node = null
133
- if (type === FlowNodeType.APPROVE) {
134
- node = {
135
- nodeId: generateNodeId(),
136
- nodeName: '审批人',
137
- type: FlowNodeType.APPROVE,
138
- approverType: 'user',
139
- signMode: 'and',
140
- userList: [],
141
- userNickNames: {},
142
- deptNameMap: {},
143
- roleList: [],
144
- roleNameMap: {},
145
- superiorLevel: 1,
146
- allowTransfer: true,
147
- rejectStrategy: 'terminate',
148
- rejectTargetNodeId: null,
149
- rejectRetryLimit: 0,
150
- termAuto: false,
151
- term: 0,
152
- termMode: 0,
153
- childNode: props.modelValue || null
154
- }
155
- } else if (type === FlowNodeType.CC) {
156
- node = {
157
- nodeId: generateNodeId(),
158
- nodeName: '抄送人',
159
- type: FlowNodeType.CC,
160
- userList: [],
161
- userNickNames: {},
162
- deptNameMap: {},
163
- allowInitiatorAddUsers: true,
164
- childNode: props.modelValue || null
165
- }
166
- } else if (type === FlowNodeType.CUSTOM) {
167
- node = {
168
- nodeId: generateNodeId(),
169
- nodeName: '自定义节点',
170
- type: FlowNodeType.CUSTOM,
171
- custom: createCustomNodeConfig(),
172
- childNode: props.modelValue || null
173
- }
174
- } else if (type === FlowNodeType.BRANCH) {
175
- node = {
176
- nodeId: generateNodeId(),
177
- nodeName: '条件分支',
178
- type: FlowNodeType.BRANCH,
179
- branchList: [createConditionNode('条件1'), createConditionNode('其他条件', true)],
180
- childNode: props.modelValue || null
181
- }
182
- } else if (type === FlowNodeType.PARALLEL) {
183
- node = {
184
- nodeId: generateNodeId(),
185
- nodeName: '并行分支',
186
- type: FlowNodeType.PARALLEL,
187
- branchList: [
188
- { nodeId: generateNodeId(), nodeName: '分支1', type: FlowNodeType.PARALLEL_BRANCH, branchIndex: 0, childNode: null },
189
- { nodeId: generateNodeId(), nodeName: '分支2', type: FlowNodeType.PARALLEL_BRANCH, branchIndex: 1, childNode: null }
190
- ],
191
- childNode: props.modelValue || null
192
- }
193
- } else if (type === FlowNodeType.INCLUSIVE) {
194
- node = {
195
- nodeId: generateNodeId(),
196
- nodeName: '包容分支',
197
- type: FlowNodeType.INCLUSIVE,
198
- branchList: [
199
- { nodeId: generateNodeId(), nodeName: '条件1', type: FlowNodeType.INCLUSIVE_BRANCH, branchIndex: 0, conditions: [], isDefaultBranch: false, childNode: null },
200
- { nodeId: generateNodeId(), nodeName: '其他分支', type: FlowNodeType.INCLUSIVE_BRANCH, branchIndex: 1, conditions: [], isDefaultBranch: true, childNode: null }
201
- ],
202
- childNode: props.modelValue || null
203
- }
204
- } else if (type === FlowNodeType.PASS) {
205
- node = {
206
- nodeId: generateNodeId(),
207
- nodeName: '直接通过',
208
- type: FlowNodeType.PASS,
209
- childNode: props.modelValue || null
210
- }
211
- } else if (type === FlowNodeType.REJECT) {
212
- node = {
213
- nodeId: generateNodeId(),
214
- nodeName: '直接拒绝',
215
- type: FlowNodeType.REJECT,
216
- childNode: props.modelValue || null
217
- }
218
- }
219
-
220
- if (!node) return
221
- emit('update:modelValue', node)
222
- }
1
+ <template>
2
+ <div class="add-node-btn-box" v-if="!readonly">
3
+ <div class="add-node-btn">
4
+ <el-popover placement="right-start" :width="270" trigger="click" :hide-after="0" :show-after="0">
5
+ <template #reference>
6
+ <el-button type="primary" :icon="Plus" circle />
7
+ </template>
8
+ <div class="add-node-popover-body">
9
+ <ul>
10
+ <li v-if="allow.type1">
11
+ <div class="fc-add-icon" style="color: #ff943e" @click="addType(FlowNodeType.APPROVE)">
12
+ <el-icon><UserFilled /></el-icon>
13
+ </div>
14
+ <p>审批节点</p>
15
+ </li>
16
+ <li v-if="allow.type2">
17
+ <div class="fc-add-icon" style="color: #3296fa" @click="addType(FlowNodeType.CC)">
18
+ <el-icon><Promotion /></el-icon>
19
+ </div>
20
+ <p>抄送节点</p>
21
+ </li>
22
+ <li v-if="allow.type7">
23
+ <div class="fc-add-icon" style="color: #6f5cf1" @click="addType(FlowNodeType.CUSTOM)">
24
+ <el-icon><SetUp /></el-icon>
25
+ </div>
26
+ <p>自定义节点</p>
27
+ </li>
28
+ <li v-if="allow.type4">
29
+ <div class="fc-add-icon" style="color: #15bc83" @click="addType(FlowNodeType.BRANCH)">
30
+ <el-icon><Share /></el-icon>
31
+ </div>
32
+ <p>条件分支</p>
33
+ </li>
34
+ <li v-if="allow.type5">
35
+ <div class="fc-add-icon" style="color: #1bc47d" @click="addType(FlowNodeType.PARALLEL)">
36
+ <el-icon><Grid /></el-icon>
37
+ </div>
38
+ <p>并行分支</p>
39
+ </li>
40
+ <li v-if="allow.type6">
41
+ <div class="fc-add-icon" style="color: #ff8a80" @click="addType(FlowNodeType.INCLUSIVE)">
42
+ <el-icon><Connection /></el-icon>
43
+ </div>
44
+ <p>包容分支</p>
45
+ </li>
46
+ <template v-if="allowTerminal">
47
+ <li>
48
+ <div class="fc-add-icon" style="color: #1bc47d" @click="addType(FlowNodeType.PASS)">
49
+ <el-icon><Select /></el-icon>
50
+ </div>
51
+ <p>直接通过</p>
52
+ </li>
53
+ <li>
54
+ <div class="fc-add-icon" style="color: #f54a4a" @click="addType(FlowNodeType.REJECT)">
55
+ <el-icon><Close /></el-icon>
56
+ </div>
57
+ <p>直接拒绝</p>
58
+ </li>
59
+ </template>
60
+ </ul>
61
+ </div>
62
+ </el-popover>
63
+ </div>
64
+ </div>
65
+ <div class="add-node-btn-box" v-else>
66
+ <div class="add-node-btn"></div>
67
+ </div>
68
+ </template>
69
+
70
+ <script setup>
71
+ import { computed, inject } from 'vue'
72
+ import {
73
+ Close,
74
+ Connection,
75
+ Grid,
76
+ Plus,
77
+ Promotion,
78
+ Select,
79
+ SetUp,
80
+ Share,
81
+ UserFilled
82
+ } from 'gbicons'
83
+ import {
84
+ FlowNodeType,
85
+ createCustomNodeConfig,
86
+ generateNodeId
87
+ } from '../../core/flow/index.js'
88
+
89
+ defineOptions({ name: 'ScAddNode' })
90
+
91
+ const props = defineProps({
92
+ modelValue: { type: Object, default: null },
93
+ parentNode: { type: Object, default: null },
94
+ readonly: { type: Boolean, default: false }
95
+ })
96
+
97
+ const emit = defineEmits(['update:modelValue'])
98
+
99
+ const readonlyAll = inject('scReadonly', false)
100
+
101
+ const isReadonly = computed(() => props.readonly || readonlyAll.value === true)
102
+
103
+ // Parallel / inclusive are only offered outside conditions, matching the
104
+ // original designer's placement rules.
105
+ const allow = computed(() => ({
106
+ type1: true,
107
+ type2: true,
108
+ type4: true,
109
+ type5: props.parentNode?.type !== FlowNodeType.CONDITION,
110
+ type6: props.parentNode?.type !== FlowNodeType.CONDITION,
111
+ type7: true
112
+ }))
113
+
114
+ const allowTerminal = computed(() => {
115
+ const parent = props.parentNode
116
+ if (!parent) return false
117
+ if (![FlowNodeType.CONDITION, FlowNodeType.INCLUSIVE_BRANCH].includes(parent.type)) return false
118
+ const child = parent.childNode
119
+ return !child || child.type === FlowNodeType.END
120
+ })
121
+
122
+ const createConditionNode = (name, isDefaultCondition = false) => ({
123
+ nodeId: generateNodeId(),
124
+ nodeName: name,
125
+ type: FlowNodeType.CONDITION,
126
+ conditions: [],
127
+ isDefaultCondition,
128
+ childNode: null
129
+ })
130
+
131
+ const addType = (type) => {
132
+ let node = null
133
+ if (type === FlowNodeType.APPROVE) {
134
+ node = {
135
+ nodeId: generateNodeId(),
136
+ nodeName: '审批人',
137
+ type: FlowNodeType.APPROVE,
138
+ approverType: 'user',
139
+ signMode: 'and',
140
+ userList: [],
141
+ userNickNames: {},
142
+ deptNameMap: {},
143
+ roleList: [],
144
+ roleNameMap: {},
145
+ superiorLevel: 1,
146
+ allowTransfer: true,
147
+ rejectStrategy: 'terminate',
148
+ rejectTargetNodeId: null,
149
+ rejectRetryLimit: 0,
150
+ termAuto: false,
151
+ term: 0,
152
+ termMode: 0,
153
+ childNode: props.modelValue || null
154
+ }
155
+ } else if (type === FlowNodeType.CC) {
156
+ node = {
157
+ nodeId: generateNodeId(),
158
+ nodeName: '抄送人',
159
+ type: FlowNodeType.CC,
160
+ userList: [],
161
+ userNickNames: {},
162
+ deptNameMap: {},
163
+ allowInitiatorAddUsers: true,
164
+ childNode: props.modelValue || null
165
+ }
166
+ } else if (type === FlowNodeType.CUSTOM) {
167
+ node = {
168
+ nodeId: generateNodeId(),
169
+ nodeName: '自定义节点',
170
+ type: FlowNodeType.CUSTOM,
171
+ custom: createCustomNodeConfig(),
172
+ childNode: props.modelValue || null
173
+ }
174
+ } else if (type === FlowNodeType.BRANCH) {
175
+ node = {
176
+ nodeId: generateNodeId(),
177
+ nodeName: '条件分支',
178
+ type: FlowNodeType.BRANCH,
179
+ branchList: [createConditionNode('条件1'), createConditionNode('其他条件', true)],
180
+ childNode: props.modelValue || null
181
+ }
182
+ } else if (type === FlowNodeType.PARALLEL) {
183
+ node = {
184
+ nodeId: generateNodeId(),
185
+ nodeName: '并行分支',
186
+ type: FlowNodeType.PARALLEL,
187
+ branchList: [
188
+ { nodeId: generateNodeId(), nodeName: '分支1', type: FlowNodeType.PARALLEL_BRANCH, branchIndex: 0, childNode: null },
189
+ { nodeId: generateNodeId(), nodeName: '分支2', type: FlowNodeType.PARALLEL_BRANCH, branchIndex: 1, childNode: null }
190
+ ],
191
+ childNode: props.modelValue || null
192
+ }
193
+ } else if (type === FlowNodeType.INCLUSIVE) {
194
+ node = {
195
+ nodeId: generateNodeId(),
196
+ nodeName: '包容分支',
197
+ type: FlowNodeType.INCLUSIVE,
198
+ branchList: [
199
+ { nodeId: generateNodeId(), nodeName: '条件1', type: FlowNodeType.INCLUSIVE_BRANCH, branchIndex: 0, conditions: [], isDefaultBranch: false, childNode: null },
200
+ { nodeId: generateNodeId(), nodeName: '其他分支', type: FlowNodeType.INCLUSIVE_BRANCH, branchIndex: 1, conditions: [], isDefaultBranch: true, childNode: null }
201
+ ],
202
+ childNode: props.modelValue || null
203
+ }
204
+ } else if (type === FlowNodeType.PASS) {
205
+ node = {
206
+ nodeId: generateNodeId(),
207
+ nodeName: '直接通过',
208
+ type: FlowNodeType.PASS,
209
+ childNode: props.modelValue || null
210
+ }
211
+ } else if (type === FlowNodeType.REJECT) {
212
+ node = {
213
+ nodeId: generateNodeId(),
214
+ nodeName: '直接拒绝',
215
+ type: FlowNodeType.REJECT,
216
+ childNode: props.modelValue || null
217
+ }
218
+ }
219
+
220
+ if (!node) return
221
+ emit('update:modelValue', node)
222
+ }
223
223
  </script>