|
@@ -69,15 +69,20 @@
|
|
|
:key="opt.value"
|
|
:key="opt.value"
|
|
|
type="button"
|
|
type="button"
|
|
|
class="assignee-seg__item"
|
|
class="assignee-seg__item"
|
|
|
- :class="{ 'is-on': cfg.assigneeType === opt.value }"
|
|
|
|
|
- @click="setAssigneeType(opt.value)"
|
|
|
|
|
|
|
+ :class="{
|
|
|
|
|
+ 'is-on':
|
|
|
|
|
+ editing.type === 'cc'
|
|
|
|
|
+ ? (cfg.assigneeTypes || []).includes(opt.value)
|
|
|
|
|
+ : cfg.assigneeType === opt.value
|
|
|
|
|
+ }"
|
|
|
|
|
+ @click="onAssigneeOptionClick(opt.value)"
|
|
|
>
|
|
>
|
|
|
{{ opt.label }}
|
|
{{ opt.label }}
|
|
|
</button>
|
|
</button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
- <el-form-item v-if="cfg.assigneeType === 'users'">
|
|
|
|
|
|
|
+ <el-form-item v-if="showUsersPicker">
|
|
|
<template #label>
|
|
<template #label>
|
|
|
指定成员
|
|
指定成员
|
|
|
<span class="form-label-tip">可多选,已选将作为本节点{{ editing.type === 'cc' ? '抄送' : '审批' }}人</span>
|
|
<span class="form-label-tip">可多选,已选将作为本节点{{ editing.type === 'cc' ? '抄送' : '审批' }}人</span>
|
|
@@ -151,7 +156,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
- <el-form-item v-if="cfg.assigneeType === 'oa_roles'" label="工作流角色">
|
|
|
|
|
|
|
+ <el-form-item v-if="showRolesPicker" label="工作流角色">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="cfg.oaRoleIds"
|
|
v-model="cfg.oaRoleIds"
|
|
|
multiple
|
|
multiple
|
|
@@ -260,6 +265,7 @@
|
|
|
createNode,
|
|
createNode,
|
|
|
ensureFlowRoot,
|
|
ensureFlowRoot,
|
|
|
findParent,
|
|
findParent,
|
|
|
|
|
+ normalizeCcAssigneeTypes,
|
|
|
type ApproverConfig,
|
|
type ApproverConfig,
|
|
|
type AssigneeType,
|
|
type AssigneeType,
|
|
|
type ConditionRule,
|
|
type ConditionRule,
|
|
@@ -312,6 +318,7 @@
|
|
|
const editing = ref<FlowNode | null>(null)
|
|
const editing = ref<FlowNode | null>(null)
|
|
|
const cfg = reactive<ApproverConfig>({
|
|
const cfg = reactive<ApproverConfig>({
|
|
|
assigneeType: 'dept_leader',
|
|
assigneeType: 'dept_leader',
|
|
|
|
|
+ assigneeTypes: [],
|
|
|
userIds: [],
|
|
userIds: [],
|
|
|
oaRoleIds: [],
|
|
oaRoleIds: [],
|
|
|
signMode: 'or'
|
|
signMode: 'or'
|
|
@@ -325,6 +332,15 @@
|
|
|
{ label: '发起人自选', value: 'initiator_select' }
|
|
{ label: '发起人自选', value: 'initiator_select' }
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+ const showUsersPicker = computed(() => {
|
|
|
|
|
+ if (editing.value?.type === 'cc') return (cfg.assigneeTypes || []).includes('users')
|
|
|
|
|
+ return cfg.assigneeType === 'users'
|
|
|
|
|
+ })
|
|
|
|
|
+ const showRolesPicker = computed(() => {
|
|
|
|
|
+ if (editing.value?.type === 'cc') return (cfg.assigneeTypes || []).includes('oa_roles')
|
|
|
|
|
+ return cfg.assigneeType === 'oa_roles'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
const drawerTitle = computed(() => {
|
|
const drawerTitle = computed(() => {
|
|
|
const t = editing.value?.type
|
|
const t = editing.value?.type
|
|
|
if (t === 'start') return '发起人'
|
|
if (t === 'start') return '发起人'
|
|
@@ -337,7 +353,7 @@
|
|
|
const drawerSubtitle = computed(() => {
|
|
const drawerSubtitle = computed(() => {
|
|
|
const t = editing.value?.type
|
|
const t = editing.value?.type
|
|
|
if (t === 'approval') return '配置本节点审批人与多人会签规则'
|
|
if (t === 'approval') return '配置本节点审批人与多人会签规则'
|
|
|
- if (t === 'cc') return '配置本节点抄送人'
|
|
|
|
|
|
|
+ if (t === 'cc') return '可同时选择多种方式,抄送时合并去重'
|
|
|
if (t === 'condition') return '配置条件分支名称与可视化规则'
|
|
if (t === 'condition') return '配置条件分支名称与可视化规则'
|
|
|
if (t === 'start') return '流程起点节点'
|
|
if (t === 'start') return '流程起点节点'
|
|
|
return '配置流程节点'
|
|
return '配置流程节点'
|
|
@@ -410,6 +426,21 @@
|
|
|
await onAssigneeTypeChange()
|
|
await onAssigneeTypeChange()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ async function onAssigneeOptionClick(type: AssigneeType) {
|
|
|
|
|
+ if (editing.value?.type === 'cc') {
|
|
|
|
|
+ const cur = [...(cfg.assigneeTypes || [])]
|
|
|
|
|
+ const i = cur.indexOf(type)
|
|
|
|
|
+ if (i >= 0) cur.splice(i, 1)
|
|
|
|
|
+ else cur.push(type)
|
|
|
|
|
+ cfg.assigneeTypes = cur
|
|
|
|
|
+ if (cur[0]) cfg.assigneeType = cur[0]
|
|
|
|
|
+ if (cur.includes('users')) await loadUsers()
|
|
|
|
|
+ if (cur.includes('oa_roles')) await loadRoles()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ await setAssigneeType(type)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
async function loadRoles() {
|
|
async function loadRoles() {
|
|
|
roleLoading.value = true
|
|
roleLoading.value = true
|
|
|
try {
|
|
try {
|
|
@@ -537,13 +568,20 @@
|
|
|
}))
|
|
}))
|
|
|
}
|
|
}
|
|
|
const ac = editing.value.approverConfig || { assigneeType: 'dept_leader' as const }
|
|
const ac = editing.value.approverConfig || { assigneeType: 'dept_leader' as const }
|
|
|
- cfg.assigneeType = ac.assigneeType || 'dept_leader'
|
|
|
|
|
|
|
+ if (editing.value.type === 'cc') {
|
|
|
|
|
+ const types = normalizeCcAssigneeTypes(ac)
|
|
|
|
|
+ cfg.assigneeTypes = types.length ? types : ['initiator_select']
|
|
|
|
|
+ cfg.assigneeType = cfg.assigneeTypes[0]
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cfg.assigneeTypes = []
|
|
|
|
|
+ cfg.assigneeType = ac.assigneeType || 'dept_leader'
|
|
|
|
|
+ }
|
|
|
cfg.userIds = [...(ac.userIds || [])]
|
|
cfg.userIds = [...(ac.userIds || [])]
|
|
|
cfg.oaRoleIds = [...(ac.oaRoleIds || [])]
|
|
cfg.oaRoleIds = [...(ac.oaRoleIds || [])]
|
|
|
cfg.signMode = ac.signMode || 'or'
|
|
cfg.signMode = ac.signMode || 'or'
|
|
|
memberPickBuffer.value = ''
|
|
memberPickBuffer.value = ''
|
|
|
- if (cfg.assigneeType === 'users') await loadUsers()
|
|
|
|
|
- if (cfg.assigneeType === 'oa_roles') await loadRoles()
|
|
|
|
|
|
|
+ if (showUsersPicker.value) await loadUsers()
|
|
|
|
|
+ if (showRolesPicker.value) await loadRoles()
|
|
|
drawerVisible.value = true
|
|
drawerVisible.value = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -594,12 +632,32 @@
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
live.name = editing.value.name
|
|
live.name = editing.value.name
|
|
|
- if (live.type === 'approval' || live.type === 'cc') {
|
|
|
|
|
|
|
+ if (live.type === 'cc') {
|
|
|
|
|
+ const types = [...new Set(cfg.assigneeTypes || [])].filter(Boolean) as AssigneeType[]
|
|
|
|
|
+ if (!types.length) {
|
|
|
|
|
+ ElMessage.warning('请至少选择一种选人方式')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (types.includes('users') && !(cfg.userIds || []).length) {
|
|
|
|
|
+ ElMessage.warning('已勾选指定成员,请选择至少一名成员')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (types.includes('oa_roles') && !(cfg.oaRoleIds || []).length) {
|
|
|
|
|
+ ElMessage.warning('已勾选工作流角色,请选择至少一个角色')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ live.approverConfig = {
|
|
|
|
|
+ assigneeTypes: types,
|
|
|
|
|
+ assigneeType: types[0],
|
|
|
|
|
+ userIds: [...(cfg.userIds || [])],
|
|
|
|
|
+ oaRoleIds: [...(cfg.oaRoleIds || [])]
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (live.type === 'approval') {
|
|
|
live.approverConfig = {
|
|
live.approverConfig = {
|
|
|
assigneeType: cfg.assigneeType,
|
|
assigneeType: cfg.assigneeType,
|
|
|
userIds: cfg.assigneeType === 'users' ? [...(cfg.userIds || [])] : undefined,
|
|
userIds: cfg.assigneeType === 'users' ? [...(cfg.userIds || [])] : undefined,
|
|
|
oaRoleIds: cfg.assigneeType === 'oa_roles' ? [...(cfg.oaRoleIds || [])] : undefined,
|
|
oaRoleIds: cfg.assigneeType === 'oa_roles' ? [...(cfg.oaRoleIds || [])] : undefined,
|
|
|
- signMode: live.type === 'approval' ? cfg.signMode || 'or' : undefined
|
|
|
|
|
|
|
+ signMode: cfg.signMode || 'or'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (live.type === 'condition' && editing.value.conditionGroups) {
|
|
if (live.type === 'condition' && editing.value.conditionGroups) {
|