gbflowengine 0.0.0-stage → 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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +270 -2
  3. package/dist/gbflowengine.css +1 -0
  4. package/dist/gbflowengine.js +19682 -0
  5. package/dist/gbflowengine.js.map +1 -0
  6. package/dist/gbflowengine.umd.cjs +5 -0
  7. package/dist/gbflowengine.umd.cjs.map +1 -0
  8. package/package.json +83 -4
  9. package/src/center/DefinitionInspect.vue +291 -0
  10. package/src/center/FlowCenter.vue +33 -0
  11. package/src/center/index.js +29 -0
  12. package/src/center/storage.js +748 -0
  13. package/src/core/flow/condition.js +160 -0
  14. package/src/core/flow/customNode.js +385 -0
  15. package/src/core/flow/defaults.js +124 -0
  16. package/src/core/flow/flowConstant.js +265 -0
  17. package/src/core/flow/flowNodeUtils.js +30 -0
  18. package/src/core/flow/index.js +47 -0
  19. package/src/core/flow/node.js +44 -0
  20. package/src/core/flow/nodeFactory.js +58 -0
  21. package/src/core/flow/prediction.js +325 -0
  22. package/src/core/flow/runtime/auto.js +83 -0
  23. package/src/core/flow/runtime/decide.js +329 -0
  24. package/src/core/flow/runtime/event.js +28 -0
  25. package/src/core/flow/runtime/execute.js +357 -0
  26. package/src/core/flow/runtime/helpers.js +52 -0
  27. package/src/core/flow/runtime/query.js +146 -0
  28. package/src/core/flow/runtime/reject.js +137 -0
  29. package/src/core/flow/runtime/token.js +269 -0
  30. package/src/core/flow/runtime.js +129 -0
  31. package/src/core/flow/schema.js +864 -0
  32. package/src/definition/FlowDefinitionDesigner.vue +338 -0
  33. package/src/definition/index.js +9 -0
  34. package/src/index.js +39 -0
  35. package/src/storage.js +200 -0
  36. package/src/testing/FlowTestPanel.vue +2502 -0
  37. package/src/testing/UserConfigDrawer.vue +376 -0
  38. package/src/testing/diagram/FlowProgressDiagram.vue +318 -0
  39. package/src/testing/diagramModel.js +517 -0
  40. package/src/testing/index.js +23 -0
  41. package/src/testing/mock.js +246 -0
  42. package/src/testing/oaExecutors.js +51 -0
  43. package/src/testing/oaSeed.js +467 -0
  44. package/src/testing/sample.js +412 -0
  45. package/src/testing/seed.js +122 -0
  46. package/src/utils/format.js +27 -0
  47. package/src/visual/FlowCanvas.vue +441 -0
  48. package/src/visual/NodeProgressDetail.vue +43 -0
  49. package/src/visual/NodeStatusBadge.vue +17 -0
  50. package/src/visual/NodeWrap.vue +47 -0
  51. package/src/visual/ScWorkflow.vue +50 -0
  52. package/src/visual/SelectDialog.vue +460 -0
  53. package/src/visual/conditionHelpers.js +117 -0
  54. package/src/visual/index.js +6 -0
  55. package/src/visual/nodes/AddNode.vue +223 -0
  56. package/src/visual/nodes/ApproverNode.vue +348 -0
  57. package/src/visual/nodes/BranchNode.vue +442 -0
  58. package/src/visual/nodes/CustomNode.vue +339 -0
  59. package/src/visual/nodes/EndNode.vue +22 -0
  60. package/src/visual/nodes/PassNode.vue +101 -0
  61. package/src/visual/nodes/PromoterNode.vue +135 -0
  62. package/src/visual/nodes/RejectNode.vue +101 -0
  63. package/src/visual/nodes/SendNode.vue +152 -0
  64. package/src/visual/styles.scss +879 -0
  65. package/src/visual/useScNodeStatus.js +18 -0
  66. package/src/workbench/OaWorkbench.vue +1341 -0
  67. package/src/workbench/components/ApprovalWorkspace.vue +2090 -0
  68. package/src/workbench/components/CategoryIcon.vue +74 -0
  69. package/src/workbench/components/NotificationIcon.vue +73 -0
  70. package/src/workbench/components/ProcessSteps.vue +557 -0
  71. package/src/workbench/components/ResubmitDialog.vue +227 -0
  72. package/src/workbench/components/SidebarNav.vue +138 -0
  73. package/src/workbench/components/StartFlowDialog.vue +1058 -0
  74. package/src/workbench/components/UserAvatar.vue +68 -0
  75. package/src/workbench/custom-tasks.js +130 -0
  76. package/src/workbench/model.js +1080 -0
  77. package/src/workbench/pages/DesignPage.vue +798 -0
  78. package/src/workbench/pages/HomePage.vue +1050 -0
  79. package/src/workbench/pages/MonitorPage.vue +1029 -0
  80. package/src/workbench/pages/NotificationsPage.vue +554 -0
  81. package/src/workbench/pages/RequestsPage.vue +644 -0
  82. package/src/workbench/pages/TaskCenterPage.vue +1155 -0
  83. package/src/workbench/pages/TemplatesPage.vue +680 -0
  84. package/src/workbench/persistence.js +89 -0
  85. package/src/workbench/shared.js +18 -0
  86. package/src/workbench/styles.scss +555 -0
  87. package/src/workbench/useWorkbench.js +955 -0
  88. package/types/center.d.ts +5 -0
  89. package/types/core.d.ts +479 -0
  90. package/types/definition.d.ts +4 -0
  91. package/types/index.d.ts +34 -0
  92. package/types/testing.d.ts +20 -0
  93. package/types/visual.d.ts +20 -0
