因为这个项目license问题无法开源,更多技术支持与服务请加入我的知识星球。
这一部分主要讲我的任务里的详情,看流程情况
1、主要调用record/index.vue,调用参数如下:
/**
* 详情
*/
function handleDetail(record: Recordable) {
console.log("handleDetail record",record)
router.push({ path: '/flowable/task/record/index',
query: {
procInsId: record.procInsId,
deployId: record.deployId,
taskId: record.taskId,
businessKey: record.businessKey,
appType: record.appType,
finished: false
}})
}
2、表单显示部分,用的VForm3,所以是下面的显示代码,根据需要可以修改成formdesigner
<!--流程处理表单设计器模块,从flowable表里获取表单数据-->
<el-col :span="16" :offset="4" v-if="variableOpen">
<div>
<!--处理流程过程中显示formdesigner表单信息-->
<v-form-render
v-if="startUserForm.isStartUserNode && startUserForm.editFormType === 'oa' && finished === 'true'"
ref="refStartBuilder"
:form-json="formModel"
:form-data="formData"
/>
<v-form-render v-else :form-json="formModel" :form-data="formData" ref="refStartBuilder" />
</div>
3、获取上面的相应值从下面的接口获取
/** 获取流程变量内容 */
const processVariables = (taskId, deployId) => {
if (taskId) {
// 提交流程申请时填写的表单存入了流程变量中后续任务处理时需要展示
getProcessVariables(taskId, deployId).then((res) => {
console.log('getProcessVariables res=', res);
variables.value = res.result.variables;
if (res.success) {
if (res.result.hasOwnProperty('variables')) {
formData.value = res.result.variables;
variableOpen.value = true;
formModel.value = res.result.formModel;
taskForm.values = formData.value;
}
getNextFlowNodeInfo(taskForm.taskId);
} else {
createMessage.error(res.message);
}
});
}
};
4、审批记录相关代码如下:
<!--流程流转记录-->
<el-card class="box-card" v-if="flowRecordList">
<template #header class="clearfix">
<span class="el-icon-notebook-1">审批记录</span>
</template>
<el-col :span="16" :offset="4">
<div class="block">
<el-timeline>
<el-timeline-item
v-for="(item, index) in flowRecordList"
:key="index"
:icon="setIcon(item.finishTime)"
:color="setColor(item.finishTime)"
>
<p style="font-weight: 700">{{ item.taskName }}</p>
<el-card v-if="item.activityType === 'startEvent'" class="box-card" shadow="hover">
{{ item.assigneeName }} 在 {{ item.createTime }} 发起流程
</el-card>
<el-card v-if="item.activityType === 'userTask'" :body-style="{ padding: '10px' }">
<label v-if="item.assigneeName" style="font-weight: normal; margin-right: 30px"
>实际办理:
{{ item.assigneeName }}
<el-tag type="info" size="small">{{ item.deptName }}</el-tag>
</label>
<label v-if="item.candidate" style="font-weight: normal; margin-right: 30px">候选办理: {{ item.candidate }}</label>
<label style="font-weight: normal">接收时间: </label
><label style="color: #8a909c; font-weight: normal">{{ item.createTime }}</label>
<label v-if="item.finishTime" style="margin-left: 30px; font-weight: normal">办结时间: </label
><label style="color: #8a909c; font-weight: normal">{{ item.finishTime }}</label>
<label v-if="item.duration" style="margin-left: 30px; font-weight: normal">耗时: </label
><label style="color: #8a909c; font-weight: normal">{{ item.duration }}</label>
<p v-if="item.listFlowCommentDto.length > 0" v-for="(commentitem, index) in item.listFlowCommentDto" :key="index">
<el-tag type="success" v-if="commentitem.type === '1'"> {{ commentitem.comment }}</el-tag>
<el-tag type="warning" v-if="commentitem.type === '2'"> {{ '退回: ' + commentitem.comment }}</el-tag>
<el-tag type="danger" v-if="commentitem.type === '3'"> {{ '驳回: ' + commentitem.comment }}</el-tag>
<el-tag type="success" v-if="commentitem.type === '4'"> {{ commentitem.comment }}</el-tag>
<el-tag type="success" v-if="commentitem.type === '5'"> {{ commentitem.comment }}</el-tag>
<el-tag type="warning" v-if="commentitem.type === '7'"> {{ '撤回: ' + commentitem.comment }}</el-tag>
<!--撤回信息-->
<el-tag type="warning" v-if="commentitem.type === '6'"> {{ commentitem.comment }}</el-tag>
<!--终止信息-->
<el-tag type="warning" v-if="commentitem.type === '8'"> {{ commentitem.comment }}</el-tag>
<!--跳过信息-->
<el-tag type="success" v-if="commentitem.type === '9'"> {{ commentitem.comment }}</el-tag>
<!--前加签-->
<el-tag type="success" v-if="commentitem.type === '10'"> {{ commentitem.comment }}</el-tag>
<!--后加签-->
<el-tag type="success" v-if="commentitem.type === '11'"> {{ commentitem.comment }}</el-tag>
<!--多实例加签-->
<el-tag type="success" v-if="commentitem.type === '12'"> {{ commentitem.comment }}</el-tag>
<!--跳转信息-->
</p>
</el-card>
<el-card v-if="item.activityType === 'endEvent'" class="box-card" shadow="hover"> {{ item.createTime }} 流程结束 </el-card>
</el-timeline-item>
</el-timeline>
</div>
</el-col>
</el-card>
目前上面的审批记录没有考虑上传文件的显示与处理,后续再根据需要处理
5、流程图,这里采用process-viewer
<el-card class="box-card">
<template #header class="clearfix">
<span class="el-icon-picture-outline">流程图</span>
</template>
<!-- 流程图 -->
<process-viewer
:key="`designer-${loadIndex}`"
:style="'height:' + height"
:xml="xmlData"
:finishedInfo="taskList"
:allCommentList="historyProcNodeList"
ref="refNode"
/>
</el-card>
6、相应的上面值代码如下,目前还没有考虑historyProcNodeList
/** xml 文件 */
const getModelDetail = (deployId) => {
// 发送请求,获取xml
readXml(deployId).then((res) => {
console.log('readXml res', res);
xmlData.value = res.result;
getFlowViewerById(taskForm.procInsId);
});
};
const getFlowViewerById = (procInsId) => {
getFlowViewer(procInsId).then((res) => {
taskList.value = res.result || [];
console.log('taskList=', taskList.value);
//fillColor();
});
};
7、效果图如下: