fix: 会签任务可选择任务接收人

rf
tony 2022-12-18 17:20:40 +08:00
parent be62877c37
commit bfd75ac552
4 changed files with 59 additions and 56 deletions

View File

@ -954,7 +954,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
// 会签节点 // 会签节点
if (Objects.nonNull(multiInstance)) { if (Objects.nonNull(multiInstance)) {
flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER); flowNextDto.setVars(multiInstance.getInputDataItem());
flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE);
} else { } else {
// 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组
@ -994,7 +994,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics(); MultiInstanceLoopCharacteristics multiInstance = userTask.getLoopCharacteristics();
// 会签节点 // 会签节点
if (Objects.nonNull(multiInstance)) { if (Objects.nonNull(multiInstance)) {
flowNextDto.setVars(ProcessConstants.PROCESS_MULTI_INSTANCE_USER); flowNextDto.setVars(multiInstance.getInputDataItem());
flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE); flowNextDto.setType(ProcessConstants.PROCESS_MULTI_INSTANCE);
} else { } else {
// 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组 // 读取自定义节点属性 判断是否是否需要动态指定任务接收人员、组

View File

@ -176,7 +176,7 @@
<!-- 流程图 --> <!-- 流程图 -->
<el-dialog :title="readImage.title" :visible.sync="readImage.open" width="70%" append-to-body> <el-dialog :title="readImage.title" :visible.sync="readImage.open" width="70%" append-to-body>
<!-- <el-image :src="readImage.src"></el-image> --> <!-- <el-image :src="readImage.src"></el-image> -->
<flow :xmlData="xmlData"/> <flow :flowData="flowData"/>
</el-dialog> </el-dialog>
<!--表单配置详情--> <!--表单配置详情-->
@ -227,7 +227,16 @@
</template> </template>
<script> <script>
import { listDefinition, updateState, delDeployment, addDeployment, updateDeployment, exportDeployment, definitionStart, readXml} from "@/api/flowable/definition"; import {
listDefinition,
updateState,
delDeployment,
addDeployment,
updateDeployment,
exportDeployment,
definitionStart,
flowXmlAndNode
} from "@/api/flowable/definition";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { getForm, addDeployForm ,listForm } from "@/api/flowable/form"; import { getForm, addDeployForm ,listForm } from "@/api/flowable/form";
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
@ -311,7 +320,7 @@ export default {
}, },
currentRow: null, currentRow: null,
// xml // xml
xmlData:"", flowData: {},
// //
form: {}, form: {},
// //
@ -380,13 +389,12 @@ export default {
this.$router.push({ path: '/flowable/definition/model',query: { deployId: row.deploymentId }}) this.$router.push({ path: '/flowable/definition/model',query: { deployId: row.deploymentId }})
}, },
/** 流程图查看 */ /** 流程图查看 */
handleReadImage(deploymentId){ handleReadImage(deployId){
this.readImage.title = "流程图"; this.readImage.title = "流程图";
this.readImage.open = true; this.readImage.open = true;
// this.readImage.src = process.env.VUE_APP_BASE_API + "/flowable/definition/readImage/" + deploymentId; // this.readImage.src = process.env.VUE_APP_BASE_API + "/flowable/definition/readImage/" + deploymentId;
// xml flowXmlAndNode({deployId:deployId}).then(res => {
readXml(deploymentId).then(res =>{ this.flowData = res.data;
this.xmlData = res.data
}) })
}, },
/** 表单查看 */ /** 表单查看 */

View File