@@ -0,0 +1,227 @@
1
+ <template>
2
+ <el-dialog
3
+ :model-value="modelValue"
4
+ title="修改并重新提交"
5
+ width="820px"
6
+ append-to-body
7
+ destroy-on-close
8
+ class="oa-resubmit-dialog"
9
+ @update:model-value="emit('update:modelValue', $event)"
10
+ @opened="prefill"
11
+ >
12
+ <div class="oa-resubmit">
13
+ <el-alert
14
+ type="warning"
15
+ :closable="false"
16
+ show-icon
17
+ title="流程已退回,请根据退回意见修改后重新提交"
18
+ >
19
+ <template #default>
20
+ <div class="oa-resubmit__tip">
21
+ <span>退回节点:{{ task?.nodeName || '发起人' }}</span>
22
+ <span v-if="rejectComment">退回意见:{{ rejectComment }}</span>
23
+ <span>请重点核对:{{ focusFields }}</span>
24
+ </div>
25
+ </template>
26
+ </el-alert>
27
+
28
+ <div class="oa-resubmit__form">
29
+ <FormViewer ref="formRef" :form-config="formComponents" :show-actions="false" />
30
+ </div>
31
+
32
+ <el-form label-position="top" class="oa-resubmit__comment">
33
+ <el-form-item label="补充说明(可选)">
34
+ <el-input
35
+ v-model="comment"
36
+ type="textarea"
37
+ :rows="2"
38
+ maxlength="300"
39
+ show-word-limit
40
+ placeholder="说明本次修改内容,便于审批人快速核对"
41
+ />
42
+ </el-form-item>
43
+ </el-form>
44
+ </div>
45
+
46
+ <template #footer>
47
+ <div class="oa-resubmit__footer">
48
+ <span class="oa-muted">提交后将按最新表单内容重新判断分支</span>
49
+ <el-button @click="emit('update:modelValue', false)">取消</el-button>
50
+ <el-button type="primary" :loading="submitting" @click="submit">
51
+ 重新提交
52
+ </el-button>
53
+ </div>
54
+ </template>
55
+ </el-dialog>
56
+ </template>
57
+
58
+ <script setup>
59
+ import { computed, nextTick, ref } from 'vue'
60
+ import { ElMessage } from 'element-plus'
61
+ import { FormViewer } from 'gbformdesign'
62
+ import { buildKeyFacts } from '../model.js'
63
+
64
+ defineOptions({ name: 'OaResubmitDialog' })
65
+
66
+ const props = defineProps({
67
+ modelValue: { type: Boolean, default: false },
68
+ instance: { type: Object, default: null },
69
+ task: { type: Object, default: null },
70
+ submitting: { type: Boolean, default: false }
71
+ })
72
+
73
+ const emit = defineEmits(['update:modelValue', 'submitted'])
74
+
75
+ const formRef = ref(null)
76
+ const comment = ref('')
77
+
78
+ const formComponents = computed(
79
+ () => props.instance?.definition?.form?.components || []
80
+ )
81
+ const rejectComment = computed(() => {
82
+ const records = [...(props.task?.records || [])].reverse()
83
+ return records.find((record) => record.action === 'reject')?.comment || ''
84
+ })
85
+ const focusFields = computed(() => {
86
+ const facts = buildKeyFacts(props.instance)
87
+ return facts.length
88
+ ? facts.map((fact) => fact.label).join('、')
89
+ : '申请内容与附件'
90
+ })
91
+
92
+ function prefill() {
93
+ const viewer = formRef.value
94
+ if (!viewer?.formData) return
95
+ Object.keys(viewer.formData).forEach((key) => delete viewer.formData[key])
96
+ Object.assign(viewer.formData, JSON.parse(JSON.stringify(props.instance?.state?.variables || {})))
97
+ comment.value = ''
98
+ }
99
+
100
+ async function submit() {
101
+ const viewer = formRef.value
102
+ if (!viewer) return
103
+ try {
104
+ await viewer.formRef?.validate?.()
105
+ } catch {
106
+ ElMessage.warning('请先完善表单必填项')
107
+ return
108
+ }
109
+ emit('submitted', {
110
+ data: JSON.parse(JSON.stringify(viewer.formData)),
111
+ comment: comment.value.trim()
112
+ })
113
+ await nextTick()
114
+ emit('update:modelValue', false)
115
+ }
116
+ </script>
117
+
118
+ <style scoped lang="scss">
119
+ .oa-resubmit {
120
+ display: flex;
121
+ flex-direction: column;
122
+ gap: 14px;
123
+ }
124
+
125
+ .oa-resubmit__tip {
126
+ display: flex;
127
+ flex-direction: column;
128
+ gap: 3px;
129
+ margin-top: 4px;
130
+ font-size: 12px;
131
+ line-height: 1.6;
132
+ }
133
+
134
+ .oa-resubmit__form {
135
+ max-height: 52vh;
136
+ overflow: auto;
137
+ padding: 18px 20px 8px;
138
+ border: 1px solid var(--oa-line);
139
+ border-radius: 9px;
140
+ background: #fcfdff;
141
+
142
+ :deep(.form-view-container) {
143
+ height: auto;
144
+ }
145
+
146
+ :deep(.form-view-content) {
147
+ overflow: visible;
148
+ }
149
+
150
+ :deep(.el-form-item__label) {
151
+ color: var(--oa-muted);
152
+ font-size: 12px;
153
+ }
154
+ }
155
+
156
+ .oa-resubmit__comment {
157
+ :deep(.el-form-item__label) {
158
+ color: var(--oa-muted);
159
+ font-size: 12px;
160
+ }
161
+ }
162
+
163
+ .oa-resubmit__footer {
164
+ display: flex;
165
+ align-items: center;
166
+ justify-content: flex-end;
167
+ gap: 8px;
168
+
169
+ .oa-muted {
170
+ margin-right: auto;
171
+ font-size: 11px;
172
+ }
173
+ }
174
+
175
+ @media (max-width: 960px) {
176
+ .oa-resubmit__form {
177
+ max-height: 46vh;
178
+ padding: 12px;
179
+ }
180
+
181
+ .oa-resubmit__form :deep(.form-wrapper) {
182
+ display: block;
183
+ }
184
+
185
+ .oa-resubmit__form :deep(.form-item-wrapper),
186
+ .oa-resubmit__form :deep(.form-item-wrapper.is-row),
187
+ .oa-resubmit__form :deep(.form-item-wrapper[style*='--item-width']) {
188
+ width: 100% !important;
189
+ max-width: 100% !important;
190
+ flex: 0 0 100% !important;
191
+ }
192
+
193
+ .oa-resubmit__form :deep(.el-form-item) {
194
+ display: flex;
195
+ flex-direction: column;
196
+ align-items: stretch;
197
+ }
198
+
199
+ .oa-resubmit__form :deep(.el-form-item__label) {
200
+ width: auto !important;
201
+ height: auto;
202
+ padding: 0 0 5px;
203
+ justify-content: flex-start;
204
+ line-height: 1.4;
205
+ text-align: left;
206
+ }
207
+
208
+ .oa-resubmit__form :deep(.el-form-item__content) {
209
+ width: 100%;
210
+ margin-left: 0 !important;
211
+ }
212
+
213
+ .oa-resubmit__footer {
214
+ flex-wrap: wrap;
215
+
216
+ .oa-muted {
217
+ flex: 0 0 100%;
218
+ margin-bottom: 4px;
219
+ }
220
+
221
+ .el-button {
222
+ min-height: 44px;
223
+ flex: 1;
224
+ }
225
+ }
226
+ }
227
+ </style>
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <nav class="oa-nav">
3
+ <div v-for="group in groups" :key="group.label" class="oa-nav__group">
4
+ <p class="oa-nav__label">{{ group.label }}</p>
5
+ <button
6
+ v-for="item in group.items"
7
+ :key="item.key"
8
+ type="button"
9
+ class="oa-nav__item"
10
+ :class="{ 'is-active': activeKey === item.key }"
11
+ @click="emit('select', item)"
12
+ >
13
+ <el-icon><component :is="item.icon" /></el-icon>
14
+ <span>{{ item.label }}</span>
15
+ <em v-if="item.badge" class="oa-nav__badge">{{ item.badge > 99 ? '99+' : item.badge }}</em>
16
+ </button>
17
+ </div>
18
+ </nav>
19
+ </template>
20
+
21
+ <script setup>
22
+ defineOptions({ name: 'OaSidebarNav' })
23
+
24
+ defineProps({
25
+ groups: { type: Array, default: () => [] },
26
+ activeKey: { type: String, default: '' }
27
+ })
28
+
29
+ const emit = defineEmits(['select'])
30
+ </script>
31
+
32
+ <style scoped lang="scss">
33
+ .oa-nav {
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 14px;
37
+ padding: 14px 10px 20px;
38
+ overflow-y: auto;
39
+
40
+ &__group {
41
+ display: flex;
42
+ flex-direction: column;
43
+ gap: 2px;
44
+ }
45
+
46
+ &__label {
47
+ margin: 0 0 4px;
48
+ padding: 0 10px;
49
+ color: #63768d;
50
+ font-size: 9.5px;
51
+ font-weight: 600;
52
+ letter-spacing: 0.1em;
53
+ text-transform: uppercase;
54
+ }
55
+
56
+ &__item {
57
+ position: relative;
58
+ display: flex;
59
+ align-items: center;
60
+ gap: 9px;
61
+ width: 100%;
62
+ min-height: 36px;
63
+ padding: 7px 10px;
64
+ border: none;
65
+ border-radius: 6px;
66
+ background: transparent;
67
+ color: var(--oa-sidebar-text);
68
+ font-size: 12px;
69
+ text-align: left;
70
+ cursor: pointer;
71
+ transition: background 0.15s ease, color 0.15s ease;
72
+
73
+ > .el-icon {
74
+ flex-shrink: 0;
75
+ color: #7f91a8;
76
+ font-size: 15px;
77
+ transition: color 0.15s ease;
78
+ }
79
+
80
+ span {
81
+ flex: 1;
82
+ min-width: 0;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ white-space: nowrap;
86
+ }
87
+
88
+ &:hover {
89
+ background: rgba(255, 255, 255, 0.055);
90
+ color: #fff;
91
+
92
+ > .el-icon {
93
+ color: #c3d3e7;
94
+ }
95
+ }
96
+
97
+ &.is-active {
98
+ background: rgba(80, 130, 235, 0.18);
99
+ color: #fff;
100
+ font-weight: 550;
101
+
102
+ > .el-icon {
103
+ color: #8fb3ff;
104
+ }
105
+
106
+ &::before {
107
+ content: '';
108
+ position: absolute;
109
+ top: 9px;
110
+ bottom: 9px;
111
+ left: 0;
112
+ width: 2px;
113
+ border-radius: 0 2px 2px 0;
114
+ background: #6f9bff;
115
+ }
116
+ }
117
+ }
118
+
119
+ &__badge {
120
+ display: inline-grid;
121
+ place-items: center;
122
+ min-width: 17px;
123
+ height: 17px;
124
+ padding: 0 5px;
125
+ border-radius: 9px;
126
+ background: rgba(255, 255, 255, 0.14);
127
+ color: #dce8fa;
128
+ font-size: 9px;
129
+ font-style: normal;
130
+ font-weight: 600;
131
+ }
132
+
133
+ &__item.is-active &__badge {
134
+ background: #3567dc;
135
+ color: #fff;
136
+ }
137
+ }
138
+ </style>