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();
|
||||
@@ -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;
|
||||
@@ -242,8 +233,6 @@ 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) {
|
||||
for (String key : keys) {
|
||||
@@ -348,29 +337,13 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
@Override
|
||||
public R completeTaskById(Map<String, Object> params) {
|
||||
String processInstance = (String) params.get("processInstance");
|
||||
// Integer ticketsId = (Integer) params.get("ticketsId");
|
||||
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());
|
||||
}
|
||||
//更新工单审批id
|
||||
// TicketsEntity ticketsEntity = new TicketsEntity();
|
||||
// ticketsEntity.setTicketsId(Long.valueOf(ticketsId));
|
||||
// ticketsEntity.setStatus(TicketsStatusEnums.CANCEL.getCode());
|
||||
// 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不能为空");
|
||||
}
|
||||
@@ -378,29 +351,53 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
.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);
|
||||
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<>();
|
||||
// 继续流程
|
||||
if (Objects.nonNull(secondTask) && StrUtil.isNotEmpty(result) && result.equals("同意")) {
|
||||
secondApprovalVars.put("approvalResult", false);
|
||||
secondApprovalVars.put("user1", 2);
|
||||
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.setTicketsId(Long.valueOf(ticketsId));
|
||||
ticketsEntity.setUpdateTime(new Date());
|
||||
ticketsService.updateById(ticketsEntity);
|
||||
|
||||
return R.ok("操作成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public R deleteFlow(Map<String, Object> params) {
|
||||
String processInstance = (String) params.get("processInstance");
|
||||
@@ -475,7 +472,6 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取流程图
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration();
|
||||
@@ -541,6 +537,7 @@ public class FlwInstanceServiceImpl extends FlowServiceNoFactory implements FlwI
|
||||
|
||||
/**
|
||||
* 根据流程实例ID获取对应的流转记录
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -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>
|
||||
@@ -99,7 +101,6 @@
|
||||
</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,11 +155,64 @@
|
||||
</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,
|
||||
@@ -155,15 +223,18 @@ export default {
|
||||
{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,6 +305,20 @@ 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.dataForm.storageId = response.storageId
|
||||
@@ -228,6 +344,10 @@ export default {
|
||||
if (data && data.code === 0) {
|
||||
this.ticketsData = data.tickets;
|
||||
}
|
||||
const user = this.ticketsData.processInstanceUser;
|
||||
if (user && (user.includes('指派') || user.includes('完结'))) {
|
||||
this.approvalForm.result = '提交'; // 自动选中“同意”
|
||||
}
|
||||
});
|
||||
},
|
||||
// 提交审批
|
||||
@@ -249,7 +369,8 @@ 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}) => {
|
||||
if (data && data.code === 0) {
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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