doc-ctrl-list.vue
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
<div class="ctrl-list-box">
<h2>
<span v-if="store.groupName">分组:{{store.groupName}}</span>
<span v-if="store.apiKeyword">关键词:“{{store.apiKeyword}}”</span>
<span v-if="store.apis.length">
共
<span v-if="store.featchApising">...</span>
<span v-else>{{store.apiCount}}</span>
条:
</span>
</h2>
<div class="ctrl-list">
<Collapse class="collapse-ctrl" accordion v-if="store.apis.length">
<Panel :name="ctrl.name" v-for="ctrl in store.apis" :key="ctrl.name">
{{ctrl.name}}({{ctrl.desc}})
<div slot="content">
<doc-act-list :list="ctrl.operationInfoList"></doc-act-list>
</div>
</Panel>
</Collapse>
<p class="no-data" v-else>
<span v-if="store.groupName || store.apiKeyword">未查询到结果</span>
<span v-else>请选择分组或者输入查询条件</span>
</p>
</div>
<Page
v-if="store.apis.length"
class="pager"
:total="store.apiCount"
:current="store.apiPage"
:page-size="store.apiRows"
show-sizer
show-total
@on-page-size-change="pageSizeChange"
@on-change="pageChange"></Page>
</div>
</template>
<script>
import {
FETCH_API_REQUEST
} from 'store/types';
import {mapState} from 'vuex';
export default {
name: 'DocCtrlList',
computed: {
...mapState(['store'])
},
methods: {
pageChange(page) {
this.$store.dispatch(FETCH_API_REQUEST, {page: page});
},
pageSizeChange(rows) {
this.$store.dispatch(FETCH_API_REQUEST, {rows: rows});
}
}
};
</script>
<style lang="scss">
.ctrl-list-box {
h2 {
margin-bottom: 12px;
margin-top: 12px;
}
padding: 20px;
.ctrl-list {
margin-bottom: 20px;
}
.no-data {
text-align: center;
line-height: 50px;
font-size: 12px;
color: #9ea7b4;
}
.pager {
text-align: center;
}
.ivu-collapse {
background: none;
border: none;
}
.collapse-ctrl {
.ivu-collapse-header {
font-size: 14px;
}
&>.ivu-collapse-item >.ivu-collapse-header {
font-size: 15px;
font-weight: bold;
}
}
}
</style>