mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	【功能优化】发起人自选判断优化
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
import request from '@/config/axios'
 | 
					import request from '@/config/axios'
 | 
				
			||||||
import { ProcessDefinitionVO } from '@/api/bpm/model'
 | 
					import { ProcessDefinitionVO } from '@/api/bpm/model'
 | 
				
			||||||
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
 | 
					import { NodeType, CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
 | 
				
			||||||
export type Task = {
 | 
					export type Task = {
 | 
				
			||||||
  id: string
 | 
					  id: string
 | 
				
			||||||
  name: string
 | 
					  name: string
 | 
				
			||||||
@@ -43,6 +43,7 @@ export type ApprovalNodeInfo = {
 | 
				
			|||||||
  id: number
 | 
					  id: number
 | 
				
			||||||
  name: string
 | 
					  name: string
 | 
				
			||||||
  nodeType: NodeType
 | 
					  nodeType: NodeType
 | 
				
			||||||
 | 
					  candidateStrategy?: CandidateStrategy
 | 
				
			||||||
  status: number
 | 
					  status: number
 | 
				
			||||||
  startTime?: Date
 | 
					  startTime?: Date
 | 
				
			||||||
  endTime?: Date
 | 
					  endTime?: Date
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,6 @@
 | 
				
			|||||||
                      ref="timelineRef"
 | 
					                      ref="timelineRef"
 | 
				
			||||||
                      :activity-nodes="activityNodes"
 | 
					                      :activity-nodes="activityNodes"
 | 
				
			||||||
                      :show-status-icon="false"
 | 
					                      :show-status-icon="false"
 | 
				
			||||||
                      :startUserSelectTasks="startUserSelectTasks"
 | 
					 | 
				
			||||||
                      :startUserSelectAssignees="startUserSelectAssignees"
 | 
					                      :startUserSelectAssignees="startUserSelectAssignees"
 | 
				
			||||||
                      @select-user-confirm="selectUserConfirm"
 | 
					                      @select-user-confirm="selectUserConfirm"
 | 
				
			||||||
                    />
 | 
					                    />
 | 
				
			||||||
@@ -78,6 +77,7 @@
 | 
				
			|||||||
<script lang="ts" setup>
 | 
					<script lang="ts" setup>
 | 
				
			||||||
import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
 | 
					import { decodeFields, setConfAndFields2 } from '@/utils/formCreate'
 | 
				
			||||||
import { BpmModelType } from '@/utils/constants'
 | 
					import { BpmModelType } from '@/utils/constants'
 | 
				
			||||||
 | 
					import { CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
 | 
				
			||||||
import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
 | 
					import ProcessInstanceBpmnViewer from '../detail/ProcessInstanceBpmnViewer.vue'
 | 
				
			||||||
import ProcessInstanceSimpleViewer from '../detail/ProcessInstanceSimpleViewer.vue'
 | 
					import ProcessInstanceSimpleViewer from '../detail/ProcessInstanceSimpleViewer.vue'
 | 
				
			||||||
import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
 | 
					import ProcessInstanceTimeline from '../detail/ProcessInstanceTimeline.vue'
 | 
				
			||||||
@@ -103,7 +103,7 @@ const detailForm: any = ref({
 | 
				
			|||||||
}) // 流程表单详情
 | 
					}) // 流程表单详情
 | 
				
			||||||
const fApi = ref<ApiAttrs>()
 | 
					const fApi = ref<ApiAttrs>()
 | 
				
			||||||
// 指定审批人
 | 
					// 指定审批人
 | 
				
			||||||
const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人的用户任务列表
 | 
					const startUserSelectTasks: any = ref([]) // 发起人需要选择审批人或抄送人的任务列表
 | 
				
			||||||
const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
 | 
					const startUserSelectAssignees = ref({}) // 发起人选择审批人的数据
 | 
				
			||||||
const bpmnXML: any = ref(null) // BPMN 数据
 | 
					const bpmnXML: any = ref(null) // BPMN 数据
 | 
				
			||||||
const simpleJson = ref<string | undefined>() // Simple 设计器数据 json 格式
 | 
					const simpleJson = ref<string | undefined>() // Simple 设计器数据 json 格式
 | 
				
			||||||
@@ -140,14 +140,6 @@ const initProcessInfo = async (row: any, formVariables?: any) => {
 | 
				
			|||||||
    if (processDefinitionDetail) {
 | 
					    if (processDefinitionDetail) {
 | 
				
			||||||
      bpmnXML.value = processDefinitionDetail.bpmnXml
 | 
					      bpmnXML.value = processDefinitionDetail.bpmnXml
 | 
				
			||||||
      simpleJson.value = processDefinitionDetail.simpleModel
 | 
					      simpleJson.value = processDefinitionDetail.simpleModel
 | 
				
			||||||
      startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
 | 
					 | 
				
			||||||
      // 设置指定审批人
 | 
					 | 
				
			||||||
      if (startUserSelectTasks.value?.length > 0) {
 | 
					 | 
				
			||||||
        for (const userTask of startUserSelectTasks.value) {
 | 
					 | 
				
			||||||
          // 初始化数据
 | 
					 | 
				
			||||||
          startUserSelectAssignees.value[userTask.id] = []
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // 情况二:业务表单
 | 
					    // 情况二:业务表单
 | 
				
			||||||
  } else if (row.formCustomCreatePath) {
 | 
					  } else if (row.formCustomCreatePath) {
 | 
				
			||||||
@@ -169,6 +161,12 @@ const getApprovalDetail = async (row: any) => {
 | 
				
			|||||||
      message.error('查询不到审批详情信息!')
 | 
					      message.error('查询不到审批详情信息!')
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    // 获取发起人自选的任务
 | 
				
			||||||
 | 
					    startUserSelectTasks.value = data.activityNodes?.filter(node => CandidateStrategy.START_USER_SELECT === node.candidateStrategy )
 | 
				
			||||||
 | 
					    for (const node of startUserSelectTasks.value) {
 | 
				
			||||||
 | 
					      // 初始化数据
 | 
				
			||||||
 | 
					      startUserSelectAssignees.value[node.id] = []
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    // 获取审批节点,显示 Timeline 的数据
 | 
					    // 获取审批节点,显示 Timeline 的数据
 | 
				
			||||||
    activityNodes.value = data.activityNodes
 | 
					    activityNodes.value = data.activityNodes
 | 
				
			||||||
  } finally {
 | 
					  } finally {
 | 
				
			||||||
@@ -187,7 +185,7 @@ const submitForm = async () => {
 | 
				
			|||||||
        Array.isArray(startUserSelectAssignees.value[userTask.id]) &&
 | 
					        Array.isArray(startUserSelectAssignees.value[userTask.id]) &&
 | 
				
			||||||
        startUserSelectAssignees.value[userTask.id].length === 0
 | 
					        startUserSelectAssignees.value[userTask.id].length === 0
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
        return message.warning(`请选择${userTask.name}的审批人`)
 | 
					        return message.warning(`请选择${userTask.name}的候选人`)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,9 +39,7 @@
 | 
				
			|||||||
        <!-- 需要自定义选择审批人 -->
 | 
					        <!-- 需要自定义选择审批人 -->
 | 
				
			||||||
        <div
 | 
					        <div
 | 
				
			||||||
          class="flex flex-wrap gap2 items-center"
 | 
					          class="flex flex-wrap gap2 items-center"
 | 
				
			||||||
          v-if="
 | 
					          v-if="isEmpty(activity.tasks) && isEmpty(activity.candidateUsers) && CandidateStrategy.START_USER_SELECT === activity.candidateStrategy"
 | 
				
			||||||
            startUserSelectTasks?.length > 0 && Array.isArray(startUserSelectAssignees[activity.id])
 | 
					 | 
				
			||||||
          "
 | 
					 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
          <!--  && activity.nodeType === NodeType.USER_TASK_NODE -->
 | 
					          <!--  && activity.nodeType === NodeType.USER_TASK_NODE -->
 | 
				
			||||||
          <el-button
 | 
					          <el-button
 | 
				
			||||||
@@ -156,7 +154,8 @@
 | 
				
			|||||||
import { formatDate } from '@/utils/formatTime'
 | 
					import { formatDate } from '@/utils/formatTime'
 | 
				
			||||||
import * as ProcessInstanceApi from '@/api/bpm/processInstance'
 | 
					import * as ProcessInstanceApi from '@/api/bpm/processInstance'
 | 
				
			||||||
import { TaskStatusEnum } from '@/api/bpm/task'
 | 
					import { TaskStatusEnum } from '@/api/bpm/task'
 | 
				
			||||||
import { NodeType } from '@/components/SimpleProcessDesignerV2/src/consts'
 | 
					import { NodeType, CandidateStrategy } from '@/components/SimpleProcessDesignerV2/src/consts'
 | 
				
			||||||
 | 
					import { isEmpty } from '@/utils/is'
 | 
				
			||||||
import { Check, Close, Loading, Clock, Minus, Delete } from '@element-plus/icons-vue'
 | 
					import { Check, Close, Loading, Clock, Minus, Delete } from '@element-plus/icons-vue'
 | 
				
			||||||
import starterSvg from '@/assets/svgs/bpm/starter.svg'
 | 
					import starterSvg from '@/assets/svgs/bpm/starter.svg'
 | 
				
			||||||
import auditorSvg from '@/assets/svgs/bpm/auditor.svg'
 | 
					import auditorSvg from '@/assets/svgs/bpm/auditor.svg'
 | 
				
			||||||
@@ -170,12 +169,10 @@ withDefaults(
 | 
				
			|||||||
  defineProps<{
 | 
					  defineProps<{
 | 
				
			||||||
    activityNodes: ProcessInstanceApi.ApprovalNodeInfo[] // 审批节点信息
 | 
					    activityNodes: ProcessInstanceApi.ApprovalNodeInfo[] // 审批节点信息
 | 
				
			||||||
    showStatusIcon?: boolean // 是否显示头像右下角状态图标
 | 
					    showStatusIcon?: boolean // 是否显示头像右下角状态图标
 | 
				
			||||||
    startUserSelectTasks?: any[] // 发起人需要选择审批人的用户任务列表
 | 
					 | 
				
			||||||
    startUserSelectAssignees?: any // 发起人选择审批人的数据
 | 
					    startUserSelectAssignees?: any // 发起人选择审批人的数据
 | 
				
			||||||
  }>(),
 | 
					  }>(),
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    showStatusIcon: true, // 默认值为 true
 | 
					    showStatusIcon: true, // 默认值为 true
 | 
				
			||||||
    startUserSelectTasks: () => [], // 默认值为空数组
 | 
					 | 
				
			||||||
    startUserSelectAssignees: () => {}
 | 
					    startUserSelectAssignees: () => {}
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user