fix: 优化审批、退回流程页面选择样式

approve-sys
tony 3 years ago
parent 09a99b859a
commit 8b163c914e

@ -2,6 +2,8 @@
基RuoYi-vue 4.x + flowable 6.5 的工作流管理 ~ 基RuoYi-vue 4.x + flowable 6.5 的工作流管理 ~
记得右上角点个 star 持续关注更新哟~~
一直想学习和入门flowable, 期间大量面向百度编程解决了很多问题, 感谢 [flowable初级使用手册](https://www.shangmayuan.com/a/538a0b230dbe4798b273305b.html) 一直想学习和入门flowable, 期间大量面向百度编程解决了很多问题, 感谢 [flowable初级使用手册](https://www.shangmayuan.com/a/538a0b230dbe4798b273305b.html)
,零基础学习很值得一看。最后感谢 [若依框架](https://gitee.com/y_project/RuoYi-Vue) ,快速集成开发爽到飞起 ~~~ ,零基础学习很值得一看。最后感谢 [若依框架](https://gitee.com/y_project/RuoYi-Vue) ,快速集成开发爽到飞起 ~~~

@ -160,7 +160,6 @@ export default {
this.adjustPalette() this.adjustPalette()
this.fitViewport() this.fitViewport()
if (this.taskList !==undefined && this.taskList.length > 0 ) { if (this.taskList !==undefined && this.taskList.length > 0 ) {
debugger
this.fillColor() this.fillColor()
} }
} catch (err) { } catch (err) {

@ -1,75 +1,36 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<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="6" v-if="variableOpen">
<!--申请流程初始化表单模块-->
<div>
<parser :key="new Date().getTime()" :form-conf="variablesData" />
</div>
<!--审批流程模块--> <!--流程处理表单模块-->
<div style="margin-left:20px;margin-bottom: 20px;font-size: 14px;" v-if="finished === 'true'"> <el-col :span="16" :offset="6" v-if="variableOpen">
<el-form ref="taskForm" :model="taskForm" label-width="80px" size="mini"> <div>
<el-form-item label="退回节点" prop="targetKey" v-show="taskForm.returnTaskShow"> <parser :key="new Date().getTime()" :form-conf="variablesData" />
<el-radio-group v-model="taskForm.targetKey"> </div>
<<el-radio-button <div style="margin-left:10%;margin-bottom: 20px;font-size: 14px;" v-if="finished === 'true'">
v-for="item in returnTaskList" <el-button icon="el-icon-edit-outline" type="success" size="mini" @click="handleComplete"></el-button>
:key="item.id" <!-- <el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleDelegate"></el-button>-->
:label="item.id" <!-- <el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleAssign"></el-button>-->
>{{item.name}}</el-radio-button> <!-- <el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleDelegate"></el-button>-->
</el-radio-group> <el-button icon="el-icon-refresh-left" type="warning" size="mini" @click="handleReturn">退</el-button>
</el-form-item> <!-- <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleReject"></el-button>-->
<el-form-item label="任务接收" prop="targetKey" v-show="taskForm.sendUserShow"> </div>
<el-select style="width: 50%" v-model="assignee" @change="handleCheckChange" :multiple="taskForm.multiple" placeholder="请选择"> </el-col>
<el-option
v-for="item in userDataList"
:key="item.userId"
:label="item.nickName"
:value="item.userId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="审批意见" prop="comment" :rules="[{ required: true, message: '请输入意见', trigger: 'blur' }]">
<el-input style="width: 50%" 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="success" size="mini" @click="handleComplete"></el-button>
<el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleDelegate"></el-button>
<el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleAssign"></el-button>
<el-button icon="el-icon-edit-outline" type="primary" size="mini" @click="handleDelegate"></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>
</div>
<div v-show="taskForm.returnTaskShow">
<el-button type="primary" @click="submitReturnTask"> </el-button>
<el-button @click="cancelTask"> </el-button>
</div>
<div v-show="taskForm.delegateTaskShow">
<el-button type="primary" @click="submitDeleteTask"> </el-button>
<el-button @click="cancelDelegateTask"> </el-button>
</div>
</el-form-item>
</el-form>
</div>
</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="submitForm" ref="parser" @getData="getData" /> <parser :key="new Date().getTime()" :form-conf="formConf" @submit="submitForm" ref="parser" @getData="getData" />
</div> </div>
</el-col> </el-col>
</el-card> </el-card>
<!--流程流转记录--> <!--流程流转记录-->
<el-card class="box-card" v-if="flowRecordList"> <el-card class="box-card" v-if="flowRecordList">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="el-icon-notebook-1">审批记录</span> <span class="el-icon-notebook-1">审批记录</span>
</div> </div>
@ -101,36 +62,113 @@
</div> </div>
</el-col> </el-col>
</el-card> </el-card>
<!--流程执行图-->
<!-- <el-card class="box-card" v-if="src" >-->
<!-- <div slot="header" class="clearfix">-->
<!-- <span class="el-icon-picture-outline">流程图</span>-->
<!-- </div>-->
<!-- <el-col :span="16" :offset="4">-->
<!-- <el-image :src="src"></el-image>-->
<!-- </el-col>-->
<!-- </el-card>-->
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="el-icon-picture-outline">流程图</span> <span class="el-icon-picture-outline">流程图</span>
</div> </div>
<flow :xmlData="xmlData" :taskData="taskList"></flow> <flow :xmlData="xmlData" :taskData="taskList"></flow>
</el-card> </el-card>
<!--审批正常流程-->
<el-dialog :title="completeTitle" :visible.sync="completeOpen" width="60%" append-to-body>
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :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="12" :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="tag in userData"
:key="tag.nickName"
closable
@close="handleClose(tag)">
{{tag.nickName}} {{tag.dept.deptName}}
</el-tag>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-input style="width: 50%;margin-right: 34%" type="textarea" v-model="taskForm.comment" placeholder="请输入处理意见"/>
<el-button @click="completeOpen = false"> </el-button>
<el-button type="primary" @click="taskComplete"> </el-button>
</span>
</el-dialog>
<!--退回流程-->
<el-dialog :title="returnTitle" :visible.sync="returnOpen" width="40%" append-to-body>
<el-form ref="taskForm" :model="taskForm" label-width="80px" >
<el-form-item label="退回节点" prop="targetKey">
<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: 50%" type="textarea" v-model="taskForm.comment" placeholder="请输入意见"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="returnOpen = false"> </el-button>
<el-button type="primary" @click="taskReturn"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {flowRecord} from "@/api/flowable/finished"; import {flowRecord} from "@/api/flowable/finished";
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import {definitionStart, getProcessVariables, userList, 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 Treeselect from "@riophae/vue-treeselect";
import {listUser} from "@/api/system/user";
export default { export default {
name: "Record", name: "Record",
components: { components: {
Parser, Parser,
flow flow,
Treeselect
}, },
props: {}, props: {},
data() { data() {
@ -138,19 +176,20 @@ export default {
// xml // xml
xmlData: "", xmlData: "",
taskList: [], taskList: [],
// // //
// taskList: [{ deptName: undefined,
// // key //
// "key": "Activity_0gtu56i", deptOptions: undefined,
// // //
// "completed": false userList: null,
// }, defaultProps: {
// { children: "children",
// // key label: "label"
// "key": "Activity_02fkd13", },
// // //
// "completed": true queryParams: {
// }], deptId: undefined
},
// //
loading: true, loading: true,
flowRecordList: [], // flowRecordList: [], //
@ -181,7 +220,12 @@ export default {
variablesData: {}, // variablesData: {}, //
variableOpen: false, // variableOpen: false, //
returnTaskList: [], // 退 returnTaskList: [], // 退
finished: 'false' finished: 'false',
completeTitle: null,
completeOpen: false,
returnTitle: null,
returnOpen: false,
userData:[],
}; };
}, },
created() { created() {
@ -202,7 +246,6 @@ export default {
} }
this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId); this.getFlowRecordList( this.taskForm.procInsId, this.taskForm.deployId);
this.finished = this.$route.query && this.$route.query.finished this.finished = this.$route.query && this.$route.query.finished
}, },
mounted() { mounted() {
// // // //
@ -218,15 +261,39 @@ export default {
// }, 1000) // }, 1000)
}, },
methods: { methods: {
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
});
},
/** 查询用户列表 */
getList() {
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows;
this.total = response.total;
}
);
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.deptId = data.id;
this.getList();
},
/** xml 文件 */ /** xml 文件 */
getModelDetail(deployId) { getModelDetail(deployId) {
// xml // xml
readXml(deployId).then(res =>{ readXml(deployId).then(res => {
this.xmlData = res.data this.xmlData = res.data
}) })
}, },
getFlowViewer(procInsId){ getFlowViewer(procInsId) {
getFlowViewer(procInsId).then(res =>{ getFlowViewer(procInsId).then(res => {
this.taskList = res.data this.taskList = res.data
}) })
}, },
@ -244,13 +311,31 @@ export default {
return "#b3bdbb"; return "#b3bdbb";
} }
}, },
//
handleSelectionChange(selection) {
this.userData = selection
const val = selection.map(item => item.userId)[0];
if (val instanceof Array) {
this.taskForm.values = {
"approval": val.join(',')
}
} else {
this.taskForm.values = {
"approval": val
}
}
},
//
handleClose(tag) {
this.userData.splice(this.userData.indexOf(tag), 1);
},
/** 流程变量赋值 */ /** 流程变量赋值 */
handleCheckChange(val){ handleCheckChange(val) {
if (val instanceof Array) { if (val instanceof Array) {
this.taskForm.values = { this.taskForm.values = {
"approval": val.join(',') "approval": val.join(',')
} }
}else { } else {
this.taskForm.values = { this.taskForm.values = {
"approval": val "approval": val
} }
@ -290,9 +375,9 @@ export default {
} }
}, },
/** 根据当前任务或者流程设计配置的下一步节点 */ /** 根据当前任务或者流程设计配置的下一步节点 */
getNextFlowNode(taskId){ getNextFlowNode(taskId) {
// todo // todo
const params = { taskId: taskId } const params = {taskId: taskId}
getNextFlowNode(params).then(res => { getNextFlowNode(params).then(res => {
const data = res.data; const data = res.data;
if (data) { if (data) {
@ -316,22 +401,31 @@ export default {
} }
}) })
}, },
/** 审批任务 */ /** 审批任务选择 */
handleComplete() { handleComplete() {
this.$refs["taskForm"].validate(valid => { this.completeOpen = true;
if (valid) { this.completeTitle = "审批流程";
complete(this.taskForm).then(response => { this.getTreeselect();
this.msgSuccess(response.msg); },
this.goBack(); /** 审批任务 */
}); taskComplete() {
} if (!this.taskForm.values){
this.msgError("请选择流程接收人员");
return;
}
if (!this.taskForm.comment){
this.msgError("请输入审批意见");
return;
}
complete(this.taskForm).then(response => {
this.msgSuccess(response.msg);
this.goBack();
}); });
}, },
/** 委派任务 */ /** 委派任务 */
handleDelegate() { handleDelegate() {
this.taskForm.delegateTaskShow = true; this.taskForm.delegateTaskShow = true;
this.taskForm.defaultTaskShow = false; this.taskForm.defaultTaskShow = false;
}, },
handleAssign(){ handleAssign(){
@ -394,23 +488,15 @@ export default {
}, },
/** 可退回任务列表 */ /** 可退回任务列表 */
handleReturn() { handleReturn() {
this.returnOpen = true;
this.returnTitle = "退回流程";
returnList(this.taskForm).then(res => { returnList(this.taskForm).then(res => {
this.returnTaskList = res.data; this.returnTaskList = res.data;
this.taskForm.returnTaskShow = true;
this.taskForm.defaultTaskShow = false;
this.taskForm.sendUserShow = false;
this.taskForm.values = null; this.taskForm.values = null;
}) })
}, },
/** 取消回退任务按钮 */
cancelTask() {
this.taskForm.returnTaskShow = false;
this.taskForm.defaultTaskShow = true;
this.taskForm.sendUserShow = true;
this.returnTaskList = [];
},
/** 提交退回任务 */ /** 提交退回任务 */
submitReturnTask() { taskReturn() {
this.$refs["taskForm"].validate(valid => { this.$refs["taskForm"].validate(valid => {
if (valid) { if (valid) {
returnTask(this.taskForm).then(res => { returnTask(this.taskForm).then(res => {
@ -420,6 +506,13 @@ export default {
} }
}); });
}, },
/** 取消回退任务按钮 */
cancelTask() {
this.taskForm.returnTaskShow = false;
this.taskForm.defaultTaskShow = true;
this.taskForm.sendUserShow = true;
this.returnTaskList = [];
},
/** 委派任务 */ /** 委派任务 */
submitDeleteTask() { submitDeleteTask() {
this.$refs["taskForm"].validate(valid => { this.$refs["taskForm"].validate(valid => {
@ -461,4 +554,8 @@ export default {
width: 100%; width: 100%;
margin-bottom: 20px; margin-bottom: 20px;
} }
.el-tag + .el-tag {
margin-left: 10px;
}
</style> </style>

Loading…
Cancel
Save