Commit f0963c3941c34a510933c80759b0154d7d7696fd
1 parent
f049bd75
流程详情页 30% - 表单信息的展示
Showing
10 changed files
with
100 additions
and
79 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/BpmTaskController.java
| ... | ... | @@ -57,12 +57,12 @@ public class BpmTaskController { |
| 57 | 57 | return success(true); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - @GetMapping("/list-by-process-instance-id") | |
| 60 | + @GetMapping("/historic-list-by-process-instance-id") | |
| 61 | 61 | @ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的") |
| 62 | 62 | @ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class) |
| 63 | - public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( | |
| 63 | + public CommonResult<List<BpmTaskRespVO>> getHistoricTaskListByProcessInstanceId( | |
| 64 | 64 | @RequestParam("processInstanceId") String processInstanceId) { |
| 65 | - return success(taskService.getTaskListByProcessInstanceId(processInstanceId)); | |
| 65 | + return success(taskService.getHistoricTaskListByProcessInstanceId(processInstanceId)); | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmProcessInstanceConvert.java
| ... | ... | @@ -64,6 +64,7 @@ public interface BpmProcessInstanceConvert { |
| 64 | 64 | |
| 65 | 65 | @Mappings({ |
| 66 | 66 | @Mapping(source = "id", target = "processInstanceId"), |
| 67 | + @Mapping(source = "id", target = "id", ignore = true), | |
| 67 | 68 | @Mapping(source = "startDate", target = "createTime"), |
| 68 | 69 | @Mapping(source = "initiator", target = "startUserId"), |
| 69 | 70 | @Mapping(source = "status", target = "status", ignore = true) | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmTaskService.java
| ... | ... | @@ -31,7 +31,7 @@ public interface BpmTaskService { |
| 31 | 31 | * @param processInstanceId 流程实例的编号 |
| 32 | 32 | * @return 流程任务列表 |
| 33 | 33 | */ |
| 34 | - List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId); | |
| 34 | + List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId); | |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * 获得流程任务列表 | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java
| ... | ... | @@ -91,7 +91,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | @Override |
| 94 | - public List<BpmTaskRespVO> getTaskListByProcessInstanceId(String processInstanceId) { | |
| 94 | + public List<BpmTaskRespVO> getHistoricTaskListByProcessInstanceId(String processInstanceId) { | |
| 95 | 95 | // 获得任务列表 |
| 96 | 96 | List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() |
| 97 | 97 | .processInstanceId(processInstanceId) | ... | ... |
yudao-admin-ui/src/api/bpm/processInstance.js
yudao-admin-ui/src/api/bpm/task.js
| ... | ... | @@ -40,3 +40,9 @@ export function rejectTask(data) { |
| 40 | 40 | }) |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | +export function getHistoricTaskListByProcessInstanceId(processInstanceId) { | |
| 44 | + return request({ | |
| 45 | + url: '/bpm/task/historic-list-by-process-instance-id?processInstanceId=' + processInstanceId, | |
| 46 | + method: 'get', | |
| 47 | + }) | |
| 48 | +} | ... | ... |
yudao-admin-ui/src/router/index.js
| ... | ... | @@ -198,6 +198,12 @@ export const constantRoutes = [ |
| 198 | 198 | component: (resolve) => require(['@/views/bpm/processInstance/create'], resolve), |
| 199 | 199 | name: '发起流程', |
| 200 | 200 | meta: { title: '发起流程' } |
| 201 | + }, | |
| 202 | + { | |
| 203 | + path: 'process-instance/detail', | |
| 204 | + component: (resolve) => require(['@/views/bpm/processInstance/detail'], resolve), | |
| 205 | + name: '流程详情', | |
| 206 | + meta: { title: '流程详情' } | |
| 201 | 207 | } |
| 202 | 208 | ] |
| 203 | 209 | }, | ... | ... |
yudao-admin-ui/src/views/bpm/processInstance/create.vue
yudao-admin-ui/src/views/bpm/processInstance/detail.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="app-container"> |
| 3 | - <!-- 第一步,通过流程定义的列表,选择对应的流程 --> | |
| 4 | - <div v-if="!selectProcessInstance"> | |
| 5 | - <el-table v-loading="loading" :data="list"> | |
| 6 | - <el-table-column label="流程名称" align="center" prop="name" width="200"> | |
| 7 | - <template slot-scope="scope"> | |
| 8 | - <el-button type="text" @click="handleBpmnDetail(scope.row)"> | |
| 9 | - <span>{{ scope.row.name }}</span> | |
| 10 | - </el-button> | |
| 11 | - </template> | |
| 12 | - </el-table-column> | |
| 13 | - <el-table-column label="流程分类" align="center" prop="category" width="100"> | |
| 14 | - <template slot-scope="scope"> | |
| 15 | - <span>{{ getDictDataLabel(DICT_TYPE.BPM_MODEL_CATEGORY, scope.row.category) }}</span> | |
| 16 | - </template> | |
| 17 | - </el-table-column> | |
| 18 | - <el-table-column label="流程版本" align="center" prop="processDefinition.version" width="80"> | |
| 19 | - <template slot-scope="scope"> | |
| 20 | - <el-tag size="medium" v-if="scope.row">v{{ scope.row.version }}</el-tag> | |
| 21 | - </template> | |
| 22 | - </el-table-column> | |
| 23 | - <el-table-column label="流程描述" align="center" prop="description" width="300" show-overflow-tooltip /> | |
| 24 | - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 25 | - <template slot-scope="scope"> | |
| 26 | - <el-button type="text" size="small" icon="el-icon-plus" @click="handleSelect(scope.row)">选择</el-button> | |
| 27 | - </template> | |
| 28 | - </el-table-column> | |
| 29 | - </el-table> | |
| 30 | - </div> | |
| 31 | - <!-- 第二步,填写表单,进行流程的提交 --> | |
| 32 | - <div v-else> | |
| 33 | - <el-card class="box-card" > | |
| 34 | - <div slot="header" class="clearfix"> | |
| 35 | - <span class="el-icon-document">申请信息【{{ selectProcessInstance.name }}】</span> | |
| 36 | - <el-button style="float: right;" type="primary" @click="selectProcessInstance = undefined">选择其它流程</el-button> | |
| 3 | + <!-- TODO 审批信息 --> | |
| 4 | + <!-- 申请信息 --> | |
| 5 | + <el-card class="box-card" v-loading="processInstanceLoading"> | |
| 6 | + <div slot="header" class="clearfix"> | |
| 7 | + <span class="el-icon-document">申请信息【{{ processInstance.name }}】</span> | |
| 8 | + </div> | |
| 9 | + <el-col :span="16" :offset="6"> | |
| 10 | + <div> | |
| 11 | + <parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" /> | |
| 37 | 12 | </div> |
| 38 | - <el-col :span="16" :offset="6"> | |
| 39 | - <div> | |
| 40 | - <parser :key="new Date().getTime()" :form-conf="detailForm" @submit="submitForm" /> | |
| 41 | - </div> | |
| 42 | - </el-col> | |
| 43 | - </el-card> | |
| 44 | - <el-card class="box-card"> | |
| 45 | - <div slot="header" class="clearfix"> | |
| 46 | - <span class="el-icon-picture-outline">流程图</span> | |
| 47 | - </div> | |
| 48 | - <my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" /> | |
| 49 | - </el-card> | |
| 50 | - </div> | |
| 51 | - | |
| 13 | + </el-col> | |
| 14 | + </el-card> | |
| 15 | + <!-- TODO 审批记录 --> | |
| 16 | + <!-- TODO 流程图 --> | |
| 17 | + <el-card class="box-card" v-loading="processInstanceLoading"> | |
| 18 | + <div slot="header" class="clearfix"> | |
| 19 | + <span class="el-icon-picture-outline">流程图</span> | |
| 20 | + </div> | |
| 21 | + <my-process-viewer key="designer" v-model="bpmnXML" v-bind="bpmnControlForm" /> | |
| 22 | + </el-card> | |
| 52 | 23 | </div> |
| 53 | 24 | </template> |
| 54 | 25 | |
| ... | ... | @@ -58,7 +29,8 @@ import {DICT_TYPE, getDictDatas} from "@/utils/dict"; |
| 58 | 29 | import {getForm} from "@/api/bpm/form"; |
| 59 | 30 | import {decodeFields} from "@/utils/formGenerator"; |
| 60 | 31 | import Parser from '@/components/parser/Parser' |
| 61 | -import {createProcessInstance, getMyProcessInstancePage} from "@/api/bpm/processInstance"; | |
| 32 | +import {createProcessInstance, getMyProcessInstancePage, getProcessInstance} from "@/api/bpm/processInstance"; | |
| 33 | +import {getHistoricTaskListByProcessInstanceId} from "@/api/bpm/task"; | |
| 62 | 34 | |
| 63 | 35 | // 流程实例的详情页,可用于审批 |
| 64 | 36 | export default { |
| ... | ... | @@ -69,11 +41,10 @@ export default { |
| 69 | 41 | data() { |
| 70 | 42 | return { |
| 71 | 43 | // 遮罩层 |
| 72 | - loading: true, | |
| 73 | - // 总条数 | |
| 74 | - total: 0, | |
| 75 | - // 表格数据 | |
| 76 | - list: [], | |
| 44 | + processInstanceLoading: true, | |
| 45 | + // 流程实例 | |
| 46 | + id: undefined, // 流程实例的编号 | |
| 47 | + processInstance: {}, | |
| 77 | 48 | |
| 78 | 49 | // 流程表单详情 |
| 79 | 50 | detailForm: { |
| ... | ... | @@ -86,27 +57,65 @@ export default { |
| 86 | 57 | prefix: "activiti" |
| 87 | 58 | }, |
| 88 | 59 | |
| 89 | - // 流程表单 | |
| 90 | - selectProcessInstance: undefined, // 选择的流程实例 | |
| 60 | + // 审批记录 | |
| 61 | + historicTasksLoad: true, | |
| 62 | + historicTasks: [], | |
| 91 | 63 | |
| 92 | 64 | // 数据字典 |
| 93 | 65 | categoryDictDatas: getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY), |
| 94 | 66 | }; |
| 95 | 67 | }, |
| 96 | 68 | created() { |
| 97 | - this.getList(); | |
| 69 | + this.id = this.$route.query.id; | |
| 70 | + if (!this.id) { | |
| 71 | + this.$message.error('未传递 id 参数,无法查看流程信息'); | |
| 72 | + return; | |
| 73 | + } | |
| 74 | + this.getDetail(); | |
| 98 | 75 | }, |
| 99 | 76 | methods: { |
| 100 | - /** 查询流程定义列表 */ | |
| 101 | - getList() { | |
| 102 | - this.loading = true; | |
| 103 | - getProcessDefinitionList({ | |
| 104 | - suspensionState: 1 | |
| 105 | - }).then(response => { | |
| 106 | - this.list = response.data | |
| 107 | - this.loading = false | |
| 77 | + /** 获得流程实例 */ | |
| 78 | + getDetail() { | |
| 79 | + // 获得流程实例相关 | |
| 80 | + this.processInstanceLoading = true; | |
| 81 | + getProcessInstance(this.id).then(response => { | |
| 82 | + if (!response.data) { | |
| 83 | + this.$message.error('查询不到流程信息!'); | |
| 84 | + return; | |
| 108 | 85 | } |
| 109 | - ); | |
| 86 | + // 设置流程信息 | |
| 87 | + this.processInstance = response.data; | |
| 88 | + | |
| 89 | + // 设置表单信息 | |
| 90 | + this.detailForm = { | |
| 91 | + ...JSON.parse(this.processInstance.processDefinition.formConf), | |
| 92 | + disabled: true, // 表单禁用 | |
| 93 | + formBtns: false, // 按钮隐藏 | |
| 94 | + fields: decodeFields(this.processInstance.processDefinition.formFields) | |
| 95 | + } | |
| 96 | + // 设置表单的值 | |
| 97 | + this.detailForm.fields.forEach(item => { | |
| 98 | + const val = this.processInstance.formVariables[item.__vModel__] | |
| 99 | + if (val) { | |
| 100 | + item.__config__.defaultValue = val | |
| 101 | + } | |
| 102 | + }) | |
| 103 | + | |
| 104 | + // 加载流程图 | |
| 105 | + getProcessDefinitionBpmnXML(this.processInstance.processDefinition.id).then(response => { | |
| 106 | + this.bpmnXML = response.data | |
| 107 | + }) | |
| 108 | + | |
| 109 | + // 取消加载中 | |
| 110 | + this.processInstanceLoading = false; | |
| 111 | + }); | |
| 112 | + | |
| 113 | + // 获得流程任务列表(审批记录) | |
| 114 | + this.historicTasksLoad = true; | |
| 115 | + getHistoricTaskListByProcessInstanceId(this.id).then(response => { | |
| 116 | + this.historicTasks = response.data; | |
| 117 | + this.historicTasksLoad = true; | |
| 118 | + }); | |
| 110 | 119 | }, |
| 111 | 120 | /** 处理选择流程的按钮操作 **/ |
| 112 | 121 | handleSelect(row) { |
| ... | ... | @@ -121,10 +130,7 @@ export default { |
| 121 | 130 | fields: decodeFields(row.formFields) |
| 122 | 131 | } |
| 123 | 132 | |
| 124 | - // 加载流程图 | |
| 125 | - getProcessDefinitionBpmnXML(row.id).then(response => { | |
| 126 | - this.bpmnXML = response.data | |
| 127 | - }) | |
| 133 | + | |
| 128 | 134 | } else if (row.formCustomCreatePath) { |
| 129 | 135 | this.$router.push({ path: row.formCustomCreatePath}); |
| 130 | 136 | // 这里暂时无需加载流程图,因为跳出到另外个 Tab; | ... | ... |
yudao-admin-ui/src/views/bpm/task/todo.vue
| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 37 | 37 | <template slot-scope="scope"> |
| 38 | 38 | <!-- TODO 权限、颜色 --> |
| 39 | - <el-button size="mini" type="text" icon="el-icon-edit">审批</el-button> | |
| 39 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAudit(scope.row)">审批</el-button> | |
| 40 | 40 | <el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, true)">通过</el-button> |
| 41 | 41 | <el-button size="mini" type="text" icon="el-icon-edit" @click="audit(scope.row, false)">不通过</el-button> |
| 42 | 42 | <el-button size="mini" type="text" icon="el-icon-edit" v-if="scope.row.suspensionState === 2">激活</el-button> |
| ... | ... | @@ -104,6 +104,10 @@ export default { |
| 104 | 104 | this.resetForm("queryForm"); |
| 105 | 105 | this.handleQuery(); |
| 106 | 106 | }, |
| 107 | + /** 处理审批按钮 */ | |
| 108 | + handleAudit(row) { | |
| 109 | + this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.processInstance.id}}); | |
| 110 | + }, | |
| 107 | 111 | audit(row, pass) { |
| 108 | 112 | if (pass) { |
| 109 | 113 | approveTask({ | ... | ... |