|
@@ -21,27 +21,27 @@
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<div style="padding-bottom: 6px">{{ v.name }}</div>
|
|
|
- <div v-if="v.type !== 0">
|
|
|
- <div v-if="userMap.get(v.name).type === 1" style="display: flex; align-items: center; gap: 6px">
|
|
|
- <el-tooltip content="添加用户" placement="left">
|
|
|
+ <div v-if="assigneeMap[v.name]" style="display: flex; align-items: center; gap: 6px">
|
|
|
+ <template v-if="assigneeMap[v.name].type === 1">
|
|
|
+ <el-tooltip v-if="!assigneeMap[v.name].disabled" content="添加用户" placement="left">
|
|
|
<el-button style="width: 32px" @click="selectHandler(v.name, 1)">
|
|
|
<svg-icon style="font-size: 18px" icon-class="flow-user-add" />
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
|
- <FlowNodeAvatar v-for="(item, index) in userMap.get(v.name).assignees" :key="index" :name="item.name" style="margin-top: 5px" />
|
|
|
- </div>
|
|
|
- <div v-else style="display: flex; align-items: center; gap: 6px">
|
|
|
- <el-tooltip content="添加角色" placement="left">
|
|
|
+ <FlowNodeAvatar v-for="(item, index) in assigneeMap[v.name].assignees" :key="index" :name="item.name" style="margin-top: 5px" />
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-tooltip v-if="!assigneeMap[v.name].disabled" content="添加角色" placement="left">
|
|
|
<el-button style="width: 32px" @click="selectHandler(v.name, 2)">
|
|
|
<svg-icon style="font-size: 18px" icon-class="flow-group-add" />
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
|
- <FlowNodeAvatar v-for="(item, index) in userMap.get(v.name).assignees" :key="index" :name="item.name" style="margin-top: 5px">
|
|
|
+ <FlowNodeAvatar v-for="(item, index) in assigneeMap[v.name].assignees" :key="index" :name="item.name" style="margin-top: 5px">
|
|
|
<template #avatar>
|
|
|
<svg-icon icon-class="flow-group" color="#fff" />
|
|
|
</template>
|
|
|
</FlowNodeAvatar>
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-timeline-item>
|
|
@@ -57,7 +57,8 @@
|
|
|
<el-button :disabled="validateForm.loading" type="primary" style="margin-left: 8px" @click="onSubmit">{{ $t('le.btn.confirm') }}</el-button>
|
|
|
</template>
|
|
|
</el-drawer>
|
|
|
- <use-select ref="useSelectRef"></use-select>
|
|
|
+ <!-- 选择人员/角色-->
|
|
|
+ <use-select ref="useSelectRef" v-bind="active_selectOpts" @update:selected="updateActive_assigneeMap"></use-select>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
import model from '@/api/flow/process'
|
|
@@ -77,13 +78,46 @@ const emit = defineEmits<{
|
|
|
update: [value: string]
|
|
|
}>()
|
|
|
const updateModelValue = (bool: boolean) => emit('update:modelValue', bool)
|
|
|
-const userMap = ref(new Map())
|
|
|
+type Assignee = {
|
|
|
+ type: 1 | 2 // 1: 用户 2: 角色
|
|
|
+ assignees: { [key: string]: any /*name, id*/ }
|
|
|
+ disabled?: boolean
|
|
|
+ selectOpts?: any
|
|
|
+ // minSelected?: number
|
|
|
+ // maxSelected?: number
|
|
|
+}
|
|
|
const useSelectRef = ref()
|
|
|
+const assigneeMap = ref<{
|
|
|
+ [key: string]: Assignee
|
|
|
+}>({})
|
|
|
+const active_assigneeKey = ref<string>()
|
|
|
+const active_selectOpts = ref({})
|
|
|
+// const userMap = ref(new Map())
|
|
|
+// const active_assigneeMap = ref<Assignee>({})
|
|
|
+window.assigneeMap = assigneeMap
|
|
|
+const updateActive_assigneeMap = (assignees: any[]) => {
|
|
|
+ // active_assigneeMap todo... { assignees: [], type }
|
|
|
+ const _cur = assigneeMap.value[active_assigneeKey.value]
|
|
|
+ if (_cur) {
|
|
|
+ _cur.assignees = assignees
|
|
|
+ }
|
|
|
+ // assigneeMap.value[active_assigneeKey.value].assignees = assignees
|
|
|
+ // Object.assign()
|
|
|
+}
|
|
|
const selectHandler = (name: string, type: number) => {
|
|
|
- if (!userMap.value.get(name)) {
|
|
|
+ /*if (!userMap.value.get(name)) {
|
|
|
userMap.value.set(name, { assignees: [], type })
|
|
|
}
|
|
|
useSelectRef.value.open(type, userMap.value.get(name).assignees)
|
|
|
+ */
|
|
|
+ if (!assigneeMap.value[name]) {
|
|
|
+ assigneeMap.value[name] = { assignees: [], type }
|
|
|
+ }
|
|
|
+ // active_assigneeMap.value = assigneeMap.value[name]
|
|
|
+ const config = assigneeMap.value[name]
|
|
|
+ active_assigneeKey.value = name
|
|
|
+ active_selectOpts.value = config.selectOpts || {}
|
|
|
+ useSelectRef.value.open(type, config.assignees)
|
|
|
}
|
|
|
const FormCreate = viewForm.$form()
|
|
|
const validateForm = ref({
|
|
@@ -94,6 +128,7 @@ const validateForm = ref({
|
|
|
rule: [],
|
|
|
loading: false
|
|
|
})
|
|
|
+
|
|
|
const onSubmit = async () => {
|
|
|
const api = validateForm.value.api
|
|
|
await api.validate()
|
|
@@ -132,49 +167,8 @@ const packageProcess = (data, list = []) => {
|
|
|
return data.reduce((_list, config) => {
|
|
|
if (config.conditionNode === 0) {
|
|
|
console.log(config.name, 'name 普通节点名称', config, data)
|
|
|
- // 需要人工审批的 做额外处理
|
|
|
- if (+config.type === 1) {
|
|
|
- /**
|
|
|
- * 设置审批类型 不同情况控制
|
|
|
- *
|
|
|
- * 1,指定人员
|
|
|
- * 模型设计的时候需要判断必须选择人员。 发起的时候不允许重新选择
|
|
|
- *
|
|
|
- * 2,主管
|
|
|
- * 发起的时候不需要选择
|
|
|
- *
|
|
|
- * 3,角色
|
|
|
- * 发起人允许重新选择
|
|
|
- *
|
|
|
- * 4,发起人自选
|
|
|
- * 发起控制: 选择一个人, 选择多个人
|
|
|
- *
|
|
|
- * 5,发起人自己
|
|
|
- * 发起人不能选择,后台控制发起人自己处理
|
|
|
- *
|
|
|
- * 6,连续多级主管
|
|
|
- * 发起人不能选择,后台控制找到对应主管
|
|
|
- */
|
|
|
- const handleName = setTypeOptions_config[config.setType]
|
|
|
- // if (config.setType) {
|
|
|
- // 针对审核人 做限制 审批限制
|
|
|
- if (Reflect.has(config, 'setType')) {
|
|
|
- console.log(handleName, 'handleName')
|
|
|
- }
|
|
|
- /*switch (handleName) {
|
|
|
- switch: ''
|
|
|
- break;
|
|
|
- switch: ''
|
|
|
- break;
|
|
|
- switch: ''
|
|
|
- break;
|
|
|
- switch: ''
|
|
|
- break;
|
|
|
- switch: ''
|
|
|
- break;
|
|
|
- }*/
|
|
|
- }
|
|
|
- // 默认用户
|
|
|
+ /* // todo...
|
|
|
+ // 默认用户
|
|
|
let type = 1
|
|
|
let assignees = config.nodeUserList
|
|
|
if (config.nodeRoleList) {
|
|
@@ -182,7 +176,90 @@ const packageProcess = (data, list = []) => {
|
|
|
type = 2
|
|
|
assignees = config.nodeRoleList
|
|
|
}
|
|
|
- userMap.value.set(config.name, { assignees, type })
|
|
|
+ // userMap.value.set(config.name, { assignees, type })
|
|
|
+ // 流程名称
|
|
|
+ assigneeMap.value[config.name] = { assignees, type }*/
|
|
|
+ // 0,发起人 1,审批人 2,抄送人 3,条件审批 4,条件分支 5,办理子流程 6,定时器在务 7,触发器在务
|
|
|
+ switch (+config.type) {
|
|
|
+ case 0: {
|
|
|
+ // 发起人
|
|
|
+ console.error(1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 1: {
|
|
|
+ // 审批人
|
|
|
+
|
|
|
+ const handleName = setTypeOptions_config[config.setType]
|
|
|
+ // if (config.setType) {
|
|
|
+ // 针对审核人 不同情况控制
|
|
|
+ if (Reflect.has(config, 'setType')) {
|
|
|
+ console.log(handleName, 'handleName', config)
|
|
|
+ let disabled = false
|
|
|
+ let selectOpts = {}
|
|
|
+ switch (config.setType) {
|
|
|
+ case 1:
|
|
|
+ // 指定人员 (不允许重新选择)
|
|
|
+ // assigneeMap.value[config.name] = { assignees: config.nodeUserList, type: 1 }
|
|
|
+ disabled = true
|
|
|
+ case 2:
|
|
|
+ // 主管 (不需要选择)
|
|
|
+ break
|
|
|
+ case 3:
|
|
|
+ // 角色 选择角色 (允许重新选择)
|
|
|
+ assigneeMap.value[config.name] = { assignees: config.nodeRoleList, type: 2 }
|
|
|
+ break
|
|
|
+ case 4:
|
|
|
+ // 发起人自选 (1: 选择一个人, 2: 选择多个人)
|
|
|
+ // const isMultiple = config.selectMode === 2
|
|
|
+ if (config.selectMode === 1) {
|
|
|
+ selectOpts.maxSelected = 1
|
|
|
+ }
|
|
|
+ break
|
|
|
+ case 5:
|
|
|
+ // 发起人自己 (不能选择)
|
|
|
+ // break
|
|
|
+ case 6:
|
|
|
+ // 连续多级主管 (不能选择)
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ assigneeMap.value[config.name] = { assignees: config.nodeUserList, type: 1, disabled: false, selectOpts }
|
|
|
+ // 发起的时候不需要选择
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 2: {
|
|
|
+ // 抄送人
|
|
|
+ // 选择人员 & allowSelection 控制 true 允许选择 否则 隐藏 todo...
|
|
|
+ assigneeMap.value[config.name] = { assignees: config.nodeUserList, type: 1, disabled: false /*!config.allowSelection*/, selectOpts: { maxSelected: 1 } }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ /*case 3: {
|
|
|
+ // 条件审批
|
|
|
+ console.error(1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 4: {
|
|
|
+ // 条件分支
|
|
|
+ console.error(1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 5: {
|
|
|
+ // 办理子流程
|
|
|
+ console.error(1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 6: {
|
|
|
+ // 定时器在务
|
|
|
+ console.error(1)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case 7: {
|
|
|
+ // 触发器在务
|
|
|
+ console.error(1)
|
|
|
+ break
|
|
|
+ }*/
|
|
|
+ }
|
|
|
_list.push(config)
|
|
|
} else if (config.conditionNode === 1) {
|
|
|
// 自定义标识key
|