mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-15 14:24:39 +00:00
[Update] 增加管理用户列表组件
This commit is contained in:
10
src/api/asset.js
Normal file
10
src/api/asset.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getAdminUserList(data) {
|
||||
return request({
|
||||
url: '/api/v1/assets/admin-users/',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ const cn = {
|
||||
'Users': '用户管理',
|
||||
'UserList': '用户列表',
|
||||
'UserGroupList': '用户组',
|
||||
'assets': '资产管理',
|
||||
'assetList': '资产列表',
|
||||
'domainList': '网关列表',
|
||||
'adminUserList': '管理用户',
|
||||
'Assets': '资产管理',
|
||||
'AssetList': '资产列表',
|
||||
'DomainList': '网关列表',
|
||||
'AdminUserList': '管理用户',
|
||||
'systemUserList': '系统用户',
|
||||
'labelList': '标签管理',
|
||||
'commandFilterList': '命令过滤',
|
||||
@@ -163,10 +163,10 @@ const cn = {
|
||||
'gateway': '网关',
|
||||
'date_created': '创建日期',
|
||||
// 管理用户
|
||||
'admin_user_list': '管理用户列表',
|
||||
'admin_user_detail': '管理用户详情',
|
||||
'create_admin_user': '创建管理用户',
|
||||
'update_admin_user': '更新管理用户',
|
||||
'AdminUserList': '管理用户列表',
|
||||
'AdminUserDetail': '管理用户详情',
|
||||
'AdminUserCreate': '创建管理用户',
|
||||
'AdminUserUpdate': '更新管理用户',
|
||||
'username': '用户名',
|
||||
'replace_node_assets_admin_user_with_this': '替换资产的管理员',
|
||||
'select_nodes': '选择节点',
|
||||
|
||||
@@ -52,7 +52,7 @@ export const constantRoutes = [
|
||||
{
|
||||
path: '/users',
|
||||
component: Layout,
|
||||
redirect: '/users/list',
|
||||
redirect: '/user/list',
|
||||
name: 'Users',
|
||||
meta: {
|
||||
title: 'Users',
|
||||
@@ -102,28 +102,36 @@ export const constantRoutes = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/static/',
|
||||
path: '/assets',
|
||||
component: Layout,
|
||||
redirect: '/asset/list',
|
||||
name: 'assets',
|
||||
meta: { title: 'assets', icon: 'user' },
|
||||
meta: { title: 'Assets', icon: 'user' },
|
||||
children: [
|
||||
{
|
||||
path: 'assets',
|
||||
name: 'assetList',
|
||||
component: () => import('@/views/table/index'),
|
||||
meta: { title: 'assetList' }
|
||||
path: 'asset/list',
|
||||
name: 'AssetList',
|
||||
component: () => import('@/views/assets/AssetList.vue'),
|
||||
meta: { title: 'AssetList' }
|
||||
},
|
||||
{
|
||||
path: 'domains',
|
||||
name: 'domainList',
|
||||
component: () => import('@/views/tree/index'),
|
||||
meta: { title: 'domainList' }
|
||||
meta: { title: 'DomainList' }
|
||||
},
|
||||
{
|
||||
path: 'admin-users',
|
||||
name: 'adminUserList',
|
||||
component: () => import('@/views/table/index'),
|
||||
meta: { title: 'adminUserList' }
|
||||
path: 'admin-user',
|
||||
name: 'AdminUserList',
|
||||
component: () => import('@/views/assets/AdminUserList'),
|
||||
meta: { title: 'AdminUserList' }
|
||||
},
|
||||
{
|
||||
path: 'admin-user/detail/:id',
|
||||
component: () => import('@/views/assets/AdminUserDetail.vue'), // Parent router-view
|
||||
name: 'AdminUserDetail',
|
||||
meta: { title: 'AdminUserDetail' },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'system-users',
|
||||
|
||||
13
src/views/assets/AdminUserDetail.vue
Normal file
13
src/views/assets/AdminUserDetail.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<h1>管理用户详情组件</h1>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AdminUserDetail'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
132
src/views/assets/AdminUserList.vue
Normal file
132
src/views/assets/AdminUserList.vue
Normal 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.username')"
|
||||
sortable
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.username }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="this.$t('assets.asset')"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.assets_amount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="this.$t('assets.comment')"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<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 { getAdminUserList } from '@/api/asset'
|
||||
import Tables from '@/layout/mixin/ListTables'
|
||||
export default {
|
||||
components: {
|
||||
BackPlayground,
|
||||
ListTables
|
||||
},
|
||||
mixins: [Tables],
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
listLoading: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getAdminUser(this.current_page, this.page_size, this.offset)
|
||||
},
|
||||
methods: {
|
||||
handleDetail: function(index, row) {
|
||||
this.$router.push({ name: 'AdminUserDetail', params: { id: row.id }})
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
// 当每页数量改变触发
|
||||
this.offset = (this.current_page - 1) * val
|
||||
this.page_size = val
|
||||
this.getAdminUserList(this.current_page, val, this.offset)
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
// 当页码改变触发
|
||||
this.offset = (val - 1) * this.page_size
|
||||
this.current_page = val
|
||||
this.getAdminUserList(val, this.page_size, this.offset)
|
||||
},
|
||||
getAdminUser(draw, limit, offset) {
|
||||
this.listLoading = true
|
||||
getAdminUserList({ draw, limit, offset }).then(response => {
|
||||
this.tableData = response.results
|
||||
this.total = response.count
|
||||
this.listLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
13
src/views/assets/AssetList.vue
Normal file
13
src/views/assets/AssetList.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<h1>这是组件AssetList</h1>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AssetList'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<BackPlayground :title="$t('route.userList')">
|
||||
<BackPlayground :title="$t('route.UserList')">
|
||||
<ListTables
|
||||
:tablebotton="$t('users.createuser')"
|
||||
:tablebotton="$t('assets.createuser')"
|
||||
tableroute="UserEdit"
|
||||
@SizeChange="handleSizeChange"
|
||||
@CurrentChange="handleCurrentChange"
|
||||
|
||||
Reference in New Issue
Block a user