Commit bb11acb15f188e938d97cfdcaa5753495d87dc48
1 parent
55a6ec78
实现我的流程的前端 UI 界面
Showing
9 changed files
with
314 additions
and
13 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/definition/BpmProcessDefinitionController.java
| ... | ... | @@ -36,16 +36,6 @@ public class BpmProcessDefinitionController { |
| 36 | 36 | return success(bpmDefinitionService.getProcessDefinitionPage(pageReqVO)); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - // TODO 芋艿:需要重写该方法 | |
| 40 | - @GetMapping(value = "/getStartForm") | |
| 41 | - public CommonResult<String> getStartForm(@RequestParam("processKey") String processKey){ | |
| 42 | -// final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery(). | |
| 43 | -// processDefinitionKey(processKey).latestVersion().singleResult(); | |
| 44 | -// processRuntime.processDefinition(processDefinition.getId()).getFormKey(); | |
| 45 | - // TODO 这样查似乎有问题??, 暂时写死 | |
| 46 | - return success("/flow/leave/apply"); | |
| 47 | - } | |
| 48 | - | |
| 49 | 39 | @GetMapping ("/get-bpmn-xml") |
| 50 | 40 | @ApiOperation(value = "获得流程定义的 BPMN XML") |
| 51 | 41 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = String.class) | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/instance/BpmProcessInstanceMyPageReqVO.java
| ... | ... | @@ -30,6 +30,9 @@ public class BpmProcessInstanceMyPageReqVO extends PageParam { |
| 30 | 30 | @ApiModelProperty(value = "流程实例的结果", notes = "参见 bpm_process_instance_result", example = "2") |
| 31 | 31 | private Integer result; |
| 32 | 32 | |
| 33 | + @ApiModelProperty(value = "流程分类", notes = "参见 bpm_model_category 数据字典", example = "1") | |
| 34 | + private String category; | |
| 35 | + | |
| 33 | 36 | @ApiModelProperty(value = "开始的创建时间") |
| 34 | 37 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 35 | 38 | private Date beginCreateTime; | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/instance/BpmProcessInstancePageItemRespVO.java
| ... | ... | @@ -28,9 +28,12 @@ public class BpmProcessInstancePageItemRespVO { |
| 28 | 28 | @ApiModelProperty(value = "流程实例的结果", required = true, notes = "参见 bpm_process_instance_result", example = "2") |
| 29 | 29 | private Integer result; |
| 30 | 30 | |
| 31 | - @ApiModelProperty(value = "创建时间", required = true) | |
| 31 | + @ApiModelProperty(value = "提交时间", required = true) | |
| 32 | 32 | private Date createTime; |
| 33 | 33 | |
| 34 | + @ApiModelProperty(value = "结束时间", required = true) | |
| 35 | + private Date endTime; | |
| 36 | + | |
| 34 | 37 | // TODO 芋艿:tasks |
| 35 | 38 | |
| 36 | 39 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java
| ... | ... | @@ -4,11 +4,15 @@ import cn.iocoder.yudao.adminserver.modules.bpm.enums.task.BpmProcessInstanceRes |
| 4 | 4 | import cn.iocoder.yudao.adminserver.modules.bpm.enums.task.BpmProcessInstanceStatusEnum; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 6 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | -import lombok.*; | |
| 7 | +import lombok.Data; | |
| 8 | +import lombok.EqualsAndHashCode; | |
| 9 | +import lombok.ToString; | |
| 8 | 10 | import org.activiti.engine.history.HistoricProcessInstance; |
| 9 | 11 | import org.activiti.engine.repository.ProcessDefinition; |
| 10 | 12 | import org.activiti.engine.runtime.ProcessInstance; |
| 11 | 13 | |
| 14 | +import java.util.Date; | |
| 15 | + | |
| 12 | 16 | /** |
| 13 | 17 | * Bpm 流程实例的拓展表 |
| 14 | 18 | * 主要解决 Activiti {@link ProcessInstance} 和 {@link HistoricProcessInstance} 不支持拓展字段,所以新建拓展表 |
| ... | ... | @@ -67,5 +71,11 @@ public class BpmProcessInstanceExtDO extends BaseDO { |
| 67 | 71 | * 枚举 {@link BpmProcessInstanceResultEnum} |
| 68 | 72 | */ |
| 69 | 73 | private Integer result; |
| 74 | + /** | |
| 75 | + * 结束时间 | |
| 76 | + * | |
| 77 | + * 冗余 {@link HistoricProcessInstance#getEndTime()} | |
| 78 | + */ | |
| 79 | + private Date endTime; | |
| 70 | 80 | |
| 71 | 81 | } | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/mysql/task/BpmProcessInstanceExtMapper.java
| ... | ... | @@ -15,6 +15,7 @@ public interface BpmProcessInstanceExtMapper extends BaseMapperX<BpmProcessInsta |
| 15 | 15 | .eqIfPresent("user_id", userId) |
| 16 | 16 | .likeIfPresent("name", reqVO.getName()) |
| 17 | 17 | .eqIfPresent("process_definition_id", reqVO.getProcessDefinitionId()) |
| 18 | + .eqIfPresent("category", reqVO.getCategory()) | |
| 18 | 19 | .eqIfPresent("status", reqVO.getStatus()) |
| 19 | 20 | .eqIfPresent("result", reqVO.getResult()) |
| 20 | 21 | .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) | ... | ... |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/task/BpmProcessInstanceStatusEnum.java
yudao-admin-ui/src/api/bpm/processInstance.js
0 → 100644
yudao-admin-ui/src/utils/dict.js
| ... | ... | @@ -36,6 +36,8 @@ export const DICT_TYPE = { |
| 36 | 36 | |
| 37 | 37 | // bpm |
| 38 | 38 | BPM_MODEL_CATEGORY: 'bpm_model_category', |
| 39 | + BPM_PROCESS_INSTANCE_STATUS: 'bpm_process_instance_status', | |
| 40 | + BPM_PROCESS_INSTANCE_RESULT: 'bpm_process_instance_result', | |
| 39 | 41 | OA_LEAVE_STATUS: 'flow_status', |
| 40 | 42 | OA_LEAVE_TYPE: 'oa_leave_type' |
| 41 | 43 | } | ... | ... |
yudao-admin-ui/src/views/bpm/process/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + | |
| 4 | + <!-- 搜索工作栏 --> | |
| 5 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | |
| 6 | + <el-form-item label="流程名" prop="name"> | |
| 7 | + <el-input v-model="queryParams.name" placeholder="请输入流程名" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 8 | + </el-form-item> | |
| 9 | + <el-form-item label="所属流程" prop="processDefinitionId"> | |
| 10 | + <el-input v-model="queryParams.processDefinitionId" placeholder="请输入流程定义的编号" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 11 | + </el-form-item> | |
| 12 | + <el-form-item label="流程分类" prop="category"> | |
| 13 | + <el-select v-model="queryParams.category" placeholder="请选择流程分类" clearable size="small"> | |
| 14 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY)" | |
| 15 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 16 | + </el-select> | |
| 17 | + </el-form-item> | |
| 18 | + <el-form-item label="提交时间"> | |
| 19 | + <el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" | |
| 20 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | |
| 21 | + </el-form-item> | |
| 22 | + <el-form-item label="状态" prop="status"> | |
| 23 | + <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small"> | |
| 24 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)" | |
| 25 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 26 | + </el-select> | |
| 27 | + </el-form-item> | |
| 28 | + <el-form-item label="结果" prop="result"> | |
| 29 | + <el-select v-model="queryParams.result" placeholder="请选择流结果" clearable size="small"> | |
| 30 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)" | |
| 31 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 32 | + </el-select> | |
| 33 | + </el-form-item> | |
| 34 | + <el-form-item> | |
| 35 | + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | |
| 36 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | |
| 37 | + </el-form-item> | |
| 38 | + </el-form> | |
| 39 | + | |
| 40 | + <!-- 操作工具栏 --> | |
| 41 | + <el-row :gutter="10" class="mb8"> | |
| 42 | + <el-col :span="1.5"> | |
| 43 | + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">发起流程</el-button> | |
| 44 | + </el-col> | |
| 45 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 46 | + </el-row> | |
| 47 | + | |
| 48 | + <!-- 列表 --> | |
| 49 | + <el-table v-loading="loading" :data="list"> | |
| 50 | + <el-table-column label="编号" align="center" prop="id" width="300" /> | |
| 51 | + <el-table-column label="流程名" align="center" prop="name" /> | |
| 52 | + <el-table-column label="流程分类" align="center" prop="category"> | |
| 53 | + <template slot-scope="scope"> | |
| 54 | + <span>{{ getDictDataLabel(DICT_TYPE.BPM_MODEL_CATEGORY, scope.row.category) }}</span> | |
| 55 | + </template> | |
| 56 | + </el-table-column> | |
| 57 | + <el-table-column label="当前审批任务" align="center" prop="tasks" /> <!-- TODO 芋艿:待完善 --> | |
| 58 | + <el-table-column label="状态" align="center" prop="status"> | |
| 59 | + <template slot-scope="scope"> | |
| 60 | + <span> | |
| 61 | + <el-tag type="primary" v-if="scope.row.result === 1"> <!-- 进行中 --> | |
| 62 | + {{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS, scope.row.result) }} | |
| 63 | + </el-tag> | |
| 64 | + <el-tag type="success" v-if="scope.row.result === 2"> <!-- 已结束 --> | |
| 65 | + {{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS, scope.row.result) }} | |
| 66 | + </el-tag> | |
| 67 | + </span> | |
| 68 | + </template> | |
| 69 | + </el-table-column> | |
| 70 | + <el-table-column label="结果" align="center" prop="result"> | |
| 71 | + <template slot-scope="scope"> | |
| 72 | + <span> | |
| 73 | + <el-tag type="primary" v-if="scope.row.result === 1"> <!-- 进行中 --> | |
| 74 | + {{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }} | |
| 75 | + </el-tag> | |
| 76 | + <el-tag type="success" v-if="scope.row.result === 2"> <!-- 通过 --> | |
| 77 | + {{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }} | |
| 78 | + </el-tag> | |
| 79 | + <el-tag type="danger" v-if="scope.row.result === 3"> <!-- 不通过 --> | |
| 80 | + {{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }} | |
| 81 | + </el-tag> | |
| 82 | + <el-tag type="info" v-if="scope.row.result === 4"> <!-- 撤回 --> | |
| 83 | + {{ getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, scope.row.result) }} | |
| 84 | + </el-tag> | |
| 85 | + </span> | |
| 86 | + </template> | |
| 87 | + </el-table-column> | |
| 88 | + <el-table-column label="提交时间" align="center" prop="createTime" width="180"> | |
| 89 | + <template slot-scope="scope"> | |
| 90 | + <span>{{ parseTime(scope.row.createTime) }}</span> | |
| 91 | + </template> | |
| 92 | + </el-table-column> | |
| 93 | + <el-table-column label="结束时间" align="center" prop="createTime" width="180"> | |
| 94 | + <template slot-scope="scope"> | |
| 95 | + <span>{{ parseTime(scope.row.endTime) }}</span> | |
| 96 | + </template> | |
| 97 | + </el-table-column> | |
| 98 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 99 | + <template slot-scope="scope"> | |
| 100 | +<!-- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"--> | |
| 101 | +<!-- v-hasPermi="['bpm:process-instance-ext:update']">修改</el-button>--> | |
| 102 | + </template> | |
| 103 | + </el-table-column> | |
| 104 | + </el-table> | |
| 105 | + <!-- 分页组件 --> | |
| 106 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 107 | + @pagination="getList"/> | |
| 108 | + | |
| 109 | + <!-- 对话框(添加 / 修改) --> | |
| 110 | + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | |
| 111 | + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | |
| 112 | + <el-form-item label="发起流程的用户编号" prop="userId"> | |
| 113 | + <el-input v-model="form.userId" placeholder="请输入发起流程的用户编号" /> | |
| 114 | + </el-form-item> | |
| 115 | + <el-form-item label="流程实例的名字" prop="name"> | |
| 116 | + <el-input v-model="form.name" placeholder="请输入流程实例的名字" /> | |
| 117 | + </el-form-item> | |
| 118 | + <el-form-item label="流程实例的编号" prop="processInstanceId"> | |
| 119 | + <el-input v-model="form.processInstanceId" placeholder="请输入流程实例的编号" /> | |
| 120 | + </el-form-item> | |
| 121 | + <el-form-item label="流程定义的编号" prop="processDefinitionId"> | |
| 122 | + <el-input v-model="form.processDefinitionId" placeholder="请输入流程定义的编号" /> | |
| 123 | + </el-form-item> | |
| 124 | + <el-form-item label="流程分类" prop="category"> | |
| 125 | + <el-select v-model="form.category" placeholder="请选择流程分类"> | |
| 126 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY)" | |
| 127 | + :key="dict.value" :label="dict.label" :value="dict.value" /> | |
| 128 | + </el-select> | |
| 129 | + </el-form-item> | |
| 130 | + <el-form-item label="流程实例的名字" prop="status"> | |
| 131 | + <el-select v-model="form.status" placeholder="请选择流程实例的名字"> | |
| 132 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS)" | |
| 133 | + :key="dict.value" :label="dict.label" :value="parseInt(dict.value)" /> | |
| 134 | + </el-select> | |
| 135 | + </el-form-item> | |
| 136 | + <el-form-item label="流程实例的结果" prop="result"> | |
| 137 | + <el-select v-model="form.result" placeholder="请选择流程实例的结果"> | |
| 138 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)" | |
| 139 | + :key="dict.value" :label="dict.label" :value="parseInt(dict.value)" /> | |
| 140 | + </el-select> | |
| 141 | + </el-form-item> | |
| 142 | + </el-form> | |
| 143 | + <div slot="footer" class="dialog-footer"> | |
| 144 | + <el-button type="primary" @click="submitForm">确 定</el-button> | |
| 145 | + <el-button @click="cancel">取 消</el-button> | |
| 146 | + </div> | |
| 147 | + </el-dialog> | |
| 148 | + </div> | |
| 149 | +</template> | |
| 150 | + | |
| 151 | +<script> | |
| 152 | +import { | |
| 153 | + getMyProcessInstancePage, | |
| 154 | + createProcessInstanceExt, | |
| 155 | + updateProcessInstanceExt, | |
| 156 | + deleteProcessInstanceExt, | |
| 157 | + getProcessInstanceExt, | |
| 158 | + getProcessInstanceExtPage, | |
| 159 | + exportProcessInstanceExtExcel | |
| 160 | +} from "@/api/bpm/processInstance"; | |
| 161 | + | |
| 162 | +export default { | |
| 163 | + name: "ProcessInstanceExt", | |
| 164 | + components: { | |
| 165 | + }, | |
| 166 | + data() { | |
| 167 | + return { | |
| 168 | + // 遮罩层 | |
| 169 | + loading: true, | |
| 170 | + // 显示搜索条件 | |
| 171 | + showSearch: true, | |
| 172 | + // 总条数 | |
| 173 | + total: 0, | |
| 174 | + // 工作流的流程实例的拓展列表 | |
| 175 | + list: [], | |
| 176 | + // 弹出层标题 | |
| 177 | + title: "", | |
| 178 | + // 是否显示弹出层 | |
| 179 | + open: false, | |
| 180 | + dateRangeCreateTime: [], | |
| 181 | + // 查询参数 | |
| 182 | + queryParams: { | |
| 183 | + pageNo: 1, | |
| 184 | + pageSize: 10, | |
| 185 | + name: null, | |
| 186 | + processDefinitionId: null, | |
| 187 | + category: null, | |
| 188 | + status: null, | |
| 189 | + result: null, | |
| 190 | + }, | |
| 191 | + // 表单参数 | |
| 192 | + form: {}, | |
| 193 | + // 表单校验 | |
| 194 | + rules: { | |
| 195 | + userId: [{ required: true, message: "发起流程的用户编号不能为空", trigger: "blur" }], | |
| 196 | + name: [{ required: true, message: "流程实例的名字不能为空", trigger: "blur" }], | |
| 197 | + processInstanceId: [{ required: true, message: "流程实例的编号不能为空", trigger: "blur" }], | |
| 198 | + processDefinitionId: [{ required: true, message: "流程定义的编号不能为空", trigger: "blur" }], | |
| 199 | + category: [{ required: true, message: "流程分类不能为空", trigger: "change" }], | |
| 200 | + status: [{ required: true, message: "流程实例的名字不能为空", trigger: "change" }], | |
| 201 | + result: [{ required: true, message: "流程实例的结果不能为空", trigger: "change" }], | |
| 202 | + } | |
| 203 | + }; | |
| 204 | + }, | |
| 205 | + created() { | |
| 206 | + this.getList(); | |
| 207 | + }, | |
| 208 | + methods: { | |
| 209 | + /** 查询列表 */ | |
| 210 | + getList() { | |
| 211 | + this.loading = true; | |
| 212 | + // 处理查询参数 | |
| 213 | + let params = {...this.queryParams}; | |
| 214 | + this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime'); | |
| 215 | + // 执行查询 | |
| 216 | + getMyProcessInstancePage(params).then(response => { | |
| 217 | + this.list = response.data.list; | |
| 218 | + this.total = response.data.total; | |
| 219 | + this.loading = false; | |
| 220 | + }); | |
| 221 | + }, | |
| 222 | + /** 取消按钮 */ | |
| 223 | + cancel() { | |
| 224 | + this.open = false; | |
| 225 | + this.reset(); | |
| 226 | + }, | |
| 227 | + /** 表单重置 */ | |
| 228 | + reset() { | |
| 229 | + this.form = { | |
| 230 | + id: undefined, | |
| 231 | + userId: undefined, | |
| 232 | + name: undefined, | |
| 233 | + processInstanceId: undefined, | |
| 234 | + processDefinitionId: undefined, | |
| 235 | + category: undefined, | |
| 236 | + status: undefined, | |
| 237 | + result: undefined, | |
| 238 | + }; | |
| 239 | + this.resetForm("form"); | |
| 240 | + }, | |
| 241 | + /** 搜索按钮操作 */ | |
| 242 | + handleQuery() { | |
| 243 | + this.queryParams.pageNo = 1; | |
| 244 | + this.getList(); | |
| 245 | + }, | |
| 246 | + /** 重置按钮操作 */ | |
| 247 | + resetQuery() { | |
| 248 | + this.dateRangeCreateTime = []; | |
| 249 | + this.resetForm("queryForm"); | |
| 250 | + this.handleQuery(); | |
| 251 | + }, | |
| 252 | + /** 新增按钮操作 */ | |
| 253 | + handleAdd() { | |
| 254 | + this.reset(); | |
| 255 | + this.open = true; | |
| 256 | + this.title = "添加工作流的流程实例的拓展"; | |
| 257 | + }, | |
| 258 | + /** 提交按钮 */ | |
| 259 | + submitForm() { | |
| 260 | + this.$refs["form"].validate(valid => { | |
| 261 | + if (!valid) { | |
| 262 | + return; | |
| 263 | + } | |
| 264 | + // 修改的提交 | |
| 265 | + if (this.form.id != null) { | |
| 266 | + updateProcessInstanceExt(this.form).then(response => { | |
| 267 | + this.msgSuccess("修改成功"); | |
| 268 | + this.open = false; | |
| 269 | + this.getList(); | |
| 270 | + }); | |
| 271 | + return; | |
| 272 | + } | |
| 273 | + // 添加的提交 | |
| 274 | + createProcessInstanceExt(this.form).then(response => { | |
| 275 | + this.msgSuccess("新增成功"); | |
| 276 | + this.open = false; | |
| 277 | + this.getList(); | |
| 278 | + }); | |
| 279 | + }); | |
| 280 | + } | |
| 281 | + } | |
| 282 | +}; | |
| 283 | +</script> | ... | ... |