feat(流程设计): 更改人员列表为后端接口获取

approve-sys
zhuyong 3 years ago
parent 7a1ff7b7e9
commit 6cfec4ef7f

@ -1,14 +1,15 @@
package com.ruoyi.flowable.controller; package com.ruoyi.flowable.controller;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.flowable.domain.dto.FlowProcDefDto; import com.ruoyi.flowable.domain.dto.FlowProcDefDto;
import com.ruoyi.flowable.domain.dto.FlowSaveXmlVo; import com.ruoyi.flowable.domain.dto.FlowSaveXmlVo;
import com.ruoyi.flowable.service.IFlowDefinitionService; import com.ruoyi.flowable.service.IFlowDefinitionService;
import com.ruoyi.system.service.ISysUserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.IOUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -21,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -40,6 +42,9 @@ public class FlowDefinitionController {
@Autowired @Autowired
private IFlowDefinitionService flowDefinitionService; private IFlowDefinitionService flowDefinitionService;
@Autowired
private ISysUserService userService;
@GetMapping(value = "/list") @GetMapping(value = "/list")
@ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class) @ApiOperation(value = "流程定义列表", response = FlowProcDefDto.class)
@ -80,7 +85,7 @@ public class FlowDefinitionController {
public AjaxResult readXml(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) { public AjaxResult readXml(@ApiParam(value = "流程定义id") @PathVariable(value = "deployId") String deployId) {
try { try {
return flowDefinitionService.readXml(deployId); return flowDefinitionService.readXml(deployId);
}catch (Exception e) { } catch (Exception e) {
return AjaxResult.error("加载xml文件异常"); return AjaxResult.error("加载xml文件异常");
} }
@ -98,9 +103,9 @@ public class FlowDefinitionController {
if (image != null) { if (image != null) {
ImageIO.write(image, "png", os); ImageIO.write(image, "png", os);
} }
}catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
try { try {
if (os != null) { if (os != null) {
os.flush(); os.flush();
@ -161,4 +166,11 @@ public class FlowDefinitionController {
return AjaxResult.success(); return AjaxResult.success();
} }
@ApiOperation(value = "指定流程办理人员列表")
@GetMapping("/userList")
public AjaxResult userList(SysUser user) {
List<SysUser> list = userService.selectUserList(user);
return AjaxResult.success(list);
}
} }

@ -35,6 +35,15 @@ export function updateState(params) {
}) })
} }
// 指定流程办理人员列表
export function userList(query) {
return request({
url: '/flowable/definition/userList',
method: 'get',
params: query
})
}
// 读取xml文件 // 读取xml文件
export function readXml(deployId) { export function readXml(deployId) {
return request({ return request({

@ -122,7 +122,7 @@ export default {
label: '指定人员', label: '指定人员',
allowCreate: true, allowCreate: true,
filterable: true, filterable: true,
dic: { data: _this.users, label: 'name', value: 'id' }, dic: { data: _this.users, label: 'nickName', value: 'userId' },
show: !!_this.showConfig.assignee && _this.formData.userType === 'assignee' show: !!_this.showConfig.assignee && _this.formData.userType === 'assignee'
}, },
{ {
@ -132,7 +132,7 @@ export default {
multiple: true, multiple: true,
allowCreate: true, allowCreate: true,
filterable: true, filterable: true,
dic: { data: _this.users, label: 'name', value: 'id' }, dic: { data: _this.users, label: 'nickName', value: 'userId' },
show: !!_this.showConfig.candidateUsers && _this.formData.userType === 'candidateUsers' show: !!_this.showConfig.candidateUsers && _this.formData.userType === 'candidateUsers'
}, },
{ {

@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import { readXml, saveXml } from "@/api/flowable/definition"; import { readXml, saveXml, userList } from "@/api/flowable/definition";
// import bpmnModeler from "workflow-bpmn-modeler"; // import bpmnModeler from "workflow-bpmn-modeler";
import bpmnModeler from '@/components/Process/index' import bpmnModeler from '@/components/Process/index'
@ -26,9 +26,9 @@ export default {
return { return {
xml: "", // xml xml: "", // xml
users: [ users: [
{ name: "张三", id: "1" }, // { name: "", id: "1" },
{ name: "李四", id: "2" }, // { name: "", id: "2" },
{ name: "轩轩", id: "100" }, // { name: "", id: "100" },
], ],
groups: [ groups: [
{ name: "超级管理员", id: "1" }, { name: "超级管理员", id: "1" },
@ -43,30 +43,44 @@ export default {
}, },
created () { created () {
const deployId = this.$route.query && this.$route.query.deployId; const deployId = this.$route.query && this.$route.query.deployId;
// xml
if (deployId) { if (deployId) {
this.getModelDetail(deployId); this.getModelDetail(deployId);
} }
this.getUserList()
}, },
methods: { methods: {
/** xml 文件 */
getModelDetail(deployId) { getModelDetail(deployId) {
// xml // xml
readXml(deployId).then(res =>{ readXml(deployId).then(res =>{
this.xml = res.data this.xml = res.data
}) })
}, },
/** 保存xml */
save(data) { save(data) {
const params = { const params = {
name: data.process.name, name: data.process.name,
category: data.process.category, category: data.process.category,
xml: data.xml xml: data.xml
} }
saveXml(params).then(res =>{ saveXml(params).then(res => {
this.$message(res.msg) this.$message(res.msg)
// //
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch("tagsView/delView", this.$route);
this.$router.go(-1) this.$router.go(-1)
}) })
}, },
/** 指定流程办理人员列表 */
getUserList() {
// todo
// const params = {
//
// }
userList().then(res =>{
this.users = res.data
})
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save