工作流增删改查功能完善

This commit is contained in:
QM303176530
2020-10-31 00:03:49 +08:00
parent 32abd69c16
commit d6bc0572c2
5 changed files with 314 additions and 334 deletions
@@ -51,7 +51,8 @@
<script>
import {
findWorkflowProcess,
createWorkflowProcess
createWorkflowProcess,
updateWorkflowProcess
} from "@/api/workflowProcess"; // 此处请自行替换地址
import gvaWfd from "@/components/gva-wfd";
import { getUserList } from "@/api/user";
@@ -67,174 +68,174 @@ export default {
lang: "zh",
done:false,
demoData: {
// nodes: [
// {
// clazz: "start",
// label: "发起请假",
// type: "start-node",
// shape: "start-node",
// x: 110,
// y: 195,
// id: "start1603681292875",
// style: {}
// },
// {
// clazz: "parallelGateway",
// label: "会签",
// type: "parallel-gateway-node",
// shape: "parallel-gateway-node",
// x: 228,
// y: 195,
// id: "parallelGateway1603681296419",
// style: {}
// },
// {
// clazz: "userTask",
// label: "审批人1",
// type: "user-task-node",
// shape: "user-task-node",
// x: 372,
// y: 84,
// id: "userTask1603681299962",
// style: {},
// assignValue: 1,
// assignType: "user"
// },
// {
// clazz: "userTask",
// label: "审批人2",
// type: "user-task-node",
// shape: "user-task-node",
// x: 370,
// y: 321,
// id: "userTask1603681302372",
// style: {},
// assignValue: 2,
// assignType: "user"
// },
// {
// clazz: "parallelGateway",
// label: "会签结果检测",
// type: "parallel-gateway-node",
// shape: "parallel-gateway-node",
// x: 519,
// y: 195,
// id: "parallelGateway1603681338222",
// style: {}
// },
// {
// clazz: "end",
// label: "请假失败",
// type: "end-node",
// shape: "end-node",
// x: 704,
// y: 317,
// id: "end1603681358043",
// style: {}
// },
// {
// clazz: "end",
// label: "请假成功",
// type: "end-node",
// shape: "end-node",
// x: 706.5,
// y: 55.5,
// id: "end1603681360882",
// style: {}
// }
// ],
// edges: [
// {
// id: "flow1603681320738",
// clazz: "flow",
// source: "parallelGateway1603681296419",
// target: "userTask1603681299962",
// sourceAnchor: 0,
// targetAnchor: 3,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 228, y: 169, index: 0 },
// endPoint: { x: 321.5, y: 84, index: 3 }
// },
// {
// id: "flow1603681321969",
// clazz: "flow",
// source: "parallelGateway1603681296419",
// target: "userTask1603681302372",
// sourceAnchor: 2,
// targetAnchor: 3,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 228, y: 221, index: 2 },
// endPoint: { x: 319.5, y: 321, index: 3 }
// },
// {
// id: "flow1603681323274",
// clazz: "flow",
// source: "start1603681292875",
// target: "parallelGateway1603681296419",
// sourceAnchor: 1,
// targetAnchor: 3,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 138, y: 195, index: 1 },
// endPoint: { x: 202, y: 195, index: 3 },
// label: "发起",
// conditionExpression: "complete"
// },
// {
// id: "flow1603681341777",
// clazz: "flow",
// source: "userTask1603681299962",
// target: "parallelGateway1603681338222",
// sourceAnchor: 1,
// targetAnchor: 3,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 422.5, y: 84, index: 1 },
// endPoint: { x: 493, y: 195, index: 3 }
// },
// {
// id: "flow1603681343425",
// clazz: "flow",
// source: "userTask1603681302372",
// target: "parallelGateway1603681338222",
// sourceAnchor: 1,
// targetAnchor: 3,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 420.5, y: 321, index: 1 },
// endPoint: { x: 493, y: 195, index: 3 }
// },
// {
// id: "flow1603681362913",
// clazz: "flow",
// source: "parallelGateway1603681338222",
// target: "end1603681360882",
// sourceAnchor: 0,
// targetAnchor: 2,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 519, y: 169, index: 0 },
// endPoint: { x: 678.5, y: 55.5, index: 2 },
// conditionExpression: "complete",
// label: "所有人同意"
// },
// {
// id: "flow1603681392729",
// clazz: "flow",
// source: "parallelGateway1603681338222",
// target: "end1603681358043",
// sourceAnchor: 2,
// targetAnchor: 2,
// shape: "flow-polyline-round",
// style: {},
// startPoint: { x: 519, y: 221, index: 2 },
// endPoint: { x: 676, y: 317, index: 2 },
// conditionExpression: "reject",
// label: "任何一人拒绝"
// }
// ],
nodes: [
{
clazz: "start",
label: "发起请假",
type: "start-node",
shape: "start-node",
x: 110,
y: 195,
id: "start1603681292875",
style: {}
},
{
clazz: "parallelGateway",
label: "会签",
type: "parallel-gateway-node",
shape: "parallel-gateway-node",
x: 228,
y: 195,
id: "parallelGateway1603681296419",
style: {}
},
{
clazz: "userTask",
label: "审批人1",
type: "user-task-node",
shape: "user-task-node",
x: 372,
y: 84,
id: "userTask1603681299962",
style: {},
assignValue: 1,
assignType: "user"
},
{
clazz: "userTask",
label: "审批人2",
type: "user-task-node",
shape: "user-task-node",
x: 370,
y: 321,
id: "userTask1603681302372",
style: {},
assignValue: 2,
assignType: "user"
},
{
clazz: "parallelGateway",
label: "会签结果检测",
type: "parallel-gateway-node",
shape: "parallel-gateway-node",
x: 519,
y: 195,
id: "parallelGateway1603681338222",
style: {}
},
{
clazz: "end",
label: "请假失败",
type: "end-node",
shape: "end-node",
x: 704,
y: 317,
id: "end1603681358043",
style: {}
},
{
clazz: "end",
label: "请假成功",
type: "end-node",
shape: "end-node",
x: 706.5,
y: 55.5,
id: "end1603681360882",
style: {}
}
],
edges: [
{
id: "flow1603681320738",
clazz: "flow",
source: "parallelGateway1603681296419",
target: "userTask1603681299962",
sourceAnchor: 0,
targetAnchor: 3,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 228, y: 169, index: 0 },
endPoint: { x: 321.5, y: 84, index: 3 }
},
{
id: "flow1603681321969",
clazz: "flow",
source: "parallelGateway1603681296419",
target: "userTask1603681302372",
sourceAnchor: 2,
targetAnchor: 3,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 228, y: 221, index: 2 },
endPoint: { x: 319.5, y: 321, index: 3 }
},
{
id: "flow1603681323274",
clazz: "flow",
source: "start1603681292875",
target: "parallelGateway1603681296419",
sourceAnchor: 1,
targetAnchor: 3,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 138, y: 195, index: 1 },
endPoint: { x: 202, y: 195, index: 3 },
label: "发起",
conditionExpression: "complete"
},
{
id: "flow1603681341777",
clazz: "flow",
source: "userTask1603681299962",
target: "parallelGateway1603681338222",
sourceAnchor: 1,
targetAnchor: 3,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 422.5, y: 84, index: 1 },
endPoint: { x: 493, y: 195, index: 3 }
},
{
id: "flow1603681343425",
clazz: "flow",
source: "userTask1603681302372",
target: "parallelGateway1603681338222",
sourceAnchor: 1,
targetAnchor: 3,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 420.5, y: 321, index: 1 },
endPoint: { x: 493, y: 195, index: 3 }
},
{
id: "flow1603681362913",
clazz: "flow",
source: "parallelGateway1603681338222",
target: "end1603681360882",
sourceAnchor: 0,
targetAnchor: 2,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 519, y: 169, index: 0 },
endPoint: { x: 678.5, y: 55.5, index: 2 },
conditionExpression: "complete",
label: "所有人同意"
},
{
id: "flow1603681392729",
clazz: "flow",
source: "parallelGateway1603681338222",
target: "end1603681358043",
sourceAnchor: 2,
targetAnchor: 2,
shape: "flow-polyline-round",
style: {},
startPoint: { x: 519, y: 221, index: 2 },
endPoint: { x: 676, y: 317, index: 2 },
conditionExpression: "reject",
label: "任何一人拒绝"
}
],
},
wkType:"create",
users: [],
@@ -275,17 +276,23 @@ export default {
})
return
}
// if(this.$route.query.type == 'edit'){
// // 等待调用编辑功能
// }else{
if(this.$route.query.type == 'edit'){
const res = await updateWorkflowProcess(processModel)
if(res.code == 0){
this.$message({
type:"success",
message:"编辑成功"
})
}
}else{
const res = await createWorkflowProcess(processModel)
if(res.success){
if(res.code == 0){
this.$message({
type:"success",
message:"创建成功"
})
}
// }
}
},
saveXML() {
console.log(this.$refs["wfd"].graph.saveXML());
@@ -6,10 +6,7 @@
<el-input placeholder="搜索条件" v-model="searchInfo.name"></el-input>
</el-form-item>
<el-form-item label="流程标题">
<el-input
placeholder="搜索条件"
v-model="searchInfo.label"
></el-input>
<el-input placeholder="搜索条件" v-model="searchInfo.label"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="onSubmit" type="primary">查询</el-button>
@@ -18,20 +15,10 @@
<el-popover placement="top" v-model="deleteVisible" width="160">
<p>确定要删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button @click="deleteVisible = false" size="mini" type="text"
>取消</el-button
>
<el-button @click="onDelete" size="mini" type="primary"
>确定</el-button
>
<el-button @click="deleteVisible = false" size="mini" type="text">取消</el-button>
<el-button @click="onDelete" size="mini" type="primary">确定</el-button>
</div>
<el-button
icon="el-icon-delete"
size="mini"
slot="reference"
type="danger"
>批量删除</el-button
>
<el-button icon="el-icon-delete" size="mini" slot="reference" type="danger">批量删除</el-button>
</el-popover>
</el-form-item>
</el-form>
@@ -46,72 +33,38 @@
tooltip-effect="dark"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="日期" width="180">
<el-table-column label="日期" width="180">
<template slot-scope="scope">{{scope.row.CreatedAt|formatDate}}</template>
</el-table-column>
<el-table-column
label="流程名称"
prop="name"
width="120"
></el-table-column>
<el-table-column label="流程名称" prop="name" width="120"></el-table-column>
<el-table-column
label="分类"
prop="category"
width="120"
></el-table-column>
<el-table-column label="分类" prop="category" width="120"></el-table-column>
<el-table-column label="类型" prop="clazz" width="120"></el-table-column>
<el-table-column
label="流程标题"
prop="label"
width="120"
></el-table-column>
<el-table-column label="流程标题" prop="label" width="120"></el-table-column>
<el-table-column label="是否隐藏图标" prop="hideIcon" width="120">
<template slot-scope="scope">{{
<template slot-scope="scope">
{{
scope.row.hideIcon | formatBoolean
}}</template>
}}
</template>
</el-table-column>
<el-table-column
label="详细介绍"
prop="description"
width="120"
></el-table-column>
<el-table-column label="详细介绍" prop="description" width="120"></el-table-column>
<el-table-column label="按钮组">
<template slot-scope="scope">
<el-button
@click="updateWorkflowProcess(scope.row)"
size="small"
type="primary"
>变更</el-button
>
<el-button class="table-button" @click="updateWorkflowProcess(scope.row)" size="small" type="primary">变更</el-button>
<el-button class="table-button" @click="viewWorkflowProcess(scope.row)" size="small" type="warning">查看</el-button>
<el-popover placement="top" width="160" v-model="scope.row.visible">
<p>确定要删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button
size="mini"
type="text"
@click="scope.row.visible = false"
>取消</el-button
>
<el-button
type="primary"
size="mini"
@click="deleteWorkflowProcess(scope.row)"
>确定</el-button
>
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteWorkflowProcess(scope.row)">确定</el-button>
</div>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
slot="reference"
>删除</el-button
>
<el-button type="danger" icon="el-icon-delete" size="mini" slot="reference">删除</el-button>
</el-popover>
</template>
</el-table-column>
@@ -132,12 +85,12 @@
<script>
import {
deleteWorkflowProcess,
deleteWorkflowProcessByIds,
getWorkflowProcessList
} from "@/api/workflowProcess"; // 此处请自行替换地址
deleteWorkflowProcess,
deleteWorkflowProcessByIds,
getWorkflowProcessList
} from "@/api/workflowProcess"; // 此处请自行替换地址
import { formatTimeToStr } from "@/utils/date";
import infoList from "@/components/mixins/infoList";
import infoList from "@/mixins/infoList";
export default {
name: "WorkflowProcess",
@@ -148,7 +101,7 @@ export default {
dialogFormVisible: false,
visible: false,
deleteVisible: false,
multipleSelection: [],
multipleSelection: []
};
},
filters: {
@@ -162,46 +115,58 @@ export default {
},
formatBoolean: function(bool) {
if (bool != null) {
return bool ? "是" :"否";
return bool ? "是" : "否";
} else {
return "";
}
}
},
methods: {
//条件搜索前端看此方法
onSubmit() {
this.page = 1
this.pageSize = 10
if (this.searchInfo.hideIcon==""){
this.searchInfo.hideIcon=null
}
this.getTableData()
},
handleSelectionChange(val) {
this.multipleSelection = val
},
async onDelete() {
const ids = []
this.multipleSelection &&
this.multipleSelection.map(item => {
ids.push(item.id)
})
const res = await deleteWorkflowProcessByIds({ ids })
if (res.code == 0) {
this.$message({
type: 'success',
message: '删除成功'
})
this.deleteVisible = false
this.getTableData()
}
},
//条件搜索前端看此方法
onSubmit() {
this.page = 1;
this.pageSize = 10;
if (this.searchInfo.hideIcon == "") {
this.searchInfo.hideIcon = null;
}
this.getTableData();
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
async onDelete() {
const ids = [];
this.multipleSelection &&
this.multipleSelection.map(item => {
ids.push(item.id);
});
const res = await deleteWorkflowProcessByIds({ ids });
if (res.code == 0) {
this.$message({
type: "success",
message: "删除成功"
});
this.deleteVisible = false;
this.getTableData();
}
},
async updateWorkflowProcess(row) {
this.$router.push({name:"workflowCreate",query:{
id:row.id,
type:'edit'
}})
this.$router.push({
name: "workflowCreate",
query: {
id: row.id,
type: "edit"
}
});
},
async viewWorkflowProcess(row) {
this.$router.push({
name: "workflowCreate",
query: {
id: row.id,
type: "view"
}
});
},
async deleteWorkflowProcess(row) {
this.visible = false;
@@ -219,7 +184,8 @@ export default {
}
},
async created() {
await this.getTableData();}
await this.getTableData();
}
};
</script>