add : 工单流程交互开发
This commit is contained in:
@@ -23,26 +23,7 @@ public class FlwInstanceController {
|
||||
@Lazy
|
||||
private FlwInstanceService instanceService;
|
||||
|
||||
/**
|
||||
* 发起流程
|
||||
*/
|
||||
@RequestMapping("/startFlowInstance")
|
||||
public R startFlowInstance(@RequestParam Map<String, Object> params){
|
||||
|
||||
instanceService.startFlowInstance(params);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起流程
|
||||
*/
|
||||
@RequestMapping("/startFlowInstance1")
|
||||
public R startFlowInstance1(@RequestParam Map<String, Object> params){
|
||||
|
||||
instanceService.startFlowInstance1(params);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,7 +58,7 @@ public class FlwInstanceController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批通过
|
||||
* 提交审批
|
||||
*/
|
||||
@PostMapping("/completeFlow")
|
||||
public R completeFlow(@RequestBody Map<String, Object> params){
|
||||
@@ -86,30 +67,6 @@ public class FlwInstanceController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 任务节点1审批通过工单完结
|
||||
*/
|
||||
@PostMapping("/completeFlow1")
|
||||
public R completeFlow1(@RequestBody Map<String, Object> params){
|
||||
|
||||
R r = instanceService.completeTaskById1(params);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 任务节点1无法解决进入下一个节点
|
||||
*/
|
||||
@PostMapping("/deleteFlow1")
|
||||
public R deleteFlow1(@RequestBody Map<String, Object> params){
|
||||
|
||||
R r = instanceService.deleteFlow1(params);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 终结流程
|
||||
|
||||
@@ -9,13 +9,11 @@ import java.util.Map;
|
||||
public interface FlwInstanceService {
|
||||
void startFlowInstance(Map<String, Object> params);
|
||||
|
||||
void startFlowInstance1(Map<String, Object> params);
|
||||
|
||||
R getTodoTaskList(Map<String, Object> params);
|
||||
|
||||
R completeTaskById(Map<String, Object> id);
|
||||
|
||||
R completeTaskById1(Map<String, Object> id);
|
||||
|
||||
void unclaimTask(String id);
|
||||
|
||||
@@ -33,5 +31,4 @@ public interface FlwInstanceService {
|
||||
|
||||
R deleteFlow(Map<String, Object> params);
|
||||
|
||||
R deleteFlow1(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -215,26 +215,7 @@ public class FlwDeployServiceImpl extends FlowServiceNoFactory implements FlwDep
|
||||
map.put("value", "");
|
||||
map.put("key", findFlowDefUserOrGroup(assignee));
|
||||
list.add(map);
|
||||
} else if (candidateUsers != null && candidateUsers.size() > 0) {
|
||||
// 指定的候选人
|
||||
String join = String.join(",", candidateUsers);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("name", flowElement.getName());
|
||||
map.put("type", "candidateUsers");
|
||||
// ${user1} ${user2},${user3} ${group1}
|
||||
map.put("value", "");
|
||||
map.put("key", findFlowDefUserOrGroup(join));
|
||||
list.add(map);
|
||||
|
||||
} else if (candidateGroups != null && candidateGroups.size() > 0) {
|
||||
String join = String.join(",", candidateGroups);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("name", flowElement.getName());
|
||||
map.put("type", "candidateGroups");
|
||||
// ${user1} ${user2},${user3} ${group1}
|
||||
map.put("value", "");
|
||||
map.put("key", findFlowDefUserOrGroup(join));
|
||||
list.add(map);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ import com.boge.modules.sys.entity.SysUserEntity;
|
||||
import com.boge.modules.sys.service.SysRoleService;
|
||||
import com.boge.modules.sys.service.SysUserService;
|
||||
import com.boge.modules.sys.service.impl.SysUserServiceImpl;
|
||||
import com.boge.modules.tickets.dao.TicketsDao;
|
||||
import com.boge.modules.tickets.entity.TicketsEntity;
|
||||
import com.boge.modules.tickets.enums.TicketUserEnums;
|
||||
import com.boge.modules.tickets.enums.TicketsStatusEnums;
|
||||
import com.boge.modules.tickets.service.TicketsService;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
@@ -69,7 +71,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
|
||||
@Value("${ProcessInstance.defId}")
|
||||
private String defId;
|
||||
|
||||
@Autowired
|
||||
private TicketsDao ticketsDao;
|
||||
//发送消息的类型
|
||||
private final static String MSGTYPE = "text";
|
||||
//将消息发送给所有成员
|
||||
@@ -84,7 +87,6 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
private final static String CREATE_SESSION_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=";
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void startFlowInstance(Map<String, Object> params) {
|
||||
SysUserEntity loginUser = ShiroUtils.getUserEntity();
|
||||
@@ -101,7 +103,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
// 启动流程
|
||||
try {
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(defId, variable);
|
||||
}catch (FlowableException e){
|
||||
} catch (FlowableException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SysUserEntity user = sysUserService.getById(userId);
|
||||
@@ -114,8 +116,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
// ticketsEntity.setAssignUserId(userId);
|
||||
// ticketsService.updateById(ticketsEntity);
|
||||
|
||||
if (StrUtil.isEmpty(user.getWexinId())){
|
||||
throw new RRException("企业id为空,企业微信消息无法推送");
|
||||
if (StrUtil.isEmpty(user.getWexinId())) {
|
||||
throw new RRException("企业id为空,企业微信消息无法推送");
|
||||
}
|
||||
|
||||
String accessToken = getAccessToken();
|
||||
@@ -124,17 +126,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startFlowInstance1(Map<String, Object> params) {
|
||||
// 启动流程
|
||||
try {
|
||||
Map<String, Object> startVars = new HashMap<>();
|
||||
runtimeService.startProcessInstanceById(defId, startVars); }
|
||||
catch (FlowableException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取access_token
|
||||
@@ -179,7 +171,6 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void sendWeChatMessage(String toUser, String content, String ACCESS_TOKEN, String ticketsId) {
|
||||
//请求串
|
||||
String url = CREATE_SESSION_URL + ACCESS_TOKEN;
|
||||
@@ -190,7 +181,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
JSONObject contentJSon = new JSONObject();
|
||||
contentJSon.put("title", "[协同提醒] - 工单审批待处理");
|
||||
contentJSon.put("description", "点击查看详情");
|
||||
contentJSon.put("url", "http://localhost:8001/#/tickets-detail?id="+ticketsId);
|
||||
contentJSon.put("url", "http://localhost:8001/#/tickets-detail?id=" + ticketsId);
|
||||
contentJSon.put("btntxt", "处理");
|
||||
|
||||
jsonObject.put("textcard", contentJSon);
|
||||
@@ -219,7 +210,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(result);
|
||||
int errcode = jsonObject1.getInteger("errcode");
|
||||
if (Objects.equals(42001, errcode)) {
|
||||
throw new RRException("发送企业微信 token 失效");
|
||||
throw new RRException("发送企业微信 token 失效");
|
||||
}
|
||||
if (Objects.equals(0, errcode)) {
|
||||
System.out.println("消息发送成功");
|
||||
@@ -242,33 +233,31 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static void packageData(Map<String, Object> params, Set<String> keys, Map<String, Object> variable) {
|
||||
if(keys != null){
|
||||
if (keys != null) {
|
||||
for (String key : keys) {
|
||||
if("id".equals(key) || "t".equals(key)){
|
||||
if ("id".equals(key) || "t".equals(key)) {
|
||||
continue;
|
||||
}
|
||||
String value = (String) params.get(key);
|
||||
if(key.contains(",")){
|
||||
if (key.contains(",")) {
|
||||
String[] split = key.split(",");
|
||||
int i = 0;
|
||||
for (String s : split) {
|
||||
if(value.contains(",")){
|
||||
if (value.contains(",")) {
|
||||
String[] split1 = value.split(",");
|
||||
if(split1.length >= i){
|
||||
variable.put(s,split1[i]);
|
||||
}else{
|
||||
variable.put(s,split1[0]);
|
||||
if (split1.length >= i) {
|
||||
variable.put(s, split1[i]);
|
||||
} else {
|
||||
variable.put(s, split1[0]);
|
||||
}
|
||||
}else{
|
||||
variable.put(s,value);
|
||||
} else {
|
||||
variable.put(s, value);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}else{
|
||||
variable.put(key,value);
|
||||
} else {
|
||||
variable.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -276,9 +265,9 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
|
||||
/**
|
||||
* 查询我的待办任务
|
||||
* 审批人
|
||||
* 候选人
|
||||
* 候选人组
|
||||
* 审批人
|
||||
* 候选人
|
||||
* 候选人组
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
@@ -286,8 +275,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
@Override
|
||||
public R getTodoTaskList(Map<String, Object> params) {
|
||||
// 获取到分页的信息
|
||||
Integer page = Integer.parseInt((String)params.getOrDefault(Constant.PAGE,1));
|
||||
Integer limit = Integer.parseInt((String) params.getOrDefault(Constant.LIMIT,5));
|
||||
Integer page = Integer.parseInt((String) params.getOrDefault(Constant.PAGE, 1));
|
||||
Integer limit = Integer.parseInt((String) params.getOrDefault(Constant.LIMIT, 5));
|
||||
// 获取当前的登录用户
|
||||
SysUserEntity loginUser = ShiroUtils.getUserEntity();
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
@@ -303,13 +292,13 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
List<Task> tasks = taskQuery.listPage((page - 1) * limit, page * limit);
|
||||
long count = taskQuery.count();
|
||||
List<FlwTaskEntity> list = new ArrayList<>();
|
||||
if(tasks != null && tasks.size() > 0){
|
||||
if (tasks != null && tasks.size() > 0) {
|
||||
for (Task task : tasks) {
|
||||
FlwTaskEntity entity = new FlwTaskEntity();
|
||||
entity.setTaskId(task.getId());
|
||||
entity.setCategory(task.getCategory());
|
||||
entity.setAssigneeId(task.getAssignee());
|
||||
if(task.getAssignee() != null){
|
||||
if (task.getAssignee() != null) {
|
||||
SysUserEntity assigneeUser = userService.getById(task.getAssignee());
|
||||
entity.setAssigneeName(assigneeUser.getNickname());
|
||||
}
|
||||
@@ -327,91 +316,99 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
// 任务的发起人
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(entity.getProcInsId()).singleResult();
|
||||
if(historicProcessInstance != null){
|
||||
if (historicProcessInstance != null) {
|
||||
String startUserId = historicProcessInstance.getStartUserId();
|
||||
entity.setStartTime(historicProcessInstance.getStartTime());
|
||||
entity.setStartUserId(startUserId);
|
||||
if(StringUtils.isNotBlank(startUserId)){
|
||||
if (StringUtils.isNotBlank(startUserId)) {
|
||||
SysUserEntity startUser = userService.getById(startUserId);
|
||||
entity.setStartUserName(startUser.getNickname());
|
||||
}
|
||||
}
|
||||
// 通过 BpmnModel 对象来检查当前的节点的 定义信息
|
||||
entity.setStatus(getUserTaskStatus(task.getProcessDefinitionId(),task.getTaskDefinitionKey()));
|
||||
entity.setStatus(getUserTaskStatus(task.getProcessDefinitionId(), task.getTaskDefinitionKey()));
|
||||
list.add(entity);
|
||||
}
|
||||
}
|
||||
PageUtils pageUtils = new PageUtils(list,(int)count,limit,page);
|
||||
return R.ok("操作成功").put("page",pageUtils);
|
||||
PageUtils pageUtils = new PageUtils(list, (int) count, limit, page);
|
||||
return R.ok("操作成功").put("page", pageUtils);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R completeTaskById(Map<String, Object> params) {
|
||||
String processInstance = (String) params.get("processInstance");
|
||||
// Integer ticketsId = (Integer) params.get("ticketsId");
|
||||
if(StringUtils.isBlank(processInstance)){
|
||||
Integer ticketsId = (Integer) params.get("ticketsId");
|
||||
String result = (String) params.get("result");
|
||||
String opinion = (String) params.get("opinion");
|
||||
|
||||
if (StringUtils.isBlank(processInstance)) {
|
||||
return R.error("流程Id不能为空");
|
||||
}
|
||||
TaskQuery taskQuery = taskService.createTaskQuery().active().processInstanceId(processInstance);
|
||||
List<Task> tasks = taskQuery.list();
|
||||
if (!tasks.isEmpty()){
|
||||
taskService.complete(tasks.get(0).getId());
|
||||
if (StringUtils.isBlank(processInstance)) {
|
||||
return R.error("流程Id不能为空");
|
||||
}
|
||||
Task secondTask = taskService.createTaskQuery()
|
||||
.processInstanceId(processInstance)
|
||||
.singleResult();
|
||||
Map<String, Object> secondApprovalVars = new HashMap<>();
|
||||
TicketsEntity ticketsEntity = new TicketsEntity();
|
||||
// 完结流程
|
||||
if (Objects.nonNull(secondTask) && StrUtil.isNotEmpty(result) && result.equals("完结")) {
|
||||
secondApprovalVars.put("approvalResult", true);
|
||||
ticketsEntity.setStatus(TicketsStatusEnums.FINISH.getCode());
|
||||
ticketsEntity.setFinishTime(new Date());
|
||||
ticketsEntity.setAssignUserId(TicketUserEnums.SPECIALIST.getCode());
|
||||
taskService.complete(secondTask.getId(), secondApprovalVars);
|
||||
}
|
||||
// 继续流程
|
||||
if (Objects.nonNull(secondTask) && StrUtil.isNotEmpty(result) && result.equals("同意")) {
|
||||
secondApprovalVars.put("approvalResult", false);
|
||||
ticketsEntity.setAssignUserId(TicketUserEnums.MANAGER.getCode());
|
||||
taskService.complete(secondTask.getId(), secondApprovalVars);
|
||||
}
|
||||
|
||||
// 指派处理人
|
||||
if (Objects.nonNull(secondTask) && StrUtil.isNotEmpty(result) && result.equals("指派")) {
|
||||
String userId = String.valueOf(params.get("userId"));
|
||||
Map<String, Object> startVars = new HashMap<>();
|
||||
startVars.put("user1",userId);
|
||||
ticketsEntity.setAssignUserId(Long.valueOf(userId));
|
||||
taskService.complete(secondTask.getId(), startVars);
|
||||
}
|
||||
|
||||
// 继续流程
|
||||
if (Objects.nonNull(secondTask) && StrUtil.isNotEmpty(result) && result.equals("提交")) {
|
||||
ticketsEntity.setAssignUserId(TicketUserEnums.SPECIALIST.getCode());
|
||||
taskService.complete(secondTask.getId(), secondApprovalVars);
|
||||
}
|
||||
|
||||
String processName = ticketsDao.selectByProcessInstance(processInstance);
|
||||
if (StringUtils.isNotBlank(processName)&& processName.contains("完结")){
|
||||
ticketsEntity.setStatus(TicketsStatusEnums.FINISH.getCode());
|
||||
}
|
||||
|
||||
//更新工单审批id
|
||||
// TicketsEntity ticketsEntity = new TicketsEntity();
|
||||
// ticketsEntity.setTicketsId(Long.valueOf(ticketsId));
|
||||
// ticketsEntity.setStatus(TicketsStatusEnums.CANCEL.getCode());
|
||||
// ticketsEntity.setUpdateTime(new Date());
|
||||
// ticketsService.updateById(ticketsEntity);
|
||||
ticketsEntity.setTicketsId(Long.valueOf(ticketsId));
|
||||
ticketsEntity.setUpdateTime(new Date());
|
||||
ticketsService.updateById(ticketsEntity);
|
||||
|
||||
return R.ok("操作成功");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R completeTaskById1(Map<String, Object> params) {
|
||||
String processInstance = (String) params.get("processInstance");
|
||||
if(StringUtils.isBlank(processInstance)){
|
||||
return R.error("流程Id不能为空");
|
||||
}
|
||||
Task secondTask = taskService.createTaskQuery()
|
||||
.processInstanceId(processInstance)
|
||||
.singleResult();
|
||||
Map<String, Object> secondApprovalVars = new HashMap<>();
|
||||
secondApprovalVars.put("approvalResult", true);
|
||||
taskService.complete(secondTask.getId(), secondApprovalVars);
|
||||
return R.ok("操作成功");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R deleteFlow1(Map<String, Object> params) {
|
||||
String processInstance = (String) params.get("processInstance");
|
||||
if(StringUtils.isBlank(processInstance)){
|
||||
return R.error("流程Id不能为空");
|
||||
}
|
||||
Task secondTask = taskService.createTaskQuery()
|
||||
.processInstanceId(processInstance)
|
||||
.singleResult();
|
||||
Map<String, Object> secondApprovalVars = new HashMap<>();
|
||||
secondApprovalVars.put("approvalResult", false);
|
||||
secondApprovalVars.put("user1", 2);
|
||||
taskService.complete(secondTask.getId(), secondApprovalVars);
|
||||
return R.ok("操作成功");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R deleteFlow(Map<String, Object> params) {
|
||||
String processInstance = (String) params.get("processInstance");
|
||||
// Integer ticketsId = (Integer) params.get("ticketsId");
|
||||
if(StringUtils.isBlank(processInstance)){
|
||||
if (StringUtils.isBlank(processInstance)) {
|
||||
return R.error("流程Id不能为空");
|
||||
}
|
||||
//查询活跃任务
|
||||
TaskQuery taskQuery = taskService.createTaskQuery().active().processInstanceId(processInstance);
|
||||
List<Task> tasks = taskQuery.list();
|
||||
if (tasks.isEmpty()){
|
||||
if (tasks.isEmpty()) {
|
||||
return R.error("没有可终结的任务");
|
||||
}
|
||||
runtimeService.deleteProcessInstance(processInstance, "测试终结流程");
|
||||
@@ -433,7 +430,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
|
||||
@Override
|
||||
public void claimTask(String id) {
|
||||
taskService.claim(id,ShiroUtils.getUserId().toString());
|
||||
taskService.claim(id, ShiroUtils.getUserId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -475,7 +472,6 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取流程图
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration();
|
||||
@@ -488,7 +484,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
byte[] b = new byte[in.available()];
|
||||
in.read(b);
|
||||
return b;
|
||||
}catch (IOException e){
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
@@ -498,8 +494,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
@Override
|
||||
public R getMyStartTaskList(Map<String, Object> params) {
|
||||
// 获取到分页的信息
|
||||
Integer page = Integer.parseInt((String)params.getOrDefault(Constant.PAGE,1));
|
||||
Integer limit = Integer.parseInt((String) params.getOrDefault(Constant.LIMIT,5));
|
||||
Integer page = Integer.parseInt((String) params.getOrDefault(Constant.PAGE, 1));
|
||||
Integer limit = Integer.parseInt((String) params.getOrDefault(Constant.LIMIT, 5));
|
||||
// 获取当前的登录用户
|
||||
SysUserEntity loginUser = ShiroUtils.getUserEntity();
|
||||
// 我们需要根据当前登录用户查询所有发起的流程
|
||||
@@ -512,7 +508,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
List<HistoricProcessInstance> tasks = historicProcessInstanceQuery.listPage((page - 1) * limit, page * limit);
|
||||
long count = historicProcessInstanceQuery.count();
|
||||
List<FlwMyFlowEntity> list = new ArrayList<>();
|
||||
if(tasks != null && tasks.size() > 0){
|
||||
if (tasks != null && tasks.size() > 0) {
|
||||
for (HistoricProcessInstance historicProcessInstance : tasks) {
|
||||
HistoricProcessInstanceEntityImpl impl = (HistoricProcessInstanceEntityImpl) historicProcessInstance;
|
||||
FlwMyFlowEntity entity = new FlwMyFlowEntity();
|
||||
@@ -525,7 +521,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
entity.setFlowProceId(impl.getProcessInstanceId());
|
||||
|
||||
// 任务的发起人
|
||||
if(historicProcessInstance != null){
|
||||
if (historicProcessInstance != null) {
|
||||
String startUserId = historicProcessInstance.getStartUserId();
|
||||
entity.setStartDate(historicProcessInstance.getStartTime());
|
||||
entity.setEndDate(historicProcessInstance.getEndTime());
|
||||
@@ -535,12 +531,13 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
list.add(entity);
|
||||
}
|
||||
}
|
||||
PageUtils pageUtils = new PageUtils(list,(int)count,limit,page);
|
||||
return R.ok("操作成功").put("page",pageUtils);
|
||||
PageUtils pageUtils = new PageUtils(list, (int) count, limit, page);
|
||||
return R.ok("操作成功").put("page", pageUtils);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据流程实例ID获取对应的流转记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@@ -550,7 +547,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
.processInstanceId(id).orderByTaskCreateTime().asc().list();
|
||||
|
||||
List<FlwHiTaskEntity> ress = new ArrayList<>();
|
||||
if(list != null){
|
||||
if (list != null) {
|
||||
for (HistoricTaskInstance entity : list) {
|
||||
FlwHiTaskEntity task = new FlwHiTaskEntity();
|
||||
task.setId(entity.getId());
|
||||
@@ -559,26 +556,26 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
task.setAssignee(entity.getAssignee());
|
||||
task.setStartTime(entity.getCreateTime());
|
||||
Long durationInMillis = entity.getDurationInMillis();
|
||||
if(durationInMillis != null){
|
||||
if (durationInMillis != null) {
|
||||
task.setDuration(durationInMillis);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(entity.getAssignee())){
|
||||
if (StringUtils.isNotBlank(entity.getAssignee())) {
|
||||
// 需要查询到用户的名称
|
||||
SysUserEntity userEntity = userService.getById(entity.getAssignee());
|
||||
String username = userEntity.getUsername();
|
||||
String nickname = userEntity.getNickname();
|
||||
if(StringUtils.isNotBlank(nickname)){
|
||||
if (StringUtils.isNotBlank(nickname)) {
|
||||
task.setAssigneeName(nickname);
|
||||
}else{
|
||||
} else {
|
||||
task.setAssigneeName(username);
|
||||
}
|
||||
}
|
||||
// 查询当前的节点的状态
|
||||
if(entity.getEndTime() != null){
|
||||
if (entity.getEndTime() != null) {
|
||||
// 这个节点已经审批完成了
|
||||
task.setStatus("finish");
|
||||
}else{
|
||||
} else {
|
||||
task.setStatus("wait");
|
||||
}
|
||||
ress.add(task);
|
||||
@@ -591,16 +588,16 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
@Override
|
||||
public R getMyCompleteTaskList(Map<String, Object> params) {
|
||||
// 获取到分页的信息
|
||||
Integer page = Integer.parseInt((String)params.getOrDefault(Constant.PAGE,1));
|
||||
Integer limit = Integer.parseInt((String) params.getOrDefault(Constant.LIMIT,5));
|
||||
Integer page = Integer.parseInt((String) params.getOrDefault(Constant.PAGE, 1));
|
||||
Integer limit = Integer.parseInt((String) params.getOrDefault(Constant.LIMIT, 5));
|
||||
// 获取当前的登录用户
|
||||
SysUserEntity loginUser = ShiroUtils.getUserEntity();
|
||||
// 我的已办 可以通过当前登录用户 匹配 act_hi_taskinst 中的审批人来找到对应的流程实例id
|
||||
List<HistoricTaskInstance> taskInstances = historyService.createHistoricTaskInstanceQuery()
|
||||
.taskAssignee(loginUser.getUserId().toString()).list();
|
||||
if(taskInstances == null || taskInstances.size() == 0){
|
||||
PageUtils pageUtils = new PageUtils(null,0,limit,page);
|
||||
return R.ok("操作成功").put("page",pageUtils);
|
||||
if (taskInstances == null || taskInstances.size() == 0) {
|
||||
PageUtils pageUtils = new PageUtils(null, 0, limit, page);
|
||||
return R.ok("操作成功").put("page", pageUtils);
|
||||
}
|
||||
Set<String> processInsIds = taskInstances.stream().map(item -> {
|
||||
return item.getProcessInstanceId();
|
||||
@@ -615,7 +612,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
List<HistoricProcessInstance> tasks = historicProcessInstanceQuery.listPage((page - 1) * limit, page * limit);
|
||||
long count = historicProcessInstanceQuery.count();
|
||||
List<FlwMyFlowEntity> list = new ArrayList<>();
|
||||
if(tasks != null && tasks.size() > 0){
|
||||
if (tasks != null && tasks.size() > 0) {
|
||||
for (HistoricProcessInstance historicProcessInstance : tasks) {
|
||||
HistoricProcessInstanceEntityImpl impl = (HistoricProcessInstanceEntityImpl) historicProcessInstance;
|
||||
FlwMyFlowEntity entity = new FlwMyFlowEntity();
|
||||
@@ -628,10 +625,10 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
entity.setFlowProceId(impl.getProcessInstanceId());
|
||||
|
||||
// 任务的发起人
|
||||
if(historicProcessInstance != null){
|
||||
if (historicProcessInstance != null) {
|
||||
String startUserId = historicProcessInstance.getStartUserId();
|
||||
SysUserEntity userEntity = userService.getById(startUserId);
|
||||
if(userEntity != null){
|
||||
if (userEntity != null) {
|
||||
entity.setUserName(userEntity.getNickname());
|
||||
}
|
||||
entity.setStartDate(historicProcessInstance.getStartTime());
|
||||
@@ -642,8 +639,8 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
list.add(entity);
|
||||
}
|
||||
}
|
||||
PageUtils pageUtils = new PageUtils(list,(int)count,limit,page);
|
||||
return R.ok("操作成功").put("page",pageUtils);
|
||||
PageUtils pageUtils = new PageUtils(list, (int) count, limit, page);
|
||||
return R.ok("操作成功").put("page", pageUtils);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -653,7 +650,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
|
||||
List<FlwHiTaskEntity> ress = new ArrayList<>();
|
||||
SysUserEntity loginUser = ShiroUtils.getUserEntity();
|
||||
if(list != null){
|
||||
if (list != null) {
|
||||
for (HistoricTaskInstance entity : list) {
|
||||
FlwHiTaskEntity task = new FlwHiTaskEntity();
|
||||
task.setId(entity.getId());
|
||||
@@ -662,30 +659,30 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
task.setAssignee(entity.getAssignee());
|
||||
task.setStartTime(entity.getCreateTime());
|
||||
Long durationInMillis = entity.getDurationInMillis();
|
||||
if(durationInMillis != null){
|
||||
if (durationInMillis != null) {
|
||||
task.setDuration(durationInMillis);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(entity.getAssignee())){
|
||||
if (StringUtils.isNotBlank(entity.getAssignee())) {
|
||||
// 需要查询到用户的名称
|
||||
SysUserEntity userEntity = userService.getById(entity.getAssignee());
|
||||
String username = userEntity.getUsername();
|
||||
String nickname = userEntity.getNickname();
|
||||
if(StringUtils.isNotBlank(nickname)){
|
||||
if (StringUtils.isNotBlank(nickname)) {
|
||||
task.setAssigneeName(nickname);
|
||||
}else{
|
||||
} else {
|
||||
task.setAssigneeName(username);
|
||||
}
|
||||
}
|
||||
// 查询当前的节点的状态
|
||||
if(entity.getEndTime() != null){
|
||||
if (entity.getEndTime() != null) {
|
||||
// 这个节点已经审批完成了
|
||||
task.setStatus("finish");
|
||||
}else{
|
||||
} else {
|
||||
task.setStatus("wait");
|
||||
}
|
||||
|
||||
if(entity.getAssignee() != null && entity.getAssignee().equals(loginUser.getUserId().toString())){
|
||||
if (entity.getAssignee() != null && entity.getAssignee().equals(loginUser.getUserId().toString())) {
|
||||
task.setStatus("success");
|
||||
}
|
||||
ress.add(task);
|
||||
@@ -695,21 +692,21 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
return ress;
|
||||
}
|
||||
|
||||
private Integer getUserTaskStatus(String processDef,String taskDefKey){
|
||||
private Integer getUserTaskStatus(String processDef, String taskDefKey) {
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDef);
|
||||
Process mainProcess = bpmnModel.getMainProcess();
|
||||
Collection<FlowElement> flowElements = mainProcess.getFlowElements();
|
||||
Integer status = 0;
|
||||
if(flowElements != null && flowElements.size() > 0){
|
||||
if (flowElements != null && flowElements.size() > 0) {
|
||||
for (FlowElement flowElement : flowElements) {
|
||||
if(flowElement instanceof UserTask){
|
||||
if (flowElement instanceof UserTask) {
|
||||
UserTask userTask = (UserTask) flowElement;
|
||||
if(userTask.getId().equals(taskDefKey)){
|
||||
if (userTask.getId().equals(taskDefKey)) {
|
||||
String assignee = userTask.getAssignee();
|
||||
if(StringUtils.isNotBlank(assignee)){
|
||||
if (StringUtils.isNotBlank(assignee)) {
|
||||
// 说明是制定的审批人
|
||||
status = 0;
|
||||
}else{
|
||||
} else {
|
||||
status = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -17,4 +17,6 @@ public interface TicketsDao extends BaseMapper<TicketsEntity> {
|
||||
|
||||
|
||||
TicketsDTO getTicketsDTOById(String ticketsId);
|
||||
|
||||
String selectByProcessInstance(String processInstance);
|
||||
}
|
||||
|
||||
@@ -78,4 +78,9 @@ public class TicketsDTO {
|
||||
* 审批流id
|
||||
*/
|
||||
private String processInstance;
|
||||
|
||||
/**
|
||||
* 审批结点
|
||||
*/
|
||||
private String processInstanceUser;
|
||||
}
|
||||
|
||||
@@ -76,11 +76,14 @@ public class TicketsEntity implements Serializable {
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 工单关闭时间
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 完结时间
|
||||
*/
|
||||
private Date finishTime;
|
||||
|
||||
/**
|
||||
* 审批流id
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.boge.modules.tickets.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TicketUserEnums {
|
||||
|
||||
|
||||
SPECIALIST(2L, "专员"),
|
||||
MANAGER(3L, "经理");
|
||||
|
||||
private Long code;
|
||||
private String msg;
|
||||
|
||||
public static String getStatus(String code) {
|
||||
for (TicketUserEnums value : values()) {
|
||||
if (value.code.equals(code)) {
|
||||
return value.msg;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
UNCHECK(0, "未开始"),
|
||||
CHECKED(1, "已指派"),
|
||||
REJECT(2, "处理中"),
|
||||
CANCEL(3, "已完成");
|
||||
FINISH(3, "已完成");
|
||||
|
||||
private Integer code;
|
||||
private String msg;
|
||||
|
||||
@@ -12,7 +12,9 @@ import com.boge.modules.sys.entity.SysUserEntity;
|
||||
import com.boge.modules.sys.service.SysUserRoleService;
|
||||
import com.boge.modules.sys.service.impl.SysUserServiceImpl;
|
||||
import com.boge.modules.tickets.dto.TicketsDTO;
|
||||
import com.boge.modules.tickets.enums.TicketUserEnums;
|
||||
import org.flowable.common.engine.api.FlowableException;
|
||||
import org.flowable.engine.IdentityService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -54,6 +56,9 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsDao, TicketsEntity> i
|
||||
@Autowired
|
||||
protected RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
protected IdentityService identityService;
|
||||
|
||||
@Value("${ProcessInstance.defId}")
|
||||
private String defId;
|
||||
|
||||
@@ -91,11 +96,11 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsDao, TicketsEntity> i
|
||||
ticketsEntityQueryWrapper.eq("create_user", loginUser.getUsername());
|
||||
}
|
||||
if (TicketsTypeEnums.TO_BE_DONE.getCode().equals(params.get("type"))) {
|
||||
ticketsEntityQueryWrapper.eq("assign_user_id", loginUser.getUserId()).eq("status", TicketsStatusEnums.CHECKED.getCode());
|
||||
ticketsEntityQueryWrapper.eq("assign_user_id", loginUser.getUserId()).eq("status", TicketsStatusEnums.REJECT.getCode());
|
||||
}
|
||||
|
||||
if (TicketsTypeEnums.FINISH.getCode().equals(params.get("type"))) {
|
||||
ticketsEntityQueryWrapper.eq("assign_user_id", loginUser.getUserId()).eq("status", TicketsStatusEnums.CANCEL.getCode());
|
||||
ticketsEntityQueryWrapper.eq("assign_user_id", loginUser.getUserId()).eq("status", TicketsStatusEnums.FINISH.getCode());
|
||||
}
|
||||
|
||||
|
||||
@@ -112,11 +117,15 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsDao, TicketsEntity> i
|
||||
public void saveTicket(TicketsEntity tickets) {
|
||||
// 启动流程
|
||||
try {
|
||||
// 记录流程的发起人
|
||||
identityService.setAuthenticatedUserId(ShiroUtils.getUserId().toString());
|
||||
Map<String, Object> startVars = new HashMap<>();
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(defId, startVars);
|
||||
SysUserEntity loginUser = ShiroUtils.getUserEntity();
|
||||
tickets.setCreateTime(new Date());
|
||||
tickets.setCreateUser(loginUser.getNickname());
|
||||
tickets.setStatus(TicketsStatusEnums.REJECT.getCode());
|
||||
tickets.setAssignUserId(TicketUserEnums.SPECIALIST.getCode());
|
||||
tickets.setProcessInstance(processInstance.getProcessInstanceId());
|
||||
ticketsDao.insert(tickets);
|
||||
} catch (Exception e) {
|
||||
@@ -127,6 +136,9 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsDao, TicketsEntity> i
|
||||
@Override
|
||||
public TicketsDTO getTicketsById(String ticketsId) {
|
||||
TicketsDTO tickets = ticketsDao.getTicketsDTOById(ticketsId);
|
||||
|
||||
String processName = ticketsDao.selectByProcessInstance(tickets.getProcessInstance());
|
||||
tickets.setProcessInstanceUser(processName);
|
||||
return tickets;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
left join sys_car as c on a.car_type = c.car_id
|
||||
where a.tickets_id = #{ticketsId}
|
||||
</select>
|
||||
<select id="selectByProcessInstance" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select NAME_ from act_ru_task where PROC_INST_ID_ = #{processInstance}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="label">工单ID</td>
|
||||
<td class="value"><el-tag size="small">{{ ticketsData.ticketsId }}</el-tag></td>
|
||||
<td class="value">
|
||||
<el-tag size="small">{{ ticketsData.ticketsId }}</el-tag>
|
||||
</td>
|
||||
<td class="label">小车类型</td>
|
||||
<td class="value">{{ ticketsData.carName || '-' }}</td>
|
||||
</tr>
|
||||
@@ -80,26 +82,25 @@
|
||||
|
||||
<!-- 审批操作按钮组 -->
|
||||
<div class="approval-tools">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="$baseUrl + '/api/localStorage' + '?name=' + dataForm.filename"
|
||||
:limit="1"
|
||||
:headers="headers"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:on-remove="handleRemove"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<el-button slot="trigger" size="mini" type="primary">上传附件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">可上传任意格式文件,且不超过100M</div>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="$baseUrl + '/api/localStorage' + '?name=' + dataForm.filename"
|
||||
:limit="1"
|
||||
:headers="headers"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:on-remove="handleRemove"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<el-button slot="trigger" size="mini" type="primary">上传附件</el-button>
|
||||
<div slot="tip" class="el-upload__tip">可上传任意格式文件,且不超过100M</div>
|
||||
|
||||
</el-upload>
|
||||
</el-upload>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- 处理意见输入 -->
|
||||
<div class="opinion-input">
|
||||
<el-input
|
||||
@@ -116,19 +117,33 @@
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 外层容器控制对齐方式 -->
|
||||
<div v-if= "ticketsData.processInstanceUser === '销售经理'" style="text-align: left; margin: 8px 0;"> <!-- 左对齐 + 上下间距 -->
|
||||
<el-button type="text" size="small"
|
||||
class="custom-assign-btn"
|
||||
@click="startFlowUser()"
|
||||
>
|
||||
指派
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="assignedUsername" class="assigned-username">
|
||||
指派:{{ assignedUsername }}
|
||||
</div>
|
||||
<el-radio-group v-if= "ticketsData.processInstanceUser === '销售专员'" v-model="approvalForm.result">
|
||||
<el-radio label="同意" border size="small">同意</el-radio>
|
||||
<el-radio label="完结" border size="small">完结</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
|
||||
<!-- 附加选项 -->
|
||||
<div class="approval-options">
|
||||
<el-checkbox v-model="approvalForm.hideOpinion">意见隐藏</el-checkbox>
|
||||
|
||||
<div class="option-item">
|
||||
<el-checkbox v-model="approvalForm.track">跟踪</el-checkbox>
|
||||
<el-radio-group v-model="approvalForm.trackType" v-if="approvalForm.track">
|
||||
<el-radio label="全部" border size="small">全部</el-radio>
|
||||
<el-radio label="指定人" border size="small">指定人</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
|
||||
<el-checkbox v-model="approvalForm.archiveAfterHandle">处理后归档</el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部操作按钮(固定在底部) -->
|
||||
@@ -140,30 +155,86 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<el-dialog
|
||||
title="指派"
|
||||
:visible.sync="dialogFormVisible"
|
||||
width="30%"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form
|
||||
:model="flowForm"
|
||||
label-width="100px"
|
||||
class="demo-dynamic"
|
||||
ref="flowFormRef"
|
||||
>
|
||||
<!-- 循环渲染动态表单时,增加v-if判断避免空数据报错 -->
|
||||
<el-form-item
|
||||
v-for="(form, index) in dynamiForm"
|
||||
:label="form.name || '未命名'"
|
||||
:key="`${form.key}-${index}`"
|
||||
:prop="form.key"
|
||||
:rules="[{ required: true, message: `请选择${form.name}`, trigger: 'change' }]"
|
||||
>
|
||||
<!-- 只在users有数据时渲染选择器,避免循环空数组 -->
|
||||
<el-select
|
||||
v-if="form.type === 'assignee' && users.length > 0"
|
||||
v-model="flowForm[form.key]"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="user in users"
|
||||
:key="user.userId"
|
||||
:label="`${user.nickname || user.username}[${user.username}]`"
|
||||
:value="user.userId"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- 当users为空时显示提示 -->
|
||||
<div v-else-if="form.type === 'assignee' && users.length === 0">
|
||||
暂无可选用户
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 弹窗底部按钮区(之前可能缺少,导致无法提交/关闭) -->
|
||||
<template #footer>
|
||||
<el-button @click="dialogFormVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleAssign">确认指派</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from "./tickets-add-or-update.vue";
|
||||
|
||||
export default {
|
||||
components: {AddOrUpdate},
|
||||
data() {
|
||||
return {
|
||||
column: 0,
|
||||
ticketsData: {},
|
||||
statusOpt: [
|
||||
{ value: '0', label: '未开始' },
|
||||
{ value: '1', label: '已指派' },
|
||||
{ value: '2', label: '处理中' },
|
||||
{ value: '3', label: '已完成' }
|
||||
{value: '0', label: '未开始'},
|
||||
{value: '1', label: '已指派'},
|
||||
{value: '2', label: '处理中'},
|
||||
{value: '3', label: '已完成'}
|
||||
],
|
||||
assignedUsername: '',
|
||||
// 审批表单数据
|
||||
approvalForm: {
|
||||
result: '同意', // 默认为同意
|
||||
result: '指派', // 默认为同意
|
||||
opinion: '', // 处理意见
|
||||
hideOpinion: false, // 意见隐藏
|
||||
track: false, // 跟踪
|
||||
trackType: '全部', // 跟踪类型
|
||||
archiveAfterHandle: false // 处理后归档
|
||||
archiveAfterHandle: false, // 处理后归档
|
||||
assignUserId: 0 // 指派人id
|
||||
},
|
||||
dictData: [],
|
||||
// 上传文件
|
||||
dataForm: {
|
||||
contractId: 0,
|
||||
@@ -177,13 +248,19 @@ export default {
|
||||
totalSum: 0,
|
||||
filename: null,
|
||||
storageId: null
|
||||
}
|
||||
},
|
||||
dialogFormVisible: false, // 必须初始化
|
||||
flowForm: {},
|
||||
users: [],
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 初始化布局
|
||||
this.column = this.isMobile() || window.innerWidth < 768 ? 2 : 4;
|
||||
this.getDataList();
|
||||
// this.checkAndSetAgree();
|
||||
},
|
||||
methods: {
|
||||
// 移动端判断
|
||||
@@ -192,6 +269,31 @@ export default {
|
||||
const mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
||||
return mobileAgents.some(agent => userAgentInfo.indexOf(agent) > -1);
|
||||
},
|
||||
handleAssign() {
|
||||
// 先验证表单必填项
|
||||
this.$refs.flowFormRef.validate(valid => {
|
||||
if (valid) {
|
||||
// 1. 获取选中的userId(假设dynamiForm中只有一个assignee类型的表单项,取第一个)
|
||||
const formItem = this.dynamiForm[0]; // 若有多个,需根据实际场景调整
|
||||
const selectedUserId = this.flowForm[formItem.key];
|
||||
|
||||
// 2. 从users数组中找到对应的user,获取username
|
||||
const selectedUser = this.users.find(user => user.userId === selectedUserId);
|
||||
if (selectedUser) {
|
||||
this.assignedUsername = selectedUser.nickname;// 保存username
|
||||
this.approvalForm.assignUserId = selectedUser.userId;
|
||||
} else {
|
||||
this.assignedUsername = '未知用户'; // 未找到时的兜底
|
||||
}
|
||||
|
||||
// 3. 关闭对话框
|
||||
this.dialogFormVisible = false;
|
||||
|
||||
// (可选)这里可以添加实际的指派逻辑,如调用接口等
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 上传文件
|
||||
beforeUpload(file) {
|
||||
let isLt2M = true
|
||||
@@ -203,8 +305,22 @@ export default {
|
||||
this.dataForm.filename = file.name
|
||||
return isLt2M
|
||||
},
|
||||
startFlowUser() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/flow/deploy/flowDef'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dynamiForm = [...data.data]
|
||||
this.users = [...data.users]
|
||||
this.roles = [...data.roles]
|
||||
this.dialogFormVisible = true
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.$notify({title: '上传成功',type: 'success'})
|
||||
this.$notify({title: '上传成功', type: 'success'})
|
||||
this.dataForm.storageId = response.storageId
|
||||
},
|
||||
handleError(e, file, fileList) {
|
||||
@@ -215,7 +331,7 @@ export default {
|
||||
duration: 2500
|
||||
})
|
||||
},
|
||||
handleRemove (file, fileList) {
|
||||
handleRemove(file, fileList) {
|
||||
this.dataForm.storageId = null
|
||||
},
|
||||
// 获取工单数据
|
||||
@@ -224,10 +340,14 @@ export default {
|
||||
url: this.$http.adornUrl(`/tickets/tickets/info/${this.$route.query.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({})
|
||||
}).then(({ data }) => {
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.ticketsData = data.tickets;
|
||||
}
|
||||
const user = this.ticketsData.processInstanceUser;
|
||||
if (user && (user.includes('指派') || user.includes('完结'))) {
|
||||
this.approvalForm.result = '提交'; // 自动选中“同意”
|
||||
}
|
||||
});
|
||||
},
|
||||
// 提交审批
|
||||
@@ -249,9 +369,10 @@ export default {
|
||||
ticketsId: this.ticketsData.ticketsId,
|
||||
processInstance: this.ticketsData.processInstance,
|
||||
result: this.approvalForm.result,
|
||||
opinion: this.approvalForm.opinion
|
||||
opinion: this.approvalForm.opinion,
|
||||
userId: this.approvalForm.assignUserId
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
@@ -265,7 +386,8 @@ export default {
|
||||
this.$message.error(data.msg || '操作失败');
|
||||
}
|
||||
});
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
// 存为草稿
|
||||
saveAsDraft() {
|
||||
@@ -302,16 +424,19 @@ export default {
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.meta-info {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.meta-info .creator {
|
||||
margin-right: 15px;
|
||||
}
|
||||
@@ -328,7 +453,7 @@ export default {
|
||||
flex: 1;
|
||||
background-color: #fff;
|
||||
padding: 30px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
border: 1px solid #eee; /* 新增边框,与右侧视觉统一 */
|
||||
}
|
||||
|
||||
@@ -350,11 +475,27 @@ export default {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.custom-assign-btn {
|
||||
color: #606266; /* 与表单文字色统一 */
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
padding: 4px 8px;
|
||||
margin: 8px 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.custom-assign-btn:hover {
|
||||
color: #409EFF;
|
||||
border-color: #c6e2ff;
|
||||
background-color: #f0f9ff;
|
||||
}
|
||||
|
||||
/* 表单区块样式 */
|
||||
.form-block {
|
||||
margin-bottom: 25px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.block-title {
|
||||
background-color: #f8f0e3; /* 浅橙色背景 */
|
||||
color: #333;
|
||||
@@ -368,13 +509,16 @@ export default {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.info-table tr {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.info-table td {
|
||||
padding: 12px 15px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.info-table .label {
|
||||
width: 25%;
|
||||
background-color: #fafafa;
|
||||
@@ -383,6 +527,7 @@ export default {
|
||||
padding-right: 20px;
|
||||
border-right: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.info-table .value {
|
||||
width: 25%;
|
||||
padding-left: 20px;
|
||||
@@ -400,7 +545,7 @@ export default {
|
||||
|
||||
background-color: #fff;
|
||||
padding: 30px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
border: 1px solid #eee; /* 与左侧统一边框 */
|
||||
align-self: stretch; /* 强制高度与左侧一致 */
|
||||
}
|
||||
@@ -438,6 +583,7 @@ export default {
|
||||
gap: 10px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.approval-result .el-radio {
|
||||
flex: 1;
|
||||
}
|
||||
@@ -452,16 +598,19 @@ export default {
|
||||
.approval-options {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.option-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 8px 0; /* 缩减选项间距 */
|
||||
}
|
||||
|
||||
.option-item .el-radio-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.approval-options .el-checkbox {
|
||||
display: block;
|
||||
margin: 8px 0; /* 缩减复选框间距 */
|
||||
@@ -482,10 +631,12 @@ export default {
|
||||
.main-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.approval-sidebar {
|
||||
width: 100%;
|
||||
margin-top: 20px; /* 垂直排列时增加间距 */
|
||||
}
|
||||
|
||||
.info-table .label, .info-table .value {
|
||||
width: 50%;
|
||||
}
|
||||
@@ -495,17 +646,20 @@ export default {
|
||||
.form-container, .approval-sidebar {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.info-table td {
|
||||
display: block;
|
||||
width: 100% !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.info-table .label {
|
||||
border-right: none;
|
||||
padding-right: 0;
|
||||
background-color: transparent;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.info-table .value {
|
||||
padding-left: 0;
|
||||
margin-bottom: 10px;
|
||||
|
||||
@@ -137,8 +137,16 @@
|
||||
header-align="center"
|
||||
align="center"
|
||||
min-width="100px"
|
||||
label="工单更新时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="finishTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
min-width="100px"
|
||||
label="工单审批完成时间">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
|
||||
Reference in New Issue
Block a user