【代码评审修改】- 新审批界面部分修改

pull/582/head
jason 2024-10-08 12:42:38 +08:00
parent 619491b4d0
commit 019104f460
3 changed files with 70 additions and 38 deletions

View File

@ -47,7 +47,7 @@ export type ApprovalNodeInfo = {
status: number status: number
startTime?: Date startTime?: Date
endTime?: Date endTime?: Date
candidateUserList?: User[] candidateUsers?: User[]
tasks: ApprovalTaskInfo[] tasks: ApprovalTaskInfo[]
} }

View File

@ -14,7 +14,7 @@
<div class="flex items-center mt-1"> <div class="flex items-center mt-1">
<!-- 情况一遍历每个审批节点下的进行中task 任务 --> <!-- 情况一遍历每个审批节点下的进行中task 任务 -->
<div v-for="(task, idx) in activity.tasks" :key="idx" class="flex items-center"> <div v-for="(task, idx) in activity.tasks" :key="idx" class="flex items-center">
<div class="flex items-center flex-col pr-2"> <div class="flex flex-col pr-2">
<div class="position-relative" v-if="task.assigneeUser || task.ownerUser"> <div class="position-relative" v-if="task.assigneeUser || task.ownerUser">
<!-- 信息头像 --> <!-- 信息头像 -->
<el-avatar <el-avatar
@ -47,7 +47,7 @@
<!-- 信息昵称 --> <!-- 信息昵称 -->
<div <div
v-if="task.assigneeUser && task.assigneeUser.nickname" v-if="task.assigneeUser && task.assigneeUser.nickname"
class="text-10px text-align-center" class="text-12px text-align-center"
> >
{{ task.assigneeUser.nickname }} {{ task.assigneeUser.nickname }}
</div> </div>
@ -57,14 +57,20 @@
> >
{{ task.ownerUser.nickname }} {{ task.ownerUser.nickname }}
</div> </div>
<!-- TODO @jason审批意见要展示哈 --> <div v-if="task.reason" class="text-#a5a5a5 my-4px text-12px flex items-center w-100%">
<!-- <div v-if="task.reason" :title="task.reason" class="text-13px text-truncate w-150px mt-1"> : {{ task.reason }}</div> --> <div
:title="task.reason"
class="text-truncate w-200px border-1px border-#a5a5a5 border-dashed rounded py-5px px-15px text-#2d2d2d"
>
{{ task.reason }}
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- 情况二遍历每个审批节点下的候选的task 任务例如说1依次审批2未来的审批任务等 --> <!-- 情况二遍历每个审批节点下的候选的task 任务例如说1依次审批2未来的审批任务等 -->
<div <div
v-for="(user, idx1) in activity.candidateUserList" v-for="(user, idx1) in activity.candidateUsers"
:key="idx1" :key="idx1"
class="flex items-center" class="flex items-center"
> >
@ -91,7 +97,6 @@
<div v-if="user.nickname" class="text-10px text-align-center"> <div v-if="user.nickname" class="text-10px text-align-center">
{{ user.nickname }} {{ user.nickname }}
</div> </div>
<!-- <div v-if="task.reason" :title="task.reason" class="text-13px text-truncate w-150px mt-1"> : {{ task.reason }}</div> -->
</div> </div>
</div> </div>
</div> </div>

View File

