feat: 开始节点获取

This commit is contained in:
tony
2022-12-15 18:24:12 +08:00
parent dd11a1ac66
commit 295a46662e
16 changed files with 311 additions and 227 deletions

View File

@@ -102,7 +102,7 @@
<el-table-column label="操作" width="250" fixed="right"class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button @click="handleLoadXml(scope.row)" icon="el-icon-edit-outline" type="text" size="small">编辑</el-button>
<el-button @click="handleAddForm(scope.row)" type="text" size="small" v-if="scope.row.formId == null">配置表单</el-button>
<el-button @click="handleAddForm(scope.row)" icon="el-icon-edit-outline" type="text" size="small" v-if="scope.row.formId == null">配置表单</el-button>
<el-button @click="handleUpdateSuspensionState(scope.row)" icon="el-icon-video-pause" type="text" size="small" v-if="scope.row.suspensionState === 1">挂起</el-button>
<el-button @click="handleUpdateSuspensionState(scope.row)" icon="el-icon-video-play" type="text" size="small" v-if="scope.row.suspensionState === 2">激活</el-button>
<el-button @click="handleDelete(scope.row)" icon="el-icon-delete" type="text" size="small" v-hasPermi="['system:deployment:remove']">删除</el-button>
@@ -401,7 +401,7 @@ export default {
/** 启动流程 */
handleDefinitionStart(row){
definitionStart(row.id).then(res =>{
this.msgSuccess(res.msg);
this.$modal.msgSuccess(res.msg);
})
},
/** 挂载表单弹框 */
@@ -435,7 +435,7 @@ export default {
submitFormDeploy(row){
this.formDeployParam.formId = row.formId;
addDeployForm(this.formDeployParam).then(res =>{
this.msgSuccess(res.msg);
this.$modal.msgSuccess(res.msg);
this.formDeployOpen = false;
this.getList();
})
@@ -456,7 +456,7 @@ export default {
state: state
}
updateState(params).then(res => {
this.msgSuccess(res.msg);
this.$modal.msgSuccess(res.msg);
this.getList();
});
},
@@ -476,13 +476,13 @@ export default {
if (valid) {
if (this.form.id != null) {
updateDeployment(this.form).then(response => {
this.msgSuccess("修改成功");
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDeployment(this.form).then(response => {
this.msgSuccess("新增成功");
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
@@ -501,7 +501,7 @@ export default {
return delDeployment(deploymentIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
this.$modal.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */

View File

@@ -12,6 +12,26 @@
</div>
</el-col>
</el-card>
<!--审批正常流程-->
<el-dialog :title="completeTitle" :visible.sync="completeOpen" width="60%" append-to-body>
<el-form ref="taskForm" :model="taskForm">
<el-form-item prop="targetKey">
<!-- <el-row :gutter="24">-->
<flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect"></flow-user>
<flow-role v-if="checkSendRole" @handleRoleSelect="handleRoleSelect"></flow-role>
<!-- </el-row>-->
</el-form-item>
<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-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="completeOpen = false"> </el-button>
<el-button type="primary" @click="taskComplete"> </el-button>
</span>
</el-dialog>
<!--流程图-->
<el-card class="box-card">
<div slot="header" class="clearfix">
@@ -29,6 +49,7 @@ import flow from '@/views/flowable/task/record/flow'
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listUser} from "@/api/system/user";
import {flowFormData} from "@/api/flowable/process";
import {getNextFlowNodeByStart} from "@/api/flowable/todo";
export default {
name: "Record",
@@ -69,12 +90,18 @@ export default {
},
formConf: {}, // 默认表单数据
variables: [], // 流程变量数据
completeTitle: null,
completeOpen: false,
checkSendUser: false, // 是否展示人员选择模块
checkSendRole: false,// 是否展示角色选择模块
checkType: 'single', // 选择类型
};
},
created() {
this.taskForm.deployId = this.$route.query && this.$route.query.deployId;
// 初始化表单
this.taskForm.procDefId = this.$route.query && this.$route.query.procDefId;
this.getNextFlowNode(this.taskForm.deployId);
this.getFlowFormData(this.taskForm.deployId);
// 回显流程记录
this.loadModelXml(this.taskForm.deployId);
@@ -143,7 +170,7 @@ export default {
formData.formBtns = false;
if (this.taskForm.procDefId) {
variables.variables = formData;
// 启动流程并将表单数据加入流程变量
// 启动流程并将表单数据加入流程变量
definitionStart(this.taskForm.procDefId, JSON.stringify(variables)).then(res => {
this.msgSuccess(res.msg);
this.goBack();
@@ -151,6 +178,57 @@ export default {
}
}
},
/** 根据当前任务获取流程设计配置的下一步节点 */
getNextFlowNode(deploymentId) {
// 根据当前任务或者流程设计配置的下一步节点 todo 暂时未涉及到考虑网关、表达式和多节点情况
const params = {deploymentId: deploymentId}
getNextFlowNodeByStart(params).then(res => {
const data = res.data;
if (data) {
if (data.type === 'assignee') { // 指定人员
this.checkSendUser = true;
this.checkType = "single";
} else if (data.type === 'candidateUsers') { // 候选人员(多个)
this.checkSendUser = true;
this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // 指定组(所属角色接收任务)
this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // 会签?
this.checkSendUser = true;
}
}
})
},
// 用户信息选中数据
handleUserSelect(selection) {
if (selection) {
const selectVal = selection.map(item => item.userId);
if (selectVal instanceof Array) {
this.taskForm.values = {
"approval": selectVal.join(',')
}
} else {
this.taskForm.values = {
"approval": selectVal
}
}
}
},
// 角色信息选中数据
handleRoleSelect(selection) {
if (selection) {
if (selection instanceof Array) {
const selectVal = selection.map(item => item.roleId);
this.taskForm.values = {
"approval": selectVal.join(',')
}
} else {
this.taskForm.values = {
"approval": selection
}
}
}
},
}
};
</script>

View File

@@ -272,7 +272,7 @@ export default {
},
// 用户信息选中数据
handleUserSelect(selection) {
console.log(selection,"handleUserSelect")
// console.log(selection,"handleUserSelect")
if (selection) {
const selectVal = selection.map(item => item.userId);
if (selectVal instanceof Array) {
@@ -288,7 +288,7 @@ export default {
},
// 角色信息选中数据
handleRoleSelect(selection) {
console.log(selection,"handleRoleSelect")
// console.log(selection,"handleRoleSelect")
if (selection) {
if (selection instanceof Array) {
const selectVal = selection.map(item => item.roleId);
@@ -381,7 +381,7 @@ export default {
this.$modal.msgError("请输入审批意见!");
return;
}
console.log(this.taskForm,"流程审批提交表单数据")
// console.log(this.taskForm,"流程审批提交表单数据")
complete(this.taskForm).then(response => {
this.$modal.msgSuccess(response.msg);
this.goBack();