gbflowengine 0.0.0-stage → 0.1.0

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 +271 -3
  3. package/dist/gbflowengine.css +1 -0
  4. package/dist/gbflowengine.js +18363 -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 +84 -6
  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,101 @@
1
+ <template>
2
+ <div class="node-wrap">
3
+ <div class="node-wrap-box" :class="statusClass" @click="show">
4
+ <div class="title" style="background: #f54a4a">
5
+ <el-icon class="icon"><Close /></el-icon>
6
+ <span>{{ nodeConfig.nodeName }}</span>
7
+ <NodeStatusBadge :status="statusInfo" />
8
+ <el-icon class="close" @click.stop="delNode()"><Close /></el-icon>
9
+ </div>
10
+ <div class="content">
11
+ <span>到达此节点后流程直接拒绝</span>
12
+ </div>
13
+ </div>
14
+ <AddNode v-model="nodeConfig.childNode" :parent-node="nodeConfig" :readonly="isReadonly" @update:model-value="updateChild" />
15
+ <el-drawer title="直接拒绝" v-model="drawer" destroy-on-close append-to-body :size="500">
16
+ <template #header>
17
+ <div class="node-wrap-drawer__title">
18
+ <label v-if="!isEditTitle" @click="editTitle">
19
+ {{ form.nodeName }}
20
+ <el-icon class="node-wrap-drawer__title-edit"><Edit /></el-icon>
21
+ </label>
22
+ <el-input v-if="isEditTitle" ref="nodeTitle" v-model="form.nodeName" clearable @blur="saveTitle" @keyup.enter="saveTitle" />
23
+ </div>
24
+ </template>
25
+ <el-container>
26
+ <el-main style="padding: 0 20px 20px 20px">
27
+ <el-form label-position="top">
28
+ <el-form-item label="节点说明">
29
+ <el-alert title="流程执行到此节点时直接结束并标记为拒绝,常用于条件分支中的驳回通道。" type="error" :closable="false" />
30
+ </el-form-item>
31
+ </el-form>
32
+ </el-main>
33
+ <el-footer>
34
+ <el-button type="primary" @click="save">保存</el-button>
35
+ <el-button @click="drawer = false">取消</el-button>
36
+ </el-footer>
37
+ </el-container>
38
+ </el-drawer>
39
+ </div>
40
+ </template>
41
+
42
+ <script setup>
43
+ import { computed, inject, ref } from 'vue'
44
+ import { Close, Edit } from '@element-plus/icons-vue'
45
+ import AddNode from './AddNode.vue'
46
+ import NodeStatusBadge from '../NodeStatusBadge.vue'
47
+ import { useScNodeStatus } from '../useScNodeStatus.js'
48
+
49
+ defineOptions({ name: 'ScRejectNode' })
50
+
51
+ const props = defineProps({
52
+ modelValue: { type: Object, required: true },
53
+ parentNode: { type: Object, default: null }
54
+ })
55
+
56
+ const emit = defineEmits(['update:modelValue'])
57
+
58
+ const readonly = inject('scReadonly', ref(false))
59
+ const isReadonly = computed(() => readonly.value === true)
60
+ const nodeConfig = computed(() => props.modelValue)
61
+ const { statusInfo, statusClass } = useScNodeStatus(nodeConfig)
62
+
63
+ const drawer = ref(false)
64
+ const isEditTitle = ref(false)
65
+ const nodeTitle = ref(null)
66
+ const form = ref({})
67
+
68
+ const updateChild = (child) => {
69
+ const next = JSON.parse(JSON.stringify(nodeConfig.value))
70
+ next.childNode = child
71
+ emit('update:modelValue', next)
72
+ }
73
+
74
+ const show = () => {
75
+ if (isReadonly.value) return
76
+ form.value = JSON.parse(JSON.stringify(nodeConfig.value))
77
+ isEditTitle.value = false
78
+ drawer.value = true
79
+ }
80
+
81
+ const editTitle = () => {
82
+ isEditTitle.value = true
83
+ requestAnimationFrame(() => nodeTitle.value?.focus())
84
+ }
85
+
86
+ const saveTitle = () => {
87
+ isEditTitle.value = false
88
+ }
89
+
90
+ const save = () => {
91
+ const source = JSON.parse(JSON.stringify(nodeConfig.value))
92
+ source.nodeName = form.value.nodeName
93
+ emit('update:modelValue', source)
94
+ drawer.value = false
95
+ }
96
+
97
+ const delNode = () => {
98
+ if (isReadonly.value) return
99
+ emit('update:modelValue', nodeConfig.value.childNode)
100
+ }
101
+ </script>
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <div class="node-wrap">
3
+ <div class="node-wrap-box" :class="statusClass" @click="show">
4
+ <div class="title" style="background: #3296fa">
5
+ <el-icon class="icon"><Promotion /></el-icon>
6
+ <span>{{ nodeConfig.nodeName }}</span>
7
+ <NodeStatusBadge :status="statusInfo" />
8
+ <el-icon class="close" @click.stop="delNode()"><Close /></el-icon>
9
+ </div>
10
+ <div v-if="!statusInfo" class="content">
11
+ <span v-if="toText(nodeConfig)">{{ toText(nodeConfig) }}</span>
12
+ <span v-else class="placeholder">请选择人员</span>
13
+ </div>
14
+ <NodeProgressDetail v-else :status="statusInfo" />
15
+ </div>
16
+ <AddNode v-model="nodeConfig.childNode" :parent-node="nodeConfig" :readonly="isReadonly" @update:model-value="updateChild" />
17
+ <el-drawer title="抄送人设置" v-model="drawer" destroy-on-close append-to-body :size="500">
18
+ <template #header>
19
+ <div class="node-wrap-drawer__title">
20
+ <label v-if="!isEditTitle" @click="editTitle">
21
+ {{ form.nodeName }}
22
+ <el-icon class="node-wrap-drawer__title-edit"><Edit /></el-icon>
23
+ </label>
24
+ <el-input v-if="isEditTitle" ref="nodeTitle" v-model="form.nodeName" clearable @blur="saveTitle" @keyup.enter="saveTitle" />
25
+ </div>
26
+ </template>
27
+ <el-container>
28
+ <el-main style="padding: 0 20px 20px 20px">
29
+ <el-form label-position="top">
30
+ <el-form-item label="选择要抄送的人员">
31
+ <el-button type="primary" :icon="Plus" round @click="selectHandle(1, userProxy)">选择人员</el-button>
32
+ <div class="tags-list">
33
+ <el-tag v-for="(user, index) in form.nodeAssigneeList" :key="user.id" closable @close="delUser(index)">
34
+ {{ user.name }}
35
+ </el-tag>
36
+ </div>
37
+ </el-form-item>
38
+ <el-form-item label="">
39
+ <el-checkbox v-model="form.allowInitiatorAddUsers" label="允许发起人自选抄送人" />
40
+ </el-form-item>
41
+ </el-form>
42
+ </el-main>
43
+ <el-footer>
44
+ <el-button type="primary" @click="save">保存</el-button>
45
+ <el-button @click="drawer = false">取消</el-button>
46
+ </el-footer>
47
+ </el-container>
48
+ </el-drawer>
49
+ </div>
50
+ </template>
51
+
52
+ <script setup>
53
+ import { computed, inject, ref } from 'vue'
54
+ import { Close, Edit, Plus, Promotion } from '@element-plus/icons-vue'
55
+ import AddNode from './AddNode.vue'
56
+ import NodeStatusBadge from '../NodeStatusBadge.vue'
57
+ import NodeProgressDetail from '../NodeProgressDetail.vue'
58
+ import { useScNodeStatus } from '../useScNodeStatus.js'
59
+
60
+ defineOptions({ name: 'ScSendNode' })
61
+
62
+ const props = defineProps({
63
+ modelValue: { type: Object, required: true }
64
+ })
65
+
66
+ const emit = defineEmits(['update:modelValue'])
67
+
68
+ const select = inject('select', null)
69
+ const readonly = inject('scReadonly', ref(false))
70
+
71
+ const isReadonly = computed(() => readonly.value === true)
72
+ const nodeConfig = computed(() => props.modelValue)
73
+ const { statusInfo, statusClass } = useScNodeStatus(nodeConfig)
74
+
75
+ const drawer = ref(false)
76
+ const isEditTitle = ref(false)
77
+ const nodeTitle = ref(null)
78
+ const form = ref({})
79
+
80
+ const userProxy = computed({
81
+ get: () => form.value.nodeAssigneeList || [],
82
+ set: () => {}
83
+ })
84
+
85
+ const updateChild = (child) => {
86
+ const next = JSON.parse(JSON.stringify(nodeConfig.value))
87
+ next.childNode = child
88
+ emit('update:modelValue', next)
89
+ }
90
+
91
+ const show = () => {
92
+ if (isReadonly.value) return
93
+ const source = nodeConfig.value
94
+ form.value = {
95
+ ...JSON.parse(JSON.stringify(source)),
96
+ nodeAssigneeList: (source.userList || []).map((id) => ({
97
+ id,
98
+ name: source.userNickNames?.[id] || `用户${id}`,
99
+ deptName: source.deptNameMap?.[id] || ''
100
+ }))
101
+ }
102
+ isEditTitle.value = false
103
+ drawer.value = true
104
+ }
105
+
106
+ const editTitle = () => {
107
+ isEditTitle.value = true
108
+ requestAnimationFrame(() => nodeTitle.value?.focus())
109
+ }
110
+
111
+ const saveTitle = () => {
112
+ isEditTitle.value = false
113
+ }
114
+
115
+ const selectHandle = (type, data) => {
116
+ select?.(type, data)
117
+ }
118
+
119
+ const delUser = (index) => {
120
+ form.value.nodeAssigneeList.splice(index, 1)
121
+ }
122
+
123
+ const save = () => {
124
+ const source = JSON.parse(JSON.stringify(nodeConfig.value))
125
+ const list = form.value.nodeAssigneeList || []
126
+ source.nodeName = form.value.nodeName
127
+ source.allowInitiatorAddUsers = form.value.allowInitiatorAddUsers
128
+ source.userList = list.map((user) => user.id)
129
+ source.userNickNames = list.reduce((result, user) => {
130
+ result[user.id] = user.name
131
+ return result
132
+ }, {})
133
+ source.deptNameMap = list.reduce((result, user) => {
134
+ if (user.deptName) result[user.id] = user.deptName
135
+ return result
136
+ }, {})
137
+ emit('update:modelValue', source)
138
+ drawer.value = false
139
+ }
140
+
141
+ const delNode = () => {
142
+ if (isReadonly.value) return
143
+ emit('update:modelValue', nodeConfig.value.childNode)
144
+ }
145
+
146
+ const toText = (node) => {
147
+ if (node.userList && node.userList.length > 0) {
148
+ return node.userList.map((id) => node.userNickNames?.[id] || `用户${id}`).join('、')
149
+ }
150
+ return node.allowInitiatorAddUsers ? '发起人自选' : false
151
+ }
152
+ </script>