fix(任务管理): 处理选择可退回任务

approve-sys
zhuyong 3 years ago
parent af870c02bb
commit 7a1ff7b7e9

@ -1,36 +1,57 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- <el-row :gutter="20">-->
<el-card class="box-card" > <el-card class="box-card" >
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="el-icon-document">基础信息</span> <span class="el-icon-document">基础信息</span>
<el-button style="float: right;" type="primary" @click="goBack"></el-button> <el-button style="float: right;" type="primary" @click="goBack"></el-button>
</div> </div>
<!--流程表单填写数据-->
<el-col :span="16" :offset="8" v-if="variableOpen"> <el-col :span="16" :offset="8" v-if="variableOpen">
<div style="margin-bottom: 20px;font-size: 14px" v-for="item in variables"> <el-form style="margin-bottom: 20px;font-size: 14px" ref="variablesForm" label-width="80px" size="mini">
<label style="font-weight: normal">{{item.label}} </label> <div v-for="item in variables">
<el-form-item :label="item.label">
<label v-if="item.val instanceof Array" style="color:#8a909c;font-weight: normal">{{item.val[0]}} {{item.val[1]}}</label> <label v-if="item.val instanceof Array" style="color:#8a909c;font-weight: normal">{{item.val[0]}} {{item.val[1]}}</label>
<label v-else style="color:#8a909c;font-weight: normal">{{item.val}}</label> <label v-else style="color:#8a909c;font-weight: normal">{{item.val}}</label>
</el-form-item>
</div> </div>
</el-form>
<!--审批意见填写--> <!--审批意见填写-->
<div style="margin-bottom: 20px;font-size: 14px;" v-if="finished"> <div style="margin-bottom: 20px;font-size: 14px;" v-if="finished">
<label style="font-weight: normal;font-size: 14px;">审批意见</label> <el-form ref="taskForm" :model="taskForm" label-width="80px" size="mini">
<el-input style="margin-top:10px;width:50%" type="textarea" v-model="comment" placeholder="请输入意见"/> <el-form-item label="退回节点" prop="targetKey" v-show="taskForm.returnTaskShow">
<div style="margin-top: 20px"> <el-radio-group v-model="taskForm.targetKey">
<<el-radio-button
v-for="item in returnTaskList"
:key="item.id"
:label="item.id"
>{{item.name}}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="审批意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
<el-input style="width: 30%;" type="textarea" v-model="taskForm.comment" placeholder="请输入意见"/>
</el-form-item>
<el-form-item>
<div v-show="taskForm.defaultTaskShow">
<el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleComplete"></el-button> <el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleComplete"></el-button>
<el-button icon="el-icon-refresh-left" type="warning" size="mini" >退回</el-button> <el-button icon="el-icon-refresh-left" type="warning" size="mini" @click="handleReturn">退</el-button>
<el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleReject"></el-button> <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleReject"></el-button>
</div> </div>
<div v-show="taskForm.returnTaskShow">
<el-button type="primary" @click="submitReturnTask"> </el-button>
<el-button @click="cancelTask"> </el-button>
</div>
</el-form-item>
</el-form>
</div> </div>
</el-col> </el-col>
<!--初始化流程加载表单信息--> <!--初始化流程加载表单信息-->
<el-col :span="16" :offset="4" v-if="formConfOpen"> <el-col :span="16" :offset="4" v-if="formConfOpen">
<div class="test-form"> <div class="test-form">
<parser :key="new Date().getTime()" :form-conf="formConf" @submit="sumbitForm1" ref="parser" @getData="getData" /> <parser :key="new Date().getTime()" :form-conf="formConf" @submit="submitForm" ref="parser" @getData="getData" />
</div> </div>
<!-- <el-button type="success" size="mini" @click="startProcess"></el-button>-->
</el-col> </el-col>
</el-card> </el-card>
@ -77,20 +98,17 @@
<el-image :src="src"></el-image> <el-image :src="src"></el-image>
</el-col> </el-col>
</el-card> </el-card>
<!-- </el-row>-->
</div> </div>
</template> </template>
<script> <script>
import { flowRecord } from "@/api/flowable/finished"; import { flowRecord } from "@/api/flowable/finished";
// import BpmnViewer from '@/components/BpmnViewer/src/BpmnViewer'
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import {definitionStart, getProcessVariables } from "@/api/flowable/definition"; import {definitionStart, getProcessVariables } from "@/api/flowable/definition";
import {complete, rejectTask} from "@/api/flowable/todo"; import {complete, rejectTask, returnList, returnTask} from "@/api/flowable/todo";
export default { export default {
name: "Record", name: "Record",
components: { components: {
// BpmnViewer
Parser Parser
}, },
props: {}, props: {},
@ -101,36 +119,40 @@ export default {
flowRecordList: [], // flowRecordList: [], //
formConfCopy: {}, formConfCopy: {},
src: null, src: null,
form:{}, rules: {}, //
// variablesForm: {}, //
rules: {}, taskForm:{
returnTaskShow: false,
defaultTaskShow: true,
comment:"", // comment:"", //
procInsId: "", //
deployId: "", //
taskId: "" ,//
procDefId: "", //
},
formConf: {}, // formConf: {}, //
formConfOpen: false, // formConfOpen: false, //
procDefId: "", //
variables: [], // variables: [], //
variableOpen: false, // variableOpen: false, //
procInsId: "", // returnTaskList: [], // 退
deployId: "", //
taskId: "" ,//
finished: false, finished: false,
isFinished: 0 isFinished: 0
}; };
}, },
created() { created() {
this.procInsId = this.$route.query && this.$route.query.procInsId; this.taskForm.procInsId = this.$route.query && this.$route.query.procInsId;
// //
this.deployId = this.$route.query && this.$route.query.deployId; this.taskForm.deployId = this.$route.query && this.$route.query.deployId;
this.procDefId = this.$route.query && this.$route.query.procDefId; this.taskForm.procDefId = this.$route.query && this.$route.query.procDefId;
this.isFinished = this.$route.query && this.$route.query.isFinished this.isFinished = this.$route.query && this.$route.query.isFinished
// //
this.taskId = this.$route.query && this.$route.query.taskId; this.taskForm.taskId = this.$route.query && this.$route.query.taskId;
if (this.taskId){ if (this.taskForm.taskId){
this.processVariables(this.taskId) this.processVariables( this.taskForm.taskId)
this.deployId = null this.taskForm.deployId = null
} }
this.getFlowRecordList(this.procInsId,this.deployId); this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId);
}, },
mounted() { mounted() {
// // // //
@ -170,8 +192,7 @@ export default {
this.formConf = res.data.formData; this.formConf = res.data.formData;
this.formConfOpen = true this.formConfOpen = true
} }
// todo:
//
if (this.isFinished == 0) { if (this.isFinished == 0) {
this.finished = res.data.finished; this.finished = res.data.finished;
} }
@ -188,19 +209,6 @@ export default {
} }
}) })
}, },
/** 启动流程 */
startProcess(){
this.$refs.parser.getData()
if (this.procDefId) {
let variables = {
"variables": this.variables
}
definitionStart(this.procDefId,JSON.stringify(variables)).then(res => {
this.msgSuccess(res.msg);
})
}
},
/** 获取流程变量内容 */ /** 获取流程变量内容 */
processVariables(taskId){ processVariables(taskId){
if (taskId) { if (taskId) {
@ -212,28 +220,12 @@ export default {
}, },
/** 审批任务*/ /** 审批任务*/
handleComplete() { handleComplete() {
const params = { complete(this.taskForm).then(response => {
instanceId: this.procInsId,
taskId: this.taskId,
comment:this.comment
}
complete(params).then(response => {
this.msgSuccess(response.msg); this.msgSuccess(response.msg);
this.goBack(); this.goBack();
}) })
}, },
/** 驳回任务 */ /** 返回页面 */
handleReject() {
const params = {
taskId: this.taskId,
comment: this.comment
}
rejectTask(params).then(res => {
this.msgSuccess(res.msg);
this.goBack();
})
},
/** 回退页面 */
goBack(){ goBack(){
// //
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch("tagsView/delView", this.$route);
@ -261,8 +253,8 @@ export default {
this.variables = variables; this.variables = variables;
} }
}, },
sumbitForm1(data) { /** 申请流程表单数据提交 */
console.log('sumbitForm1提交数据', data) submitForm(data) {
if (data){ if (data){
const variableList = []; const variableList = [];
data.fields.forEach(item =>{ data.fields.forEach(item =>{
@ -280,17 +272,45 @@ export default {
} }
variableList.push(variableData) variableList.push(variableData)
}) })
// this.variables = variables; if (this.taskForm.procDefId) {
if (this.procDefId) {
let variables = { let variables = {
"variables": variableList "variables": variableList
} }
definitionStart(this.procDefId,JSON.stringify(variables)).then(res => { //
definitionStart(this.taskForm.procDefId,JSON.stringify(variables)).then(res => {
this.msgSuccess(res.msg); this.msgSuccess(res.msg);
this.goBack(); this.goBack();
}) })
} }
} }
},
/** 驳回任务 */
handleReject() {
rejectTask(this.taskForm).then(res => {
this.msgSuccess(res.msg);
this.goBack();
})
},
/** 可退回任务列表 */
handleReturn() {
returnList(this.taskForm).then(res => {
this.returnTaskList = res.data;
this.taskForm.returnTaskShow = true;
this.taskForm.defaultTaskShow = false;
})
},
/** 取消回退任务按钮 */
cancelTask() {
this.taskForm.returnTaskShow = false;
this.taskForm.defaultTaskShow = true;
this.returnTaskList = [];
},
/** 提交退回任务 */
submitReturnTask(){
returnTask(this.taskForm).then(res => {
this.msgSuccess(res.msg);
this.goBack()
})
} }
} }
}; };

