增加用户管理模块

This commit is contained in:
p71924506 2022-12-15 18:21:46 +08:00
parent f881fcc5da
commit 5cb5603615
5 changed files with 146 additions and 9 deletions

View File

@ -13,10 +13,10 @@
mode="vertical"
>
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
<el-menu-item index="4">
<i class="el-icon-setting"></i>
<span slot="title">添加用户</span>
</el-menu-item>
<!-- <el-menu-item index="4">-->
<!-- <i class="el-icon-setting"></i>-->
<!-- <span slot="title">添加用户</span>-->
<!-- </el-menu-item>-->
</el-menu>
</el-scrollbar>
</div>

View File

@ -5,6 +5,7 @@ Vue.use(Router)
/* Layout */
import Layout from '@/layout'
import UserManage from '@/views/userManage/UserManage'
/**
* Note: sub-menu only appear when route children.length >= 1
@ -47,14 +48,28 @@ export const constantRoutes = [
path: '/',
component: Layout,
redirect: '/fileList',
children: [{
children: [
{
path: 'fileList',
name: 'FileList',
component: () => import('@/views/fileList/FileList'),
meta: { title: '文件列表', icon: 'dashboard' }
}]
},
},
]
},
{
path:'/',
component: Layout,
children: [
{
path: "userManage",
name: 'userManage',
component:() => import("@/views/userManage/UserManage"),
meta: {title: '用户管理',icon: 'el-icon-setting'}
}
]
},
// {
// path: '/example',
// component: Layout,

View File

@ -117,6 +117,16 @@ export const getFilesInfoByName = data =>{
})
}
export const getAllUser =()=>{
return axios({
headers:{
"Authorization": localStorage.getItem("systemToken")
},
url: '/user/getAllUser',
method: 'post'
})
}
// 默认全部倒出
// 根据需要进行
export default {
@ -130,5 +140,6 @@ export default {
addType,
addFileInfo,
getFilesInfoByType,
getFilesInfoByName
getFilesInfoByName,
getAllUser
}

View File

@ -63,7 +63,7 @@
:headers="headers"
action="/api/file/uploadFile"
:on-success="uploadSuccess"
multiple>
:limit="1">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>

View File

@ -0,0 +1,111 @@
<template>
<div class="app-container">
<!--搜索框-->
<div class="manageList-header-input">
<!-- 输入框 双向绑定数据 自带清空 -->
<!-- <el-input v-model="searchInfo.keyWords" suffix-icon="el-icon-edit" clearable placeholder="输入文件名搜索">-->
<!-- <el-button slot="append" icon="el-icon-search" @click="nameSearch"></el-button>-->
<!-- </el-input>-->
<el-button style="margin-bottom: 10px" type="primary" @click="dialogVisible = true">新增用户</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<!--userId-->
<el-table-column align="center" label="用户ID" width="300">
<template slot-scope="scope">
{{ scope.row.userId }}
</template>
</el-table-column>
<!--name-->
<el-table-column label="用户名">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<!--phone-->
<el-table-column label="电话">
<template slot-scope="scope">
{{ scope.row.phone }}
</template>
</el-table-column>
<el-table-column label="用户类型">
<template slot-scope="scope">
{{ scope.row.role }}
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="操作" width="150">
<template slot-scope="scope">
<i class="el-icon-files" @click="viewFile(scope.row.location)" style="cursor: pointer">重置密码</i>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { Message } from 'element-ui'
export default {
name: 'UserManage',
data(){
return{
//
list: null,
listLoading: true,
//token
headers:{
"Authorization": localStorage.getItem("systemToken")
},
}
},
methods:{
getAllUser(){
this.$api.getAllUser().then((res)=>{
if (res.status === 0) {
this.list = res.data
this.listLoading = false
}else {
Message.warning("服务错误")
}
})
}
},
created() {
this.getAllUser()
}
}
</script>
<style scoped>
.manageList-header-input {
float: left;
margin-bottom: 20px;
}
.manageList-header-input .el-input {
width: 17rem;
}
.manageList-header-input .el-select {
width: 8rem;
}
</style>