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.
- package/README.md +271 -271
- package/dist/gbflowengine.css +1 -1
- package/dist/gbflowengine.js +8232 -6913
- package/dist/gbflowengine.js.map +1 -1
- package/dist/gbflowengine.umd.cjs +2 -2
- package/dist/gbflowengine.umd.cjs.map +1 -1
- package/package.json +85 -84
- package/src/center/DefinitionInspect.vue +291 -291
- package/src/center/FlowCenter.vue +33 -33
- package/src/center/index.js +29 -29
- package/src/center/storage.js +748 -748
- package/src/core/flow/condition.js +160 -160
- package/src/core/flow/customNode.js +385 -385
- package/src/core/flow/defaults.js +124 -124
- package/src/core/flow/flowConstant.js +265 -265
- package/src/core/flow/flowNodeUtils.js +29 -29
- package/src/core/flow/index.js +47 -47
- package/src/core/flow/node.js +44 -44
- package/src/core/flow/nodeFactory.js +58 -58
- package/src/core/flow/prediction.js +325 -325
- package/src/core/flow/schema.js +864 -864
- package/src/definition/FlowDefinitionDesigner.vue +338 -338
- package/src/definition/index.js +9 -9
- package/src/index.js +39 -39
- package/src/storage.js +200 -200
- package/src/testing/FlowTestPanel.vue +2502 -2502
- package/src/testing/UserConfigDrawer.vue +376 -376
- package/src/testing/diagram/FlowProgressDiagram.vue +318 -318
- package/src/testing/diagramModel.js +517 -517
- package/src/testing/index.js +23 -23
- package/src/testing/mock.js +246 -246
- package/src/testing/oaExecutors.js +51 -51
- package/src/testing/oaSeed.js +467 -467
- package/src/testing/sample.js +412 -412
- package/src/testing/seed.js +122 -122
- package/src/utils/format.js +27 -27
- package/src/visual/FlowCanvas.vue +440 -440
- package/src/visual/NodeProgressDetail.vue +43 -43
- package/src/visual/NodeStatusBadge.vue +17 -17
- package/src/visual/NodeWrap.vue +46 -46
- package/src/visual/ScWorkflow.vue +49 -49
- package/src/visual/SelectDialog.vue +459 -459
- package/src/visual/conditionHelpers.js +116 -116
- package/src/visual/index.js +6 -6
- package/src/visual/nodes/AddNode.vue +222 -222
- package/src/visual/nodes/ApproverNode.vue +347 -347
- package/src/visual/nodes/BranchNode.vue +441 -441
- package/src/visual/nodes/CustomNode.vue +339 -339
- package/src/visual/nodes/EndNode.vue +21 -21
- package/src/visual/nodes/PassNode.vue +100 -100
- package/src/visual/nodes/PromoterNode.vue +134 -134
- package/src/visual/nodes/RejectNode.vue +100 -100
- package/src/visual/nodes/SendNode.vue +151 -151
- package/src/visual/styles.scss +879 -879
- package/src/visual/useScNodeStatus.js +18 -18
- package/src/workbench/OaWorkbench.vue +1341 -1341
- package/src/workbench/components/ApprovalWorkspace.vue +2090 -2090
- package/src/workbench/components/CategoryIcon.vue +74 -74
- package/src/workbench/components/NotificationIcon.vue +73 -73
- package/src/workbench/components/ProcessSteps.vue +557 -557
- package/src/workbench/components/ResubmitDialog.vue +227 -227
- package/src/workbench/components/SidebarNav.vue +138 -138
- package/src/workbench/components/StartFlowDialog.vue +1058 -1058
- package/src/workbench/components/UserAvatar.vue +68 -68
- package/src/workbench/model.js +1080 -1080
- package/src/workbench/pages/DesignPage.vue +798 -798
- package/src/workbench/pages/HomePage.vue +1050 -1050
- package/src/workbench/pages/MonitorPage.vue +1029 -1029
- package/src/workbench/pages/NotificationsPage.vue +554 -554
- package/src/workbench/pages/RequestsPage.vue +644 -644
- package/src/workbench/pages/TaskCenterPage.vue +1155 -1155
- package/src/workbench/pages/TemplatesPage.vue +680 -680
- package/src/workbench/styles.scss +555 -555
- package/types/center.d.ts +5 -5
- package/types/core.d.ts +479 -479
- package/types/definition.d.ts +4 -4
- package/types/index.d.ts +34 -34
- package/types/testing.d.ts +20 -20
- package/types/visual.d.ts +20 -20
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="end-node" :class="statusClass">
|
|
3
|
-
<div class="end-node-circle"></div>
|
|
4
|
-
<div class="end-node-text">{{ nodeConfig.nodeName || '流程结束' }}</div>
|
|
5
|
-
<NodeStatusBadge :status="statusInfo" />
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup>
|
|
10
|
-
import { computed } from 'vue'
|
|
11
|
-
import NodeStatusBadge from '../NodeStatusBadge.vue'
|
|
12
|
-
import { useScNodeStatus } from '../useScNodeStatus.js'
|
|
13
|
-
|
|
14
|
-
defineOptions({ name: 'ScEndNode' })
|
|
15
|
-
|
|
16
|
-
const props = defineProps({
|
|
17
|
-
modelValue: { type: Object, required: true }
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const nodeConfig = computed(() => props.modelValue)
|
|
21
|
-
const { statusInfo, statusClass } = useScNodeStatus(nodeConfig)
|
|
1
|
+
<template>
|
|
2
|
+
<div class="end-node" :class="statusClass">
|
|
3
|
+
<div class="end-node-circle"></div>
|
|
4
|
+
<div class="end-node-text">{{ nodeConfig.nodeName || '流程结束' }}</div>
|
|
5
|
+
<NodeStatusBadge :status="statusInfo" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import { computed } from 'vue'
|
|
11
|
+
import NodeStatusBadge from '../NodeStatusBadge.vue'
|
|
12
|
+
import { useScNodeStatus } from '../useScNodeStatus.js'
|
|
13
|
+
|
|
14
|
+
defineOptions({ name: 'ScEndNode' })
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
modelValue: { type: Object, required: true }
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const nodeConfig = computed(() => props.modelValue)
|
|
21
|
+
const { statusInfo, statusClass } = useScNodeStatus(nodeConfig)
|
|
22
22
|
</script>
|
|
@@ -1,101 +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: #1bc47d">
|
|
5
|
-
<el-icon class="icon"><Select /></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="success" :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, Select } from '
|
|
45
|
-
import AddNode from './AddNode.vue'
|
|
46
|
-
import NodeStatusBadge from '../NodeStatusBadge.vue'
|
|
47
|
-
import { useScNodeStatus } from '../useScNodeStatus.js'
|
|
48
|
-
|
|
49
|
-
defineOptions({ name: 'ScPassNode' })
|
|
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
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="node-wrap">
|
|
3
|
+
<div class="node-wrap-box" :class="statusClass" @click="show">
|
|
4
|
+
<div class="title" style="background: #1bc47d">
|
|
5
|
+
<el-icon class="icon"><Select /></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="success" :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, Select } from 'gbicons'
|
|
45
|
+
import AddNode from './AddNode.vue'
|
|
46
|
+
import NodeStatusBadge from '../NodeStatusBadge.vue'
|
|
47
|
+
import { useScNodeStatus } from '../useScNodeStatus.js'
|
|
48
|
+
|
|
49
|
+
defineOptions({ name: 'ScPassNode' })
|
|
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
101
|
</script>
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="node-wrap">
|
|
3
|
-
<div class="node-wrap-box start-node" :class="statusClass" @click="show">
|
|
4
|
-
<div class="title" style="background: #576a95">
|
|
5
|
-
<el-icon class="icon"><UserFilled /></el-icon>
|
|
6
|
-
<span>{{ nodeConfig.nodeName }}</span>
|
|
7
|
-
<NodeStatusBadge :status="statusInfo" />
|
|
8
|
-
</div>
|
|
9
|
-
<div class="content">
|
|
10
|
-
<span>{{ toText(nodeConfig) }}</span>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
<AddNode v-model="nodeConfig.childNode" :parent-node="nodeConfig" :readonly="isReadonly" @update:model-value="updateChild" />
|
|
14
|
-
<el-drawer title="发起人" v-model="drawer" destroy-on-close append-to-body :size="500">
|
|
15
|
-
<template #header>
|
|
16
|
-
<div class="node-wrap-drawer__title">
|
|
17
|
-
<label v-if="!isEditTitle" @click="editTitle">
|
|
18
|
-
{{ form.nodeName }}
|
|
19
|
-
<el-icon class="node-wrap-drawer__title-edit"><Edit /></el-icon>
|
|
20
|
-
</label>
|
|
21
|
-
<el-input v-if="isEditTitle" ref="nodeTitle" v-model="form.nodeName" clearable @blur="saveTitle" @keyup.enter="saveTitle" />
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
<el-container>
|
|
25
|
-
<el-main style="padding: 0 20px 20px 20px">
|
|
26
|
-
<el-form label-position="top">
|
|
27
|
-
<el-form-item label="谁可以发起此审批">
|
|
28
|
-
<el-button type="primary" :icon="Plus" round @click="selectHandle(2, roleProxy)">选择角色</el-button>
|
|
29
|
-
<div class="tags-list">
|
|
30
|
-
<el-tag v-for="(role, index) in form.roleList" :key="role.id" type="info" closable @close="delRole(index)">
|
|
31
|
-
{{ role.name }}
|
|
32
|
-
</el-tag>
|
|
33
|
-
</div>
|
|
34
|
-
</el-form-item>
|
|
35
|
-
<el-alert v-if="!form.roleList || form.roleList.length == 0" title="不指定则默认所有人都可发起此审批" type="info" :closable="false" />
|
|
36
|
-
</el-form>
|
|
37
|
-
</el-main>
|
|
38
|
-
<el-footer>
|
|
39
|
-
<el-button type="primary" @click="save">保存</el-button>
|
|
40
|
-
<el-button @click="drawer = false">取消</el-button>
|
|
41
|
-
</el-footer>
|
|
42
|
-
</el-container>
|
|
43
|
-
</el-drawer>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script setup>
|
|
48
|
-
import { computed, inject, ref } from 'vue'
|
|
49
|
-
import { Edit, Plus, UserFilled } from '
|
|
50
|
-
import AddNode from './AddNode.vue'
|
|
51
|
-
import NodeStatusBadge from '../NodeStatusBadge.vue'
|
|
52
|
-
import { useScNodeStatus } from '../useScNodeStatus.js'
|
|
53
|
-
|
|
54
|
-
defineOptions({ name: 'ScPromoterNode' })
|
|
55
|
-
|
|
56
|
-
const props = defineProps({
|
|
57
|
-
modelValue: { type: Object, required: true }
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const emit = defineEmits(['update:modelValue'])
|
|
61
|
-
|
|
62
|
-
const select = inject('select', null)
|
|
63
|
-
const readonly = inject('scReadonly', ref(false))
|
|
64
|
-
|
|
65
|
-
const isReadonly = computed(() => readonly.value === true)
|
|
66
|
-
const nodeConfig = computed(() => props.modelValue)
|
|
67
|
-
const { statusInfo, statusClass } = useScNodeStatus(nodeConfig)
|
|
68
|
-
|
|
69
|
-
const drawer = ref(false)
|
|
70
|
-
const isEditTitle = ref(false)
|
|
71
|
-
const nodeTitle = ref(null)
|
|
72
|
-
const form = ref({})
|
|
73
|
-
|
|
74
|
-
const roleProxy = computed({
|
|
75
|
-
get: () => (form.value.roleList || []).map((role) => ({ id: role.id, name: role.roleName || role.name })),
|
|
76
|
-
set: () => {}
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
const updateChild = (child) => {
|
|
80
|
-
const next = JSON.parse(JSON.stringify(nodeConfig.value))
|
|
81
|
-
next.childNode = child
|
|
82
|
-
emit('update:modelValue', next)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const show = () => {
|
|
86
|
-
if (isReadonly.value) return
|
|
87
|
-
const source = nodeConfig.value
|
|
88
|
-
form.value = {
|
|
89
|
-
...JSON.parse(JSON.stringify(source)),
|
|
90
|
-
roleList: (source.roleList || []).map((id) => ({
|
|
91
|
-
id,
|
|
92
|
-
name: source.roleNameMap?.[id] || `角色${id}`
|
|
93
|
-
}))
|
|
94
|
-
}
|
|
95
|
-
isEditTitle.value = false
|
|
96
|
-
drawer.value = true
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const editTitle = () => {
|
|
100
|
-
isEditTitle.value = true
|
|
101
|
-
requestAnimationFrame(() => nodeTitle.value?.focus())
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const saveTitle = () => {
|
|
105
|
-
isEditTitle.value = false
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const selectHandle = (type, data) => {
|
|
109
|
-
select?.(type, data)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const delRole = (index) => {
|
|
113
|
-
form.value.roleList.splice(index, 1)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const save = () => {
|
|
117
|
-
const source = JSON.parse(JSON.stringify(nodeConfig.value))
|
|
118
|
-
const list = form.value.roleList || []
|
|
119
|
-
source.nodeName = form.value.nodeName
|
|
120
|
-
source.roleList = list.map((role) => role.id)
|
|
121
|
-
source.roleNameMap = list.reduce((result, role) => {
|
|
122
|
-
result[role.id] = role.name
|
|
123
|
-
return result
|
|
124
|
-
}, {})
|
|
125
|
-
emit('update:modelValue', source)
|
|
126
|
-
drawer.value = false
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const toText = (node) => {
|
|
130
|
-
if (node.roleList && node.roleList.length > 0) {
|
|
131
|
-
return node.roleList.map((id) => node.roleNameMap?.[id] || `角色${id}`).join('、')
|
|
132
|
-
}
|
|
133
|
-
return '所有人'
|
|
134
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="node-wrap">
|
|
3
|
+
<div class="node-wrap-box start-node" :class="statusClass" @click="show">
|
|
4
|
+
<div class="title" style="background: #576a95">
|
|
5
|
+
<el-icon class="icon"><UserFilled /></el-icon>
|
|
6
|
+
<span>{{ nodeConfig.nodeName }}</span>
|
|
7
|
+
<NodeStatusBadge :status="statusInfo" />
|
|
8
|
+
</div>
|
|
9
|
+
<div class="content">
|
|
10
|
+
<span>{{ toText(nodeConfig) }}</span>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
<AddNode v-model="nodeConfig.childNode" :parent-node="nodeConfig" :readonly="isReadonly" @update:model-value="updateChild" />
|
|
14
|
+
<el-drawer title="发起人" v-model="drawer" destroy-on-close append-to-body :size="500">
|
|
15
|
+
<template #header>
|
|
16
|
+
<div class="node-wrap-drawer__title">
|
|
17
|
+
<label v-if="!isEditTitle" @click="editTitle">
|
|
18
|
+
{{ form.nodeName }}
|
|
19
|
+
<el-icon class="node-wrap-drawer__title-edit"><Edit /></el-icon>
|
|
20
|
+
</label>
|
|
21
|
+
<el-input v-if="isEditTitle" ref="nodeTitle" v-model="form.nodeName" clearable @blur="saveTitle" @keyup.enter="saveTitle" />
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<el-container>
|
|
25
|
+
<el-main style="padding: 0 20px 20px 20px">
|
|
26
|
+
<el-form label-position="top">
|
|
27
|
+
<el-form-item label="谁可以发起此审批">
|
|
28
|
+
<el-button type="primary" :icon="Plus" round @click="selectHandle(2, roleProxy)">选择角色</el-button>
|
|
29
|
+
<div class="tags-list">
|
|
30
|
+
<el-tag v-for="(role, index) in form.roleList" :key="role.id" type="info" closable @close="delRole(index)">
|
|
31
|
+
{{ role.name }}
|
|
32
|
+
</el-tag>
|
|
33
|
+
</div>
|
|
34
|
+
</el-form-item>
|
|
35
|
+
<el-alert v-if="!form.roleList || form.roleList.length == 0" title="不指定则默认所有人都可发起此审批" type="info" :closable="false" />
|
|
36
|
+
</el-form>
|
|
37
|
+
</el-main>
|
|
38
|
+
<el-footer>
|
|
39
|
+
<el-button type="primary" @click="save">保存</el-button>
|
|
40
|
+
<el-button @click="drawer = false">取消</el-button>
|
|
41
|
+
</el-footer>
|
|
42
|
+
</el-container>
|
|
43
|
+
</el-drawer>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import { computed, inject, ref } from 'vue'
|
|
49
|
+
import { Edit, Plus, UserFilled } from 'gbicons'
|
|
50
|
+
import AddNode from './AddNode.vue'
|
|
51
|
+
import NodeStatusBadge from '../NodeStatusBadge.vue'
|
|
52
|
+
import { useScNodeStatus } from '../useScNodeStatus.js'
|
|
53
|
+
|
|
54
|
+
defineOptions({ name: 'ScPromoterNode' })
|
|
55
|
+
|
|
56
|
+
const props = defineProps({
|
|
57
|
+
modelValue: { type: Object, required: true }
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const emit = defineEmits(['update:modelValue'])
|
|
61
|
+
|
|
62
|
+
const select = inject('select', null)
|
|
63
|
+
const readonly = inject('scReadonly', ref(false))
|
|
64
|
+
|
|
65
|
+
const isReadonly = computed(() => readonly.value === true)
|
|
66
|
+
const nodeConfig = computed(() => props.modelValue)
|
|
67
|
+
const { statusInfo, statusClass } = useScNodeStatus(nodeConfig)
|
|
68
|
+
|
|
69
|
+
const drawer = ref(false)
|
|
70
|
+
const isEditTitle = ref(false)
|
|
71
|
+
const nodeTitle = ref(null)
|
|
72
|
+
const form = ref({})
|
|
73
|
+
|
|
74
|
+
const roleProxy = computed({
|
|
75
|
+
get: () => (form.value.roleList || []).map((role) => ({ id: role.id, name: role.roleName || role.name })),
|
|
76
|
+
set: () => {}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const updateChild = (child) => {
|
|
80
|
+
const next = JSON.parse(JSON.stringify(nodeConfig.value))
|
|
81
|
+
next.childNode = child
|
|
82
|
+
emit('update:modelValue', next)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const show = () => {
|
|
86
|
+
if (isReadonly.value) return
|
|
87
|
+
const source = nodeConfig.value
|
|
88
|
+
form.value = {
|
|
89
|
+
...JSON.parse(JSON.stringify(source)),
|
|
90
|
+
roleList: (source.roleList || []).map((id) => ({
|
|
91
|
+
id,
|
|
92
|
+
name: source.roleNameMap?.[id] || `角色${id}`
|
|
93
|
+
}))
|
|
94
|
+
}
|
|
95
|
+
isEditTitle.value = false
|
|
96
|
+
drawer.value = true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const editTitle = () => {
|
|
100
|
+
isEditTitle.value = true
|
|
101
|
+
requestAnimationFrame(() => nodeTitle.value?.focus())
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const saveTitle = () => {
|
|
105
|
+
isEditTitle.value = false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const selectHandle = (type, data) => {
|
|
109
|
+
select?.(type, data)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const delRole = (index) => {
|
|
113
|
+
form.value.roleList.splice(index, 1)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const save = () => {
|
|
117
|
+
const source = JSON.parse(JSON.stringify(nodeConfig.value))
|
|
118
|
+
const list = form.value.roleList || []
|
|
119
|
+
source.nodeName = form.value.nodeName
|
|
120
|
+
source.roleList = list.map((role) => role.id)
|
|
121
|
+
source.roleNameMap = list.reduce((result, role) => {
|
|
122
|
+
result[role.id] = role.name
|
|
123
|
+
return result
|
|
124
|
+
}, {})
|
|
125
|
+
emit('update:modelValue', source)
|
|
126
|
+
drawer.value = false
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const toText = (node) => {
|
|
130
|
+
if (node.roleList && node.roleList.length > 0) {
|
|
131
|
+
return node.roleList.map((id) => node.roleNameMap?.[id] || `角色${id}`).join('、')
|
|
132
|
+
}
|
|
133
|
+
return '所有人'
|
|
134
|
+
}
|
|
135
135
|
</script>
|