@ -99,27 +99,6 @@
@click="handleProcess(scope.row)" @click="handleProcess(scope.row)"
>处理 >处理
</el-button> </el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit-outline"-->
<!-- @click="handleComplete(scope.row)"-->
<!-- >审批-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-refresh-left"-->
<!-- @click="handleReturn(scope.row)"-->
<!-- >退回-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-circle-close"-->
<!-- @click="handleReject(scope.row)"-->
<!-- >驳回-->
<!-- </el-button>-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -139,63 +118,6 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 审批任务 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="任务编号" prop="taskId">
<el-input disabled v-model="form.taskId"/>
</el-form-item>
<el-form-item label="意见内容" prop="comment">
<el-input type="textarea" v-model="form.comment" placeholder="请输入意见"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 驳回任务 -->
<el-dialog :title="rejectTask.title" :visible.sync="rejectTask.open" width="500px" append-to-body>
<el-form ref="rejectTask" :model="rejectTask" label-width="80px">
<el-form-item label="任务编号" prop="taskId">
<el-input disabled v-model="rejectTask.taskId"/>
</el-form-item>
<el-form-item label="意见内容" prop="comment">
<el-input type="textarea" v-model="rejectTask.comment" placeholder="请输入意见"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitRejectForm"> </el-button>
<el-button @click="cancelReject"> </el-button>
</div>
</el-dialog>
<!-- 退回任务 -->
<el-dialog :title="returnTaskData.title" :visible.sync="returnTaskData.open" width="500px" append-to-body>
<el-table
v-loading="loading"
:data="returnList"
@current-change="handleCurrentChange"
highlight-current-row
border
>
<el-table-column width="55" align="center" label="选择">
<template scope="scope">
<el-radio :label="scope.$index" v-model="radio" @change.native="handleRadioChoice(scope.row)">{{""}}</el-radio>
</template>
</el-table-column>
<el-table-column label="退回key" align="center" prop="id"/>
<el-table-column label="退回节点" align="center" prop="name"/>
</el-table>
<el-divider></el-divider>
<label>意见</label><el-input type="textarea" v-model="taskComment" placeholder="请输入意见"/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitReturnTask"> </el-button>
<el-button @click="cancelTask"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -234,13 +156,6 @@ export default {
title: "", title: "",
// //
open: false, open: false,
radio: "",
// 退
returnList: [],
// 退
returnTaskData: {},
// 退
taskComment: "",
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -250,14 +165,12 @@ export default {
}, },
// //
form: {}, form: {},
rejectTask:{},
// //
rules: {} rules: {}
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 查询流程定义列表 */ /** 查询流程定义列表 */
@ -284,17 +197,6 @@ export default {
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
//
cancelReject() {
this.rejectTask.open = false;
this.rejectTask = {};
},
//
cancelTask() {
this.returnTaskData.open = false;
this.radio = "";
this.getList();
},
// //
reset() { reset() {
this.form = { this.form = {
@ -327,58 +229,12 @@ export default {
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
//
handleRadioChoice(row){
this.returnTaskData.targetKey = row.id
},
handleCurrentChange(val) {
if (val) {
let index = this.returnList.findIndex(
item => item.id === val.id
)
if (index > -1) {
this.radio = index;
}
this.$emit('data', val.pkg)
}
this.returnTaskData.targetKey = val.id
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加流程定义"; this.title = "添加流程定义";
}, },
/** 审批任务*/
handleComplete(row) {
this.form = {
instanceId: row.procInsId,
taskId: row.taskId
}
this.open = true;
this.title = "审批任务";
},
/** 可退回任务列表 */
handleReturn(row) {
const params = {
taskId: row.taskId
}
returnList(params).then(res => {
this.returnList = res.data;
this.returnTaskData.taskId = params.taskId
this.returnTaskData.open = true;
this.returnTaskData.title = "可退回任务列表";
})
},
/** 驳回任务 */
handleReject(row) {
this.rejectTask = {
instanceId: row.procInsId,
taskId: row.taskId
}
this.rejectTask.open = true;
this.rejectTask.title = "驳回任务";
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
@ -389,43 +245,6 @@ export default {
this.title = "修改流程定义"; this.title = "修改流程定义";
}); });
}, },
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
complete(this.form).then(response => {
this.msgSuccess(response.msg);
this.open = false;
this.getList();
})
}
});
},
/** 提交退回任务*/
submitReturnTask(){
const params = {
taskId: this.returnTaskData.taskId,
targetKey: this.returnTaskData.targetKey
}
returnTask(params).then(res => {
this.returnTaskData.open = false;
this.msgSuccess(res.msg);
this.radio = "";
this.getList();
})
},
/** 提交驳回任务*/
submitRejectForm(){
const params = {
taskId: this.rejectTask.taskId,
comment: this.rejectTask.comment
}
rejectTask(params).then(res => {
this.msgSuccess(res.msg);
this.rejectTask.open = false;
this.getList();
})
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;

Loading…
Cancel
Save