@ -12,25 +12,37 @@
<el-divider class="!my-8px" /> <el-divider class="!my-8px" />
<div class="flex items-center gap-5 mb-10px h-40px"> <div class="flex items-center gap-5 mb-10px h-40px">
<div class="text-26px font-bold mb-5px">{{ processInstance.name }}</div> <div class="text-26px font-bold mb-5px">{{ processInstance.name }}</div>
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS" :value="processInstance.status" /> <dict-tag
v-if="processInstance.status"
:type="DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS"
:value="processInstance.status"
/>
</div> </div>
<div class="flex items-center gap-5 mb-10px text-13px h-35px"> <div class="flex items-center gap-5 mb-10px text-13px h-35px">
<div <div
class="bg-gray-100 h-35px rounded-3xl flex items-center p-8px gap-2 dark:color-gray-600" class="bg-gray-100 h-35px rounded-3xl flex items-center p-8px gap-2 dark:color-gray-600"
> >
<img class="rounded-full h-28px" src="@/assets/imgs/avatar.jpg" alt="" /> <!-- <img class="rounded-full h-28px" src="@/assets/imgs/avatar.jpg" alt="" /> -->
<el-avatar
:size="28"
v-if="processInstance?.startUser?.avatar"
:src="processInstance?.startUser?.avatar"
/>
<el-avatar :size="28" v-else-if="processInstance?.startUser?.nickname">
{{ processInstance?.startUser?.nickname.substring(0, 1) }}
</el-avatar>
{{ processInstance?.startUser?.nickname }} {{ processInstance?.startUser?.nickname }}
</div> </div>
<div class="text-#878c93"> {{ formatDate(processInstance.startTime) }} 提交 </div> <div class="text-#878c93"> {{ formatDate(processInstance.startTime) }} 提交 </div>
</div> </div>
<el-tabs v-model="activeTab"> <el-tabs v-model="activeTab" @tab-change="onTabChange">
<!-- 表单信息 --> <!-- 表单信息 -->
<el-tab-pane label="审批详情" name="form"> <el-tab-pane label="审批详情" name="form">
<div class="form-scroll-area"> <div class="form-scroll-area">
<el-scrollbar> <el-scrollbar>
<el-row :gutter="10"> <el-row>
<el-col :span="18" class="!flex !flex-col formCol"> <el-col :span="18" class="!flex !flex-col formCol">
<!-- 表单信息 --> <!-- 表单信息 -->
<div <div
@ -38,11 +50,7 @@
class="form-box flex flex-col mb-30px flex-1" class="form-box flex flex-col mb-30px flex-1"
> >
<!-- 情况一流程表单 --> <!-- 情况一流程表单 -->
<el-col <el-col v-if="processInstance?.processDefinition?.formType === 10">
v-if="processInstance?.processDefinition?.formType === 10"
:offset="6"
:span="16"
>
<form-create <form-create
v-model="detailForm.value" v-model="detailForm.value"
v-model:api="fApi" v-model:api="fApi"
@ -64,33 +72,44 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
</el-tab-pane> </el-tab-pane>
<!-- 流程图 --> <!-- 流程图 -->
<el-tab-pane label="流程图" name="diagram"> <el-tab-pane label="流程图" name="diagram">
<ProcessInstanceBpmnViewer <div class="form-scroll-area">
:id="`${id}`" <el-scrollbar>
:bpmn-xml="bpmnXml" <ProcessInstanceBpmnViewer
:loading="processInstanceLoading" :id="`${id}`"
:process-instance="processInstance" :bpmn-xml="bpmnXml"
:tasks="tasks" :loading="processInstanceLoading"
/> :process-instance="processInstance"
:tasks="tasks"
/>
</el-scrollbar>
</div>
</el-tab-pane> </el-tab-pane>
<!-- 流转记录 --> <!-- 流转记录 -->
<el-tab-pane label="流转记录" name="record"> <el-tab-pane label="流转记录" name="record">
<ProcessInstanceTaskList <div class="form-scroll-area">
:loading="tasksLoad" <el-scrollbar>
:process-instance="processInstance" <ProcessInstanceTaskList
:tasks="tasks" :loading="tasksLoad"
@refresh="getTaskList" :process-instance="processInstance"
/> :tasks="tasks"
/>
</el-scrollbar>
</div>
</el-tab-pane> </el-tab-pane>
<!-- 流转评论 TODO 待开发 --> <!-- 流转评论 TODO 待开发 -->
<el-tab-pane label="流转评论" name="comment"> 流转评论 </el-tab-pane> <el-tab-pane label="流转评论" name="comment">
<div class="form-scroll-area">
<el-scrollbar> 流转评论 </el-scrollbar>
</div>
</el-tab-pane>
</el-tabs> </el-tabs>
<div <div class="b-t-solid border-t-1px border-[var(--el-border-color)]">
class="b-t-solid border-t-1px border-[var(--el-border-color)]"
v-if="activeTab === 'form'"
>
<!-- 操作栏按钮 --> <!-- 操作栏按钮 -->
<ProcessInstanceOperationButton <ProcessInstanceOperationButton
ref="operationButtonRef" ref="operationButtonRef"
@ -131,6 +150,7 @@ const props = defineProps<{
const message = useMessage() // const message = useMessage() //
const processInstanceLoading = ref(false) // const processInstanceLoading = ref(false) //
const processInstance = ref<any>({}) // const processInstance = ref<any>({}) //
let processDefinitionId = undefined // Id
const operationButtonRef = ref() const operationButtonRef = ref()
const timelineRef = ref() const timelineRef = ref()
const bpmnXml = ref('') // BPMN XML const bpmnXml = ref('') // BPMN XML
@ -151,10 +171,10 @@ const detailForm = ref({
}) // }) //
/** 获得详情 */ /** 获得详情 */
const getDetail = () => { const getDetail = async () => {
// 1. // 1.
getProcessInstance() getProcessInstance()
// 2. // 2.
getTaskList() getTaskList()
} }
@ -202,9 +222,9 @@ const getProcessInstance = async () => {
// data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue // data.processDefinition.formCustomViewPath /crm/contract/detail/index.vue
BusinessFormComponent.value = registerComponent(data.processDefinition.formCustomViewPath) BusinessFormComponent.value = registerComponent(data.processDefinition.formCustomViewPath)
} }
processDefinitionId = processDefinition.id
// //
bpmnXml.value = (await DefinitionApi.getProcessDefinition(processDefinition.id))?.bpmnXml // bpmnXml.value = (await DefinitionApi.getProcessDefinition(processDefinition.id))?.bpmnXml
} finally { } finally {
processInstanceLoading.value = false processInstanceLoading.value = false
} }
@ -273,6 +293,13 @@ const refresh = () => {
/** 当前的Tab */ /** 当前的Tab */
const activeTab = ref('form') const activeTab = ref('form')
/** Tab 切换 加载流程图,直接加载显示不出来,不知道啥原因,所以切换以后在加载 */
const onTabChange = async (tabName: string) => {
if (tabName === 'diagram' && processDefinitionId && !bpmnXml.value) {
//
bpmnXml.value = (await DefinitionApi.getProcessDefinition(processDefinitionId))?.bpmnXml
}
}
/** 初始化 */ /** 初始化 */
const userOptions = ref<UserApi.UserVO[]>([]) // const userOptions = ref<UserApi.UserVO[]>([]) //
onMounted(async () => { onMounted(async () => {