Browse Source

feat: 流程设计数据回显

master
tony 3 years ago
parent
commit
8c8dfa1c0f
  1. 8
      ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java
  2. 40
      ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java
  3. 80
      ruoyi-ui/src/components/Process/components/nodePanel/task.vue
  4. 22
      ruoyi-ui/src/components/flow/Expression/index.vue
  5. 2
      ruoyi-ui/src/components/flow/Role/index.vue
  6. 20
      ruoyi-ui/src/components/flow/User/index.vue
  7. 18
      ruoyi-ui/src/components/parser/Parser.vue
  8. 9
      ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue
  9. 139
      ruoyi-ui/src/views/flowable/task/todo/detail/index.vue

8
ruoyi-flowable/src/main/java/com/ruoyi/flowable/common/constant/ProcessConstants.java

@ -11,7 +11,7 @@ public class ProcessConstants {
/** /**
* 动态数据 * 动态数据
*/ */
public static final String DATA_TYPE = "dynamic"; public static final String DYNAMIC = "dynamic";
/** /**
* 固定任务接收 * 固定任务接收
@ -21,19 +21,19 @@ public class ProcessConstants {
/** /**
* 单个审批人 * 单个审批人
*/ */
public static final String USER_TYPE_ASSIGNEE = "assignee"; public static final String ASSIGNEE = "assignee";
/** /**
* 候选人 * 候选人
*/ */
public static final String USER_TYPE_USERS = "candidateUsers"; public static final String CANDIDATE_USERS = "candidateUsers";
/** /**
* 审批组 * 审批组
*/ */
public static final String USER_TYPE_ROUPS = "candidateGroups"; public static final String CANDIDATE_GROUPS = "candidateGroups";
/** /**
* 单个审批人 * 单个审批人

40
ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java

@ -15,7 +15,6 @@ import com.ruoyi.flowable.domain.dto.FlowNextDto;
import com.ruoyi.flowable.domain.dto.FlowTaskDto; import com.ruoyi.flowable.domain.dto.FlowTaskDto;
import com.ruoyi.flowable.domain.dto.FlowViewerDto; import com.ruoyi.flowable.domain.dto.FlowViewerDto;
import com.ruoyi.flowable.domain.vo.FlowTaskVo; import com.ruoyi.flowable.domain.vo.FlowTaskVo;
import com.ruoyi.flowable.domain.vo.ReturnTaskNodeVo;
import com.ruoyi.flowable.factory.FlowServiceFactory; import com.ruoyi.flowable.factory.FlowServiceFactory;
import com.ruoyi.flowable.flow.CustomProcessDiagramGenerator; import com.ruoyi.flowable.flow.CustomProcessDiagramGenerator;
import com.ruoyi.flowable.flow.FindNextNodeUtil; import com.ruoyi.flowable.flow.FindNextNodeUtil;
@ -32,15 +31,12 @@ import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.*; import org.flowable.bpmn.model.*;
import org.flowable.common.engine.api.FlowableException; import org.flowable.common.engine.api.FlowableException;
import org.flowable.common.engine.api.FlowableObjectNotFoundException; import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.flowable.common.engine.api.query.QueryProperty;
import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.history.HistoricActivityInstance; import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery; import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.impl.ActivityInstanceQueryProperty;
import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution; import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.task.Comment; import org.flowable.engine.task.Comment;
@ -60,7 +56,6 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors;
/** /**
* @author XuanXuan * @author XuanXuan
@ -952,44 +947,19 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
// 会签节点 // 会签节点
if (Objects.nonNull(multiInstance)) { if (Objects.nonNull(multiInstance)) {
List<SysUser> list = sysUserService.selectUserList(new SysUser()); List<SysUser> list = sysUserService.selectUserList(new SysUser());
flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER); flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER);
flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE);
flowNextDto.setUserList(list); flowNextDto.setUserList(list);
} else { } else {
// 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组
String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE); String dataType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_DATA_TYPE);
String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE); String userType = userTask.getAttributeValue(ProcessConstants.NAMASPASE, ProcessConstants.PROCESS_CUSTOM_USER_TYPE);
flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
flowNextDto.setType(userType);
// 处理加载动态指定下一节点接收人员信息 // 处理加载动态指定下一节点接收人员信息
if (ProcessConstants.DATA_TYPE.equals(dataType)) { if (ProcessConstants.DYNAMIC.equals(dataType)) {
// 指定单个人员 flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
if (ProcessConstants.USER_TYPE_ASSIGNEE.equals(userType)) { flowNextDto.setType(userType);
List<SysUser> list = sysUserService.selectUserList(new SysUser());
flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
flowNextDto.setType(ProcessConstants.USER_TYPE_ASSIGNEE);
flowNextDto.setUserList(list);
}
// 候选人员(多个)
if (ProcessConstants.USER_TYPE_USERS.equals(userType)) {
List<SysUser> list = sysUserService.selectUserList(new SysUser());
flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
flowNextDto.setType(ProcessConstants.USER_TYPE_USERS);
flowNextDto.setUserList(list);
}
// 候选组
if (ProcessConstants.USER_TYPE_ROUPS.equals(userType)) {
List<SysRole> sysRoles = sysRoleService.selectRoleAll();
flowNextDto.setVars(ProcessConstants.PROCESS_APPROVAL);
flowNextDto.setType(ProcessConstants.USER_TYPE_ROUPS);
flowNextDto.setRoleList(sysRoles);
}
} else {
flowNextDto.setType(ProcessConstants.FIXED);
} }
} }
} }

80
ruoyi-ui/src/components/Process/components/nodePanel/task.vue

@ -71,7 +71,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:show-close="false" :show-close="false"
> >
<flow-user :checkType="checkType" @handleUserSelect="handleUserSelect"></flow-user> <flow-user :checkType="checkType" :selectValues="selectValues" @handleUserSelect="handleUserSelect"></flow-user>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="userVisible = false"> </el-button> <el-button @click="userVisible = false"> </el-button>
<el-button type="primary" @click="checkUserComplete"> </el-button> <el-button type="primary" @click="checkUserComplete"> </el-button>
@ -85,7 +85,7 @@
:close-on-press-escape="false" :close-on-press-escape="false"
:show-close="false" :show-close="false"
> >
<flow-exp @handleSingleExpSelect="handleSingleExpSelect"></flow-exp> <flow-exp :selectValues="selectValues" @handleSingleExpSelect="handleSingleExpSelect"></flow-exp>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="expVisible = false"> </el-button> <el-button @click="expVisible = false"> </el-button>
<el-button type="primary" @click="checkExpComplete"> </el-button> <el-button type="primary" @click="checkExpComplete"> </el-button>
@ -169,6 +169,7 @@ export default {
checkType: 'single', checkType: 'single',
// //
checkValues: null, checkValues: null,
selectValues: null,
// //
userList: this.users, userList: this.users,
groupList: this.groups, groupList: this.groups,
@ -375,14 +376,14 @@ export default {
}, },
watch: { watch: {
'formData.userType': function(val, oldVal) { 'formData.userType': function(val, oldVal) {
const types = ['assignee', 'candidateUsers', 'candidateGroups']
if (oldVal) { if (oldVal) {
const types = ['assignee', 'candidateUsers', 'candidateGroups']
types.forEach(type => { types.forEach(type => {
delete this.element.businessObject.$attrs[`flowable:${type}`] delete this.element.businessObject.$attrs[`flowable:${type}`]
delete this.formData[type] delete this.formData[type]
this.updateProperties({'flowable:userType': type})
}) })
} }
this.updateProperties({'flowable:userType': val})
}, },
// // // //
// 'formData.dataType': function(val) { // 'formData.dataType': function(val) {
@ -510,19 +511,21 @@ export default {
const attrs = that.element.businessObject.$attrs; const attrs = that.element.businessObject.$attrs;
const businessObject = that.element.businessObject; const businessObject = that.element.businessObject;
// //
if (attrs.hasOwnProperty("flowable:assignee")){ if (attrs.hasOwnProperty("flowable:assignee")) {
const val = attrs["flowable:assignee"]; const val = attrs["flowable:assignee"];
// () // ()
if (attrs["flowable:dataType"] === "dynamic"){ if (attrs["flowable:dataType"] === "dynamic") {
this.checkValues = that.expList.find(item => item.id == val).name; this.checkValues = that.expList.find(item => item.expression == val).name;
}else { this.selectValues = that.expList.find(item => item.expression == val).id;
} else {
this.checkValues = that.userList.find(item => item.userId == val).nickName; this.checkValues = that.userList.find(item => item.userId == val).nickName;
this.selectValues = that.userList.find(item => item.userId == val).userId;
} }
// //
} else if (attrs.hasOwnProperty("flowable:candidateUsers")) { } else if (attrs.hasOwnProperty("flowable:candidateUsers")) {
const val = attrs["flowable:candidateUsers"]; const val = attrs["flowable:candidateUsers"];
if (attrs["flowable:dataType"] === "dynamic") { if (attrs["flowable:dataType"] === "dynamic") {
this.checkValues = that.expList.find(item => item.id == val).name; this.checkValues = that.expList.find(item => item.expression == val).name;
} else { } else {
const array = []; const array = [];
const vals = val.split(','); const vals = val.split(',');
@ -533,25 +536,13 @@ export default {
} }
}) })
this.checkValues = array.join(','); this.checkValues = array.join(',');
} this.selectValues = array.join(',');
// if (val.indexOf(",") !== -1) { }
// const vals = val.split(','); } else if (businessObject.hasOwnProperty("candidateGroups")) {
// vals.forEach(key => {
// const user = that.userList.find(item => item.userId == key)
// if (user) {
// array.push(user.nickName);
// }
// })
// this.checkValues = array.join(',');
// }else {
// const user = that.userList.find(item => item.userId == val);
// this.checkValues = user.nickName;
// }
} else if (businessObject.hasOwnProperty("candidateGroups")){
// //
const val = businessObject["candidateGroups"]; const val = businessObject["candidateGroups"];
if (attrs["flowable:dataType"] === "dynamic") { if (attrs["flowable:dataType"] === "dynamic") {
this.checkValues = that.expList.find(item => item.id == val).name; this.checkValues = that.expList.find(item => item.expression == val).name;
} else { } else {
const array = []; const array = [];
const vals = val.split(','); const vals = val.split(',');
@ -563,19 +554,6 @@ export default {
}) })
this.checkValues = array.join(','); this.checkValues = array.join(',');
} }
// if (val.indexOf(",") !== -1) {
// const vals = val.split(',');
// vals.forEach(key => {
// const role = that.groupList.find(item => item.roleId == key)
// if (role) {
// array.push(role.roleName);
// }
// })
// this.checkValues = array.join(',');
// }else {
// const role = that.groupList.find(item => item.roleId == val);
// this.checkValues = role.roleName;
// }
} }
}, },
finishExecutionListener() { finishExecutionListener() {
@ -622,44 +600,42 @@ export default {
this.expType = expType; this.expType = expType;
}, },
// //
handleSingleExpSelect(selection){ handleSingleExpSelect(selection) {
this.deleteFlowAttar(); this.deleteFlowAttar();
console.log(this.element.businessObject,"element.businessObject")
this.updateProperties({'flowable:dataType': 'dynamic'}) this.updateProperties({'flowable:dataType': 'dynamic'})
if ("assignee" === this.expType){ if ("assignee" === this.expType) {
this.updateProperties({'flowable:assignee': selection.id.toString()}); this.updateProperties({'flowable:assignee': selection.expression});
}else if ("candidateUsers" === this.expType) { } else if ("candidateUsers" === this.expType) {
this.updateProperties({'flowable:candidateUsers': selection.id.toString()}); this.updateProperties({'flowable:candidateUsers': selection.expression});
}else if ("candidateGroups" === this.expType) { } else if ("candidateGroups" === this.expType) {
this.updateProperties({'flowable:candidateGroups': selection.id.toString()}); this.updateProperties({'flowable:candidateGroups': selection.expression});
} }
this.checkValues = selection.name; this.checkValues = selection.name;
this.expType = null; this.expType = null;
}, },
// //
handleUserSelect(selection) { handleUserSelect(selection) {
console.log(selection,"handleUserSelect")
const that = this; const that = this;
if (selection) { if (selection) {
that.deleteFlowAttar(); that.deleteFlowAttar();
this.updateProperties({'flowable:dataType': 'fixed'}) that.updateProperties({'flowable:dataType': 'fixed'})
if (selection instanceof Array){ if (selection instanceof Array) {
const userIds = selection.map(item => item.userId); const userIds = selection.map(item => item.userId);
const nickName = selection.map(item => item.nickName); const nickName = selection.map(item => item.nickName);
that.updateProperties({'flowable:candidateUsers': userIds.join(',')}) that.updateProperties({'flowable:candidateUsers': userIds.join(',')})
that.checkValues = nickName.join(','); that.checkValues = nickName.join(',');
}else { } else {
that.updateProperties({'flowable:assignee': selection.userId}) that.updateProperties({'flowable:assignee': selection.userId})
that.checkValues = selection.nickName; that.checkValues = selection.nickName;
} }
} }
}, },
// //
handleRoleSelect(selection,name) { handleRoleSelect(selection, name) {
const that = this; const that = this;
if (selection && name) { if (selection && name) {
that.deleteFlowAttar(); that.deleteFlowAttar();
this.updateProperties({'flowable:dataType': 'fixed'}) that.updateProperties({'flowable:dataType': 'fixed'})
that.updateProperties({'flowable:candidateGroups': selection}); that.updateProperties({'flowable:candidateGroups': selection});
that.checkValues = name; that.checkValues = name;
} }

22
ruoyi-ui/src/components/flow/Expression/index.vue

@ -50,11 +50,19 @@
</template> </template>
<script> <script>
import { listExpression, getExpression, delExpression, addExpression, updateExpression } from "@/api/system/expression"; import { listExpression } from "@/api/system/expression";
export default { export default {
name: "Expression", name: "Expression",
dicts: ['sys_common_status'], dicts: ['sys_common_status'],
//
props: {
selectValues: {
type: Number,
default: 0,
required: false
}
},
data() { data() {
return { return {
// //
@ -83,9 +91,18 @@ export default {
expression: null, expression: null,
status: null, status: null,
}, },
radioSelected:null radioSelected: this.selectValues
}; };
}, },
watch: {
selectValues: {
immediate: true,
handler(newVal) {
console.log(newVal,"selectValues")
this.radioSelected = newVal
}
}
},
created() { created() {
this.getList(); this.getList();
}, },
@ -112,7 +129,6 @@ export default {
// //
handleSingleExpSelect(selection) { handleSingleExpSelect(selection) {
this.radioSelected = selection.id;//,radio this.radioSelected = selection.id;//,radio
// console.log( this.radioSelected ,"handleSingleExpSelect");
this.$emit('handleSingleExpSelect',selection); this.$emit('handleSingleExpSelect',selection);
}, },
} }

2
ruoyi-ui/src/components/flow/Role/index.vue

@ -16,7 +16,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-if="selectType === 'multiple'" v-loading="loading" :data="roleList" @selection-change="handleMultipleRoleSelect"> <el-table v-if="selectType === 'multiple'" v-loading="loading" :data="roleList" @selection-change="handleMultipleRoleSelect">
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" width="50" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" /> <el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" /> <el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />

20
ruoyi-ui/src/components/flow/User/index.vue

@ -97,9 +97,16 @@ export default {
components: { Treeselect }, components: { Treeselect },
// //
props: { props: {
checkType: String, selectValues: {
default: 'multiple', type: Number | String,
required: false default: 0,
required: false
},
checkType: {
type: String,
default: 'multiple',
required: true
},
}, },
data() { data() {
return { return {
@ -166,6 +173,13 @@ export default {
// //
deptName(val) { deptName(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
},
selectValues: {
immediate: true,
handler(newVal) {
console.log(newVal,"user-selectValues")
this.radioSelected = newVal
}
} }
}, },
created() { created() {

18
ruoyi-ui/src/components/parser/Parser.vue

@ -79,15 +79,17 @@ function formBtns(h) {
} }
function renderFormItem(h, elementList) { function renderFormItem(h, elementList) {
return elementList.map(scheme => { if (elementList) {
const config = scheme.__config__ return elementList.map(scheme => {
const layout = layouts[config.layout] const config = scheme.__config__
const layout = layouts[config.layout]
if (layout) { if (layout) {
return layout.call(this, h, scheme) return layout.call(this, h, scheme)
} }
throw new Error(`没有与${config.layout}匹配的layout`) throw new Error(`没有与${config.layout}匹配的layout`)
}) })
}
} }
function renderChildren(h, scheme) { function renderChildren(h, scheme) {

9
ruoyi-ui/src/views/flowable/task/myProcess/send/index.vue

@ -26,9 +26,7 @@
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import {definitionStart, readXml} from "@/api/flowable/definition"; import {definitionStart, readXml} from "@/api/flowable/definition";
import flow from '@/views/flowable/task/record/flow' import flow from '@/views/flowable/task/record/flow'
import {treeselect} from "@/api/system/dept";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect";
import {listUser} from "@/api/system/user"; import {listUser} from "@/api/system/user";
import {flowFormData} from "@/api/flowable/process"; import {flowFormData} from "@/api/flowable/process";
@ -37,7 +35,6 @@ export default {
components: { components: {
Parser, Parser,
flow, flow,
Treeselect
}, },
props: {}, props: {},
data() { data() {
@ -83,12 +80,6 @@ export default {
this.loadModelXml(this.taskForm.deployId); this.loadModelXml(this.taskForm.deployId);
}, },
methods: { methods: {
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
});
},
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {

139
ruoyi-ui/src/views/flowable/task/todo/detail/index.vue

@ -78,61 +78,13 @@
</el-card> </el-card>
<!--审批正常流程--> <!--审批正常流程-->
<el-dialog :title="completeTitle" :visible.sync="completeOpen" :width="checkSendUser? '60%':'40%'" append-to-body> <el-dialog :title="completeTitle" :visible.sync="completeOpen" width="60%" append-to-body>
<el-form ref="taskForm" :model="taskForm"> <el-form ref="taskForm" :model="taskForm">
<el-form-item v-if="checkSendUser" prop="targetKey"> <el-form-item prop="targetKey">
<el-row :gutter="24"> <!-- <el-row :gutter="24">-->
<!-- <flow-user @handleUserSelect="handleUserSelect"></flow-user>--> <flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect"></flow-user>
<flow-role @handleRoleSelect="handleRoleSelect"></flow-role> <flow-role v-if="checkSendRole" @handleRoleSelect="handleRoleSelect"></flow-role>
<!-- &lt;!&ndash;部门数据&ndash;&gt;--> <!-- </el-row>-->
<!-- <el-col :span="6" :xs="24">-->
<!-- <h6>部门列表</h6>-->
<!-- <div class="head-container">-->
<!-- <el-input-->
<!-- v-model="deptName"-->
<!-- placeholder="请输入部门名称"-->
<!-- clearable-->
<!-- size="small"-->
<!-- prefix-icon="el-icon-search"-->
<!-- style="margin-bottom: 20px"-->
<!-- />-->
<!-- </div>-->
<!-- <div class="head-container">-->
<!-- <el-tree-->
<!-- :data="deptOptions"-->
<!-- :props="defaultProps"-->
<!-- :expand-on-click-node="false"-->
<!-- :filter-node-method="filterNode"-->
<!-- ref="tree"-->
<!-- default-expand-all-->
<!-- @node-click="handleNodeClick"-->
<!-- />-->
<!-- </div>-->
<!-- </el-col>-->
<!-- <el-col :span="10" :xs="24">-->
<!-- <h6>待选人员</h6>-->
<!-- <el-table-->
<!-- ref="singleTable"-->
<!-- :data="userList"-->
<!-- border-->
<!-- style="width: 100%"-->
<!-- @selection-change="handleSelectionChange">-->
<!-- <el-table-column type="selection" width="50" align="center" />-->
<!-- <el-table-column label="用户名" align="center" prop="nickName" />-->
<!-- <el-table-column label="部门" align="center" prop="dept.deptName" />-->
<!-- </el-table>-->
<!-- </el-col>-->
<!-- <el-col :span="8" :xs="24">-->
<!-- <h6>已选人员</h6>-->
<!-- <el-tag-->
<!-- v-for="(user,index) in userData"-->
<!-- :key="index"-->
<!-- closable-->
<!-- @close="handleClose(user)">-->
<!-- {{user.nickName}} {{user.dept.deptName}}-->
<!-- </el-tag>-->
<!-- </el-col>-->
</el-row>
</el-form-item> </el-form-item>
<el-form-item label="处理意见" label-width="80px" prop="comment" :rules="[{ required: true, message: '请输入处理意见', trigger: 'blur' }]"> <el-form-item label="处理意见" label-width="80px" prop="comment" :rules="[{ required: true, message: '请输入处理意见', trigger: 'blur' }]">
<el-input type="textarea" v-model="taskForm.comment" placeholder="请输入处理意见"/> <el-input type="textarea" v-model="taskForm.comment" placeholder="请输入处理意见"/>
@ -189,9 +141,7 @@ import Parser from '@/components/parser/Parser'
import {definitionStart, getProcessVariables, readXml, getFlowViewer} from "@/api/flowable/definition"; import {definitionStart, getProcessVariables, readXml, getFlowViewer} from "@/api/flowable/definition";
import {complete, rejectTask, returnList, returnTask, getNextFlowNode, delegate} from "@/api/flowable/todo"; import {complete, rejectTask, returnList, returnTask, getNextFlowNode, delegate} from "@/api/flowable/todo";
import flow from '@/views/flowable/task/record/flow' import flow from '@/views/flowable/task/record/flow'
import {treeselect} from "@/api/system/dept";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect";
import {listUser} from "@/api/system/user"; import {listUser} from "@/api/system/user";
export default { export default {
@ -199,7 +149,6 @@ export default {
components: { components: {
Parser, Parser,
flow, flow,
Treeselect,
FlowUser, FlowUser,
FlowRole, FlowRole,
}, },
@ -212,7 +161,6 @@ export default {
// //
deptName: undefined, deptName: undefined,
// //
deptOptions: undefined,
// //
userList: null, userList: null,
defaultProps: { defaultProps: {
@ -235,7 +183,6 @@ export default {
delegateTaskShow: false, // 退 delegateTaskShow: false, // 退
defaultTaskShow: true, // defaultTaskShow: true, //
sendUserShow: false, // sendUserShow: false, //
multiple: false,
comment:"", // comment:"", //
procInsId: "", // procInsId: "", //
instanceId: "", // instanceId: "", //
@ -245,7 +192,6 @@ export default {
vars: "", vars: "",
targetKey:"" targetKey:""
}, },
userDataList:[], //
assignee: null, assignee: null,
formConf: {}, // formConf: {}, //
variables: [], // variables: [], //
@ -258,7 +204,9 @@ export default {
rejectOpen: false, rejectOpen: false,
rejectTitle: null, rejectTitle: null,
userData:[], userData:[],
checkSendUser: false // checkSendUser: false, //
checkSendRole: false,//
checkType: 'single', //
}; };
}, },
created() { created() {
@ -278,12 +226,6 @@ export default {
this.getFlowRecordList(this.taskForm.procInsId, this.taskForm.deployId); this.getFlowRecordList(this.taskForm.procInsId, this.taskForm.deployId);
}, },
methods: { methods: {
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
});
},
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
@ -328,11 +270,10 @@ export default {
return "#b3bdbb"; return "#b3bdbb";
} }
}, },
// //
handleUserSelect(selection) { handleUserSelect(selection) {
console.log(selection,"handleUserSelect") console.log(selection,"handleUserSelect")
if (selection) { if (selection) {
this.userData = selection
const selectVal = selection.map(item => item.userId); const selectVal = selection.map(item => item.userId);
if (selectVal instanceof Array) { if (selectVal instanceof Array) {
this.taskForm.values = { this.taskForm.values = {
@ -345,28 +286,22 @@ export default {
} }
} }
}, },
// //
handleRoleSelect(selection) { handleRoleSelect(selection) {
console.log(selection,"handleRoleSelect") console.log(selection,"handleRoleSelect")
if (selection) { if (selection) {
this.userData = selection if (selection instanceof Array) {
const selectVal = selection.map(item => item.userId); const selectVal = selection.map(item => item.roleId);
if (selectVal instanceof Array) {
this.taskForm.values = { this.taskForm.values = {
"approval": selectVal.join(',') "approval": selectVal.join(',')
} }
} else { } else {
this.taskForm.values = { this.taskForm.values = {
"approval": selectVal "approval": selection
} }
} }
} }
}, },
//
handleClose(tag) {
this.userData.splice(this.userData.indexOf(tag), 1);
this.$refs.singleTable.toggleRowSelection(tag, false)
},
/** 流程变量赋值 */ /** 流程变量赋值 */
handleCheckChange(val) { handleCheckChange(val) {
if (val instanceof Array) { if (val instanceof Array) {
@ -413,46 +348,42 @@ export default {
getNextFlowNode(params).then(res => { getNextFlowNode(params).then(res => {
const data = res.data; const data = res.data;
if (data) { if (data) {
this.checkSendUser = true
if (data.type === 'assignee') { // if (data.type === 'assignee') { //
this.userDataList = res.data.userList; this.checkSendUser = true;
} else if (data.type === 'candidateUsers') { // () this.checkType = "single";
this.userDataList = res.data.userList; } else if (data.type === 'candidateUsers') { // ()
this.taskForm.multiple = true; this.checkSendUser = true;
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // () } else if (data.type === 'candidateGroups') { // ()
res.data.roleList.forEach(role => { this.checkSendRole = true;
role.userId = role.roleId;
role.nickName = role.roleName;
})
this.userDataList = res.data.roleList;
this.taskForm.multiple = false;
} else if (data.type === 'multiInstance') { // ? } else if (data.type === 'multiInstance') { // ?
this.userDataList = res.data.userList; this.checkSendUser = true;
this.taskForm.multiple = true;
}else if (data.type === 'fixed') { //
this.checkSendUser = false;
} }
} }
}) })
}, },
/** 审批任务选择 */ /** 加载审批任务弹框 */
handleComplete() { handleComplete() {
this.completeOpen = true; this.completeOpen = true;
this.completeTitle = "流程审批"; this.completeTitle = "流程审批";
this.getTreeselect();
}, },
/** 审批任务 */ /** 用户审批任务 */
taskComplete() { taskComplete() {
if (!this.taskForm.values && this.checkSendUser){ if (!this.taskForm.values && this.checkSendUser){
this.msgError("请选择流程接收人员"); this.$modal.msgError("请选择流程接收人员!");
return;
}
if (!this.taskForm.values && this.checkSendRole){
this.$modal.msgError("请选择流程接收角色组!");
return; return;
} }
if (!this.taskForm.comment){ if (!this.taskForm.comment){
this.msgError("请输入审批意见"); this.$modal.msgError("请输入审批意见!");
return; return;
} }
console.log(this.taskForm,"流程审批提交表单数据")
complete(this.taskForm).then(response => { complete(this.taskForm).then(response => {
this.msgSuccess(response.msg); this.$modal.msgSuccess(response.msg);
this.goBack(); this.goBack();
}); });
}, },
@ -504,7 +435,7 @@ export default {
variables.variables = formData; variables.variables = formData;
// //
definitionStart(that.taskForm.procDefId, JSON.stringify(variables)).then(res => { definitionStart(that.taskForm.procDefId, JSON.stringify(variables)).then(res => {
that.msgSuccess(res.msg); that.$modal.msgSuccess(res.msg);
that.goBack(); that.goBack();
}) })
} }
@ -520,7 +451,7 @@ export default {
this.$refs["taskForm"].validate(valid => { this.$refs["taskForm"].validate(valid => {
if (valid) { if (valid) {
rejectTask(this.taskForm).then(res => { rejectTask(this.taskForm).then(res => {
this.msgSuccess(res.msg); this.$modal.msgSuccess(res.msg);
this.goBack(); this.goBack();
}); });
} }
@ -540,7 +471,7 @@ export default {
this.$refs["taskForm"].validate(valid => { this.$refs["taskForm"].validate(valid => {
if (valid) { if (valid) {
returnTask(this.taskForm).then(res => { returnTask(this.taskForm).then(res => {
this.msgSuccess(res.msg); this.$modal.msgSuccess(res.msg);
this.goBack() this.goBack()
}); });
} }
@ -558,7 +489,7 @@ export default {
this.$refs["taskForm"].validate(valid => { this.$refs["taskForm"].validate(valid => {
if (valid) { if (valid) {
delegate(this.taskForm).then(response => { delegate(this.taskForm).then(response => {
this.msgSuccess(response.msg); this.$modal.msgSuccess(response.msg);
this.goBack(); this.goBack();
}); });
} }

Loading…
Cancel
Save