@ -5,9 +5,9 @@
<span class="el-icon-document">发起任务</span> <span class="el-icon-document">发起任务</span>
<el-button style="float: right;" size="mini" type="primary" @click="goBack"></el-button> <el-button style="float: right;" size="mini" type="primary" @click="goBack"></el-button>
</div> </div>
<el-tabs tab-position="top" @tab-click="handleClick"> <el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<!--表单信息--> <!--表单信息-->
<el-tab-pane label="表单信息"> <el-tab-pane label="表单信息" name="1">
<!--初始化流程加载表单信息--> <!--初始化流程加载表单信息-->
<el-col :span="16" :offset="4"> <el-col :span="16" :offset="4">
<div class="test-form"> <div class="test-form">
@ -16,7 +16,7 @@
</el-col> </el-col>
</el-tab-pane> </el-tab-pane>
<!--流程图--> <!--流程图-->
<el-tab-pane label="流程图"> <el-tab-pane label="流程图" name="2">
<flow :flowData="flowData"/> <flow :flowData="flowData"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -56,6 +56,7 @@ export default {
return { return {
// xml // xml
flowData: {}, flowData: {},
activeName: '1', // tab
defaultProps: { defaultProps: {
children: "children", children: "children",
label: "label" label: "label"
@ -74,10 +75,10 @@ export default {
taskOpen: false, taskOpen: false,
checkSendUser: false, // checkSendUser: false, //
checkSendRole: false,// checkSendRole: false,//
checkType: 'single', // checkType: '', //
checkValues: null, // checkValues: null, //
formData: {}, // , formData: {}, // ,
activeValue: 1, // tab multiInstanceVars: '' //
}; };
}, },
created() { created() {
@ -89,7 +90,7 @@ export default {
}, },
methods: { methods: {
handleClick(tab, event) { handleClick(tab, event) {
if (tab.name === '3'){ if (tab.name === '2'){
flowXmlAndNode({deployId:this.deployId}).then(res => { flowXmlAndNode({deployId:this.deployId}).then(res => {
this.flowData = res.data; this.flowData = res.data;
}) })
@ -149,7 +150,10 @@ export default {
} else if (data.type === 'candidateGroups') { // () } else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true; this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // ? } else if (data.type === 'multiInstance') { // ?
// elementVariable
this.multiInstanceVars = data.vars;
this.checkSendUser = true; this.checkSendUser = true;
this.checkType = "multiple";
} }
if (this.checkSendUser || this.checkSendRole){ if (this.checkSendUser || this.checkSendRole){
this.taskOpen = true; this.taskOpen = true;
@ -194,7 +198,11 @@ export default {
// //
formData.formBtns = false; formData.formBtns = false;
variables.variables = formData; variables.variables = formData;
variables.approval = this.checkValues; if (this.multiInstanceVars) {
this.$set(variables, this.multiInstanceVars, this.checkValues);
} else {
this.$set(variables, "approval", this.checkValues);
}
console.log(variables,"流程发起提交表单数据") console.log(variables,"流程发起提交表单数据")
// //
definitionStart(this.procDefId, JSON.stringify(variables)).then(res => { definitionStart(this.procDefId, JSON.stringify(variables)).then(res => {
@ -218,7 +226,10 @@ export default {
} else if (data.type === 'candidateGroups') { // () } else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true; this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // ? } else if (data.type === 'multiInstance') { // ?
// elementVariable
this.multiInstanceVars = data.vars;
this.checkSendUser = true; this.checkSendUser = true;
this.checkType = "multiple";
} }
} }
}) })
@ -228,7 +239,11 @@ export default {
if (selection) { if (selection) {
if (selection instanceof Array) { if (selection instanceof Array) {
const selectVal = selection.map(item => item.userId); const selectVal = selection.map(item => item.userId);
this.checkValues = selectVal.join(',') if (this.multiInstanceVars) {
this.checkValues = selection;
} else {
this.checkValues = selectVal.join(',');
}
} else { } else {
this.checkValues = selection.userId; this.checkValues = selection.userId;
} }

View File

@ -179,15 +179,14 @@ export default {
returnTaskShow: false, // 退 returnTaskShow: false, // 退
delegateTaskShow: false, // 退 delegateTaskShow: false, // 退
defaultTaskShow: true, // defaultTaskShow: true, //
sendUserShow: false, //
comment:"", // comment:"", //
procInsId: "", // procInsId: "", //
instanceId: "", // instanceId: "", //
deployId: "", // deployId: "", //
taskId: "" ,// taskId: "" ,//
procDefId: "", // procDefId: "", //
vars: "", targetKey:"",
targetKey:"" variables:{},
}, },
assignee: null, assignee: null,
formConf: {}, // formConf: {}, //
@ -205,7 +204,8 @@ export default {
checkSendRole: false,// checkSendRole: false,//
checkType: 'single', // checkType: 'single', //
taskName: null, // taskName: null, //
startUser: null, // startUser: null, // ,
multiInstanceVars: '' //
}; };
}, },
created() { created() {
@ -252,13 +252,13 @@ export default {
if (selection) { if (selection) {
if (selection instanceof Array) { if (selection instanceof Array) {
const selectVal = selection.map(item => item.userId); const selectVal = selection.map(item => item.userId);
this.taskForm.values = { if (this.multiInstanceVars) {
"approval": selectVal.join(',') this.$set(this.taskForm.variables, this.multiInstanceVars, selection);
} else {
this.$set(this.taskForm.variables, "approval", selectVal.join(','));
} }
} else { } else {
this.taskForm.values = { this.$set(this.taskForm.variables, "approval", selection);
"approval": selection
}
} }
} }
}, },
@ -267,25 +267,9 @@ export default {
if (selection) { if (selection) {
if (selection instanceof Array) { if (selection instanceof Array) {
const selectVal = selection.map(item => item.roleId); const selectVal = selection.map(item => item.roleId);
this.taskForm.values = { this.$set(this.taskForm.variables, "approval", selectVal.join(','));
"approval": selectVal.join(',')
}
} else { } else {
this.taskForm.values = { this.$set(this.taskForm.variables, "approval", selection);
"approval": selection
}
}
}
},
/** 流程变量赋值 */
handleCheckChange(val) {
if (val instanceof Array) {
this.taskForm.values = {
"approval": val.join(',')
}
} else {
this.taskForm.values = {
"approval": val
} }
} }
}, },
@ -332,12 +316,10 @@ export default {
} else if (data.type === 'candidateGroups') { // () } else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true; this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // } else if (data.type === 'multiInstance') { //
listUser().then(response => { // elementVariable
this.taskForm.values = { this.multiInstanceVars = data.vars;
"userList": response.rows this.checkSendUser = true;
} this.checkType = "multiple";
}
);
} }
} }
}) })
@ -349,11 +331,11 @@ export default {
}, },
/** 用户审批任务 */ /** 用户审批任务 */
taskComplete() { taskComplete() {
if (!this.taskForm.values && this.checkSendUser){ if (!this.taskForm.variables && this.checkSendUser){
this.$modal.msgError("请选择流程接收人员!"); this.$modal.msgError("请选择流程接收人员!");
return; return;
} }
if (!this.taskForm.values && this.checkSendRole){ if (!this.taskForm.variables && this.checkSendRole){
this.$modal.msgError("请选择流程接收角色组!"); this.$modal.msgError("请选择流程接收角色组!");
return; return;
} }
@ -361,7 +343,7 @@ export default {
this.$modal.msgError("请输入审批意见!"); this.$modal.msgError("请输入审批意见!");
return; return;
} }
// console.log(this.taskForm,"") console.log(this.taskForm,"流程审批提交表单数据")
complete(this.taskForm).then(response => { complete(this.taskForm).then(response => {
this.$modal.msgSuccess(response.msg); this.$modal.msgSuccess(response.msg);
this.goBack(); this.goBack();
@ -425,7 +407,7 @@ export default {
this.returnTitle = "退回流程"; this.returnTitle = "退回流程";
returnList(this.taskForm).then(res => { returnList(this.taskForm).then(res => {
this.returnTaskList = res.data; this.returnTaskList = res.data;
this.taskForm.values = null; this.taskForm.variables = null;
}) })
}, },
/** 提交退回任务 */ /** 提交退回任务 */
@ -443,7 +425,6 @@ export default {
cancelTask() { cancelTask() {
this.taskForm.returnTaskShow = false; this.taskForm.returnTaskShow = false;
this.taskForm.defaultTaskShow = true; this.taskForm.defaultTaskShow = true;
this.taskForm.sendUserShow = true;
this.returnTaskList = []; this.returnTaskList = [];
}, },
/** 委派任务 */ /** 委派任务 */
@ -461,7 +442,6 @@ export default {
cancelDelegateTask() { cancelDelegateTask() {
this.taskForm.delegateTaskShow = false; this.taskForm.delegateTaskShow = false;
this.taskForm.defaultTaskShow = true; this.taskForm.defaultTaskShow = true;
this.taskForm.sendUserShow = true;
this.returnTaskList = []; this.returnTaskList = [];
}, },
} }