正在显示
23 个修改的文件
包含
1032 行增加
和
643 行删除
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | 3 | ||
4 | <head> | 4 | <head> |
5 | <meta charset="utf-8"> | 5 | <meta charset="utf-8"> |
6 | - <title>流浪地球项目</title> | 6 | + <title>易通快速通关申报管理系统</title> |
7 | <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> | 7 | <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"> |
8 | </head> | 8 | </head> |
9 | 9 | ||
@@ -14,4 +14,4 @@ | @@ -14,4 +14,4 @@ | ||
14 | <!-- built files will be auto injected --> | 14 | <!-- built files will be auto injected --> |
15 | </body> | 15 | </body> |
16 | 16 | ||
17 | -</html> | ||
17 | +</html> |
@@ -7,7 +7,7 @@ Vue.prototype.$http = axios; | @@ -7,7 +7,7 @@ Vue.prototype.$http = axios; | ||
7 | 7 | ||
8 | export const getuserMenus = params => { return axios.get(`/perm/userMenus`, { params: params }); }; | 8 | export const getuserMenus = params => { return axios.get(`/perm/userMenus`, { params: params }); }; |
9 | 9 | ||
10 | -export const getUserList = params => { return axios.get(`/hqpt-user-center/user/list`, { params: params }); }; | 10 | +export const getUserList = params => { return axios.get(`/cloud-user-center/user/list`, { params: params }); }; |
11 | 11 | ||
12 | export const getUserListPage = params => { return axios({ | 12 | export const getUserListPage = params => { return axios({ |
13 | method: 'GET', | 13 | method: 'GET', |
@@ -55,4 +55,4 @@ export const setUserRole = params => { return axios({ | @@ -55,4 +55,4 @@ export const setUserRole = params => { return axios({ | ||
55 | headers: { | 55 | headers: { |
56 | 'Content-Type': 'application/json;charset=UTF-8' | 56 | 'Content-Type': 'application/json;charset=UTF-8' |
57 | } | 57 | } |
58 | -})}; | ||
58 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/company'; | 3 | +let base = '/cloud-user-center/company'; |
4 | 4 | ||
5 | 5 | ||
6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | 6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; |
@@ -34,4 +34,4 @@ export const add = params => { return axios({ | @@ -34,4 +34,4 @@ export const add = params => { return axios({ | ||
34 | headers: { | 34 | headers: { |
35 | 'Content-Type': 'application/json;charset=UTF-8' | 35 | 'Content-Type': 'application/json;charset=UTF-8' |
36 | } | 36 | } |
37 | -})}; | ||
37 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/department'; | 3 | +let base = '/cloud-user-center/department'; |
4 | 4 | ||
5 | 5 | ||
6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | 6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; |
@@ -34,4 +34,4 @@ export const add = params => { return axios({ | @@ -34,4 +34,4 @@ export const add = params => { return axios({ | ||
34 | headers: { | 34 | headers: { |
35 | 'Content-Type': 'application/json;charset=UTF-8' | 35 | 'Content-Type': 'application/json;charset=UTF-8' |
36 | } | 36 | } |
37 | -})}; | ||
37 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/group'; | 3 | +let base = '/cloud-user-center/group'; |
4 | 4 | ||
5 | 5 | ||
6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | 6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; |
@@ -34,4 +34,4 @@ export const add = params => { return axios({ | @@ -34,4 +34,4 @@ export const add = params => { return axios({ | ||
34 | headers: { | 34 | headers: { |
35 | 'Content-Type': 'application/json;charset=UTF-8' | 35 | 'Content-Type': 'application/json;charset=UTF-8' |
36 | } | 36 | } |
37 | -})}; | ||
37 | +})}; |
@@ -46,7 +46,7 @@ export default { | @@ -46,7 +46,7 @@ export default { | ||
46 | login: data =>{ | 46 | login: data =>{ |
47 | return axios({ | 47 | return axios({ |
48 | method: 'POST', // 请求协议 | 48 | method: 'POST', // 请求协议 |
49 | - url: 'hqpt-user-center/login', // 请求的地址 | 49 | + url: 'cloud-user-center/login', // 请求的地址 |
50 | data: qs.stringify(data), // post 请求的数据 | 50 | data: qs.stringify(data), // post 请求的数据 |
51 | timeout: 30000, // 超时时间, 单位毫秒 | 51 | timeout: 30000, // 超时时间, 单位毫秒 |
52 | headers: { | 52 | headers: { |
@@ -67,4 +67,4 @@ export default { | @@ -67,4 +67,4 @@ export default { | ||
67 | // headers: {}, | 67 | // headers: {}, |
68 | // // axios 的配置 | 68 | // // axios 的配置 |
69 | // config: {} | 69 | // config: {} |
70 | -// } | ||
70 | +// } |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/system/log'; | 3 | +let base = '/cloud-user-center/system/log'; |
4 | 4 | ||
5 | 5 | ||
6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | 6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/perm'; | 3 | +let base = '/cloud-user-center/perm'; |
4 | 4 | ||
5 | 5 | ||
6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | 6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; |
@@ -34,4 +34,4 @@ export const add = params => { return axios({ | @@ -34,4 +34,4 @@ export const add = params => { return axios({ | ||
34 | headers: { | 34 | headers: { |
35 | 'Content-Type': 'application/json;charset=UTF-8' | 35 | 'Content-Type': 'application/json;charset=UTF-8' |
36 | } | 36 | } |
37 | -})}; | ||
37 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/role'; | 3 | +let base = '/cloud-user-center/role'; |
4 | 4 | ||
5 | 5 | ||
6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | 6 | export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; |
@@ -43,4 +43,4 @@ export const updateRolePerm = params => { return axios({ | @@ -43,4 +43,4 @@ export const updateRolePerm = params => { return axios({ | ||
43 | headers: { | 43 | headers: { |
44 | 'Content-Type': 'application/json;charset=UTF-8' | 44 | 'Content-Type': 'application/json;charset=UTF-8' |
45 | } | 45 | } |
46 | -})}; | ||
46 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/come_car'; | 3 | +let base = '/cloud-user-center/come_car'; |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
@@ -35,4 +35,4 @@ export const add = params => { return axios({ | @@ -35,4 +35,4 @@ export const add = params => { return axios({ | ||
35 | headers: { | 35 | headers: { |
36 | 'Content-Type': 'application/json;charset=UTF-8' | 36 | 'Content-Type': 'application/json;charset=UTF-8' |
37 | } | 37 | } |
38 | -})}; | ||
38 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/key'; | 3 | +let base = '/cloud-user-center/key'; |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
@@ -35,4 +35,4 @@ export const add = params => { return axios({ | @@ -35,4 +35,4 @@ export const add = params => { return axios({ | ||
35 | headers: { | 35 | headers: { |
36 | 'Content-Type': 'application/json;charset=UTF-8' | 36 | 'Content-Type': 'application/json;charset=UTF-8' |
37 | } | 37 | } |
38 | -})}; | ||
38 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/maintain'; | 3 | +let base = '/cloud-user-center/maintain'; |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
@@ -35,4 +35,4 @@ export const add = params => { return axios({ | @@ -35,4 +35,4 @@ export const add = params => { return axios({ | ||
35 | headers: { | 35 | headers: { |
36 | 'Content-Type': 'application/json;charset=UTF-8' | 36 | 'Content-Type': 'application/json;charset=UTF-8' |
37 | } | 37 | } |
38 | -})}; | ||
38 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/on_duty'; | 3 | +let base = '/cloud-user-center/on_duty'; |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
@@ -35,4 +35,4 @@ export const add = params => { return axios({ | @@ -35,4 +35,4 @@ export const add = params => { return axios({ | ||
35 | headers: { | 35 | headers: { |
36 | 'Content-Type': 'application/json;charset=UTF-8' | 36 | 'Content-Type': 'application/json;charset=UTF-8' |
37 | } | 37 | } |
38 | -})}; | ||
38 | +})}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/inspection'; | 3 | +let base = '/cloud-user-center/inspection'; |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
@@ -35,4 +35,4 @@ export const add = params => { return axios({ | @@ -35,4 +35,4 @@ export const add = params => { return axios({ | ||
35 | headers: { | 35 | headers: { |
36 | 'Content-Type': 'application/json;charset=UTF-8' | 36 | 'Content-Type': 'application/json;charset=UTF-8' |
37 | } | 37 | } |
38 | -})}; | ||
38 | +})}; |
1 | import http from './http.js' | 1 | import http from './http.js' |
2 | -let baseUrl = '/hqpt-user-center/user' | 2 | +let baseUrl = '/cloud-user-center/user' |
3 | 3 | ||
4 | export const getUserList = params => { return http.get(`${baseUrl}/list`, params); }; | 4 | export const getUserList = params => { return http.get(`${baseUrl}/list`, params); }; |
5 | 5 | ||
@@ -13,4 +13,4 @@ export const editUser = params => { return http.put(`/user/edit`,params)}; | @@ -13,4 +13,4 @@ export const editUser = params => { return http.put(`/user/edit`,params)}; | ||
13 | 13 | ||
14 | export const addUser = params => { return http.post(`/user/add`,params)}; | 14 | export const addUser = params => { return http.post(`/user/add`,params)}; |
15 | 15 | ||
16 | -export const setUserRole = params => { return http.put(`/user/roleset`,params)}; | ||
16 | +export const setUserRole = params => { return http.put(`/user/roleset`,params)}; |
1 | import axios from 'axios' | 1 | import axios from 'axios' |
2 | 2 | ||
3 | -let base = '/hqpt-user-center/water_stations_patrol'; | 3 | +let base = '/cloud-user-center/water_stations_patrol'; |
4 | 4 | ||
5 | 5 | ||
6 | 6 | ||
@@ -35,4 +35,4 @@ export const add = params => { return axios({ | @@ -35,4 +35,4 @@ export const add = params => { return axios({ | ||
35 | headers: { | 35 | headers: { |
36 | 'Content-Type': 'application/json;charset=UTF-8' | 36 | 'Content-Type': 'application/json;charset=UTF-8' |
37 | } | 37 | } |
38 | -})}; | ||
38 | +})}; |
@@ -7,9 +7,9 @@ import Role from './views/nav1/role.vue' | @@ -7,9 +7,9 @@ import Role from './views/nav1/role.vue' | ||
7 | import Perm from './views/nav1/perm.vue' | 7 | import Perm from './views/nav1/perm.vue' |
8 | import LOG from './views/nav1/Log.vue' | 8 | import LOG from './views/nav1/Log.vue' |
9 | import PreManifest from './views/agent/PreManifest.vue' | 9 | import PreManifest from './views/agent/PreManifest.vue' |
10 | -import Company from './views/nav1/company.vue' | ||
11 | -import Department from './views/nav1/department.vue' | ||
12 | -import Group from './views/nav1/groupcompany.vue' | 10 | +// import Company from './views/nav1/company.vue' |
11 | +// import Department from './views/nav1/department.vue' | ||
12 | +// import Group from './views/nav1/groupcompany.vue' | ||
13 | import Process from './views/hqpt/Process.vue' | 13 | import Process from './views/hqpt/Process.vue' |
14 | import Job from './views/hqpt/Job.vue' | 14 | import Job from './views/hqpt/Job.vue' |
15 | // import Form from './views/nav1/Form.vue' | 15 | // import Form from './views/nav1/Form.vue' |
@@ -58,12 +58,12 @@ let routes = [ | @@ -58,12 +58,12 @@ let routes = [ | ||
58 | iconCls: 'el-icon-setting',//图标样式class | 58 | iconCls: 'el-icon-setting',//图标样式class |
59 | children: [ | 59 | children: [ |
60 | { path: '/user', component: User, name: '用户管理' }, | 60 | { path: '/user', component: User, name: '用户管理' }, |
61 | - { path: '/role', component: Role, name: '岗位管理' }, | 61 | + { path: '/role', component: Role, name: '组织机构' }, |
62 | { path: '/perm', component: Perm, name: '权限管理' }, | 62 | { path: '/perm', component: Perm, name: '权限管理' }, |
63 | { path: '/log', component: LOG, name: '系统日志' }, | 63 | { path: '/log', component: LOG, name: '系统日志' }, |
64 | - { path: '/department', component: Department, name: '部门管理' }, | ||
65 | - { path: '/company', component: Company, name: '公司管理'}, | ||
66 | - { path: '/group', component: Group, name: '集团管理'} | 64 | + // { path: '/department', component: Department, name: '部门管理' }, |
65 | + // { path: '/company', component: Company, name: '公司管理'}, | ||
66 | + // { path: '/group', component: Group, name: '集团管理'} | ||
67 | ] | 67 | ] |
68 | }, | 68 | }, |
69 | { | 69 | { |
@@ -161,4 +161,4 @@ let handleMenuList = function (router,menu) { | @@ -161,4 +161,4 @@ let handleMenuList = function (router,menu) { | ||
161 | } | 161 | } |
162 | export default { | 162 | export default { |
163 | routes,setUserMenus,handleMenuList,initRouters | 163 | routes,setUserMenus,handleMenuList,initRouters |
164 | -}; | ||
164 | +}; |
1 | <template> | 1 | <template> |
2 | - <el-row class="container"> | 2 | + <el-row class="container darkmenu" style="margin-top: 0px;"> |
3 | <el-col :span="24" class="header"> | 3 | <el-col :span="24" class="header"> |
4 | - <el-col :span="10" class="logo" :class="collapsed?'logo-collapse-width':'logo-width'"> | 4 | + <el-col :span="10" class="logo" align="center" :class="collapsed?'logo-collapse-width':'logo-width'"> |
5 | {{collapsed?'':sysName}} | 5 | {{collapsed?'':sysName}} |
6 | </el-col> | 6 | </el-col> |
7 | <el-col :span="10"> | 7 | <el-col :span="10"> |
@@ -11,75 +11,182 @@ | @@ -11,75 +11,182 @@ | ||
11 | </el-col> | 11 | </el-col> |
12 | <el-col :span="4" class="userinfo"> | 12 | <el-col :span="4" class="userinfo"> |
13 | <el-dropdown trigger="hover"> | 13 | <el-dropdown trigger="hover"> |
14 | - <span class="el-dropdown-link userinfo-inner"><img :src="this.sysUserAvatar" /> {{sysUserName}}</span> | 14 | + <span class="el-dropdown-link userinfo-inner"><img |
15 | + :src="this.sysUserAvatar"/> {{sysUserName}}</span> | ||
15 | <el-dropdown-menu slot="dropdown"> | 16 | <el-dropdown-menu slot="dropdown"> |
16 | <el-dropdown-item>我的消息</el-dropdown-item> | 17 | <el-dropdown-item>我的消息</el-dropdown-item> |
17 | - <el-dropdown-item>设置</el-dropdown-item> | 18 | + <el-dropdown-item @click.native="editPass">修改密码</el-dropdown-item> |
18 | <el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item> | 19 | <el-dropdown-item divided @click.native="logout">退出登录</el-dropdown-item> |
19 | </el-dropdown-menu> | 20 | </el-dropdown-menu> |
20 | </el-dropdown> | 21 | </el-dropdown> |
21 | </el-col> | 22 | </el-col> |
22 | </el-col> | 23 | </el-col> |
24 | + <el-col> | ||
25 | + <el-dialog title="修改密码" :visible.sync="dialogFormVisible"> | ||
26 | + <el-form :model="resetForm" status-icon :rules="resetFormRules" ref="resetForm" label-width="100px"> | ||
27 | + <el-form-item label="用户名" prop="name"> | ||
28 | + <span>{{sysUserName}}</span> | ||
29 | + </el-form-item> | ||
30 | + <el-form-item label="新密码" prop="newpwd"> | ||
31 | + <el-input type="password" v-model="resetForm.newpwd" autocomplete="off" | ||
32 | + placeholder="8-20位字符在数字、小写、大写字母以及特殊字符中四选三"></el-input> | ||
33 | + </el-form-item> | ||
34 | + <el-form-item label="确认密码" prop="renewpwd"> | ||
35 | + <el-input type="password" v-model="resetForm.renewpwd" auto-complete="off"></el-input> | ||
36 | + </el-form-item> | ||
37 | + <el-form-item> | ||
38 | + <el-button type="primary" @click="submitEdit('resetForm')" style="float:right">提 交</el-button> | ||
39 | + </el-form-item> | ||
40 | + | ||
41 | + </el-form> | ||
42 | + </el-dialog> | ||
43 | + </el-col> | ||
23 | <el-col :span="24" class="main"> | 44 | <el-col :span="24" class="main"> |
24 | <aside :class="collapsed?'menu-collapsed':'menu-expanded'"> | 45 | <aside :class="collapsed?'menu-collapsed':'menu-expanded'"> |
25 | <!--导航菜单--> | 46 | <!--导航菜单--> |
26 | - <el-menu :default-active="$route.path" class="el-menu-vertical-demo" @open="handleopen" @close="handleclose" @select="handleselect" unique-opened router v-show="!collapsed" style="min-width: 230px"> | 47 | + <el-menu :default-active="$route.path" class="el-menu-vertical-demo" @open="handleopen" |
48 | + @close="handleclose" @select="handleselect" unique-opened router v-show="!collapsed" | ||
49 | + style="min-width: 230px"> | ||
27 | <template v-for="(item,index) in $router.options.routes" v-if="!item.hidden"> | 50 | <template v-for="(item,index) in $router.options.routes" v-if="!item.hidden"> |
28 | <el-submenu :index="index+''" v-if="!item.leaf"> | 51 | <el-submenu :index="index+''" v-if="!item.leaf"> |
29 | <template slot="title"><i :class="item.iconCls"></i>{{item.name}}</template> | 52 | <template slot="title"><i :class="item.iconCls"></i>{{item.name}}</template> |
30 | - <el-menu-item v-for="child in item.children" :index="child.path" :key="child.path" v-if="!child.hidden">{{child.name}}</el-menu-item> | 53 | + <el-menu-item v-for="child in item.children" :index="child.path" :key="child.path" |
54 | + v-if="!child.hidden">{{child.name}} | ||
55 | + </el-menu-item> | ||
31 | </el-submenu> | 56 | </el-submenu> |
32 | - <el-menu-item v-if="item.leaf&&item.children.length>0" :index="item.children[0].path"><i :class="item.iconCls"></i>{{item.children[0].name}}</el-menu-item> | 57 | + <el-menu-item v-if="item.leaf&&item.children.length>0" :index="item.children[0].path"><i |
58 | + :class="item.iconCls"></i>{{item.children[0].name}} | ||
59 | + </el-menu-item> | ||
33 | </template> | 60 | </template> |
34 | </el-menu> | 61 | </el-menu> |
35 | <!--导航菜单-折叠后--> | 62 | <!--导航菜单-折叠后--> |
36 | <ul class="el-menu el-menu-vertical-demo collapsed" v-show="collapsed" ref="menuCollapsed"> | 63 | <ul class="el-menu el-menu-vertical-demo collapsed" v-show="collapsed" ref="menuCollapsed"> |
37 | <li v-for="(item,index) in $router.options.routes" v-if="!item.hidden" class="el-submenu item"> | 64 | <li v-for="(item,index) in $router.options.routes" v-if="!item.hidden" class="el-submenu item"> |
38 | <template v-if="!item.leaf"> | 65 | <template v-if="!item.leaf"> |
39 | - <div class="el-submenu__title" style="padding-left: 20px;" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)"><i :class="item.iconCls"></i></div> | ||
40 | - <ul class="el-menu submenu" :class="'submenu-hook-'+index" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)"> | ||
41 | - <li v-for="child in item.children" v-if="!child.hidden" :key="child.path" class="el-menu-item" style="padding-left: 40px;" :class="$route.path==child.path?'is-active':''" @click="$router.push(child.path)">{{child.name}}</li> | 66 | + <div class="el-submenu__title" style="padding-left: 20px;" @mouseover="showMenu(index,true)" |
67 | + @mouseout="showMenu(index,false)"><i :class="item.iconCls"></i></div> | ||
68 | + <ul class="el-menu submenu" :class="'submenu-hook-'+index" @mouseover="showMenu(index,true)" | ||
69 | + @mouseout="showMenu(index,false)"> | ||
70 | + <li v-for="child in item.children" v-if="!child.hidden" :key="child.path" | ||
71 | + class="el-menu-item" style="padding-left: 40px;" | ||
72 | + :class="$route.path==child.path?'is-active':''" @click="$router.push(child.path)"> | ||
73 | + {{child.name}} | ||
74 | + </li> | ||
42 | </ul> | 75 | </ul> |
43 | </template> | 76 | </template> |
44 | <template v-else> | 77 | <template v-else> |
45 | - <li class="el-submenu"> | ||
46 | - <div class="el-submenu__title el-menu-item" style="padding-left: 20px;height: 56px;line-height: 56px;padding: 0 20px;" :class="$route.path==item.children[0].path?'is-active':''" @click="$router.push(item.children[0].path)"><i :class="item.iconCls"></i></div> | ||
47 | - </li> | ||
48 | - </template> | 78 | + <li class="el-submenu"> |
79 | + <div class="el-submenu__title el-menu-item" | ||
80 | + style="padding-left: 20px;height: 56px;line-height: 56px;padding: 0 20px;" | ||
81 | + :class="$route.path==item.children[0].path?'is-active':''" | ||
82 | + @click="$router.push(item.children[0].path)"><i :class="item.iconCls"></i></div> | ||
49 | </li> | 83 | </li> |
50 | - </ul> | ||
51 | - </aside> | ||
52 | - <section class="content-container"> | ||
53 | - <div class="grid-content bg-purple-light"> | ||
54 | - <el-col :span="24" class="breadcrumb-container"> | ||
55 | - <strong class="title">{{$route.name}}</strong> | ||
56 | - <el-breadcrumb separator="/" class="breadcrumb-inner"> | ||
57 | - <el-breadcrumb-item v-for="item in $route.matched" :key="item.path"> | ||
58 | - {{ item.name }} | ||
59 | - </el-breadcrumb-item> | ||
60 | - </el-breadcrumb> | ||
61 | - </el-col> | ||
62 | - <el-col :span="24" class="content-wrapper"> | ||
63 | - <transition name="fade" mode="out-in"> | ||
64 | - <router-view></router-view> | ||
65 | - </transition> | ||
66 | - </el-col> | ||
67 | - </div> | ||
68 | - </section> | 84 | +</template> |
85 | +</li> | ||
86 | +</ul> | ||
87 | +</aside> | ||
88 | +<section class="content-container"> | ||
89 | + <div class="grid-content bg-purple-light"> | ||
90 | + <el-col :span="24" class="breadcrumb-container"> | ||
91 | + <strong class="title">{{$route.name}}</strong> | ||
92 | + <el-breadcrumb separator=">" class="breadcrumb-inner"> | ||
93 | + <el-breadcrumb-item v-for="item in $route.matched" :key="item.path"> | ||
94 | + {{ item.name }} | ||
95 | + </el-breadcrumb-item> | ||
96 | + </el-breadcrumb> | ||
69 | </el-col> | 97 | </el-col> |
70 | - </el-row> | 98 | + <el-col :span="24" class="content-wrapper"> |
99 | + <transition name="fade" mode="out-in"> | ||
100 | + <router-view :key="$route.path +$route.query.t"></router-view> | ||
101 | + </transition> | ||
102 | + </el-col> | ||
103 | + </div> | ||
104 | +</section> | ||
105 | +</el-col> | ||
106 | +</el-row> | ||
71 | </template> | 107 | </template> |
72 | 108 | ||
73 | - | ||
74 | <script> | 109 | <script> |
75 | - import rt from '../routes' | ||
76 | - export default { | 110 | + import rt from '../routes' |
111 | + import {editPass} from '../api/user'; | ||
112 | + import ElFormItem from "element-ui/packages/form/src/form-item"; | ||
113 | + | ||
114 | + export default { | ||
115 | + | ||
116 | + provide() { | ||
117 | + return { | ||
118 | + reload: this.reload | ||
119 | + } | ||
120 | + }, | ||
121 | + components: {ElFormItem}, | ||
77 | data() { | 122 | data() { |
123 | + var validatePass = (rule, value, callback) => { | ||
124 | + if (!value) { | ||
125 | + callback(new Error('请输入新密码')); | ||
126 | + } else { | ||
127 | + var ls = 0; | ||
128 | + if (value.match(/([a-z])+/)) { | ||
129 | + ls++; | ||
130 | + } | ||
131 | + if (value.match(/([0-9])+/)) { | ||
132 | + ls++; | ||
133 | + } | ||
134 | + if (value.match(/([A-Z])+/)) { | ||
135 | + ls++; | ||
136 | + } | ||
137 | + if ((/([\W])+/) && !value.match(/(![\u4E00-\u9FA5])+/)) { | ||
138 | + ls++; | ||
139 | + } | ||
140 | + if (value.toString().length < 8 || value.toString().length > 20) { | ||
141 | + callback(new Error('密码长度为8 - 20个字符')); | ||
142 | + ls = 0; | ||
143 | + } | ||
144 | + if (value.match(/([\u4E00-\u9FA5])+/)) { | ||
145 | + callback(new Error('不能包含中文字符')); | ||
146 | + ls = 0; | ||
147 | + } | ||
148 | + switch (ls) { | ||
149 | + case 0: | ||
150 | + this.passwordPercent = 0; | ||
151 | + callback(new Error('数字、小写字母、大写字母以及特殊字符中四选三')); | ||
152 | + break; | ||
153 | + case 1: | ||
154 | + this.passwordPercent = 33; | ||
155 | + callback(new Error('数字、小写字母、大写字母以及特殊字符中四选三')); | ||
156 | + break; | ||
157 | + case 2: | ||
158 | + this.passwordPercent = 66; | ||
159 | + callback(new Error('数字、小写字母 、大写字母以及特殊字符中四选三')); | ||
160 | + break; | ||
161 | + case 3: | ||
162 | + case 4: | ||
163 | + this.passwordPercent = 100; | ||
164 | + break; | ||
165 | + default: | ||
166 | + this.passwordPercent = 0; | ||
167 | + break; | ||
168 | + } | ||
169 | + callback(); | ||
170 | + } | ||
171 | + | ||
172 | + }; | ||
173 | + | ||
174 | + var validatePass2 = (rule, value, callback) => { | ||
175 | + if (value === '') { | ||
176 | + callback(new Error('请再次输入密码')); | ||
177 | + } else if (value !== this.resetForm.newpwd) { | ||
178 | + callback(new Error('两次输入密码不一致!')); | ||
179 | + } else { | ||
180 | + callback(); | ||
181 | + } | ||
182 | + }; | ||
78 | return { | 183 | return { |
79 | - sysName:'后勤管理平台', | ||
80 | - collapsed:false, | 184 | + sysName: '易通快速通关申报管理系统', |
185 | + collapsed: false, | ||
81 | sysUserName: '', | 186 | sysUserName: '', |
187 | + sysUserId: '', | ||
82 | sysUserAvatar: '', | 188 | sysUserAvatar: '', |
189 | + isRouterAlive: true, | ||
83 | form: { | 190 | form: { |
84 | name: '', | 191 | name: '', |
85 | region: '', | 192 | region: '', |
@@ -89,10 +196,67 @@ | @@ -89,10 +196,67 @@ | ||
89 | type: [], | 196 | type: [], |
90 | resource: '', | 197 | resource: '', |
91 | desc: '' | 198 | desc: '' |
92 | - } | 199 | + }, |
200 | + dialogFormVisible: false, | ||
201 | + resetForm: { | ||
202 | + newpwd: '', | ||
203 | + renewpwd: '', | ||
204 | + }, | ||
205 | + resetFormRules: { | ||
206 | + newpwd: [ | ||
207 | + {required: true, validator: validatePass, trigger: 'blur'} | ||
208 | + ], | ||
209 | + renewpwd: [ | ||
210 | + {required: true, validator: validatePass2, trigger: 'blur'} | ||
211 | + ] | ||
212 | + }, | ||
213 | + editForm: { | ||
214 | + userId: '', | ||
215 | + password: '', | ||
216 | + }, | ||
93 | } | 217 | } |
94 | }, | 218 | }, |
95 | methods: { | 219 | methods: { |
220 | + reload() { | ||
221 | + this.$nextTick(function () { | ||
222 | + this.$router.push({ | ||
223 | + path: this.$router.path, | ||
224 | + query: { | ||
225 | + t: new Date().getTime() | ||
226 | + } | ||
227 | + }) | ||
228 | + }) | ||
229 | + }, | ||
230 | + editPass: function () { | ||
231 | + this.dialogFormVisible = true; | ||
232 | + }, | ||
233 | + submitEdit(formName) { | ||
234 | + this.$refs[formName].validate((valid) => { | ||
235 | + if (valid) { | ||
236 | + this.editForm.userId = this.sysUserId; | ||
237 | + this.editForm.password = this.resetForm.renewpwd; | ||
238 | + editPass(this.editForm).then(res => { | ||
239 | + let response = res.data; | ||
240 | + if (response.code == '200') { | ||
241 | + this.$notify({ | ||
242 | + title: '密码修改成功', | ||
243 | + message: '密码修改成功,退出请重新登录', | ||
244 | + type: 'success' | ||
245 | + }); | ||
246 | + this.dialogFormVisible = false; | ||
247 | + } else { | ||
248 | + this.$notify.error({ | ||
249 | + title: '密码修改失败', | ||
250 | + message: '密码修改失败!!!' | ||
251 | + }); | ||
252 | + } | ||
253 | + }); | ||
254 | + } else { | ||
255 | + console.log('error submit!!'); | ||
256 | + return false; | ||
257 | + } | ||
258 | + }); | ||
259 | + }, | ||
96 | onSubmit() { | 260 | onSubmit() { |
97 | console.log('submit!'); | 261 | console.log('submit!'); |
98 | }, | 262 | }, |
@@ -103,7 +267,7 @@ | @@ -103,7 +267,7 @@ | ||
103 | console.log('handleclose'); | 267 | console.log('handleclose'); |
104 | }, | 268 | }, |
105 | handleselect: function (a, b) { | 269 | handleselect: function (a, b) { |
106 | - console.log('handleselect!'); | 270 | + this.reload() |
107 | }, | 271 | }, |
108 | //退出登录 | 272 | //退出登录 |
109 | logout: function () { | 273 | logout: function () { |
@@ -112,11 +276,10 @@ | @@ -112,11 +276,10 @@ | ||
112 | //type: 'warning' | 276 | //type: 'warning' |
113 | }).then(() => { | 277 | }).then(() => { |
114 | sessionStorage.removeItem('user'); | 278 | sessionStorage.removeItem('user'); |
115 | - sessionStorage.removeItem('menu'); | ||
116 | - | ||
117 | - //退出后初始化原来的路由 | ||
118 | - let sysRoutes = JSON.parse(sessionStorage.getItem('sysMenu')); | ||
119 | - console.log(sysRoutes); | 279 | + sessionStorage.removeItem('menu'); |
280 | + //退出后初始化原来的路由 | ||
281 | + let sysRoutes = JSON.parse(sessionStorage.getItem('sysMenu')); | ||
282 | + console.log(sysRoutes); | ||
120 | _this.$router.options.routes = sysRoutes; | 283 | _this.$router.options.routes = sysRoutes; |
121 | 284 | ||
122 | _this.$router.push('/login'); | 285 | _this.$router.push('/login'); |
@@ -127,28 +290,29 @@ | @@ -127,28 +290,29 @@ | ||
127 | 290 | ||
128 | }, | 291 | }, |
129 | //折叠导航栏 | 292 | //折叠导航栏 |
130 | - collapse:function(){ | ||
131 | - this.collapsed=!this.collapsed; | 293 | + collapse: function () { |
294 | + this.collapsed = !this.collapsed; | ||
132 | }, | 295 | }, |
133 | - showMenu(i,status){ | ||
134 | - this.$refs.menuCollapsed.getElementsByClassName('submenu-hook-'+i)[0].style.display=status?'block':'none'; | 296 | + showMenu(i, status) { |
297 | + this.$refs.menuCollapsed.getElementsByClassName('submenu-hook-' + i)[0].style.display = status ? 'block' : 'none'; | ||
135 | } | 298 | } |
136 | }, | 299 | }, |
137 | mounted() { | 300 | mounted() { |
138 | - var _this = this; | 301 | + var _this = this; |
139 | var user = sessionStorage.getItem('user'); | 302 | var user = sessionStorage.getItem('user'); |
140 | if (user) { | 303 | if (user) { |
141 | user = JSON.parse(user); | 304 | user = JSON.parse(user); |
142 | this.sysUserName = user.username || ''; | 305 | this.sysUserName = user.username || ''; |
306 | + this.sysUserId = user.userId || ''; | ||
143 | this.sysUserAvatar = user.userface || '/static/images/faceDefault.jpg'; | 307 | this.sysUserAvatar = user.userface || '/static/images/faceDefault.jpg'; |
144 | } | 308 | } |
145 | //操作路由,判断本地存储的用户栏目列表是否存在,如果存在则加载路由 | 309 | //操作路由,判断本地存储的用户栏目列表是否存在,如果存在则加载路由 |
146 | var userRouters = sessionStorage.getItem('menu'); | 310 | var userRouters = sessionStorage.getItem('menu'); |
147 | if (userRouters) { | 311 | if (userRouters) { |
148 | - userRouters = JSON.parse(userRouters); | ||
149 | - _this.$router.options.routes = userRouters; | ||
150 | - console.log("home:"); | ||
151 | - console.log(_this.$router.options.routes); | 312 | + userRouters = JSON.parse(userRouters); |
313 | + _this.$router.options.routes = userRouters; | ||
314 | + console.log("home:"); | ||
315 | + console.log(_this.$router.options.routes); | ||
152 | } | 316 | } |
153 | } | 317 | } |
154 | } | 318 | } |
@@ -157,24 +321,28 @@ | @@ -157,24 +321,28 @@ | ||
157 | 321 | ||
158 | <style scoped lang="scss"> | 322 | <style scoped lang="scss"> |
159 | @import '~scss_vars'; | 323 | @import '~scss_vars'; |
160 | - | 324 | + |
161 | .container { | 325 | .container { |
162 | position: absolute; | 326 | position: absolute; |
163 | top: 0px; | 327 | top: 0px; |
164 | bottom: 0px; | 328 | bottom: 0px; |
165 | width: 100%; | 329 | width: 100%; |
330 | + | ||
166 | .header { | 331 | .header { |
167 | height: 60px; | 332 | height: 60px; |
168 | line-height: 60px; | 333 | line-height: 60px; |
169 | - background: $color-primary; | ||
170 | - color:#fff; | 334 | + background: $color-primary url("/static/images/air-banner.png"); |
335 | + color: #fff; | ||
336 | + | ||
171 | .userinfo { | 337 | .userinfo { |
172 | text-align: right; | 338 | text-align: right; |
173 | padding-right: 35px; | 339 | padding-right: 35px; |
174 | float: right; | 340 | float: right; |
341 | + | ||
175 | .userinfo-inner { | 342 | .userinfo-inner { |
176 | cursor: pointer; | 343 | cursor: pointer; |
177 | - color:#fff; | 344 | + color: #fff; |
345 | + | ||
178 | img { | 346 | img { |
179 | width: 40px; | 347 | width: 40px; |
180 | height: 40px; | 348 | height: 40px; |
@@ -184,38 +352,45 @@ | @@ -184,38 +352,45 @@ | ||
184 | } | 352 | } |
185 | } | 353 | } |
186 | } | 354 | } |
355 | + | ||
187 | .logo { | 356 | .logo { |
188 | //width:230px; | 357 | //width:230px; |
189 | - height:60px; | 358 | + height: 60px; |
190 | font-size: 22px; | 359 | font-size: 22px; |
191 | - padding-left:20px; | ||
192 | - padding-right:20px; | ||
193 | - border-color: rgba(238,241,146,0.3); | 360 | + padding-left: 20px; |
361 | + padding-right: 20px; | ||
362 | + border-color: rgba(238, 241, 146, 0.3); | ||
194 | border-right-width: 1px; | 363 | border-right-width: 1px; |
195 | border-right-style: solid; | 364 | border-right-style: solid; |
365 | + | ||
196 | img { | 366 | img { |
197 | width: 40px; | 367 | width: 40px; |
198 | float: left; | 368 | float: left; |
199 | margin: 10px 10px 10px 18px; | 369 | margin: 10px 10px 10px 18px; |
200 | } | 370 | } |
371 | + | ||
201 | .txt { | 372 | .txt { |
202 | - color:#fff; | 373 | + color: #fff; |
203 | } | 374 | } |
204 | } | 375 | } |
205 | - .logo-width{ | ||
206 | - width:230px; | 376 | + |
377 | + .logo-width { | ||
378 | + width: 230px; | ||
207 | } | 379 | } |
208 | - .logo-collapse-width{ | ||
209 | - width:60px | 380 | + |
381 | + .logo-collapse-width { | ||
382 | + width: 60px | ||
210 | } | 383 | } |
211 | - .tools{ | 384 | + |
385 | + .tools { | ||
212 | padding: 0px 23px; | 386 | padding: 0px 23px; |
213 | - width:14px; | 387 | + width: 14px; |
214 | height: 60px; | 388 | height: 60px; |
215 | line-height: 60px; | 389 | line-height: 60px; |
216 | cursor: pointer; | 390 | cursor: pointer; |
217 | } | 391 | } |
218 | } | 392 | } |
393 | + | ||
219 | .main { | 394 | .main { |
220 | display: flex; | 395 | display: flex; |
221 | // background: #324057; | 396 | // background: #324057; |
@@ -223,63 +398,79 @@ | @@ -223,63 +398,79 @@ | ||
223 | top: 60px; | 398 | top: 60px; |
224 | bottom: 0px; | 399 | bottom: 0px; |
225 | overflow: hidden; | 400 | overflow: hidden; |
401 | + | ||
226 | aside { | 402 | aside { |
227 | - flex:0 0 230px; | 403 | + flex: 0 0 230px; |
228 | width: 230px; | 404 | width: 230px; |
229 | // position: absolute; | 405 | // position: absolute; |
230 | // top: 0px; | 406 | // top: 0px; |
231 | // bottom: 0px; | 407 | // bottom: 0px; |
232 | - .el-menu{ | ||
233 | - height: 100%; | ||
234 | - } | ||
235 | - .collapsed{ | ||
236 | - width:60px; | ||
237 | - .item{ | 408 | + .collapsed { |
409 | + width: 60px; | ||
410 | + | ||
411 | + .item { | ||
238 | position: relative; | 412 | position: relative; |
239 | } | 413 | } |
240 | - .submenu{ | ||
241 | - position:absolute; | ||
242 | - top:0px; | ||
243 | - left:60px; | ||
244 | - z-index:99999; | ||
245 | - height:auto; | ||
246 | - display:none; | 414 | + |
415 | + .submenu { | ||
416 | + position: absolute; | ||
417 | + top: 0px; | ||
418 | + left: 60px; | ||
419 | + z-index: 99999; | ||
420 | + height: auto; | ||
421 | + display: none; | ||
247 | } | 422 | } |
248 | 423 | ||
249 | } | 424 | } |
250 | } | 425 | } |
251 | - .menu-collapsed{ | ||
252 | - flex:0 0 60px; | 426 | + |
427 | + .menu-collapsed { | ||
428 | + flex: 0 0 60px; | ||
253 | width: 60px; | 429 | width: 60px; |
254 | } | 430 | } |
255 | - .menu-expanded{ | ||
256 | - flex:0 0 230px; | 431 | + |
432 | + .menu-expanded { | ||
433 | + flex: 0 0 230px; | ||
257 | width: 230px; | 434 | width: 230px; |
258 | } | 435 | } |
259 | - .menu-expanded ul{ | 436 | + |
437 | + .menu-expanded ul { | ||
260 | width: 230px; | 438 | width: 230px; |
261 | } | 439 | } |
440 | + | ||
262 | .content-container { | 441 | .content-container { |
263 | // background: #f1f2f7; | 442 | // background: #f1f2f7; |
264 | - flex:1; | 443 | + flex: 1; |
265 | // position: absolute; | 444 | // position: absolute; |
266 | // right: 0px; | 445 | // right: 0px; |
267 | // top: 0px; | 446 | // top: 0px; |
268 | // bottom: 0px; | 447 | // bottom: 0px; |
269 | // left: 230px; | 448 | // left: 230px; |
270 | overflow-y: scroll; | 449 | overflow-y: scroll; |
271 | - padding: 20px; | 450 | + padding: 10px; |
451 | + background-color: #dfe6e9; | ||
272 | .breadcrumb-container { | 452 | .breadcrumb-container { |
273 | //margin-bottom: 15px; | 453 | //margin-bottom: 15px; |
454 | + background: #bfcbd9; | ||
274 | .title { | 455 | .title { |
275 | width: 200px; | 456 | width: 200px; |
276 | float: left; | 457 | float: left; |
277 | color: #475669; | 458 | color: #475669; |
459 | + margin-left: 20px; | ||
460 | + margin-top: 8px; | ||
461 | + font-size: 16px; | ||
278 | } | 462 | } |
463 | + | ||
279 | .breadcrumb-inner { | 464 | .breadcrumb-inner { |
280 | float: right; | 465 | float: right; |
466 | + margin-right: 20px; | ||
467 | + } | ||
468 | + | ||
469 | + .el-breadcrumb { | ||
470 | + line-height: 36px; | ||
281 | } | 471 | } |
282 | } | 472 | } |
473 | + | ||
283 | .content-wrapper { | 474 | .content-wrapper { |
284 | background-color: #fff; | 475 | background-color: #fff; |
285 | box-sizing: border-box; | 476 | box-sizing: border-box; |
@@ -287,4 +478,50 @@ | @@ -287,4 +478,50 @@ | ||
287 | } | 478 | } |
288 | } | 479 | } |
289 | } | 480 | } |
290 | -</style> | ||
481 | +</style> | ||
482 | +<style lang="scss"> | ||
483 | + .darkmenu { | ||
484 | + .main { | ||
485 | + aside { | ||
486 | + .el-menu { | ||
487 | + height: 100%; | ||
488 | + background: #606060; | ||
489 | + | ||
490 | + .el-menu-item { | ||
491 | + i { | ||
492 | + color: white; | ||
493 | + } | ||
494 | + | ||
495 | + color: white; | ||
496 | + } | ||
497 | + | ||
498 | + .el-menu-item.is-active { | ||
499 | + color: #e6a23c; | ||
500 | + } | ||
501 | + | ||
502 | + .el-menu-item:hover, .el-menu-item:focus { | ||
503 | + background-color: #1a4496; | ||
504 | + } | ||
505 | + | ||
506 | + .el-submenu { | ||
507 | + ul.el-menu.el-menu--inline { | ||
508 | + background: #303030; | ||
509 | + } | ||
510 | + | ||
511 | + .el-submenu__title { | ||
512 | + color: white; | ||
513 | + | ||
514 | + i { | ||
515 | + color: white; | ||
516 | + } | ||
517 | + } | ||
518 | + | ||
519 | + .el-submenu__title:hover { | ||
520 | + background-color: #1a4496; | ||
521 | + } | ||
522 | + } | ||
523 | + } | ||
524 | + } | ||
525 | + } | ||
526 | + } | ||
527 | +</style> |
@@ -15,26 +15,28 @@ | @@ -15,26 +15,28 @@ | ||
15 | </el-form> | 15 | </el-form> |
16 | </el-col> | 16 | </el-col> |
17 | <!--列表--> | 17 | <!--列表--> |
18 | - <el-table :data="logs" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
19 | - <el-table-column type="index" width="60"> | 18 | + <el-table :data="logs" highlight-current-row border v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> |
19 | + <el-table-column type="index" width="60" align="center"> | ||
20 | </el-table-column> | 20 | </el-table-column> |
21 | - <el-table-column prop="logid" label="ID" width="80" sortable> | 21 | + <el-table-column prop="logid" label="ID" width="80" sortable align="center"> |
22 | </el-table-column> | 22 | </el-table-column> |
23 | - <el-table-column prop="username" label="操作账号" width="120" sortable> | 23 | + <el-table-column prop="username" label="操作账号" width="120" sortable align="center"> |
24 | </el-table-column> | 24 | </el-table-column> |
25 | - <el-table-column prop="ip" label="IP" width="100" sortable> | 25 | + <el-table-column prop="ip" label="IP" width="110" sortable align="center"> |
26 | </el-table-column> | 26 | </el-table-column> |
27 | - <el-table-column prop="logcreattime" label="操作时间" width="200" sortable> | 27 | + <el-table-column prop="logcreattime" label="操作时间" width="200" sortable align="center"> |
28 | </el-table-column> | 28 | </el-table-column> |
29 | - <el-table-column prop="methodname" label="系统动作" width="120" sortable> | 29 | + <el-table-column prop="methodname" label="系统动作" width="120" sortable align="center"> |
30 | </el-table-column> | 30 | </el-table-column> |
31 | - <el-table-column prop="operatenamecn" label="动作描述" width="120" sortable> | 31 | + <el-table-column prop="operatenamecn" label="动作描述" width="120" sortable align="center"> |
32 | </el-table-column> | 32 | </el-table-column> |
33 | - <el-table-column prop="modelnamecn" label="操作模块" width="120" sortable> | 33 | + <el-table-column prop="modelnamecn" label="操作模块" width="120" sortable align="center"> |
34 | </el-table-column> | 34 | </el-table-column> |
35 | - <el-table-column prop="classname" label="系统类" show-overflow-tooltip="true" width="100" sortable> | 35 | + <el-table-column prop="classname" label="系统类" show-overflow-tooltip width="100" sortable align="center"> |
36 | </el-table-column> | 36 | </el-table-column> |
37 | - <el-table-column prop="result" label="操作结果" min-width="200" sortable> | 37 | + <el-table-column prop="parameters" label="参数" show-overflow-tooltip width="100" sortable align="center"> |
38 | + </el-table-column> | ||
39 | + <el-table-column prop="result" label="操作结果" min-width="200" sortable align="center"> | ||
38 | </el-table-column> | 40 | </el-table-column> |
39 | </el-table> | 41 | </el-table> |
40 | 42 | ||
@@ -122,4 +124,4 @@ | @@ -122,4 +124,4 @@ | ||
122 | 124 | ||
123 | <style scoped> | 125 | <style scoped> |
124 | 126 | ||
125 | -</style> | ||
127 | +</style> |
@@ -16,32 +16,36 @@ | @@ -16,32 +16,36 @@ | ||
16 | </el-col> | 16 | </el-col> |
17 | 17 | ||
18 | <!--列表--> | 18 | <!--列表--> |
19 | - <el-table :data="tableList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
20 | - <el-table-column type="selection" width="55"> | 19 | + <el-table :data="tableList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;" |
20 | + row-key="permissionId" | ||
21 | + border | ||
22 | + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" | ||
23 | + > | ||
24 | + <el-table-column type="selection" width="55" align="center"> | ||
21 | </el-table-column> | 25 | </el-table-column> |
22 | - <el-table-column type="index" width="60"> | 26 | + <!--<el-table-column type="index" width="60">--> |
27 | + <!--</el-table-column>--> | ||
28 | + <el-table-column prop="permissionId" label="ID" width="130" align="center" sortable> | ||
23 | </el-table-column> | 29 | </el-table-column> |
24 | - <el-table-column prop="permissionId" label="ID" width="100" sortable> | 30 | + <el-table-column prop="name" label="权限名称" min-width="150" align="center" sortable> |
25 | </el-table-column> | 31 | </el-table-column> |
26 | - <el-table-column prop="name" label="权限名称" min-width="200" sortable> | 32 | + <el-table-column prop="description" label="描述" min-width="120" align="center" sortable> |
27 | </el-table-column> | 33 | </el-table-column> |
28 | - <el-table-column prop="description" label="描述" min-width="200" sortable> | 34 | + <el-table-column prop="ismenu" label="是否目录" width="120" :formatter="formatState" align="center" sortable> |
29 | </el-table-column> | 35 | </el-table-column> |
30 | - <el-table-column prop="permissionOrder" label="排序" width="100" sortable> | 36 | + <el-table-column prop="url" label="访问路径" width="250" align="center" sortable> |
31 | </el-table-column> | 37 | </el-table-column> |
32 | - <el-table-column prop="url" label="路径" width="100" sortable> | ||
33 | - </el-table-column> | ||
34 | - <el-table-column label="操作" min-width="150"> | 38 | + <el-table-column label="操作" min-width="150" align="center"> |
35 | <template slot-scope="scope"> | 39 | <template slot-scope="scope"> |
36 | - <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
37 | - <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | 40 | + <el-button size="small" type="success" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> |
41 | + <el-button type="danger" icon="el-icon-delete" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
38 | </template> | 42 | </template> |
39 | </el-table-column> | 43 | </el-table-column> |
40 | </el-table> | 44 | </el-table> |
41 | 45 | ||
42 | <!--工具条--> | 46 | <!--工具条--> |
43 | <el-col :span="24" class="toolbar"> | 47 | <el-col :span="24" class="toolbar"> |
44 | - <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 48 | + <el-button type="danger" icon="el-icon-delete" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
45 | <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="float:right;"> | 49 | <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="float:right;"> |
46 | </el-pagination> | 50 | </el-pagination> |
47 | </el-col> | 51 | </el-col> |
@@ -143,7 +147,7 @@ | @@ -143,7 +147,7 @@ | ||
143 | tableList: [], | 147 | tableList: [], |
144 | total: 0, | 148 | total: 0, |
145 | pageNum: 1, | 149 | pageNum: 1, |
146 | - pageSize: 10, | 150 | + pageSize: 10000, |
147 | listLoading: false, | 151 | listLoading: false, |
148 | sels: [],//列表选中列 | 152 | sels: [],//列表选中列 |
149 | //编辑界面是否显示 | 153 | //编辑界面是否显示 |
@@ -208,7 +212,7 @@ | @@ -208,7 +212,7 @@ | ||
208 | return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知'; | 212 | return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知'; |
209 | }, | 213 | }, |
210 | formatState: function (row, column) { | 214 | formatState: function (row, column) { |
211 | - return row.state == true ? '是' : row.state == false ? '否' : '未知'; | 215 | + return row.ismenu == true ? '是' : row.ismenu == false ? '否' : '未知'; |
212 | }, | 216 | }, |
213 | handleCurrentChange(val) { | 217 | handleCurrentChange(val) { |
214 | this.pageNum = val; | 218 | this.pageNum = val; |
@@ -373,4 +377,4 @@ | @@ -373,4 +377,4 @@ | ||
373 | 377 | ||
374 | <style scoped> | 378 | <style scoped> |
375 | 379 | ||
376 | -</style> | ||
380 | +</style> |
@@ -10,34 +10,46 @@ | @@ -10,34 +10,46 @@ | ||
10 | <el-button type="primary" v-on:click="getRoles()">查询</el-button> | 10 | <el-button type="primary" v-on:click="getRoles()">查询</el-button> |
11 | </el-form-item> | 11 | </el-form-item> |
12 | <el-form-item> | 12 | <el-form-item> |
13 | - <el-button type="primary" @click="handleAdd">新增</el-button> | 13 | + <el-button type="success" @click="handleAdd">新增</el-button> |
14 | </el-form-item> | 14 | </el-form-item> |
15 | </el-form> | 15 | </el-form> |
16 | </el-col> | 16 | </el-col> |
17 | 17 | ||
18 | <!--列表--> | 18 | <!--列表--> |
19 | - <el-table :data="roles" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
20 | - <el-table-column type="selection" width="55"> | 19 | + <el-table :data="roles" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;" |
20 | + default-expand-all | ||
21 | + row-key="roleId" | ||
22 | + border | ||
23 | + :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> | ||
24 | + <el-table-column type="selection" width="60" align="center"> | ||
21 | </el-table-column> | 25 | </el-table-column> |
22 | - <el-table-column type="index" width="60"> | 26 | + <!--<el-table-column type="index" width="60">--> |
27 | + <!--</el-table-column>--> | ||
28 | + <el-table-column prop="roleId" label="ID" width="110" align="center"> | ||
23 | </el-table-column> | 29 | </el-table-column> |
24 | - <el-table-column prop="roleId" label="ID" width="100" sortable> | 30 | + <el-table-column prop="roleName" label="岗位/角色名称" width="180" sortable align="center"> |
25 | </el-table-column> | 31 | </el-table-column> |
26 | - <el-table-column prop="roleName" label="岗位/角色名称" min-width="200" sortable> | 32 | + <!--<el-table-column prop="departmentName" label="部门名称" min-width="200" sortable>--> |
33 | + <!--</el-table-column>--> | ||
34 | + <el-table-column prop="description" label="描述" min-width="100" align="center" > | ||
27 | </el-table-column> | 35 | </el-table-column> |
28 | - <el-table-column prop="departmentName" label="部门名称" min-width="200" sortable> | 36 | + <el-table-column prop="type" label="类型" min-width="100" sortable align="center"> |
29 | </el-table-column> | 37 | </el-table-column> |
30 | - <el-table-column prop="description" label="岗位/角色描述" min-width="200" sortable> | ||
31 | - </el-table-column> | ||
32 | - <el-table-column label="操作" min-width="260"> | 38 | +<!-- <el-table-column prop="businessLicense" label="工商代码" min-width="180" align="center">--> |
39 | +<!-- </el-table-column>--> | ||
40 | +<!-- <el-table-column prop="customsRegCode" label="海关备案代码" min-width="150" align="center" >--> | ||
41 | +<!-- </el-table-column>--> | ||
42 | +<!-- <el-table-column prop="mqcode" label="海关通道编号" min-width="150" align="center">--> | ||
43 | +<!-- </el-table-column>--> | ||
44 | + <el-table-column label="操作" width="230px" fixed="right" align="center"> | ||
33 | <template slot-scope="scope"> | 45 | <template slot-scope="scope"> |
34 | - <el-button size="small" @click="setPerm(scope.$index, scope.row)">设置权限</el-button> | ||
35 | - <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
36 | - <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | 46 | + <el-button type="success" size="small" @click="handleAdd(scope.$index, scope.row)" style="width:97px;margin-left: 1px;">新增下级</el-button> |
47 | + <el-button type="warning" size="small" @click="setPerm(scope.$index, scope.row)" style="width:97px;margin-left: 1px;">设置权限</el-button> | ||
48 | + <el-button type="primary" style="width:97px;margin-left: 1px;margin-top: 3px;" size="small" @click="handleEdit(scope.$index, scope.row)" >编辑</el-button> | ||
49 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)" style="width:97px;margin-left: 1px;">删除</el-button> | ||
37 | </template> | 50 | </template> |
38 | </el-table-column> | 51 | </el-table-column> |
39 | </el-table> | 52 | </el-table> |
40 | - | ||
41 | <!--工具条--> | 53 | <!--工具条--> |
42 | <el-col :span="24" class="toolbar"> | 54 | <el-col :span="24" class="toolbar"> |
43 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 55 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
@@ -45,67 +57,57 @@ | @@ -45,67 +57,57 @@ | ||
45 | </el-pagination> | 57 | </el-pagination> |
46 | </el-col> | 58 | </el-col> |
47 | 59 | ||
48 | - <!--编辑界面--> | ||
49 | - <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
50 | - <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
51 | - <el-form-item label="ID"> | ||
52 | - <span>{{editForm.roleId}}</span> | ||
53 | - </el-form-item> | ||
54 | - <el-form-item label="岗位名称"> | ||
55 | - <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input> | ||
56 | - </el-form-item> | ||
57 | - <el-form-item label="岗位描述"> | ||
58 | - <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | ||
59 | - </el-form-item> | ||
60 | - <el-form-item label="部门名称"> | ||
61 | - <el-select v-model="editForm.departmentId" placeholder="请选择"> | ||
62 | - <el-option | ||
63 | - v-for="item in departmentNameList" | ||
64 | - :key="item.departmentId" | ||
65 | - :label="item.departmentName" | ||
66 | - :value="item.departmentId"> | ||
67 | - </el-option> | ||
68 | - </el-select> | ||
69 | - </el-form-item> | ||
70 | - </el-form> | ||
71 | - <div slot="footer" class="dialog-footer"> | ||
72 | - <el-button @click.native="editFormVisible = false">取消</el-button> | ||
73 | - <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
74 | - </div> | ||
75 | - </el-dialog> | ||
76 | - | ||
77 | <!--新增界面--> | 60 | <!--新增界面--> |
78 | - <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
79 | - <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
80 | - <el-form-item label="岗位/角色名称" prop="roleName"> | ||
81 | - <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input> | 61 | + <el-dialog :title="dialogMap[dialogStatus]" :visible.sync="addFormVisible" :close-on-click-modal="false"> |
62 | + <el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm"> | ||
63 | + <el-form-item label="上级组织机构"> | ||
64 | + <span>{{addForm.parentName}}</span> | ||
65 | + </el-form-item> | ||
66 | + <el-form-item label="组织机构名称" prop="roleName"> | ||
67 | + <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入组织机构名称:例如:公司名称"></el-input> | ||
82 | </el-form-item> | 68 | </el-form-item> |
83 | - <el-form-item label="岗位/角色描述" prop="description"> | ||
84 | - <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | 69 | + <el-form-item label="组织机构描述" prop="description"> |
70 | + <el-input v-model="addForm.description" auto-complete="off" placeholder="组织机构描述:例如:组织机构简介"></el-input> | ||
85 | </el-form-item> | 71 | </el-form-item> |
86 | - <el-form-item label="部门名称" prop="roleSign"> | ||
87 | - <el-select v-model="addForm.departmentId" placeholder="请选择"> | 72 | + <el-form-item label="组织机构类型" prop="type"> |
73 | + <el-select | ||
74 | + v-model="addForm.type" | ||
75 | + filterable | ||
76 | + allow-create | ||
77 | + default-first-option | ||
78 | + placeholder="请选择类型"> | ||
88 | <el-option | 79 | <el-option |
89 | - v-for="item in departmentNameList" | ||
90 | - :key="item.departmentId" | ||
91 | - :label="item.departmentName" | ||
92 | - :value="item.departmentId"> | 80 | + v-for="item in companyOption" |
81 | + :key="item.value" | ||
82 | + :label="item.label" | ||
83 | + :value="item.value"> | ||
93 | </el-option> | 84 | </el-option> |
94 | </el-select> | 85 | </el-select> |
95 | </el-form-item> | 86 | </el-form-item> |
87 | +<!-- <el-form-item label="工商企业代码" prop="businessLicense">--> | ||
88 | +<!-- <el-input v-model="addForm.businessLicense" auto-complete="off" placeholder="社会信用代码或者组织机构代码"></el-input>--> | ||
89 | +<!-- </el-form-item>--> | ||
90 | +<!-- <el-form-item label="海关备案代码" prop="customsRegCode">--> | ||
91 | +<!-- <el-input v-model="addForm.customsRegCode" auto-complete="off" placeholder="海关备案后返回的备案代码"></el-input>--> | ||
92 | +<!-- </el-form-item>--> | ||
93 | +<!-- <el-form-item label="海关通道编号" prop="mqcode">--> | ||
94 | +<!-- <el-input v-model="addForm.mqcode" auto-complete="off" placeholder="海关通道编号"></el-input>--> | ||
95 | +<!-- </el-form-item>--> | ||
96 | </el-form> | 96 | </el-form> |
97 | <div slot="footer" class="dialog-footer"> | 97 | <div slot="footer" class="dialog-footer"> |
98 | <el-button @click.native="addFormVisible = false">取消</el-button> | 98 | <el-button @click.native="addFormVisible = false">取消</el-button> |
99 | - <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | 99 | + <el-button type="primary" @click="dialogStatus==='create'?addSubmit():editSubmit()" :loading="addLoading" >提交</el-button> |
100 | </div> | 100 | </div> |
101 | </el-dialog> | 101 | </el-dialog> |
102 | 102 | ||
103 | <!--权限设置界面--> | 103 | <!--权限设置界面--> |
104 | <el-dialog title="岗位的权限设置" :visible.sync="PermFormVisible" :close-on-click-modal="false"> | 104 | <el-dialog title="岗位的权限设置" :visible.sync="PermFormVisible" :close-on-click-modal="false"> |
105 | <el-form :model="permForm" label-width="80px" ref="permForm"> | 105 | <el-form :model="permForm" label-width="80px" ref="permForm"> |
106 | - <el-checkbox-group v-model="permIds" size="small"> | ||
107 | - <el-checkbox v-for="perm in permissons" :label="perm.permissionId" :key="perm.permissionId">{{perm.name}}</el-checkbox> | ||
108 | - </el-checkbox-group> | 106 | + <el-tree :data="permissons" :props="treeDefaultProps" |
107 | + @check="clickDeal" | ||
108 | + show-checkbox highlight-current default-expand-all check-on-click-node check-strictly | ||
109 | + node-key="permissionId" ref="tree"> | ||
110 | + </el-tree> | ||
109 | </el-form> | 111 | </el-form> |
110 | <div slot="footer" class="dialog-footer"> | 112 | <div slot="footer" class="dialog-footer"> |
111 | <el-button @click.native="PermFormVisible = false">取消</el-button> | 113 | <el-button @click.native="PermFormVisible = false">取消</el-button> |
@@ -128,6 +130,20 @@ | @@ -128,6 +130,20 @@ | ||
128 | filters: { | 130 | filters: { |
129 | roleName: '' | 131 | roleName: '' |
130 | }, | 132 | }, |
133 | + companyOption: [ | ||
134 | + { | ||
135 | + label: "集团", | ||
136 | + value: "集团" | ||
137 | + }, | ||
138 | + { | ||
139 | + label: "公司", | ||
140 | + value: "公司" | ||
141 | + } | ||
142 | + ], | ||
143 | + treeDefaultProps: { | ||
144 | + children: 'children', | ||
145 | + label: 'name', | ||
146 | + }, | ||
131 | departmentNameList:[], | 147 | departmentNameList:[], |
132 | roles: [], | 148 | roles: [], |
133 | permissons: [], | 149 | permissons: [], |
@@ -137,23 +153,11 @@ | @@ -137,23 +153,11 @@ | ||
137 | pageSize: 5, | 153 | pageSize: 5, |
138 | listLoading: false, | 154 | listLoading: false, |
139 | sels: [],//列表选中列 | 155 | sels: [],//列表选中列 |
140 | - //编辑界面是否显示 | ||
141 | - editFormVisible: false, | ||
142 | - editLoading: false, | ||
143 | - editFormRules: { | ||
144 | - roleName: [ | ||
145 | - { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
146 | - ] | 156 | + dialogMap: { |
157 | + update: '编辑', | ||
158 | + create: '新增', | ||
147 | }, | 159 | }, |
148 | - //编辑界面数据 | ||
149 | - editForm: { | ||
150 | - roleId: 1, | ||
151 | - description: '', | ||
152 | - roleName: '', | ||
153 | - roleSign: 1, | ||
154 | - departmentId:'' | ||
155 | - }, | ||
156 | - | 160 | + dialogStatus: 'create', |
157 | //新增界面是否显示 | 161 | //新增界面是否显示 |
158 | addFormVisible: false, | 162 | addFormVisible: false, |
159 | //设置权限界面是否显示 | 163 | //设置权限界面是否显示 |
@@ -172,7 +176,13 @@ | @@ -172,7 +176,13 @@ | ||
172 | description: '', | 176 | description: '', |
173 | roleName: '', | 177 | roleName: '', |
174 | roleSign: 1, | 178 | roleSign: 1, |
175 | - departmentId:'' | 179 | + departmentId:'', |
180 | + type: '', | ||
181 | + businessLicense: '', | ||
182 | + customsRegCode: '', | ||
183 | + parentName: '', | ||
184 | + mqcode: '' | ||
185 | + | ||
176 | }, | 186 | }, |
177 | permForm: { | 187 | permForm: { |
178 | roleId: 1, | 188 | roleId: 1, |
@@ -225,7 +235,6 @@ | @@ -225,7 +235,6 @@ | ||
225 | 235 | ||
226 | }, | 236 | }, |
227 | 237 | ||
228 | - | ||
229 | //获取部门列表 | 238 | //获取部门列表 |
230 | getdepartmentNames() { | 239 | getdepartmentNames() { |
231 | 240 | ||
@@ -265,7 +274,11 @@ | @@ -265,7 +274,11 @@ | ||
265 | if(null!= error.response && error.response!==undefined){ | 274 | if(null!= error.response && error.response!==undefined){ |
266 | let status= error.response.status; | 275 | let status= error.response.status; |
267 | let msg = error.response.statusText; | 276 | let msg = error.response.statusText; |
268 | - alert(status+msg); | 277 | + message({ |
278 | + // 饿了么的消息弹窗组件 | ||
279 | + message: status+msg, | ||
280 | + type: "error" | ||
281 | + }); | ||
269 | }else { | 282 | }else { |
270 | alert(error); | 283 | alert(error); |
271 | } | 284 | } |
@@ -300,14 +313,16 @@ | @@ -300,14 +313,16 @@ | ||
300 | * @param row 为这行的数据对象 | 313 | * @param row 为这行的数据对象 |
301 | */ | 314 | */ |
302 | handleEdit: function (index, row) { | 315 | handleEdit: function (index, row) { |
303 | - this.editFormVisible = true; | ||
304 | - this.editForm = Object.assign({}, row); | ||
305 | - this.getdepartmentNames(); | 316 | + this.addFormVisible = true; |
317 | + this.dialogStatus= 'update', | ||
318 | + this.addForm = Object.assign({}, row); | ||
319 | + // this.getdepartmentNames(); | ||
306 | }, | 320 | }, |
307 | setPerm: function (index, row) { | 321 | setPerm: function (index, row) { |
322 | + this.PermFormVisible = true; | ||
323 | + this.getPermList(); | ||
308 | var _this = this; | 324 | var _this = this; |
309 | this.permIds = []; | 325 | this.permIds = []; |
310 | - this.PermFormVisible = true; | ||
311 | this.permForm = Object.assign({}, row); | 326 | this.permForm = Object.assign({}, row); |
312 | let rolePerms = this.permForm.permissions; | 327 | let rolePerms = this.permForm.permissions; |
313 | if (util.checkNull(rolePerms)){ | 328 | if (util.checkNull(rolePerms)){ |
@@ -317,31 +332,47 @@ | @@ -317,31 +332,47 @@ | ||
317 | } | 332 | } |
318 | }); | 333 | }); |
319 | } | 334 | } |
320 | - this.getPermList(); | 335 | + |
336 | + this.$nextTick(() => { | ||
337 | + | ||
338 | + //反向适配 | ||
339 | + this.$refs.tree.setCheckedKeys(this.permIds); | ||
340 | + }); | ||
321 | }, | 341 | }, |
322 | //显示新增界面,每次点开初始化数据 | 342 | //显示新增界面,每次点开初始化数据 |
323 | - handleAdd: function () { | 343 | + handleAdd: function (index,row) { |
324 | this.addFormVisible = true; | 344 | this.addFormVisible = true; |
345 | + this.dialogStatus= 'create'; | ||
325 | this.addForm = { | 346 | this.addForm = { |
326 | - username: '', | ||
327 | - password: '', | ||
328 | - sex: 1, | ||
329 | - address: '', | ||
330 | - realname: '', | ||
331 | - email: '', | ||
332 | - mobilephone: '', | ||
333 | - age: 1 | ||
334 | - }; | ||
335 | - this.getdepartmentNames(); | 347 | + description: '', |
348 | + roleName: '', | ||
349 | + roleSign: 1, | ||
350 | + departmentId:'', | ||
351 | + type: '', | ||
352 | + businessLicense: '', | ||
353 | + customsRegCode: '', | ||
354 | + mqcode: '', | ||
355 | + parentid: 0 | ||
356 | + | ||
357 | + }; | ||
358 | + //如果新增下级 | ||
359 | + if(util.checkNull(row)){ | ||
360 | + //传递上级ID | ||
361 | + let parentRole = Object.assign({}, row); | ||
362 | + this.addForm.parentid = parentRole.roleId; | ||
363 | + this.addForm.parentName = parentRole.roleName; | ||
364 | + } | ||
365 | + | ||
366 | +// this.getdepartmentNames(); | ||
336 | }, | 367 | }, |
337 | //编辑 | 368 | //编辑 |
338 | editSubmit: function () { | 369 | editSubmit: function () { |
339 | - this.$refs.editForm.validate((valid) => { | 370 | + this.$refs.addForm.validate((valid) => { |
340 | if (valid) { | 371 | if (valid) { |
341 | this.$confirm('确认提交吗?', '提示', {}).then(() => { | 372 | this.$confirm('确认提交吗?', '提示', {}).then(() => { |
342 | - this.editLoading = true; | 373 | + this.addLoading = true; |
343 | //NProgress.start(); | 374 | //NProgress.start(); |
344 | - let para = Object.assign({}, this.editForm); | 375 | + let para = Object.assign({}, this.addForm); |
345 | //不需要提交的 去掉,后端不好接收 | 376 | //不需要提交的 去掉,后端不好接收 |
346 | para.authorities = null; | 377 | para.authorities = null; |
347 | para.permissions = null; | 378 | para.permissions = null; |
@@ -354,8 +385,8 @@ | @@ -354,8 +385,8 @@ | ||
354 | 式; | 385 | 式; |
355 | */ | 386 | */ |
356 | /*moment 安装 npm install moment --save*/ | 387 | /*moment 安装 npm install moment --save*/ |
357 | - para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); | ||
358 | - this.editLoading = false; | 388 | + // para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); |
389 | + this.addLoading = false; | ||
359 | edit(para).then((res) => { | 390 | edit(para).then((res) => { |
360 | 391 | ||
361 | //NProgress.done(); | 392 | //NProgress.done(); |
@@ -363,8 +394,8 @@ | @@ -363,8 +394,8 @@ | ||
363 | message: '提交成功', | 394 | message: '提交成功', |
364 | type: 'success' | 395 | type: 'success' |
365 | }); | 396 | }); |
366 | - this.$refs['editForm'].resetFields(); | ||
367 | - this.editFormVisible = false; | 397 | + this.$refs['addForm'].resetFields(); |
398 | + this.addFormVisible = false; | ||
368 | this.getRoles(); | 399 | this.getRoles(); |
369 | }).catch(error => alert(error)); | 400 | }).catch(error => alert(error)); |
370 | }); | 401 | }); |
@@ -403,7 +434,7 @@ | @@ -403,7 +434,7 @@ | ||
403 | //NProgress.start(); | 434 | //NProgress.start(); |
404 | let role = Object.assign({}, this.permForm); | 435 | let role = Object.assign({}, this.permForm); |
405 | let roleId = role.roleId; | 436 | let roleId = role.roleId; |
406 | - let permissionIds = this.permIds | 437 | + let permissionIds = this.$refs.tree.getCheckedKeys(); |
407 | let para = {roleId,permissionIds}; | 438 | let para = {roleId,permissionIds}; |
408 | updateRolePerm(para).then((res) => { | 439 | updateRolePerm(para).then((res) => { |
409 | this.addLoading = false; | 440 | this.addLoading = false; |
@@ -446,6 +477,81 @@ | @@ -446,6 +477,81 @@ | ||
446 | }).catch(() => { | 477 | }).catch(() => { |
447 | 478 | ||
448 | }); | 479 | }); |
480 | + }, | ||
481 | + treeHandleCheckChange: function (data, checked, indeterminate) { | ||
482 | + if(checked) { | ||
483 | + this.permIds.push(data.permissionId); | ||
484 | + }else { | ||
485 | + this.permIds.splice(this.permIds.contains(data.permissionId),1); | ||
486 | + } | ||
487 | + console.log(data, checked, indeterminate); | ||
488 | + | ||
489 | + }, | ||
490 | + uniteParentSame(id,treeStatus){//当子节点全为未选中时父节点也变为未选中状态 | ||
491 | + let node = this.$refs.tree.getNode(permissionId);//获取当前节点的节点树 | ||
492 | + if (node.parent !== null && node.parent !== undefined) { | ||
493 | + let parentNode = node.parent.data;//获取当前节点的父节点树 | ||
494 | + if (parentNode != undefined){//判断父节点是否存在 | ||
495 | + for (let i = 0; i < parentNode.children.length; i++) { | ||
496 | + let checkedKeys = this.$refs.tree.getCheckedKeys(); | ||
497 | + let hafCheckedKeys = this.$refs.tree.getHalfCheckedKeys(); | ||
498 | + let selectNodes = checkedKeys.concat(hafCheckedKeys);//获取已选择树节点 | ||
499 | + let selected = selectNodes.indexOf(parentNode.children[i].permissionId); // -1当前节点的同级节点是否全部未选中 | ||
500 | + if (selected !== -1){ | ||
501 | + return; | ||
502 | + } | ||
503 | + } | ||
504 | + }else { | ||
505 | + return; | ||
506 | + } | ||
507 | + this.$refs.tree.setChecked(parentNode.permissionId, false);//修改节点为未选择 | ||
508 | + if(node.level>2){//判断是否是最上级节点 | ||
509 | + this.uniteParentSame(parentNode.permissionId,treeStatus) | ||
510 | + } | ||
511 | + }else { | ||
512 | + return; | ||
513 | + } | ||
514 | + }, | ||
515 | + | ||
516 | + // 统一处理子节点为相同的勾选状态 | ||
517 | + uniteChildSame(treeList, isSelected){ | ||
518 | + this.$refs.tree.setChecked(treeList.permissionId, isSelected); | ||
519 | + if (treeList.children !== undefined){ | ||
520 | + for (let i = 0; i < treeList.children.length; i++) { | ||
521 | + this.uniteChildSame(treeList.children[i], isSelected) | ||
522 | + } | ||
523 | + } | ||
524 | + }, | ||
525 | + // 统一处理父节点为选中 | ||
526 | + selectedParent(currentObj){ | ||
527 | + let currentNode = this.$refs.tree.getNode(currentObj); | ||
528 | + if (currentNode.parent.key !== undefined) { | ||
529 | + this.$refs.tree.setChecked(currentNode.parent, true); | ||
530 | + this.selectedParent(currentNode.parent) | ||
531 | + } | ||
532 | + }, | ||
533 | + clickDeal: function (currentObj, treeStatus){ | ||
534 | + // 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。 | ||
535 | + let selected = treeStatus.checkedKeys.indexOf(currentObj.permissionId); // -1未选中 | ||
536 | + // 选中 | ||
537 | + if (selected !== -1) { | ||
538 | + // 子节点只要被选中父节点就被选中 | ||
539 | + this.selectedParent(currentObj); | ||
540 | + // 统一处理子节点为相同的勾选状态 | ||
541 | + this.uniteChildSame(currentObj, true) | ||
542 | + } else { | ||
543 | + // 未选中 处理子节点全部未选中 | ||
544 | + if (currentObj.children !== undefined){ | ||
545 | + if (currentObj.children.length !== 0) { | ||
546 | + this.uniteChildSame(currentObj, false) | ||
547 | + } | ||
548 | + //放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定 | ||
549 | + // this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态 | ||
550 | + } | ||
551 | + // else { | ||
552 | + // this.uniteParentSame(currentObj.id,treeStatus) | ||
553 | + // } | ||
554 | + } | ||
449 | } | 555 | } |
450 | }, | 556 | }, |
451 | mounted() { | 557 | mounted() { |
@@ -457,4 +563,4 @@ | @@ -457,4 +563,4 @@ | ||
457 | 563 | ||
458 | <style scoped> | 564 | <style scoped> |
459 | 565 | ||
460 | -</style> | ||
566 | +</style> |
1 | <template> | 1 | <template> |
2 | - <section> | ||
3 | - <!--工具条--> | ||
4 | - <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
5 | - <el-form :inline="true" :model="filters"> | ||
6 | - <el-form-item> | ||
7 | - <el-input v-model="filters.realName" placeholder="姓名"></el-input> | ||
8 | - </el-form-item> | ||
9 | - <el-form-item> | ||
10 | - <el-input v-model="filters.userName" placeholder="账号"></el-input> | ||
11 | - </el-form-item> | ||
12 | - <el-form-item> | ||
13 | - <el-button type="primary" v-on:click="getUsers">查询</el-button> | ||
14 | - </el-form-item> | ||
15 | - <el-form-item> | ||
16 | - <el-button type="primary" @click="handleAdd">新增</el-button> | ||
17 | - </el-form-item> | ||
18 | - </el-form> | ||
19 | - </el-col> | 2 | + <section> |
3 | + <!--工具条--> | ||
4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
5 | + <el-form :inline="true" :model="filters"> | ||
6 | + <el-form-item> | ||
7 | + <el-input v-model="filters.realName" placeholder="姓名"></el-input> | ||
8 | + </el-form-item> | ||
9 | + <el-form-item> | ||
10 | + <el-input v-model="filters.userName" placeholder="账号"></el-input> | ||
11 | + </el-form-item> | ||
12 | + <el-form-item> | ||
13 | + <el-button type="primary" v-on:click="getUsers">查询</el-button> | ||
14 | + </el-form-item> | ||
15 | + <el-form-item> | ||
16 | + <el-button type="primary" @click="handleAdd">新增</el-button> | ||
17 | + </el-form-item> | ||
18 | + </el-form> | ||
19 | + </el-col> | ||
20 | 20 | ||
21 | - <!--列表--> | ||
22 | - <el-table :data="users" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
23 | - <el-table-column type="selection" width="55"> | ||
24 | - </el-table-column> | ||
25 | - <el-table-column type="index" width="60"> | ||
26 | - </el-table-column> | ||
27 | - <el-table-column prop="userId" label="ID" width="100" sortable> | ||
28 | - </el-table-column> | ||
29 | - <el-table-column prop="username" label="账号" width="120" sortable> | ||
30 | - </el-table-column> | ||
31 | - <el-table-column prop="realname" label="姓名" width="120" sortable> | ||
32 | - </el-table-column> | ||
33 | - <el-table-column prop="sex" label="性别" width="100" :formatter="formatSex" sortable> | ||
34 | - </el-table-column> | ||
35 | - <el-table-column prop="mobilephone" label="电话" width="125"> | ||
36 | - </el-table-column> | ||
37 | - <el-table-column prop="creattime" label="创建时间" width="170" sortable> | ||
38 | - </el-table-column> | ||
39 | - <el-table-column prop="updatetime" label="更新时间" width="170" sortable> | ||
40 | - </el-table-column> | ||
41 | - <el-table-column prop="address" label="地址" min-width="180"> | ||
42 | - </el-table-column> | ||
43 | - <el-table-column prop="email" label="Email" min-width="180"> | ||
44 | - </el-table-column> | ||
45 | - <el-table-column prop="state" label="启用" width="100" :formatter="formatState" sortable> | ||
46 | - </el-table-column> | ||
47 | - <el-table-column label="操作" width="250"> | ||
48 | - <template slot-scope="scope"> | ||
49 | - <el-button size="small" @click="roleEdit(scope.$index, scope.row)">权限配置</el-button> | ||
50 | - <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
51 | - <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
52 | - </template> | ||
53 | - </el-table-column> | ||
54 | - </el-table> | 21 | + <!--列表--> |
22 | + <el-table :data="users" highlight-current-row border v-loading="listLoading" @selection-change="selsChange" | ||
23 | + style="width: 100%;"> | ||
24 | + <el-table-column type="selection" width="55" align="center"> | ||
25 | + </el-table-column> | ||
26 | + <!--<el-table-column type="index" width="60">--> | ||
27 | + <!--</el-table-column>--> | ||
28 | + <el-table-column prop="userId" label="ID" width="100" align="center" sortable> | ||
29 | + </el-table-column> | ||
30 | + <el-table-column prop="username" label="账号" width="120" align="center" sortable> | ||
31 | + </el-table-column> | ||
32 | + <el-table-column prop="realname" label="姓名" width="120" align="center" sortable> | ||
33 | + </el-table-column> | ||
34 | + <el-table-column prop="sex" label="性别" width="100" :formatter="formatSex" align="center" sortable> | ||
35 | + </el-table-column> | ||
36 | + <el-table-column prop="mobilephone" label="电话" width="130" align="center"> | ||
37 | + </el-table-column> | ||
38 | + <el-table-column prop="creattime" label="创建时间" width="175" align="center" sortable> | ||
39 | + </el-table-column> | ||
40 | + <el-table-column prop="updatetime" label="更新时间" width="175" align="center" sortable> | ||
41 | + </el-table-column> | ||
42 | + <el-table-column prop="address" label="地址" min-width="180" align="center"> | ||
43 | + </el-table-column> | ||
44 | + <el-table-column prop="email" label="Email" min-width="180" align="center"> | ||
45 | + </el-table-column> | ||
46 | + <el-table-column prop="state" label="启用" width="100" :formatter="formatState" align="center" sortable> | ||
47 | + </el-table-column> | ||
48 | + <el-table-column label="操作" width="300px" fixed="right" align="center"> | ||
49 | + <template slot-scope="scope"> | ||
50 | + <el-button type="primary" icon="el-icon-setting" size="small" @click="roleEdit(scope.$index, scope.row)">角色配置</el-button> | ||
51 | + <el-button size="small" type="success" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
52 | + <el-button type="danger" icon="el-icon-delete" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
53 | + </template> | ||
54 | + </el-table-column> | ||
55 | + </el-table> | ||
55 | 56 | ||
56 | - <!--工具条--> | ||
57 | - <el-col :span="24" class="toolbar"> | ||
58 | - <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
59 | - <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;"> | ||
60 | - </el-pagination> | ||
61 | - </el-col> | 57 | + <!--工具条--> |
58 | + <el-col :span="24" class="toolbar"> | ||
59 | + <el-button type="danger" icon="el-icon-delete" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
60 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="10" | ||
61 | + :total="total" style="float:right;"> | ||
62 | + </el-pagination> | ||
63 | + </el-col> | ||
62 | 64 | ||
63 | - <!--编辑界面--> | ||
64 | - <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
65 | - <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
66 | - <el-form-item label="ID"> | ||
67 | - <span>{{editForm.userId}}</span> | ||
68 | - </el-form-item> | ||
69 | - <el-form-item label="账号"> | ||
70 | - <span>{{editForm.username}}</span> | ||
71 | - </el-form-item> | ||
72 | - <el-form-item label="密码" prop="password"> | ||
73 | - <el-input v-model="editForm.password" auto-complete="off" type="password" show-password></el-input> | ||
74 | - </el-form-item> | ||
75 | - <el-form-item label="姓名" prop="realname"> | ||
76 | - <el-input v-model="editForm.realname" auto-complete="off"></el-input> | ||
77 | - </el-form-item> | ||
78 | - <el-form-item label="电话" prop="mobilephone"> | ||
79 | - <el-input v-model="editForm.mobilephone" auto-complete="off"></el-input> | ||
80 | - </el-form-item> | ||
81 | - <el-form-item label="Email" prop="email"> | ||
82 | - <el-input v-model="editForm.email" auto-complete="off"></el-input> | ||
83 | - </el-form-item> | ||
84 | - <el-form-item label="性别"> | ||
85 | - <el-radio-group v-model="editForm.sex"> | ||
86 | - <el-radio class="radio" label="1" >男</el-radio> | ||
87 | - <el-radio class="radio" label="0" >女</el-radio> | ||
88 | - </el-radio-group> | ||
89 | - </el-form-item> | ||
90 | - <el-form-item label="年龄"> | ||
91 | - <el-input-number v-model="editForm.age" :min="0" :max="200"></el-input-number> | ||
92 | - </el-form-item> | ||
93 | - <!--<el-form-item label="创建日期">--> | ||
94 | - <!--<el-date-picker type="date" placeholder="创建日期" v-model="editForm.creattime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"></el-date-picker>--> | ||
95 | - <!--</el-form-item>--> | ||
96 | - <el-form-item label="地址"> | ||
97 | - <el-input type="textarea" v-model="editForm.address"></el-input> | ||
98 | - </el-form-item> | ||
99 | - <el-form-item label="启用"> | ||
100 | - <el-radio-group v-model="editForm.state"> | ||
101 | - <el-radio class="radio" label="true" >是</el-radio> | ||
102 | - <el-radio class="radio" label="false" >否</el-radio> | ||
103 | - </el-radio-group> | ||
104 | - </el-form-item> | ||
105 | - <el-form-item lable="头像"> | ||
106 | - <el-upload | ||
107 | - class="avatar-uploader" | ||
108 | - action="http://127.0.0.1:7003/upload" | ||
109 | - :show-file-list="true" | ||
110 | - accept="image/jpeg,image/jpg,image/png" | ||
111 | - :on-success="handleAvatarSuccess" | ||
112 | - :before-upload="beforeAvatarUpload" | ||
113 | - > | ||
114 | - <img v-if="faceImageUrl" :src="faceImageUrl" class="avatar"> | ||
115 | - <i v-else class="el-icon-plus avatar-uploader-icon"></i> | ||
116 | - </el-upload> | ||
117 | - </el-form-item> | ||
118 | - </el-form> | ||
119 | - <div slot="footer" class="dialog-footer"> | ||
120 | - <el-button @click.native="editFormVisible = false">取消</el-button> | ||
121 | - <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
122 | - </div> | ||
123 | - </el-dialog> | 65 | + <!--编辑界面--> |
66 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
67 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
68 | + <el-form-item label="ID"> | ||
69 | + <span>{{editForm.userId}}</span> | ||
70 | + </el-form-item> | ||
71 | + <el-form-item label="账号"> | ||
72 | + <span>{{editForm.username}}</span> | ||
73 | + </el-form-item> | ||
74 | +<!-- <el-form-item label="密码" prop="password">--> | ||
75 | +<!-- <el-input v-model="editForm.password" auto-complete="off" type="password" show-password></el-input>--> | ||
76 | +<!-- </el-form-item>--> | ||
77 | + <el-form-item label="姓名" prop="realname"> | ||
78 | + <el-input v-model="editForm.realname" auto-complete="off"></el-input> | ||
79 | + </el-form-item> | ||
80 | + <el-form-item label="电话" prop="mobilephone"> | ||
81 | + <el-input v-model="editForm.mobilephone" auto-complete="off"></el-input> | ||
82 | + </el-form-item> | ||
83 | + <el-form-item label="Email" prop="email"> | ||
84 | + <el-input v-model="editForm.email" auto-complete="off"></el-input> | ||
85 | + </el-form-item> | ||
86 | + <el-form-item label="性别"> | ||
87 | + <el-radio-group v-model="editForm.sex"> | ||
88 | + <el-radio class="radio" label="1">男</el-radio> | ||
89 | + <el-radio class="radio" label="0">女</el-radio> | ||
90 | + </el-radio-group> | ||
91 | + </el-form-item> | ||
92 | + <el-form-item label="年龄"> | ||
93 | + <el-input-number v-model="editForm.age" :min="0" :max="200"></el-input-number> | ||
94 | + </el-form-item> | ||
95 | + <!--<el-form-item label="创建日期">--> | ||
96 | + <!--<el-date-picker type="date" placeholder="创建日期" v-model="editForm.creattime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"></el-date-picker>--> | ||
97 | + <!--</el-form-item>--> | ||
98 | + <el-form-item label="地址"> | ||
99 | + <el-input type="textarea" v-model="editForm.address"></el-input> | ||
100 | + </el-form-item> | ||
101 | + <el-form-item label="启用"> | ||
102 | + <el-radio-group v-model="editForm.state"> | ||
103 | + <el-radio class="radio" label="true">是</el-radio> | ||
104 | + <el-radio class="radio" label="false">否</el-radio> | ||
105 | + </el-radio-group> | ||
106 | + </el-form-item> | ||
107 | + <el-form-item lable="头像"> | ||
108 | + <el-upload | ||
109 | + class="avatar-uploader" | ||
110 | + action="http://127.0.0.1:7003/upload" | ||
111 | + :show-file-list="true" | ||
112 | + accept="image/jpeg,image/jpg,image/png" | ||
113 | + :on-success="handleAvatarSuccess" | ||
114 | + :before-upload="beforeAvatarUpload" | ||
115 | + > | ||
116 | + <img v-if="faceImageUrl" :src="faceImageUrl" class="avatar"> | ||
117 | + <i v-else class="el-icon-plus avatar-uploader-icon"></i> | ||
118 | + </el-upload> | ||
119 | + </el-form-item> | ||
120 | + </el-form> | ||
121 | + <div slot="footer" class="dialog-footer"> | ||
122 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
123 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
124 | + </div> | ||
125 | + </el-dialog> | ||
124 | 126 | ||
125 | - <!--新增界面--> | ||
126 | - <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
127 | - <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
128 | - <el-form-item label="账号" prop="username"> | ||
129 | - <el-input v-model="addForm.username"></el-input> | ||
130 | - </el-form-item> | ||
131 | - <el-form-item label="密码" prop="password"> | ||
132 | - <el-input v-model="addForm.password" type="password"></el-input> | ||
133 | - </el-form-item> | ||
134 | - <el-form-item label="姓名" prop="realname"> | ||
135 | - <el-input v-model="addForm.realname"></el-input> | ||
136 | - </el-form-item> | ||
137 | - <el-form-item label="电话" prop="mobilephone"> | ||
138 | - <el-input v-model="addForm.mobilephone"></el-input> | ||
139 | - </el-form-item> | ||
140 | - <el-form-item label="Email" prop="email"> | ||
141 | - <el-input v-model="addForm.email"></el-input> | ||
142 | - </el-form-item> | ||
143 | - <el-form-item label="性别"> | ||
144 | - <el-radio-group v-model="addForm.sex"> | ||
145 | - <el-radio class="radio" label="1">男</el-radio> | ||
146 | - <el-radio class="radio" label="0">女</el-radio> | ||
147 | - </el-radio-group> | ||
148 | - </el-form-item> | ||
149 | - <el-form-item label="年龄" prop="age"> | ||
150 | - <el-input-number v-model="addForm.age" :min="0" :max="200"></el-input-number> | ||
151 | - </el-form-item> | ||
152 | - <el-form-item label="地址"> | ||
153 | - <el-input type="textarea" v-model="addForm.address"></el-input> | ||
154 | - </el-form-item> | ||
155 | - </el-form> | ||
156 | - <div slot="footer" class="dialog-footer"> | ||
157 | - <el-button @click.native="addFormVisible = false">取消</el-button> | ||
158 | - <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
159 | - </div> | ||
160 | - </el-dialog> | 127 | + <!--新增界面--> |
128 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
129 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
130 | + <el-form-item label="账号" prop="username"> | ||
131 | + <el-input v-model="addForm.username" aria-placeholder="用户名长度在5-11位,支持英文和数字"></el-input> | ||
132 | + </el-form-item> | ||
133 | + <el-form-item label="密码" prop="password"> | ||
134 | + <el-input v-model="addForm.password" type="password"></el-input> | ||
135 | + </el-form-item> | ||
136 | + <el-form-item label="姓名" prop="realname"> | ||
137 | + <el-input v-model="addForm.realname"></el-input> | ||
138 | + </el-form-item> | ||
139 | + <el-form-item label="电话" prop="mobilephone"> | ||
140 | + <el-input v-model="addForm.mobilephone"></el-input> | ||
141 | + </el-form-item> | ||
142 | + <el-form-item label="Email" prop="email"> | ||
143 | + <el-input v-model="addForm.email"></el-input> | ||
144 | + </el-form-item> | ||
145 | + <el-form-item label="性别"> | ||
146 | + <el-radio-group v-model="addForm.sex"> | ||
147 | + <el-radio class="radio" label="1">男</el-radio> | ||
148 | + <el-radio class="radio" label="0">女</el-radio> | ||
149 | + </el-radio-group> | ||
150 | + </el-form-item> | ||
151 | + <el-form-item label="年龄" prop="age"> | ||
152 | + <el-input-number v-model="addForm.age" :min="0" :max="200"></el-input-number> | ||
153 | + </el-form-item> | ||
154 | + <el-form-item label="地址"> | ||
155 | + <el-input type="textarea" v-model="addForm.address"></el-input> | ||
156 | + </el-form-item> | ||
157 | + </el-form> | ||
158 | + <div slot="footer" class="dialog-footer"> | ||
159 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
160 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
161 | + </div> | ||
162 | + </el-dialog> | ||
161 | 163 | ||
162 | - <!--权限设置--> | ||
163 | - <el-dialog title="权限设置" :visible.sync="roleFormVisible" :close-on-click-modal="false"> | ||
164 | - <el-form :model="roleEditForm" label-width="80px" ref="roleEditForm" > | ||
165 | - <el-form-item label="ID"> | ||
166 | - <span>{{roleEditForm.userId}}</span> | ||
167 | - </el-form-item> | ||
168 | - <el-form-item label="账号"> | ||
169 | - <span>{{roleEditForm.username}}</span> | ||
170 | - </el-form-item> | ||
171 | - <el-checkbox-group v-model="roleIds" size="small"> | ||
172 | - <el-checkbox-button v-for="role in roles" :label="role.roleId" :key="role.roleId" >{{role.description}}</el-checkbox-button> | ||
173 | - </el-checkbox-group> | ||
174 | - </el-form> | ||
175 | - <div slot="footer" class="dialog-footer"> | ||
176 | - <el-button @click.native="roleFormVisible = false">取消</el-button> | ||
177 | - <el-button type="primary" @click.native="roleEditSubmit" :loading="addLoading">提交</el-button> | ||
178 | - </div> | ||
179 | - </el-dialog> | ||
180 | - </section> | 164 | + <!--权限设置--> |
165 | + <el-dialog title="权限设置" :visible.sync="roleFormVisible" :close-on-click-modal="false"> | ||
166 | + <el-form :model="roleEditForm" label-width="80px" ref="roleEditForm"> | ||
167 | + <el-form-item label="ID"> | ||
168 | + <span>{{roleEditForm.userId}}</span> | ||
169 | + </el-form-item> | ||
170 | + <el-form-item label="账号"> | ||
171 | + <span>{{roleEditForm.username}}</span> | ||
172 | + </el-form-item> | ||
173 | + <el-tree :data="roles" :props="treeDefaultProps" default-expand-all show-checkbox highlight-current | ||
174 | + check-strictly node-key="roleId" ref="tree" @check-change="treeHandleCheckChange"> | ||
175 | + </el-tree> | ||
176 | + </el-form> | ||
177 | + | ||
178 | + <div slot="footer" class="dialog-footer"> | ||
179 | + <el-button @click.native="roleFormVisible = false">取消</el-button> | ||
180 | + <el-button type="primary" @click.native="roleEditSubmit" :loading="addLoading">提交</el-button> | ||
181 | + </div> | ||
182 | + </el-dialog> | ||
183 | + </section> | ||
181 | </template> | 184 | </template> |
182 | 185 | ||
183 | <script> | 186 | <script> |
184 | - import util from '../../common/js/util' | ||
185 | - import NProgress from 'nprogress' | ||
186 | - import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole } from '../../api/user'; | ||
187 | - import { getList} from '../../api/role_api'; | 187 | + import util from '../../common/js/util' |
188 | + import NProgress from 'nprogress' | ||
189 | + import {getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole} from '../../api/user'; | ||
190 | + import {getList} from '../../api/role_api'; | ||
188 | import moment from 'moment' | 191 | import moment from 'moment' |
189 | - export default { | ||
190 | - data() { | ||
191 | - return { | ||
192 | - filters: { | 192 | + |
193 | + export default { | ||
194 | + data() { | ||
195 | + return { | ||
196 | + filters: { | ||
193 | userName: '', | 197 | userName: '', |
194 | - realName: '' | ||
195 | - }, | ||
196 | - users: [], | ||
197 | - total: 0, | 198 | + realName: '' |
199 | + }, | ||
200 | + treeDefaultProps: { | ||
201 | + children: 'children', | ||
202 | + label: 'roleName', | ||
203 | + }, | ||
204 | + users: [], | ||
205 | + total: 0, | ||
198 | pageNum: 1, | 206 | pageNum: 1, |
199 | pageSize: 10, | 207 | pageSize: 10, |
200 | faceImageUrl: '', | 208 | faceImageUrl: '', |
201 | - listLoading: false, | ||
202 | - sels: [],//列表选中列 | ||
203 | - //编辑界面是否显示 | ||
204 | - editFormVisible: false, | ||
205 | - editLoading: false, | ||
206 | - editFormRules: { | ||
207 | - name: [ | ||
208 | - { required: true, message: '请输入姓名', trigger: 'blur' } | ||
209 | - ] | ||
210 | - }, | ||
211 | - //编辑界面数据 | ||
212 | - editForm: { | 209 | + listLoading: false, |
210 | + sels: [],//列表选中列 | ||
211 | + //编辑界面是否显示 | ||
212 | + editFormVisible: false, | ||
213 | + editLoading: false, | ||
214 | + editFormRules: { | ||
215 | + name: [ | ||
216 | + {required: true, message: '请输入姓名', trigger: 'blur'} | ||
217 | + ], | ||
218 | + mobilephone: [ | ||
219 | + {required: true, message: '请输入手机号码', trigger: ['blur', 'change']} | ||
220 | + ] | ||
221 | + }, | ||
222 | + //编辑界面数据 | ||
223 | + editForm: { | ||
213 | userId: 1, | 224 | userId: 1, |
214 | username: '', | 225 | username: '', |
215 | - password: '', | ||
216 | - sex: 1, | ||
217 | - creattime: '', | 226 | + password: '', |
227 | + sex: '1', | ||
228 | + creattime: undefined, | ||
218 | address: '', | 229 | address: '', |
219 | - realname: '', | ||
220 | - email: '', | ||
221 | - mobilephone: '', | ||
222 | - state: 'true' | ||
223 | - }, | 230 | + realname: '', |
231 | + email: '', | ||
232 | + mobilephone: '', | ||
233 | + state: true | ||
234 | + }, | ||
224 | 235 | ||
225 | - addFormVisible: false,//新增界面是否显示 | ||
226 | - addLoading: false, | ||
227 | - addFormRules: { | 236 | + addFormVisible: false,//新增界面是否显示 |
237 | + addLoading: false, | ||
238 | + addFormRules: { | ||
228 | username: [ | 239 | username: [ |
229 | - { required: true, message: '请输入姓名', trigger: 'blur' } | ||
230 | - ] | ||
231 | - }, | ||
232 | - //用户角色配置 | 240 | + {required: true, message: '请输入姓名,用户名长度在5-11位,支持英文和数字', trigger: 'blur'}, |
241 | + ], | ||
242 | + password: [ | ||
243 | + {required: true, message: '请输入密码,用户名长度在6-18位,支持英文和数字和非空字符', trigger: 'blur'} | ||
244 | + ], | ||
245 | + mobilephone: [ | ||
246 | + {required: true, message: '请输入手机号码', trigger: ['blur', 'change']}, | ||
247 | + ], | ||
248 | + }, | ||
249 | + //用户角色配置 | ||
233 | roleFormVisible: false, | 250 | roleFormVisible: false, |
234 | - //新增界面数据 | ||
235 | - addForm: { | 251 | + //新增界面数据 |
252 | + addForm: { | ||
236 | username: '', | 253 | username: '', |
237 | password: '', | 254 | password: '', |
238 | sex: 1, | 255 | sex: 1, |
239 | address: '', | 256 | address: '', |
240 | realname: '', | 257 | realname: '', |
241 | - email: '', | 258 | + email: '', |
242 | mobilephone: '', | 259 | mobilephone: '', |
243 | - age: 1 | ||
244 | - }, | 260 | + age: 1 |
261 | + }, | ||
245 | roleEditForm: { | 262 | roleEditForm: { |
246 | userId: 1, | 263 | userId: 1, |
247 | - username: "", | ||
248 | - roles: [] | ||
249 | - }, | ||
250 | - roles: [], | 264 | + username: "", |
265 | + roles: [] | ||
266 | + }, | ||
267 | + roles: [], | ||
251 | roleIds: [] | 268 | roleIds: [] |
252 | 269 | ||
253 | - } | ||
254 | - }, | ||
255 | - methods: { | ||
256 | - //性别显示转换 | ||
257 | - formatSex: function (row, column) { | ||
258 | - return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知'; | ||
259 | - }, | 270 | + } |
271 | + }, | ||
272 | + methods: { | ||
273 | + //性别显示转换 | ||
274 | + formatSex: function (row, column) { | ||
275 | + return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知'; | ||
276 | + }, | ||
260 | formatState: function (row, column) { | 277 | formatState: function (row, column) { |
261 | return row.state == true ? '是' : row.state == false ? '否' : '未知'; | 278 | return row.state == true ? '是' : row.state == false ? '否' : '未知'; |
262 | }, | 279 | }, |
263 | - handleCurrentChange(val) { | ||
264 | - this.pageNum = val; | ||
265 | - this.getUsers(); | ||
266 | - }, | ||
267 | - //获取用户列表 | ||
268 | - getUsers:function() { | ||
269 | - let para = { | 280 | + handleCurrentChange(val) { |
281 | + this.pageNum = val; | ||
282 | + this.getUsers(); | ||
283 | + }, | ||
284 | + //获取用户列表 | ||
285 | + getUsers: function () { | ||
286 | + let para = { | ||
270 | pageNum: this.pageNum, | 287 | pageNum: this.pageNum, |
271 | pageSize: this.pageSize, | 288 | pageSize: this.pageSize, |
272 | userName: this.filters.userName, | 289 | userName: this.filters.userName, |
273 | realName: this.filters.realName | 290 | realName: this.filters.realName |
274 | - }; | ||
275 | - this.listLoading = true; | 291 | + }; |
292 | + this.listLoading = true; | ||
276 | getUserList(para).then((res) => { | 293 | getUserList(para).then((res) => { |
277 | let response = res.data.data; | 294 | let response = res.data.data; |
278 | - this.total = response.total; | ||
279 | - this.users = response.list; | ||
280 | - this.listLoading = false; | ||
281 | - //NProgress.done(); | ||
282 | - }).catch((error) => { | 295 | + this.total = response.total; |
296 | + this.users = response.list; | ||
297 | + this.listLoading = false; | ||
298 | + //NProgress.done(); | ||
299 | + }).catch((error) => { | ||
283 | this.listLoading = false; | 300 | this.listLoading = false; |
284 | this.$message.error(error.toString()); | 301 | this.$message.error(error.toString()); |
285 | - }); | 302 | + }); |
286 | 303 | ||
287 | - }, | ||
288 | - //删除 | ||
289 | - handleDel: function (index, row) { | ||
290 | - this.$confirm('确认删除该记录吗?', '提示', { | ||
291 | - type: 'warning' | ||
292 | - }).then(() => { | ||
293 | - this.listLoading = true; | ||
294 | - //NProgress.start(); | ||
295 | - let para = { userId: row.userId }; | ||
296 | - removeUser(para).then((res) => { | ||
297 | - this.listLoading = false; | ||
298 | - //NProgress.done(); | ||
299 | - this.$message({ | ||
300 | - message: '删除成功', | ||
301 | - type: 'success' | ||
302 | - }); | ||
303 | - this.getUsers(); | ||
304 | - }).catch((error) => { | 304 | + }, |
305 | + //删除 | ||
306 | + handleDel: function (index, row) { | ||
307 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
308 | + type: 'warning' | ||
309 | + }).then(() => { | ||
310 | + this.listLoading = true; | ||
311 | + //NProgress.start(); | ||
312 | + let para = {userId: row.userId}; | ||
313 | + removeUser(para).then((res) => { | ||
314 | + this.listLoading = false; | ||
315 | + //NProgress.done(); | ||
316 | + this.$message({ | ||
317 | + message: '删除成功', | ||
318 | + type: 'success' | ||
319 | + }); | ||
320 | + this.getUsers(); | ||
321 | + }).catch((error) => { | ||
305 | this.listLoading = false; | 322 | this.listLoading = false; |
306 | alert(error); | 323 | alert(error); |
307 | - }); | ||
308 | - }).catch(); | ||
309 | - }, | 324 | + }); |
325 | + }).catch(); | ||
326 | + }, | ||
310 | /** | 327 | /** |
311 | - * 显示编辑界面 | 328 | + * 显示编辑界面 |
312 | * @param index | 329 | * @param index |
313 | * @param row 为这行的数据对象 | 330 | * @param row 为这行的数据对象 |
314 | */ | 331 | */ |
315 | - handleEdit: function (index, row) { | ||
316 | - this.editFormVisible = true; | ||
317 | - this.editForm = Object.assign({}, row); | ||
318 | - }, | 332 | + handleEdit: function (index, row) { |
333 | + this.editFormVisible = true; | ||
334 | + this.editForm = Object.assign({}, row); | ||
335 | + }, | ||
319 | roleEdit: function (index, row) { | 336 | roleEdit: function (index, row) { |
337 | + this.roleFormVisible = true; | ||
338 | + this.getRoles(); | ||
320 | var _this = this; | 339 | var _this = this; |
321 | _this.roleIds = []; | 340 | _this.roleIds = []; |
322 | this.roleEditForm = Object.assign({}, row); | 341 | this.roleEditForm = Object.assign({}, row); |
323 | - let userRoles = this.roleEditForm.roles; | ||
324 | - if (util.checkNull(userRoles)){ | ||
325 | - userRoles.forEach(function (role,v_index,v_arr) { | ||
326 | - _this.roleIds[v_index] = role.roleId; | 342 | + let roles = this.roleEditForm.roles; |
343 | + | ||
344 | + if (util.checkNull(roles)) { | ||
345 | + roles.forEach(function (role, v_index, v_arr) { | ||
346 | + if (util.checkNull(role)) { | ||
347 | + _this.roleIds[v_index] = role.roleId; | ||
348 | + } | ||
327 | }); | 349 | }); |
328 | - } | ||
329 | - this.getRoles(); | 350 | + } |
351 | + this.$nextTick(() => { | ||
352 | + //反向适配 | ||
353 | + this.$refs.tree.setCheckedKeys(this.roleIds); | ||
354 | + }); | ||
330 | }, | 355 | }, |
331 | getRoles() { | 356 | getRoles() { |
332 | let para = { | 357 | let para = { |
@@ -336,45 +361,45 @@ | @@ -336,45 +361,45 @@ | ||
336 | NProgress.start(); | 361 | NProgress.start(); |
337 | getList(para).then((res) => { | 362 | getList(para).then((res) => { |
338 | this.roles = res.data.list; | 363 | this.roles = res.data.list; |
339 | - this.roleFormVisible = true; | ||
340 | NProgress.done(); | 364 | NProgress.done(); |
341 | }).catch((error) => { | 365 | }).catch((error) => { |
342 | - if(null!= error.response && error.response!==undefined){ | ||
343 | - let status= error.response.status; | 366 | + if (null != error.response && error.response !== undefined) { |
367 | + let status = error.response.status; | ||
344 | let msg = error.response.statusText; | 368 | let msg = error.response.statusText; |
345 | - alert(status+msg); | ||
346 | - }else { | 369 | + alert(status + msg); |
370 | + } else { | ||
347 | alert(error); | 371 | alert(error); |
348 | } | 372 | } |
349 | }); | 373 | }); |
350 | 374 | ||
375 | + | ||
351 | }, | 376 | }, |
352 | - //显示新增界面,每次点开初始化数据 | ||
353 | - handleAdd: function () { | ||
354 | - this.addFormVisible = true; | ||
355 | - this.addForm = { | 377 | + //显示新增界面,每次点开初始化数据 |
378 | + handleAdd: function () { | ||
379 | + this.addFormVisible = true; | ||
380 | + this.addForm = { | ||
356 | username: '', | 381 | username: '', |
357 | password: '', | 382 | password: '', |
358 | sex: 1, | 383 | sex: 1, |
359 | address: '', | 384 | address: '', |
360 | realname: '', | 385 | realname: '', |
361 | - email: '', | 386 | + email: '', |
362 | mobilephone: '', | 387 | mobilephone: '', |
363 | age: 1 | 388 | age: 1 |
364 | - }; | ||
365 | - }, | ||
366 | - //编辑 | ||
367 | - editSubmit: function () { | ||
368 | - this.$refs.editForm.validate((valid) => { | ||
369 | - if (valid) { | ||
370 | - this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
371 | - this.editLoading = true; | ||
372 | - //NProgress.start(); | ||
373 | - let para = Object.assign({}, this.editForm); | ||
374 | - //不需要提交的 去掉,后端不好接收 | ||
375 | - para.authorities = null; | ||
376 | - para.permissions = null; | ||
377 | - para.roles = null; | 389 | + }; |
390 | + }, | ||
391 | + //编辑 | ||
392 | + editSubmit: function () { | ||
393 | + this.$refs.editForm.validate((valid) => { | ||
394 | + if (valid) { | ||
395 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
396 | + this.editLoading = true; | ||
397 | + //NProgress.start(); | ||
398 | + // let para = Object.assign({}, this.editForm); | ||
399 | + //不需要提交的 去掉,后端不好接收 | ||
400 | + this.editForm.authorities = null; | ||
401 | + this.editForm.permissions = null; | ||
402 | + this.editForm.roles = null; | ||
378 | // para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | 403 | // para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); |
379 | /* | 404 | /* |
380 | 查询之后格式this.filters.column.create_start_date中日期发生变化; | 405 | 查询之后格式this.filters.column.create_start_date中日期发生变化; |
@@ -382,112 +407,127 @@ | @@ -382,112 +407,127 @@ | ||
382 | 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格 | 407 | 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格 |
383 | 式; | 408 | 式; |
384 | */ | 409 | */ |
385 | - /*moment 安装 npm install moment --save*/ | 410 | + /*moment 安装 npm install moment --save*/ |
386 | // para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); | 411 | // para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); |
387 | this.editLoading = false; | 412 | this.editLoading = false; |
388 | - editUser(para).then((res) => { | 413 | + editUser(this.editForm).then((res) => { |
389 | 414 | ||
390 | - //NProgress.done(); | ||
391 | - this.$message({ | ||
392 | - message: '提交成功', | ||
393 | - type: 'success' | ||
394 | - }); | ||
395 | - this.$refs['editForm'].resetFields(); | ||
396 | - this.editFormVisible = false; | ||
397 | - this.getUsers(); | ||
398 | - }).catch(error => alert(error)); | ||
399 | - }); | ||
400 | - } | ||
401 | - }); | ||
402 | - }, | ||
403 | - //新增 | ||
404 | - addSubmit: function () { | ||
405 | - this.$refs.addForm.validate((valid) => { | ||
406 | - if (valid) { | ||
407 | - this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
408 | - this.addLoading = true; | ||
409 | - let para = Object.assign({}, this.addForm); | 415 | + //NProgress.done(); |
416 | + this.$message({ | ||
417 | + message: '提交成功', | ||
418 | + type: 'success' | ||
419 | + }); | ||
420 | + this.$refs['editForm'].resetFields(); | ||
421 | + this.editFormVisible = false; | ||
422 | + this.getUsers(); | ||
423 | + }).catch(error => alert(error)); | ||
424 | + }); | ||
425 | + } | ||
426 | + }); | ||
427 | + }, | ||
428 | + //新增 | ||
429 | + addSubmit: function () { | ||
430 | + this.$refs.addForm.validate((valid) => { | ||
431 | + if (valid) { | ||
432 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
433 | + this.addLoading = true; | ||
434 | + let para = Object.assign({}, this.addForm); | ||
410 | // para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | 435 | // para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); |
411 | - addUser(para).then((res) => { | ||
412 | - this.addLoading = false; | ||
413 | - //NProgress.done(); | ||
414 | - this.$message({ | ||
415 | - message: '提交成功', | ||
416 | - type: 'success' | ||
417 | - }); | ||
418 | - this.$refs['addForm'].resetFields(); | ||
419 | - this.addFormVisible = false; | ||
420 | - this.getUsers(); | ||
421 | - }).catch(error => { | 436 | + addUser(para).then((res) => { |
437 | + this.addLoading = false; | ||
438 | + //NProgress.done(); | ||
439 | + this.$message({ | ||
440 | + message: '提交成功', | ||
441 | + type: 'success' | ||
442 | + }); | ||
443 | + this.$refs['addForm'].resetFields(); | ||
444 | + this.addFormVisible = false; | ||
445 | + this.getUsers(); | ||
446 | + }).catch(error => { | ||
422 | this.addLoading = false; | 447 | this.addLoading = false; |
423 | - alert(error.message); | ||
424 | - }); | ||
425 | - }); | ||
426 | - } | ||
427 | - }); | ||
428 | - }, | ||
429 | - selsChange: function (sels) { | ||
430 | - this.sels = sels; | ||
431 | - }, | ||
432 | - //批量删除 | ||
433 | - batchRemove: function () { | ||
434 | - var ids = this.sels.map(item => item.userId).toString(); | ||
435 | - this.$confirm('确认删除选中记录吗?', '提示', { | ||
436 | - type: 'warning' | ||
437 | - }).then(() => { | ||
438 | - this.listLoading = true; | ||
439 | - //NProgress.start(); | ||
440 | - let para = { ids: ids }; | ||
441 | - batchRemoveUser(para).then((res) => { | ||
442 | - this.listLoading = false; | ||
443 | - //NProgress.done(); | ||
444 | - this.$message({ | ||
445 | - message: '删除成功', | ||
446 | - type: 'success' | ||
447 | - }); | ||
448 | - this.getUsers(); | ||
449 | - }); | ||
450 | - }).catch(() => { | 448 | + this.$message({ |
449 | + message: error.message, | ||
450 | + type: 'error' | ||
451 | + }); | ||
452 | + }); | ||
453 | + }); | ||
454 | + } | ||
455 | + }); | ||
456 | + }, | ||
457 | + selsChange: function (sels) { | ||
458 | + this.sels = sels; | ||
459 | + }, | ||
460 | + //批量删除 | ||
461 | + batchRemove: function () { | ||
462 | + var ids = this.sels.map(item => item.userId).toString(); | ||
463 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
464 | + type: 'warning' | ||
465 | + }).then(() => { | ||
466 | + this.listLoading = true; | ||
467 | + //NProgress.start(); | ||
468 | + let para = {ids: ids}; | ||
469 | + batchRemoveUser(para).then((res) => { | ||
470 | + this.listLoading = false; | ||
471 | + //NProgress.done(); | ||
472 | + this.$message({ | ||
473 | + message: '删除成功', | ||
474 | + type: 'success' | ||
475 | + }); | ||
476 | + this.getUsers(); | ||
477 | + }); | ||
478 | + }).catch(() => { | ||
451 | 479 | ||
452 | - }); | ||
453 | - }, | 480 | + }); |
481 | + }, | ||
454 | roleEditSubmit: function () { | 482 | roleEditSubmit: function () { |
455 | this.$confirm('确认提交吗?', '提示', {}).then(() => { | 483 | this.$confirm('确认提交吗?', '提示', {}).then(() => { |
456 | // this.editLoading = true; | 484 | // this.editLoading = true; |
457 | let userId = this.roleEditForm.userId; | 485 | let userId = this.roleEditForm.userId; |
458 | - let roleIds = this.roleIds; | ||
459 | - let para = {userId,roleIds}; | 486 | + let roleIds = this.$refs.tree.getCheckedKeys(); |
487 | + let para = {userId, roleIds}; | ||
460 | setUserRole(para).then((res) => { | 488 | setUserRole(para).then((res) => { |
461 | - if (res.status ===200) { | ||
462 | - alert("ok"); | ||
463 | - } | ||
464 | - this.getUsers(); | 489 | + if (res.status === 200) { |
490 | + this.$message({ | ||
491 | + message: '岗位设置成功', | ||
492 | + type: 'success' | ||
493 | + }); | ||
494 | + } | ||
495 | + this.getUsers(); | ||
465 | this.roleFormVisible = false; | 496 | this.roleFormVisible = false; |
466 | }).catch(err => { | 497 | }).catch(err => { |
467 | alert(err); | 498 | alert(err); |
468 | - }); | 499 | + }); |
469 | console.log(para); | 500 | console.log(para); |
470 | - }); | 501 | + }); |
502 | + }, | ||
503 | + handleAvatarSuccess: function (response) { | ||
504 | + this.faceImageUrl = 'http://127.0.0.1:7003/' + response.data; | ||
471 | }, | 505 | }, |
472 | - handleAvatarSuccess: function(response){ | ||
473 | - this.faceImageUrl = 'http://127.0.0.1:7003/'+response.data; | ||
474 | - }, | ||
475 | beforeAvatarUpload: function () { | 506 | beforeAvatarUpload: function () { |
476 | 507 | ||
508 | + }, | ||
509 | + treeHandleCheckChange: function (data, checked, indeterminate) { | ||
510 | + if (checked) { | ||
511 | + this.roleIds.push(data.roleId); | ||
512 | + } else { | ||
513 | + this.roleIds.splice(this.roleIds.contains(data.roleId), 1); | ||
514 | + } | ||
515 | +// console.log(data, checked, indeterminate); | ||
516 | + console.log(this.roleIds); | ||
477 | } | 517 | } |
478 | - }, | ||
479 | - mounted() { | ||
480 | - this.getUsers(); | ||
481 | - }, | ||
482 | - computed: { | 518 | + }, |
519 | + mounted() { | ||
520 | + this.getUsers(); | ||
521 | + }, | ||
522 | + computed: { | ||
483 | hideShow() {//当图片多于一张的时候,就隐藏上传框 | 523 | hideShow() {//当图片多于一张的时候,就隐藏上传框 |
484 | return this.file === '' ? false : true | 524 | return this.file === '' ? false : true |
485 | } | 525 | } |
486 | }, | 526 | }, |
487 | - } | 527 | + } |
488 | 528 | ||
489 | </script> | 529 | </script> |
490 | 530 | ||
491 | <style scoped> | 531 | <style scoped> |
492 | 532 | ||
493 | -</style> | ||
533 | +</style> |
static/images/air-banner.png
0 → 100644

82.3 KB
-
请 注册 或 登录 后发表评论