[Update] 增加命令过滤器列表组件

This commit is contained in:
jym503558564
2020-03-22 11:46:09 +08:00
parent 7dc161da86
commit 3b19fdf6f0
4 changed files with 145 additions and 5 deletions

View File

@@ -32,3 +32,11 @@ export function getLabelList(data) {
})
}
export function getCommandFilterList(data) {
return request({
url: '/api/v1/assets/cmd-filters/',
method: 'get',
params: data
})
}

View File

@@ -21,7 +21,7 @@ const cn = {
'AdminUserList': '管理用户',
'SystemUserList': '系统用户',
'LabelList': '标签管理',
'commandFilterList': '命令过滤',
'CommandFilterList': '命令过滤',
'platformList': '平台列表',
'applications': '应用管理',
'perms': '权限管理',

View File

@@ -146,10 +146,10 @@ export const constantRoutes = [
meta: { title: 'LabelList' }
},
{
path: 'command-filters',
name: 'commandFilterList',
component: () => import('@/views/tree/index'),
meta: { title: 'commandFilterList' }
path: 'cmd-filter/list',
name: 'CommandFilterList',
component: () => import('@/views/assets/CommandFilterList.vue'),
meta: { title: 'CommandFilterList' }
},
{
path: 'platforms',

View File

@@ -0,0 +1,132 @@
<template>
<BackPlayground :title="$t('route.AdminUserList')">
<ListTables
:tablebotton="$t('assets.AdminUserCreate')"
tableroute="UserEdit"
@SizeChange="handleSizeChange"
@CurrentChange="handleCurrentChange"
>
<el-table
v-loading="listLoading"
:data="tableData"
stripe
border
class="userTable"
>
<el-table-column
type="selection"
width="55"
align="center"
header-align="center"
/>
<el-table-column
:label="this.$t('assets.name')"
sortable
align="center"
header-align="center"
>
<template slot-scope="scope">
<el-button type="text" size="small" style="font-size:14px" @click="handleDetail(scope.$index, scope.row)">{{ scope.row.name }}</el-button>
</template>
</el-table-column>
<el-table-column
:label="this.$t('assets.rules')"
align="center"
header-align="center"
>
<template slot-scope="scope">
<span>{{ scope.row.rules.length }}</span>
</template>
</el-table-column>
<el-table-column
:label="this.$t('assets.system_user')"
align="center"
header-align="center"
>
<template slot-scope="scope">
<span>{{ scope.row.system_users.length }}</span>
</template>
</el-table-column>
<el-table-column
:label="this.$t('assets.comment')"
align="center"
header-align="center"
sortable
>
<template slot-scope="scope">
<span>{{ scope.row.comment }}</span>
</template>
</el-table-column>
<el-table-column
:label="this.$t('assets.action')"
align="center"
header-align="center"
>
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click="handleEdit(scope.$index, scope.row)"
>{{ $t('assets.update') }}</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)"
>{{ $t('assets.delete') }}</el-button>
</template>
</el-table-column>
</el-table>
</ListTables>
</BackPlayground>
</template>
<script>
import { ListTables, BackPlayground } from '@/layout/components'
import { getCommandFilterList } from '@/api/asset'
import Tables from '@/layout/mixin/ListTables'
export default {
components: {
BackPlayground,
ListTables
},
mixins: [Tables],
data() {
return {
tableData: [],
listLoading: true
}
},
created() {
this.getCommandFilter(this.current_page, this.page_size, this.offset)
},
methods: {
handleDetail: function(index, row) {
this.$router.push({ name: 'LabelDetail', params: { id: row.id }})
},
handleSizeChange(val) {
// 当每页数量改变触发
this.offset = (this.current_page - 1) * val
this.page_size = val
this.getCommandFilter(this.current_page, val, this.offset)
},
handleCurrentChange(val) {
// 当页码改变触发
this.offset = (val - 1) * this.page_size
this.current_page = val
this.getCommandFilter(val, this.page_size, this.offset)
},
getCommandFilter(draw, limit, offset) {
this.listLoading = true
getCommandFilterList({ draw, limit, offset }).then(response => {
this.tableData = response.results
this.total = response.count
this.listLoading = false
})
}
}
}
</script>
<style lang="less" scoped>
</style>