diff --git a/public/json/user.json b/public/json/login.json similarity index 100% rename from public/json/user.json rename to public/json/login.json diff --git a/public/json/post.json b/public/json/post.json new file mode 100644 index 00000000..2fc882e1 --- /dev/null +++ b/public/json/post.json @@ -0,0 +1,5 @@ +{ + "code": 200, + "data": null, + "message": "用户名已存在" +} diff --git a/public/json/role.json b/public/json/role.json new file mode 100644 index 00000000..da92123d --- /dev/null +++ b/public/json/role.json @@ -0,0 +1,56 @@ +{ + "code": 200, + "count": 2, + "data": [ + { + "id": "1", + "label": "超级管理员", + "alias": "SA" + }, + { + "id": "2", + "label": "管理员", + "alias": "admin", + "children": [ + { + "id": "21", + "label": "系统管理员", + "alias": "SystemAdmin" + }, + { + "id": "22", + "label": "业务管理员", + "alias": "BusinessAdmin" + }, + { + "id": "23", + "label": "数据管理员", + "alias": "DataAdmin" + } + ] + }, + { + "id": "3", + "label": "操作员", + "alias": "OperatorManager", + "children": [ + { + "id": "31", + "label": "公告维护员", + "alias": "BulletinManager" + }, + { + "id": "32", + "label": "审核员", + "alias": "Auditor" + }, + { + "id": "33", + "label": "复审员", + "alias": "Reviewer" + } + ] + } + ], + "message": "" +} diff --git a/public/json/user_list.json b/public/json/user_list.json new file mode 100644 index 00000000..3fa21ec3 --- /dev/null +++ b/public/json/user_list.json @@ -0,0 +1,25 @@ +{ + "code": 200, + "count": 2, + "data": [ + { + "id": "100", + "userName": "81883387", + "mail": "81883387@qq.com", + "name": "sakuya", + "group": ["1"], + "groupName": ["超级管理员"], + "date": "2021-10-10 12:00:00" + }, + { + "id": "101", + "userName": "luhkpev", + "mail": "k.luhkpev@zdgtfd.ma", + "name": "John Martinez", + "group": ["22", "23"], + "groupName": ["业务管理员", "数据管理员"], + "date": "2021-02-21 14:21:48" + } + ], + "message": "" +} diff --git a/src/api/index.js b/src/api/index.js index 814508fa..843aef5e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -11,12 +11,49 @@ import http from "@/utils/request"; const api = { user: { - info: { - url: `${config.API_URL}/json/user.json`, + login: { + url: `${config.API_URL}/json/login.json`, name: "登录获取用户菜单和权限", get: async function(){ return await http.get(this.url); } + }, + list: { + url: `${config.API_URL}/json/user_list.json`, + name: "获取用户列表", + get: async function(params={}){ + return await http.get(this.url, params); + } + }, + save: { + url: `${config.API_URL}/json/post.json`, + name: "新增编辑用户", + post: async function(params={}){ + return await http.get(this.url, params); + } + }, + del: { + url: `${config.API_URL}/json/post.json`, + name: "删除用户", + post: async function(params={}){ + return await http.get(this.url, params); + } + } + }, + role: { + select: { + url: `${config.API_URL}/json/role.json`, + name: "角色选择列表", + get: async function(){ + return await http.get(this.url); + } + }, + list: { + url: `${config.API_URL}/json/role.json`, + name: "角色列表", + get: async function(){ + return await http.get(this.url); + } } }, demo: { diff --git a/src/components/scTable/index.vue b/src/components/scTable/index.vue index 6f457454..e1689588 100644 --- a/src/components/scTable/index.vue +++ b/src/components/scTable/index.vue @@ -14,7 +14,7 @@ @@ -56,6 +56,7 @@ }, data() { return { + emptyText: "暂无数据", toggleIndex: 0, tableData: [], pageSize: 20, @@ -95,7 +96,14 @@ page: this.currentPage } Object.assign(reqData, this.tableParams) - var res = await this.apiObj.get(reqData); + try { + var res = await this.apiObj.get(reqData); + }catch(error){ + this.loading = false; + this.emptyText = error.statusText; + return false; + } + this.emptyText = "暂无数据"; this.tableData = res.data; this.total = res.count; this.loading = false; diff --git a/src/style/fix.less b/src/style/fix.less index bc5e5fc4..abfed14f 100644 --- a/src/style/fix.less +++ b/src/style/fix.less @@ -4,7 +4,7 @@ .el-menu .el-menu-item a {color: inherit;text-decoration: none;display: block;width:100%;height:100%;position: absolute;top:0px;left:0px;} .el-form-item-msg {font-size: 12px;color: #999;} .el-container {height: 100%;} -.el-aside {border-right: 1px solid #e6e6e6;background: #fff;padding-top:20px;} +.el-aside {border-right: 1px solid #e6e6e6;background: #fff;} .el-header {background: #fff;border-bottom: 1px solid #e6e6e6;padding:13px 15px;display: flex;justify-content: space-between;align-items: center;} .el-header .left-panel {display: flex;align-items: center;} .el-header .right-panel {display: flex;align-items: center;} @@ -15,3 +15,4 @@ .el-drawer__body {overflow: auto;} .el-popconfirm__main {margin: 14px 0;} .el-card__header {border-bottom: 0} +.el-tree-node__content {height:36px;} \ No newline at end of file diff --git a/src/views/login.vue b/src/views/login.vue index da0eb697..91c7e52c 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -103,7 +103,7 @@ }) }, login: async function() { - var userInfo = await this.$API.user.info.get(); + var userInfo = await this.$API.user.login.get(); this.$TOOL.data.set("user", userInfo.data); this.$router.replace({ path: '/' diff --git a/src/views/setting/role/index.vue b/src/views/setting/role/index.vue index c0f956c1..a364f600 100644 --- a/src/views/setting/role/index.vue +++ b/src/views/setting/role/index.vue @@ -14,15 +14,15 @@ - + - + - + @@ -41,13 +41,15 @@ diff --git a/src/views/setting/user/index.vue b/src/views/setting/user/index.vue index 257cf473..a4b8529d 100644 --- a/src/views/setting/user/index.vue +++ b/src/views/setting/user/index.vue @@ -1,12 +1,19 @@ diff --git a/src/views/setting/user/save.vue b/src/views/setting/user/save.vue new file mode 100644 index 00000000..872e1885 --- /dev/null +++ b/src/views/setting/user/save.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/src/views/template/sideList.vue b/src/views/template/sideList.vue index bb645daa..cd87a25b 100644 --- a/src/views/template/sideList.vue +++ b/src/views/template/sideList.vue @@ -99,7 +99,7 @@ } }, async created() { - var userInfo = await this.$API.user.info.get(); + var userInfo = await this.$API.user.login.get(); this.tableData = userInfo.data.menuList; }, mounted(){