Browse Source

feat: approver 审核人/发起人自选 调整

lanceJiang 6 months ago
parent
commit
1f7ebff4c3

+ 10 - 10
src/components/scWorkflow/nodes/approver.vue

@@ -380,13 +380,13 @@ export default {
 				const config = selectModeOptions_config[this.form.selectMode] || {} // limit: {minSelected, maxSelected}
 				const assignees = _form.nodeCandidate.assignees
 				if (assignees && assignees.length) {
-					// 自选一个人
-					if (_form.selectMode === 1) {
-						if (assignees.length && assignees.length > 1) return this.$message.warning('自选一个人,只能选一个')
-					} else {
-						// 自选多人/自选角色 需要2人以上
-						if (assignees.length && assignees.length < 2) return this.$message.warning(`${config.label},只能选两个以上`)
-					}
+					// // 自选一个人
+					// if (_form.selectMode === 1) {
+					// 	if (assignees.length && assignees.length > 1) return this.$message.warning('自选一个人,只能选一个')
+					// } else {
+					// 自选多人/自选角色 需要2人以上
+					if (assignees.length && assignees.length < 2) return this.$message.warning(`${config.label},只能选两个以上`)
+					// }
 				}
 			}
 			if (_form.actionUrl && _form.actionUrl.length) {
@@ -419,10 +419,10 @@ export default {
 			this.select(type, { assignees })
 		},
 		selectHandle_nodeCandidate(nodeCandidate) {
-			// form.nodeCandidate: {type: 1|2, assignees: {name, id}[]}
-			const limit = selectModeOptions_config[this.form.selectMode]?.limit || {} // {minSelected, maxSelected}
+			// form.nodeCandidate: {type: 1(用户)|2(角色), assignees: {name, id}[]}
+			const limit = { minSelected: 2 } // selectModeOptions_config[this.form.selectMode]?.limit || {} // {minSelected, maxSelected}
 			// type: 1人员, 3角色 5子表单
-			this.select(nodeCandidate.type, { ...nodeCandidate, ...limit })
+			this.select({ 1: 1, 2: 3 }[nodeCandidate.type], { ...nodeCandidate, ...limit })
 		},
 		selectModeChange(mode) {
 			const oldMode = this.form.selectMode

+ 6 - 6
src/components/scWorkflow/nodes/config.ts

@@ -93,25 +93,25 @@ export const setTypeOptions_config = setTypeOptions.reduce((res: { [key: string]
 export const selectModeOptions = [
 	{
 		label: '自选一个人',
-		value: 1,
+		value: 1 /*,
 		limit: {
 			minSelected: 1,
 			maxSelected: 1
-		}
+		}*/
 	},
 	{
 		label: '自选多个人',
-		value: 2,
+		value: 2 /*,
 		limit: {
 			minSelected: 2
-		}
+		}*/
 	},
 	{
 		label: '自选角色',
-		value: 3,
+		value: 3 /*,
 		limit: {
 			minSelected: 2
-		}
+		}*/
 	}
 ]
 

+ 6 - 0
src/views/approve/components/config.ts

@@ -1,6 +1,7 @@
 type ModelContentConfig = {
 	nodeKey: string
 	nodeName: string
+	// 0:发起人 1:审批人 2:抄送人 3:条件审批 4:条件分支 5:办理子流程 6:定时器在务 7:触发器在务 8:并行路由 9:包容路由 10:路由分支
 	type: number
 	local_status?: string // 填充自定义状态
 	p_nodeNames?: string[] // 填充自定义状态
@@ -13,6 +14,11 @@ type ModelContentConfig = {
 		conditionList: any[]
 		childNode: ModelContentConfig
 	}[]
+	// 备选数据
+	nodeCandidate?: {
+		type: 1 | 2
+		assignees?: { name: string; id: string }[]
+	}
 }
 type RenderNodes = {
 	[key: string]: 0 | 1 // 0已执行 1执行中

+ 4 - 2
src/views/approve/launch/ItemDrawer.vue

@@ -67,7 +67,7 @@
 <script setup lang="ts">
 import model from '@/api/flow/process'
 import { erFormPreview } from '@ER/formEditor'
-import { ref, computed, reactive } from 'vue'
+import { ref, computed, reactive, nextTick } from 'vue'
 import { ElMessage } from 'element-plus'
 import UseSelect from '@/components/scWorkflow/select.vue'
 import FlowNodeAvatar from '@/components/Flow/FlowNodeAvatar.vue'
@@ -116,7 +116,9 @@ const selectHandler = (nodeKey: string, type: 1 | 3) => {
 	const config = assigneeMap.value[nodeKey]
 	active_assigneeKey.value = nodeKey
 	active_selectOpts.value = config.selectOpts || {}
-	useSelectRef.value.open(type, config.assignees)
+	nextTick(() => {
+		useSelectRef.value.open(type, config.assignees)
+	})
 }
 const validateForm = ref({
 	api: {},