Skip to content

Commit de83330

Browse files
committed
添加流程发布
1 parent 5a0e4a7 commit de83330

File tree

7 files changed

+128
-23
lines changed

7 files changed

+128
-23
lines changed

src/App.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@
99
name: 'app'
1010
}
1111
</script>
12+
13+
<style>
14+
.toolbar {
15+
height: 50px;
16+
line-height: 50px;
17+
background-color: #ffffff;
18+
}
19+
</style>

src/components/bpmn/VueBpmn.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@
130130
}
131131
},
132132
processSave(data){
133+
let initData = this.initData;
134+
data.procId = initData.key;
135+
data.name = initData.name;
133136
this.$emit("processSave",data);
134137
},
135138
restart() {

src/components/element/ElementTable.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44
<el-table-column v-for="(item,index) in columns" :key="index" :prop="item.key"
55
:label="item.title" :formatter="item.formatter">
66
<template slot-scope="scope">
7-
<div v-if="item.formatter" v-html="item.formatter(scope.row,item.key,scope.row[item.key],index)"></div>
8-
<div v-else>{{scope.row[item.key]}}</div>
7+
<div v-if="item.operator">
8+
<template v-for="(o,key) in item.operator">
9+
<el-button :type="o.type" :key="key" @click="o.click(scope.row)"
10+
size="small" v-if="!o.hidden || !o.hidden(scope.row)">{{o.name}}
11+
</el-button>
12+
</template>
13+
</div>
14+
<div v-else>
15+
<span v-if="!item.formatter">{{scope.row[item.key]}}</span>
16+
<span v-else v-html="item.formatter(scope.row,item.key,scope.row[item.key],index)"></span>
17+
</div>
918
</template>
1019
</el-table-column>
1120
</el-table>
@@ -24,7 +33,9 @@
2433
name: "ElementTable",
2534
data() {
2635
return {
27-
data: {},
36+
data: {
37+
total: 0
38+
},
2839
page: 1
2940
}
3041
},
@@ -41,11 +52,20 @@
4152
},
4253
methods: {
4354
reload(page) {
55+
if (!this.url) {
56+
return;
57+
}
4458
let that = this;
4559
this.page = page;
4660
this.get(this.url, {page: this.page, pageSize: this.pageSize}, res => {
4761
that.data = res.data;
4862
})
63+
},
64+
deploy(row) {
65+
console.log(row)
66+
},
67+
open() {
68+
console.log("d")
4969
}
5070
}
5171
}

src/libs/api.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ export default {
22
// deployProcess: "flow/deploy" flowable
33
deployProcess: "act/deploy", // activiti
44
processList: "process/list",
5-
processBuffer: "process/buffer"
5+
processBuffer: "process/buffer",
6+
processRemove: "process/${id}/remove",
7+
processDeploy: "process/${id}/deploy",
8+
processInstQuery: "process/inst/list",
69
}

src/router/router.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,25 @@ export const appRouter = [{
6363
},
6464
{
6565
path: '/process',
66-
icon: 'el-icon-s-help',
66+
icon: 'el-icon-s-finance',
6767
name: 'process',
6868
title: '流程管理',
6969
access: 0,
7070
component: Main,
7171
children: [{
7272
path: 'design',
73-
icon: 'el-icon-s-help',
73+
icon: 'el-icon-s-ticket',
7474
name: 'design',
7575
title: '流程设计',
7676
component: () =>
7777
import ('../views/process/design')
78+
},{
79+
path: 'inst',
80+
icon: 'el-icon-s-claim',
81+
name: 'inst',
82+
title: '流程实例',
83+
component: () =>
84+
import ('../views/process/inst')
7885
}]
7986
}
8087
]

src/views/process/design.vue

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<div class="toolbar">
44
<el-button type="primary" @click="openNewDialog">添加流程</el-button>
55
</div>
6-
<element-table :url="url" :page-size="10" :columns="columns"></element-table>
6+
<element-table :url="url" :page-size="10" :columns="columns" ref="elementTable"></element-table>
77

88
<el-dialog title="流程图" :visible.sync="dialogVisible" width="1100px">
99
<slot name="-" style="border: none;padding: 0px;margin: 0px;">
10-
<vue-bpmn style="overflow: hidden;height: 700px;" @processSave="processSave"></vue-bpmn>
10+
<vue-bpmn style="overflow: hidden;height: 700px;" product="flowable" @processSave="processSave"></vue-bpmn>
1111
</slot>
1212
</el-dialog>
1313
</div>
@@ -30,15 +30,41 @@
3030
key: 'name',
3131
title: '流程名称'
3232
}, {
33-
key: 'ora',
33+
key: 'status',
3434
title: '状态',
35-
formatter: (row, key, value, index) => {
36-
console.log(row)
37-
console.log(key)
38-
console.log(value)
39-
console.log(index)
40-
return '<button class="el-button" size="mini">dd</button>';
35+
formatter: (row, key) => {
36+
if (row[key] == 0) {
37+
return "未发布";
38+
}
39+
return "已发布"
4140
}
41+
}, {
42+
key: 'ora',
43+
title: '操作',
44+
operator: [{
45+
name: "发布",
46+
type: "text",
47+
click: (row) => {
48+
this.put(this.Apis.processDeploy.replace("${id}", row.id), {}, res => {
49+
console.log(res)
50+
});
51+
},
52+
hidden: (row) => {
53+
return row.status == 1;
54+
}
55+
}, {
56+
name: "删除",
57+
type: "text",
58+
click: (row) => {
59+
console.log(row);
60+
this.delete(this.Apis.processRemove.replace("${id}", row.id), {}, res => {
61+
console.log(res)
62+
if (res.code == 200) {
63+
this.$refs.elementTable.reload();
64+
}
65+
})
66+
}
67+
}]
4268
}]
4369
}
4470
},
@@ -53,19 +79,17 @@
5379
processSave(data) {
5480
let that = this;
5581
that.post(this.Apis.processBuffer, data, res => {
56-
console.log(res)
82+
if (res.code == 200) {
83+
that.$refs.elementTable.reload();
84+
}
5785
})
86+
},
87+
deploy() {
88+
5889
}
5990
}
6091
}
6192
</script>
6293

6394
<style scoped>
64-
.toolbar {
65-
height: 50px;
66-
line-height: 50px;
67-
background-color: #ffffff;
68-
}
69-
70-
7195
</style>

src/views/process/inst.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<template>
2+
<div>
3+
<div class="toolbar">
4+
<el-button type="primary" @click="openNewDialog">请假申请</el-button>
5+
</div>
6+
<element-table :url="url" :columns="columns" :page-size="10"></element-table>
7+
8+
<el-dialog title="请假申请" :visible.sync="dialogVisible">
9+
<el-container>
10+
dd
11+
</el-container>
12+
</el-dialog>
13+
</div>
14+
</template>
15+
16+
<script>
17+
import ElementTable from "../../components/element/ElementTable";
18+
export default {
19+
name: "inst",
20+
data(){
21+
return {
22+
dialogVisible:false,
23+
url:this.Apis.processInstQuery,
24+
columns:[]
25+
}
26+
},
27+
components:{
28+
ElementTable
29+
},
30+
methods:{
31+
openNewDialog(){
32+
this.dialogVisible = true;
33+
}
34+
}
35+
}
36+
</script>
37+
38+
<style scoped>
39+
40+
</style>

0 commit comments

Comments
 (0)