流程详情页 30% - 表单信息的展示

pull/2/head
YunaiV 2022-01-16 22:16:49 +08:00
parent f049bd7530
commit f0963c3941
10 changed files with 100 additions and 79 deletions

View File

@ -57,12 +57,12 @@ public class BpmTaskController {
return success(true); return success(true);
} }
@GetMapping("/list-by-process-instance-id") @GetMapping("/historic-list-by-process-instance-id")
@ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的") @ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的")
@ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class) @ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class)
public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( public CommonResult<List<BpmTaskRespVO>> getHistoricTaskListByProcessInstanceId(
@RequestParam("processInstanceId") String processInstanceId) { @RequestParam("processInstanceId") String processInstanceId) {
return success(taskService.getTaskListByProcessInstanceId(processInstanceId)); return success(taskService.getHistoricTaskListByProcessInstanceId(processInstanceId));
} }
/** /**

View File

@ -64,6 +64,7 @@ public interface BpmProcessInstanceConvert {
@Mappings({ @Mappings({
@Mapping(source = "id", target = "processInstanceId"), @Mapping(source = "id", target = "processInstanceId"),
@Mapping(source = "id", target = "id", ignore = true),
@Mapping(source = "startDate", target = "createTime"), @Mapping(source = "startDate", target = "createTime"),
@Mapping(source = "initiator", target = "startUserId"), @Mapping(source = "initiator", target = "startUserId"),
@Mapping(source = "status", target = "status", ignore = true) @Mapping(source = "status", target = "status", ignore = true)

View File

@ -31,7 +31,7 @@ public interface BpmTaskService {
* @param processInstanceId * @param processInstanceId
* @return * @return
*/ */
List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId); List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId);
/** /**
* *

View File

@ -91,7 +91,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
} }
@Override @Override
public List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId) { public List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId) {
// 获得任务列表 // 获得任务列表
List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId) .processInstanceId(processInstanceId)

View File

@ -27,7 +27,7 @@ export function cancelProcessInstance(id, reason) {
}) })
} }
export function getMyProcessInstance(id) { export function getProcessInstance(id) {
return request({ return request({
url: '/bpm/process-instance/get?id=' + id, url: '/bpm/process-instance/get?id=' + id,
method: 'get', method: 'get',

View File

@ -40,3 +40,9 @@ export function rejectTask(data) {
}) })
} }
export function getHistoricTaskListByProcessInstanceId(processInstanceId) {
return request({
url: '/bpm/task/historic-list-by-process-instance-id?processInstanceId=' + processInstanceId,
method: 'get',
})
}

View File

@ -198,6 +198,12 @@ export const constantRoutes = [
component: (resolve) => require(['@/views/bpm/processInstance/create'], resolve), component: (resolve) => require(['@/views/bpm/processInstance/create'], resolve),
name: '发起流程', name: '发起流程',
meta: { title: '发起流程' } meta: { title: '发起流程' }
},
{
path: 'process-instance/detail',
component: (resolve) => require(['@/views/bpm/processInstance/detail'], resolve),
name: '流程详情',
meta: { title: '流程详情' }
} }
] ]
}, },

View File

@ -70,8 +70,6 @@ export default {
return { return {
// //
loading: true, loading: true,
//
total: 0,
// //
list: [], list: [],

View File

@ -1,54 +1,25 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 第一步通过流程定义的列表选择对应的流程 --> <!-- TODO 审批信息 -->
<div v-if="!selectProcessInstance"> <!-- 申请信息 -->
<el-table v-loading="loading" :data="list"> <el-card class="box-card" v-loading="processInstanceLoading">
<el-table-column label="流程名称" align="center" prop="name" width="200"> <div slot="header" class="clearfix">
<template slot-scope="scope"> <span class="el-icon-document">申请信息{{ processInstance.name }}</span>
<el-button type="text" @click="handleBpmnDetail(scope.row)"> </div>
<span>{{ scope.row.name }}</span> <el-col :span="16" :offset="6">
</el-button> <div>
</template> <parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" />
</el-table-column>
<el-table-column label="流程分类" align="center" prop="category" width="100">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.BPM_MODEL_CATEGORY, scope.row.category) }}</span>
</template>
</el-table-column>
<el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80">
<template slot-scope="scope">
<el-tag size="medium" v-if="scope.row">v{{ scope.row.version }}</el-tag>
</template>
</el-table-column>
<el-table-column label="流程描述" align="center" prop="description" width="300" show-overflow-tooltip />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" size="small" icon="el-icon-plus" @click="handleSelect(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 第二步填写表单进行流程的提交 -->
<div v-else>
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span class="el-icon-document">申请信息{{ selectProcessInstance.name }}</span>
<el-button style="float: right;" type="primary" @click="selectProcessInstance = undefined">选择其它流程</el-button>
</div> </div>
<el-col :span="16" :offset="6"> </el-col>
<div> </el-card>
<parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" /> <!-- TODO 审批记录 -->
</div> <!-- TODO 流程图 -->
</el-col> <el-card class="box-card" v-loading="processInstanceLoading">
</el-card> <div slot="header" class="clearfix">
<el-card class="box-card"> <span class="el-icon-picture-outline">流程图</span>
<div slot="header" class="clearfix"> </div>
<span class="el-icon-picture-outline">流程图</span> <my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" />
</div> </el-card>
<my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" />
</el-card>
</div>
</div> </div>
</template> </template>
@ -58,7 +29,8 @@ import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import {getForm} from "@/api/bpm/form"; import {getForm} from "@/api/bpm/form";
import {decodeFields} from "@/utils/formGenerator"; import {decodeFields} from "@/utils/formGenerator";
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import {createProcessInstance, getMyProcessInstancePage} from "@/api/bpm/processInstance"; import {createProcessInstance, getMyProcessInstancePage, getProcessInstance} from "@/api/bpm/processInstance";
import {getHistoricTaskListByProcessInstanceId} from "@/api/bpm/task";
// //
export default { export default {
@ -69,11 +41,10 @@ export default {
data() { data() {
return { return {
// //
loading: true, processInstanceLoading: true,
// //
total: 0, id: undefined, //
// processInstance: {},
list: [],
// //
detailForm: { detailForm: {
@ -86,27 +57,65 @@ export default {
prefix: "activiti" prefix: "activiti"
}, },
// //
selectProcessInstance: undefined, // historicTasksLoad: true,
historicTasks: [],
// //
categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY),
}; };
}, },
created() { created() {
this.getList(); this.id = this.$route.query.id;
if (!this.id) {
this.$message.error('未传递 id 参数,无法查看流程信息');
return;
}
this.getDetail();
}, },
methods: { methods: {
/** 查询流程定义列表 */ /** 获得流程实例 */
getList() { getDetail() {
this.loading = true; //
getProcessDefinitionList({ this.processInstanceLoading = true;
suspensionState: 1 getProcessInstance(this.id).then(response => {
}).then(response => { if (!response.data) {
this.list = response.data this.$message.error('查询不到流程信息!');
this.loading = false return;
} }
); //
this.processInstance = response.data;
//
this.detailForm = {
...JSON.parse(this.processInstance.processDefinition.formConf),
disabled: true, //
formBtns: false, //
fields: decodeFields(this.processInstance.processDefinition.formFields)
}
//
this.detailForm.fields.forEach(item => {
const val = this.processInstance.formVariables[item.__vModel__]
if (val) {
item.__config__.defaultValue = val
}
})
//
getProcessDefinitionBpmnXML(this.processInstance.processDefinition.id).then(response => {
this.bpmnXML = response.data
})
//
this.processInstanceLoading = false;
});
//
this.historicTasksLoad = true;
getHistoricTaskListByProcessInstanceId(this.id).then(response => {
this.historicTasks = response.data;
this.historicTasksLoad = true;
});
}, },
/** 处理选择流程的按钮操作 **/ /** 处理选择流程的按钮操作 **/
handleSelect(row) { handleSelect(row) {
@ -121,10 +130,7 @@ export default {
fields: decodeFields(row.formFields) fields: decodeFields(row.formFields)
} }
//
getProcessDefinitionBpmnXML(row.id).then(response => {
this.bpmnXML = response.data
})
} else if (row.formCustomCreatePath) { } else if (row.formCustomCreatePath) {
this.$router.push({ path: row.formCustomCreatePath}); this.$router.push({ path: row.formCustomCreatePath});
// Tab // Tab

View File

@ -36,7 +36,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- TODO 权限颜色 --> <!-- TODO 权限颜色 -->
<el-button size="mini" type="text" icon="el-icon-edit">审批</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAudit(scope.row)"></el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, true)">通过</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, true)">通过</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, false)">不通过</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, false)">不通过</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.suspensionState === 2"></el-button> <el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.suspensionState === 2"></el-button>
@ -104,6 +104,10 @@ export default {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 处理审批按钮 */
handleAudit(row) {
this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.processInstance.id}});
},
audit(row, pass) { audit(row, pass) {
if (pass) { if (pass) {
approveTask({ approveTask({