正在显示
15 个修改的文件
包含
340 行增加
和
102 行删除
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 }); }; |
@@ -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: { |
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 }); }; |
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 }); }; |
1 | import http from './http.js' | 1 | import http from './http.js' |
2 | -let baseUrl = '/hqpt-user-center/user' | ||
3 | - | 2 | +let baseUrl = '/cloud-user-center/user' |
4 | export const getUserList = params => { return http.get(`${baseUrl}/list`, params); }; | 3 | export const getUserList = params => { return http.get(`${baseUrl}/list`, params); }; |
5 | 4 | ||
6 | export const getUserListPage = params => { return http.get(`/user/list`,params) }; | 5 | export const getUserListPage = params => { return http.get(`/user/list`,params) }; |
1 | var SIGN_REGEXP = /([yMdhsm])(\1*)/g; | 1 | var SIGN_REGEXP = /([yMdhsm])(\1*)/g; |
2 | var DEFAULT_PATTERN = 'yyyy-MM-dd'; | 2 | var DEFAULT_PATTERN = 'yyyy-MM-dd'; |
3 | +/** | ||
4 | + * 根据数组 元素的“值” 来删除或者获取数据 | ||
5 | + * 使用方法arrList.splice(arrList.contains('c'),1) | ||
6 | + */ | ||
7 | +Array.prototype.contains = function(obj) { | ||
8 | + var i = this.length; | ||
9 | + while (i--) { | ||
10 | + if (this[i] === obj) { | ||
11 | + return i; // 返回的这个 i 就是元素的索引下标, | ||
12 | + } | ||
13 | + } | ||
14 | + return false; | ||
15 | +} | ||
3 | 16 | ||
4 | function padding(s, len) { | 17 | function padding(s, len) { |
5 | - var len = len - (s + '').length; | 18 | + len = len - (s + '').length; |
6 | for (var i = 0; i < len; i++) { s = '0' + s; } | 19 | for (var i = 0; i < len; i++) { s = '0' + s; } |
7 | return s; | 20 | return s; |
8 | -}; | 21 | +} |
9 | 22 | ||
10 | export default { | 23 | export default { |
11 | getQueryStringByName: function (name) { | 24 | getQueryStringByName: function (name) { |
@@ -53,7 +53,7 @@ let routes = [ | @@ -53,7 +53,7 @@ let routes = [ | ||
53 | iconCls: 'el-icon-setting',//图标样式class | 53 | iconCls: 'el-icon-setting',//图标样式class |
54 | children: [ | 54 | children: [ |
55 | { path: '/user', component: User, name: '用户管理' }, | 55 | { path: '/user', component: User, name: '用户管理' }, |
56 | - { path: '/role', component: Role, name: '岗位管理' }, | 56 | + { path: '/role', component: Role, name: '组织机构' }, |
57 | { path: '/perm', component: Perm, name: '权限管理' }, | 57 | { path: '/perm', component: Perm, name: '权限管理' }, |
58 | { path: '/log', component: LOG, name: '系统日志' }, | 58 | { path: '/log', component: LOG, name: '系统日志' }, |
59 | { path: '/department', component: Department, name: '部门管理' }, | 59 | { path: '/department', component: Department, name: '部门管理' }, |
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" :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"> |
8 | <div class="tools" @click.prevent="collapse"> | 8 | <div class="tools" @click.prevent="collapse"> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | <el-col :span="24" class="main"> | 23 | <el-col :span="24" class="main"> |
24 | <aside :class="collapsed?'menu-collapsed':'menu-expanded'"> | 24 | <aside :class="collapsed?'menu-collapsed':'menu-expanded'"> |
25 | <!--导航菜单--> | 25 | <!--导航菜单--> |
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" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b"> | 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"> |
27 | <template v-for="(item,index) in $router.options.routes" v-if="!item.hidden"> | 27 | <template v-for="(item,index) in $router.options.routes" v-if="!item.hidden"> |
28 | <el-submenu :index="index+''" v-if="!item.leaf"> | 28 | <el-submenu :index="index+''" v-if="!item.leaf"> |
29 | <template slot="title"><i :class="item.iconCls"></i>{{item.name}}</template> | 29 | <template slot="title"><i :class="item.iconCls"></i>{{item.name}}</template> |
@@ -45,11 +45,11 @@ | @@ -45,11 +45,11 @@ | ||
45 | <li class="el-submenu"> | 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> | 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> | 47 | </li> |
48 | - </template> | ||
49 | - </li> | ||
50 | - </ul> | ||
51 | - </aside> | ||
52 | - <section class="content-container"> | 48 | +</template> |
49 | +</li> | ||
50 | +</ul> | ||
51 | +</aside> | ||
52 | +<section class="content-container"> | ||
53 | <div class="grid-content bg-purple-light"> | 53 | <div class="grid-content bg-purple-light"> |
54 | <el-col :span="24" class="breadcrumb-container"> | 54 | <el-col :span="24" class="breadcrumb-container"> |
55 | <strong class="title">{{$route.name}}</strong> | 55 | <strong class="title">{{$route.name}}</strong> |
@@ -61,25 +61,31 @@ | @@ -61,25 +61,31 @@ | ||
61 | </el-col> | 61 | </el-col> |
62 | <el-col :span="24" class="content-wrapper"> | 62 | <el-col :span="24" class="content-wrapper"> |
63 | <transition name="fade" mode="out-in"> | 63 | <transition name="fade" mode="out-in"> |
64 | - <router-view></router-view> | 64 | + <router-view :key="$route.path +$route.query.t"></router-view> |
65 | </transition> | 65 | </transition> |
66 | </el-col> | 66 | </el-col> |
67 | </div> | 67 | </div> |
68 | - </section> | ||
69 | - </el-col> | ||
70 | - </el-row> | 68 | +</section> |
69 | +</el-col> | ||
70 | +</el-row> | ||
71 | </template> | 71 | </template> |
72 | 72 | ||
73 | - | ||
74 | <script> | 73 | <script> |
75 | import rt from '../routes' | 74 | import rt from '../routes' |
76 | export default { | 75 | export default { |
76 | + | ||
77 | + provide() { | ||
78 | + return { | ||
79 | + reload: this.reload | ||
80 | + } | ||
81 | + }, | ||
77 | data() { | 82 | data() { |
78 | return { | 83 | return { |
79 | - sysName:'后勤管理平台', | 84 | + sysName:'易通快速通关申报管理系统', |
80 | collapsed:false, | 85 | collapsed:false, |
81 | sysUserName: '', | 86 | sysUserName: '', |
82 | sysUserAvatar: '', | 87 | sysUserAvatar: '', |
88 | + isRouterAlive: true, | ||
83 | form: { | 89 | form: { |
84 | name: '', | 90 | name: '', |
85 | region: '', | 91 | region: '', |
@@ -93,6 +99,16 @@ | @@ -93,6 +99,16 @@ | ||
93 | } | 99 | } |
94 | }, | 100 | }, |
95 | methods: { | 101 | methods: { |
102 | + reload() { | ||
103 | + this.$nextTick(function () { | ||
104 | + this.$router.push({ | ||
105 | + path: this.$router.path, | ||
106 | + query:{ | ||
107 | + t: new Date().getTime() | ||
108 | + } | ||
109 | + }) | ||
110 | + }) | ||
111 | + }, | ||
96 | onSubmit() { | 112 | onSubmit() { |
97 | console.log('submit!'); | 113 | console.log('submit!'); |
98 | }, | 114 | }, |
@@ -103,7 +119,7 @@ | @@ -103,7 +119,7 @@ | ||
103 | console.log('handleclose'); | 119 | console.log('handleclose'); |
104 | }, | 120 | }, |
105 | handleselect: function (a, b) { | 121 | handleselect: function (a, b) { |
106 | - console.log('handleselect!'); | 122 | + this.reload() |
107 | }, | 123 | }, |
108 | //退出登录 | 124 | //退出登录 |
109 | logout: function () { | 125 | logout: function () { |
@@ -113,7 +129,6 @@ | @@ -113,7 +129,6 @@ | ||
113 | }).then(() => { | 129 | }).then(() => { |
114 | sessionStorage.removeItem('user'); | 130 | sessionStorage.removeItem('user'); |
115 | sessionStorage.removeItem('menu'); | 131 | sessionStorage.removeItem('menu'); |
116 | - | ||
117 | //退出后初始化原来的路由 | 132 | //退出后初始化原来的路由 |
118 | let sysRoutes = JSON.parse(sessionStorage.getItem('sysMenu')); | 133 | let sysRoutes = JSON.parse(sessionStorage.getItem('sysMenu')); |
119 | console.log(sysRoutes); | 134 | console.log(sysRoutes); |
@@ -157,7 +172,6 @@ | @@ -157,7 +172,6 @@ | ||
157 | 172 | ||
158 | <style scoped lang="scss"> | 173 | <style scoped lang="scss"> |
159 | @import '~scss_vars'; | 174 | @import '~scss_vars'; |
160 | - | ||
161 | .container { | 175 | .container { |
162 | position: absolute; | 176 | position: absolute; |
163 | top: 0px; | 177 | top: 0px; |
@@ -166,7 +180,7 @@ | @@ -166,7 +180,7 @@ | ||
166 | .header { | 180 | .header { |
167 | height: 60px; | 181 | height: 60px; |
168 | line-height: 60px; | 182 | line-height: 60px; |
169 | - background: $color-primary; | 183 | + background: $color-primary url("/static/images/air-banner.png"); |
170 | color:#fff; | 184 | color:#fff; |
171 | .userinfo { | 185 | .userinfo { |
172 | text-align: right; | 186 | text-align: right; |
@@ -229,9 +243,6 @@ | @@ -229,9 +243,6 @@ | ||
229 | // position: absolute; | 243 | // position: absolute; |
230 | // top: 0px; | 244 | // top: 0px; |
231 | // bottom: 0px; | 245 | // bottom: 0px; |
232 | - .el-menu{ | ||
233 | - height: 100%; | ||
234 | - } | ||
235 | .collapsed{ | 246 | .collapsed{ |
236 | width:60px; | 247 | width:60px; |
237 | .item{ | 248 | .item{ |
@@ -268,16 +279,21 @@ | @@ -268,16 +279,21 @@ | ||
268 | // bottom: 0px; | 279 | // bottom: 0px; |
269 | // left: 230px; | 280 | // left: 230px; |
270 | overflow-y: scroll; | 281 | overflow-y: scroll; |
271 | - padding: 20px; | 282 | + padding: 10px; |
272 | .breadcrumb-container { | 283 | .breadcrumb-container { |
273 | //margin-bottom: 15px; | 284 | //margin-bottom: 15px; |
274 | .title { | 285 | .title { |
275 | width: 200px; | 286 | width: 200px; |
276 | float: left; | 287 | float: left; |
277 | color: #475669; | 288 | color: #475669; |
289 | + margin-left: 10px; | ||
278 | } | 290 | } |
279 | .breadcrumb-inner { | 291 | .breadcrumb-inner { |
280 | float: right; | 292 | float: right; |
293 | + margin-right:10px; | ||
294 | + } | ||
295 | + .el-breadcrumb{ | ||
296 | + line-height:36px; | ||
281 | } | 297 | } |
282 | } | 298 | } |
283 | .content-wrapper { | 299 | .content-wrapper { |
@@ -288,3 +304,41 @@ | @@ -288,3 +304,41 @@ | ||
288 | } | 304 | } |
289 | } | 305 | } |
290 | </style> | 306 | </style> |
307 | +<style lang="scss"> | ||
308 | + .darkmenu{ | ||
309 | + .main { | ||
310 | + aside { | ||
311 | + .el-menu{ | ||
312 | + height: 100%; | ||
313 | + background: #606060; | ||
314 | + .el-menu-item { | ||
315 | + i{ | ||
316 | + color: white; | ||
317 | + } | ||
318 | + color: white; | ||
319 | + } | ||
320 | + .el-menu-item.is-active{ | ||
321 | + color:#e6a23c; | ||
322 | + } | ||
323 | + .el-menu-item:hover,.el-menu-item:focus{ | ||
324 | + background-color: #1a4496; | ||
325 | + } | ||
326 | + .el-submenu { | ||
327 | + ul.el-menu.el-menu--inline{ | ||
328 | + background: #303030; | ||
329 | + } | ||
330 | + .el-submenu__title { | ||
331 | + color: white; | ||
332 | + i{ | ||
333 | + color: white; | ||
334 | + } | ||
335 | + } | ||
336 | + .el-submenu__title:hover { | ||
337 | + background-color: #1a4496; | ||
338 | + } | ||
339 | + } | ||
340 | + } | ||
341 | + } | ||
342 | + } | ||
343 | + } | ||
344 | +</style> |
@@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
3 | <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px" class="demo-ruleForm login-container" id="loginForm"> | 3 | <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px" class="demo-ruleForm login-container" id="loginForm"> |
4 | <h3 class="title">系统登录</h3> | 4 | <h3 class="title">系统登录</h3> |
5 | <el-form-item prop="account"> | 5 | <el-form-item prop="account"> |
6 | - <el-input type="text" v-model="ruleForm2.account" auto-complete="off" placeholder="账号"></el-input> | 6 | + <el-input type="text" v-model="ruleForm2.account" autofocus placeholder="账号"></el-input> |
7 | </el-form-item> | 7 | </el-form-item> |
8 | <el-form-item prop="checkPass"> | 8 | <el-form-item prop="checkPass"> |
9 | - <el-input type="password" v-model="ruleForm2.checkPass" auto-complete="off" placeholder="密码"></el-input> | 9 | + <el-input type="password" v-model="ruleForm2.checkPass" placeholder="密码" @keyup.enter.native="handleSubmit2"></el-input> |
10 | </el-form-item> | 10 | </el-form-item> |
11 | - <el-checkbox v-model="checked" checked class="remember">记住密码</el-checkbox> | 11 | + <el-checkbox v-model="checked" checked class="remeberme">记住密码</el-checkbox> |
12 | <el-form-item style="width:100%;"> | 12 | <el-form-item style="width:100%;"> |
13 | <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit2" :loading="logining" :plain="true">登录</el-button> | 13 | <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit2" :loading="logining" :plain="true">登录</el-button> |
14 | <!--<el-button @click.native.prevent="handleReset2">重置</el-button>--> | 14 | <!--<el-button @click.native.prevent="handleReset2">重置</el-button>--> |
@@ -42,8 +42,8 @@ | @@ -42,8 +42,8 @@ | ||
42 | fixStyle: '', | 42 | fixStyle: '', |
43 | logining: false, | 43 | logining: false, |
44 | ruleForm2: { | 44 | ruleForm2: { |
45 | - account: 'admin', | ||
46 | - checkPass: '123456' | 45 | + account: '', |
46 | + checkPass: '' | ||
47 | }, | 47 | }, |
48 | rules2: { | 48 | rules2: { |
49 | account: [ | 49 | account: [ |
@@ -16,22 +16,26 @@ | @@ -16,22 +16,26 @@ | ||
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%;"> | 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 | + > | ||
20 | <el-table-column type="selection" width="55"> | 24 | <el-table-column type="selection" width="55"> |
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" 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" 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" 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="100" :formatter="formatState" 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="300" 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="100"> |
35 | <template slot-scope="scope"> | 39 | <template slot-scope="scope"> |
36 | <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | 40 | <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> | 41 | <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> |
@@ -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: 100, |
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; |
@@ -16,28 +16,38 @@ | @@ -16,28 +16,38 @@ | ||
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%;"> | 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'}"> | ||
20 | <el-table-column type="selection" width="55"> | 24 | <el-table-column type="selection" width="55"> |
21 | </el-table-column> | 25 | </el-table-column> |
22 | - <el-table-column type="index" width="60"> | ||
23 | - </el-table-column> | ||
24 | - <el-table-column prop="roleId" label="ID" width="100" sortable> | 26 | + <!--<el-table-column type="index" width="60">--> |
27 | + <!--</el-table-column>--> | ||
28 | + <el-table-column prop="roleId" label="ID" width="120"> | ||
25 | </el-table-column> | 29 | </el-table-column> |
26 | <el-table-column prop="roleName" label="岗位/角色名称" min-width="200" sortable> | 30 | <el-table-column prop="roleName" label="岗位/角色名称" min-width="200" sortable> |
27 | </el-table-column> | 31 | </el-table-column> |
28 | - <el-table-column prop="departmentName" 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="160" > | ||
35 | + </el-table-column> | ||
36 | + <el-table-column prop="type" label="类型" min-width="80" sortable> | ||
29 | </el-table-column> | 37 | </el-table-column> |
30 | - <el-table-column prop="description" label="岗位/角色描述" min-width="200" sortable> | 38 | + <el-table-column prop="businessLicense" label="工商代码" min-width="180" > |
39 | + </el-table-column> | ||
40 | + <el-table-column prop="customsRegCode" label="海关备案代码" min-width="150" > | ||
31 | </el-table-column> | 41 | </el-table-column> |
32 | <el-table-column label="操作" min-width="260"> | 42 | <el-table-column label="操作" min-width="260"> |
33 | <template slot-scope="scope"> | 43 | <template slot-scope="scope"> |
44 | + <el-button type="primary" size="small" @click="handleAdd(scope.$index, scope.row)">新增下级</el-button> | ||
34 | <el-button size="small" @click="setPerm(scope.$index, scope.row)">设置权限</el-button> | 45 | <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> | 46 | <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> | 47 | <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> |
37 | </template> | 48 | </template> |
38 | </el-table-column> | 49 | </el-table-column> |
39 | </el-table> | 50 | </el-table> |
40 | - | ||
41 | <!--工具条--> | 51 | <!--工具条--> |
42 | <el-col :span="24" class="toolbar"> | 52 | <el-col :span="24" class="toolbar"> |
43 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 53 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
@@ -76,23 +86,37 @@ | @@ -76,23 +86,37 @@ | ||
76 | 86 | ||
77 | <!--新增界面--> | 87 | <!--新增界面--> |
78 | <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | 88 | <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> | 89 | + <el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm"> |
90 | + <el-form-item label="上级组织机构"> | ||
91 | + <span>{{addForm.parentName}}</span> | ||
82 | </el-form-item> | 92 | </el-form-item> |
83 | - <el-form-item label="岗位/角色描述" prop="description"> | ||
84 | - <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | 93 | + <el-form-item label="组织机构名称" prop="roleName"> |
94 | + <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入组织机构名称:例如:公司名称"></el-input> | ||
85 | </el-form-item> | 95 | </el-form-item> |
86 | - <el-form-item label="部门名称" prop="roleSign"> | ||
87 | - <el-select v-model="addForm.departmentId" placeholder="请选择"> | 96 | + <el-form-item label="组织机构描述" prop="description"> |
97 | + <el-input v-model="addForm.description" auto-complete="off" placeholder="组织机构描述:例如:组织机构简介"></el-input> | ||
98 | + </el-form-item> | ||
99 | + <el-form-item label="组织机构类型" prop="description"> | ||
100 | + <el-select | ||
101 | + v-model="addForm.type" | ||
102 | + filterable | ||
103 | + allow-create | ||
104 | + default-first-option | ||
105 | + placeholder="请选择类型"> | ||
88 | <el-option | 106 | <el-option |
89 | - v-for="item in departmentNameList" | ||
90 | - :key="item.departmentId" | ||
91 | - :label="item.departmentName" | ||
92 | - :value="item.departmentId"> | 107 | + v-for="item in companyOption" |
108 | + :key="item.value" | ||
109 | + :label="item.label" | ||
110 | + :value="item.value"> | ||
93 | </el-option> | 111 | </el-option> |
94 | </el-select> | 112 | </el-select> |
95 | </el-form-item> | 113 | </el-form-item> |
114 | + <el-form-item label="工商企业代码" prop="description"> | ||
115 | + <el-input v-model="addForm.businessLicense" auto-complete="off" placeholder="社会信用代码或者组织机构代码"></el-input> | ||
116 | + </el-form-item> | ||
117 | + <el-form-item label="海关备案代码" prop="description"> | ||
118 | + <el-input v-model="addForm.customsRegCode" auto-complete="off" placeholder="海关备案后返回的备案代码"></el-input> | ||
119 | + </el-form-item> | ||
96 | </el-form> | 120 | </el-form> |
97 | <div slot="footer" class="dialog-footer"> | 121 | <div slot="footer" class="dialog-footer"> |
98 | <el-button @click.native="addFormVisible = false">取消</el-button> | 122 | <el-button @click.native="addFormVisible = false">取消</el-button> |
@@ -103,9 +127,11 @@ | @@ -103,9 +127,11 @@ | ||
103 | <!--权限设置界面--> | 127 | <!--权限设置界面--> |
104 | <el-dialog title="岗位的权限设置" :visible.sync="PermFormVisible" :close-on-click-modal="false"> | 128 | <el-dialog title="岗位的权限设置" :visible.sync="PermFormVisible" :close-on-click-modal="false"> |
105 | <el-form :model="permForm" label-width="80px" ref="permForm"> | 129 | <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> | 130 | + <el-tree :data="permissons" :props="treeDefaultProps" |
131 | + @check="clickDeal" | ||
132 | + show-checkbox highlight-current default-expand-all check-on-click-node check-strictly | ||
133 | + node-key="permissionId" ref="tree"> | ||
134 | + </el-tree> | ||
109 | </el-form> | 135 | </el-form> |
110 | <div slot="footer" class="dialog-footer"> | 136 | <div slot="footer" class="dialog-footer"> |
111 | <el-button @click.native="PermFormVisible = false">取消</el-button> | 137 | <el-button @click.native="PermFormVisible = false">取消</el-button> |
@@ -128,6 +154,20 @@ | @@ -128,6 +154,20 @@ | ||
128 | filters: { | 154 | filters: { |
129 | roleName: '' | 155 | roleName: '' |
130 | }, | 156 | }, |
157 | + companyOption: [ | ||
158 | + { | ||
159 | + label: "集团", | ||
160 | + value: "集团" | ||
161 | + }, | ||
162 | + { | ||
163 | + label: "公司", | ||
164 | + value: "公司" | ||
165 | + } | ||
166 | + ], | ||
167 | + treeDefaultProps: { | ||
168 | + children: 'children', | ||
169 | + label: 'name', | ||
170 | + }, | ||
131 | departmentNameList:[], | 171 | departmentNameList:[], |
132 | roles: [], | 172 | roles: [], |
133 | permissons: [], | 173 | permissons: [], |
@@ -172,7 +212,12 @@ | @@ -172,7 +212,12 @@ | ||
172 | description: '', | 212 | description: '', |
173 | roleName: '', | 213 | roleName: '', |
174 | roleSign: 1, | 214 | roleSign: 1, |
175 | - departmentId:'' | 215 | + departmentId:'', |
216 | + type: '', | ||
217 | + businessLicense: '', | ||
218 | + customsRegCode: '', | ||
219 | + parentName: '' | ||
220 | + | ||
176 | }, | 221 | }, |
177 | permForm: { | 222 | permForm: { |
178 | roleId: 1, | 223 | roleId: 1, |
@@ -225,7 +270,6 @@ | @@ -225,7 +270,6 @@ | ||
225 | 270 | ||
226 | }, | 271 | }, |
227 | 272 | ||
228 | - | ||
229 | //获取部门列表 | 273 | //获取部门列表 |
230 | getdepartmentNames() { | 274 | getdepartmentNames() { |
231 | 275 | ||
@@ -265,7 +309,11 @@ | @@ -265,7 +309,11 @@ | ||
265 | if(null!= error.response && error.response!==undefined){ | 309 | if(null!= error.response && error.response!==undefined){ |
266 | let status= error.response.status; | 310 | let status= error.response.status; |
267 | let msg = error.response.statusText; | 311 | let msg = error.response.statusText; |
268 | - alert(status+msg); | 312 | + message({ |
313 | + // 饿了么的消息弹窗组件 | ||
314 | + message: status+msg, | ||
315 | + type: "error" | ||
316 | + }); | ||
269 | }else { | 317 | }else { |
270 | alert(error); | 318 | alert(error); |
271 | } | 319 | } |
@@ -305,9 +353,10 @@ | @@ -305,9 +353,10 @@ | ||
305 | this.getdepartmentNames(); | 353 | this.getdepartmentNames(); |
306 | }, | 354 | }, |
307 | setPerm: function (index, row) { | 355 | setPerm: function (index, row) { |
356 | + this.PermFormVisible = true; | ||
357 | + this.getPermList(); | ||
308 | var _this = this; | 358 | var _this = this; |
309 | this.permIds = []; | 359 | this.permIds = []; |
310 | - this.PermFormVisible = true; | ||
311 | this.permForm = Object.assign({}, row); | 360 | this.permForm = Object.assign({}, row); |
312 | let rolePerms = this.permForm.permissions; | 361 | let rolePerms = this.permForm.permissions; |
313 | if (util.checkNull(rolePerms)){ | 362 | if (util.checkNull(rolePerms)){ |
@@ -317,22 +366,36 @@ | @@ -317,22 +366,36 @@ | ||
317 | } | 366 | } |
318 | }); | 367 | }); |
319 | } | 368 | } |
320 | - this.getPermList(); | 369 | + |
370 | + this.$nextTick(() => { | ||
371 | + | ||
372 | + //反向适配 | ||
373 | + this.$refs.tree.setCheckedKeys(this.permIds); | ||
374 | + }); | ||
321 | }, | 375 | }, |
322 | //显示新增界面,每次点开初始化数据 | 376 | //显示新增界面,每次点开初始化数据 |
323 | - handleAdd: function () { | 377 | + handleAdd: function (index,row) { |
324 | this.addFormVisible = true; | 378 | this.addFormVisible = true; |
325 | this.addForm = { | 379 | this.addForm = { |
326 | - username: '', | ||
327 | - password: '', | ||
328 | - sex: 1, | ||
329 | - address: '', | ||
330 | - realname: '', | ||
331 | - email: '', | ||
332 | - mobilephone: '', | ||
333 | - age: 1 | 380 | + description: '', |
381 | + roleName: '', | ||
382 | + roleSign: 1, | ||
383 | + departmentId:'', | ||
384 | + type: '', | ||
385 | + businessLicense: '', | ||
386 | + customsRegCode: '', | ||
387 | + parentid: 0 | ||
388 | + | ||
334 | }; | 389 | }; |
335 | - this.getdepartmentNames(); | 390 | + //如果新增下级 |
391 | + if(util.checkNull(row)){ | ||
392 | + //传递上级ID | ||
393 | + let parentRole = Object.assign({}, row); | ||
394 | + this.addForm.parentid = parentRole.roleId; | ||
395 | + this.addForm.parentName = parentRole.roleName; | ||
396 | + } | ||
397 | + | ||
398 | +// this.getdepartmentNames(); | ||
336 | }, | 399 | }, |
337 | //编辑 | 400 | //编辑 |
338 | editSubmit: function () { | 401 | editSubmit: function () { |
@@ -403,7 +466,7 @@ | @@ -403,7 +466,7 @@ | ||
403 | //NProgress.start(); | 466 | //NProgress.start(); |
404 | let role = Object.assign({}, this.permForm); | 467 | let role = Object.assign({}, this.permForm); |
405 | let roleId = role.roleId; | 468 | let roleId = role.roleId; |
406 | - let permissionIds = this.permIds | 469 | + let permissionIds = this.$refs.tree.getCheckedKeys(); |
407 | let para = {roleId,permissionIds}; | 470 | let para = {roleId,permissionIds}; |
408 | updateRolePerm(para).then((res) => { | 471 | updateRolePerm(para).then((res) => { |
409 | this.addLoading = false; | 472 | this.addLoading = false; |
@@ -446,6 +509,81 @@ | @@ -446,6 +509,81 @@ | ||
446 | }).catch(() => { | 509 | }).catch(() => { |
447 | 510 | ||
448 | }); | 511 | }); |
512 | + }, | ||
513 | + treeHandleCheckChange: function (data, checked, indeterminate) { | ||
514 | + if(checked) { | ||
515 | + this.permIds.push(data.permissionId); | ||
516 | + }else { | ||
517 | + this.permIds.splice(this.permIds.contains(data.permissionId),1); | ||
518 | + } | ||
519 | + console.log(data, checked, indeterminate); | ||
520 | + | ||
521 | + }, | ||
522 | + uniteParentSame(id,treeStatus){//当子节点全为未选中时父节点也变为未选中状态 | ||
523 | + let node = this.$refs.tree.getNode(permissionId);//获取当前节点的节点树 | ||
524 | + if (node.parent !== null && node.parent !== undefined) { | ||
525 | + let parentNode = node.parent.data;//获取当前节点的父节点树 | ||
526 | + if (parentNode != undefined){//判断父节点是否存在 | ||
527 | + for (let i = 0; i < parentNode.children.length; i++) { | ||
528 | + let checkedKeys = this.$refs.tree.getCheckedKeys(); | ||
529 | + let hafCheckedKeys = this.$refs.tree.getHalfCheckedKeys(); | ||
530 | + let selectNodes = checkedKeys.concat(hafCheckedKeys);//获取已选择树节点 | ||
531 | + let selected = selectNodes.indexOf(parentNode.children[i].permissionId); // -1当前节点的同级节点是否全部未选中 | ||
532 | + if (selected !== -1){ | ||
533 | + return; | ||
534 | + } | ||
535 | + } | ||
536 | + }else { | ||
537 | + return; | ||
538 | + } | ||
539 | + this.$refs.tree.setChecked(parentNode.permissionId, false);//修改节点为未选择 | ||
540 | + if(node.level>2){//判断是否是最上级节点 | ||
541 | + this.uniteParentSame(parentNode.permissionId,treeStatus) | ||
542 | + } | ||
543 | + }else { | ||
544 | + return; | ||
545 | + } | ||
546 | + }, | ||
547 | + | ||
548 | + // 统一处理子节点为相同的勾选状态 | ||
549 | + uniteChildSame(treeList, isSelected){ | ||
550 | + this.$refs.tree.setChecked(treeList.permissionId, isSelected); | ||
551 | + if (treeList.children !== undefined){ | ||
552 | + for (let i = 0; i < treeList.children.length; i++) { | ||
553 | + this.uniteChildSame(treeList.children[i], isSelected) | ||
554 | + } | ||
555 | + } | ||
556 | + }, | ||
557 | + // 统一处理父节点为选中 | ||
558 | + selectedParent(currentObj){ | ||
559 | + let currentNode = this.$refs.tree.getNode(currentObj); | ||
560 | + if (currentNode.parent.key !== undefined) { | ||
561 | + this.$refs.tree.setChecked(currentNode.parent, true); | ||
562 | + this.selectedParent(currentNode.parent) | ||
563 | + } | ||
564 | + }, | ||
565 | + clickDeal: function (currentObj, treeStatus){ | ||
566 | + // 用于:父子节点严格互不关联时,父节点勾选变化时通知子节点同步变化,实现单向关联。 | ||
567 | + let selected = treeStatus.checkedKeys.indexOf(currentObj.permissionId); // -1未选中 | ||
568 | + // 选中 | ||
569 | + if (selected !== -1) { | ||
570 | + // 子节点只要被选中父节点就被选中 | ||
571 | + this.selectedParent(currentObj); | ||
572 | + // 统一处理子节点为相同的勾选状态 | ||
573 | + this.uniteChildSame(currentObj, true) | ||
574 | + } else { | ||
575 | + // 未选中 处理子节点全部未选中 | ||
576 | + if (currentObj.children !== undefined){ | ||
577 | + if (currentObj.children.length !== 0) { | ||
578 | + this.uniteChildSame(currentObj, false) | ||
579 | + } | ||
580 | + //放开时为当子节点全为未选中时父节点也变为未选中状态 注释后就是父节点不和子节点强制绑定 | ||
581 | + // this.uniteParentSame(currentObj.id,treeStatus)//当子节点全为未选中时父节点也变为未选中状态 | ||
582 | + } | ||
583 | + // else { | ||
584 | + // this.uniteParentSame(currentObj.id,treeStatus) | ||
585 | + // } | ||
586 | + } | ||
449 | } | 587 | } |
450 | }, | 588 | }, |
451 | mounted() { | 589 | mounted() { |
@@ -19,11 +19,11 @@ | @@ -19,11 +19,11 @@ | ||
19 | </el-col> | 19 | </el-col> |
20 | 20 | ||
21 | <!--列表--> | 21 | <!--列表--> |
22 | - <el-table :data="users" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | 22 | + <el-table :data="users" highlight-current-row border v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> |
23 | <el-table-column type="selection" width="55"> | 23 | <el-table-column type="selection" width="55"> |
24 | </el-table-column> | 24 | </el-table-column> |
25 | - <el-table-column type="index" width="60"> | ||
26 | - </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> | 27 | <el-table-column prop="userId" label="ID" width="100" sortable> |
28 | </el-table-column> | 28 | </el-table-column> |
29 | <el-table-column prop="username" label="账号" width="120" sortable> | 29 | <el-table-column prop="username" label="账号" width="120" sortable> |
@@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
46 | </el-table-column> | 46 | </el-table-column> |
47 | <el-table-column label="操作" width="250"> | 47 | <el-table-column label="操作" width="250"> |
48 | <template slot-scope="scope"> | 48 | <template slot-scope="scope"> |
49 | - <el-button size="small" @click="roleEdit(scope.$index, scope.row)">权限配置</el-button> | 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> | 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> | 51 | <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> |
52 | </template> | 52 | </template> |
@@ -126,7 +126,7 @@ | @@ -126,7 +126,7 @@ | ||
126 | <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | 126 | <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> |
127 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 127 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
128 | <el-form-item label="账号" prop="username"> | 128 | <el-form-item label="账号" prop="username"> |
129 | - <el-input v-model="addForm.username"></el-input> | 129 | + <el-input v-model="addForm.username" aria-placeholder="用户名长度在5-11位,支持英文和数字"></el-input> |
130 | </el-form-item> | 130 | </el-form-item> |
131 | <el-form-item label="密码" prop="password"> | 131 | <el-form-item label="密码" prop="password"> |
132 | <el-input v-model="addForm.password" type="password"></el-input> | 132 | <el-input v-model="addForm.password" type="password"></el-input> |
@@ -168,10 +168,10 @@ | @@ -168,10 +168,10 @@ | ||
168 | <el-form-item label="账号"> | 168 | <el-form-item label="账号"> |
169 | <span>{{roleEditForm.username}}</span> | 169 | <span>{{roleEditForm.username}}</span> |
170 | </el-form-item> | 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> | 171 | + <el-tree :data="roles" :props="treeDefaultProps" default-expand-all show-checkbox highlight-current check-strictly node-key="roleId" ref="tree" @check-change="treeHandleCheckChange"> |
172 | + </el-tree> | ||
174 | </el-form> | 173 | </el-form> |
174 | + | ||
175 | <div slot="footer" class="dialog-footer"> | 175 | <div slot="footer" class="dialog-footer"> |
176 | <el-button @click.native="roleFormVisible = false">取消</el-button> | 176 | <el-button @click.native="roleFormVisible = false">取消</el-button> |
177 | <el-button type="primary" @click.native="roleEditSubmit" :loading="addLoading">提交</el-button> | 177 | <el-button type="primary" @click.native="roleEditSubmit" :loading="addLoading">提交</el-button> |
@@ -193,6 +193,10 @@ | @@ -193,6 +193,10 @@ | ||
193 | userName: '', | 193 | userName: '', |
194 | realName: '' | 194 | realName: '' |
195 | }, | 195 | }, |
196 | + treeDefaultProps: { | ||
197 | + children: 'children', | ||
198 | + label: 'roleName', | ||
199 | + }, | ||
196 | users: [], | 200 | users: [], |
197 | total: 0, | 201 | total: 0, |
198 | pageNum: 1, | 202 | pageNum: 1, |
@@ -226,7 +230,10 @@ | @@ -226,7 +230,10 @@ | ||
226 | addLoading: false, | 230 | addLoading: false, |
227 | addFormRules: { | 231 | addFormRules: { |
228 | username: [ | 232 | username: [ |
229 | - { required: true, message: '请输入姓名', trigger: 'blur' } | 233 | + { required: true, message: '请输入姓名,用户名长度在5-11位,支持英文和数字', trigger: 'blur' }, |
234 | + ], | ||
235 | + password: [ | ||
236 | + { required: true, message: '请输入密码,用户名长度在6-18位,支持英文和数字和非空字符', trigger: 'blur'} | ||
230 | ] | 237 | ] |
231 | }, | 238 | }, |
232 | //用户角色配置 | 239 | //用户角色配置 |
@@ -317,16 +324,24 @@ | @@ -317,16 +324,24 @@ | ||
317 | this.editForm = Object.assign({}, row); | 324 | this.editForm = Object.assign({}, row); |
318 | }, | 325 | }, |
319 | roleEdit: function (index, row) { | 326 | roleEdit: function (index, row) { |
327 | + this.roleFormVisible = true; | ||
328 | + this.getRoles(); | ||
320 | var _this = this; | 329 | var _this = this; |
321 | _this.roleIds = []; | 330 | _this.roleIds = []; |
322 | this.roleEditForm = Object.assign({}, row); | 331 | 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) { | 332 | + let roles = this.roleEditForm.roles; |
333 | + | ||
334 | + if (util.checkNull(roles)){ | ||
335 | + roles.forEach(function (role,v_index,v_arr) { | ||
336 | + if (util.checkNull(role)) { | ||
326 | _this.roleIds[v_index] = role.roleId; | 337 | _this.roleIds[v_index] = role.roleId; |
338 | + } | ||
327 | }); | 339 | }); |
328 | } | 340 | } |
329 | - this.getRoles(); | 341 | + this.$nextTick(() => { |
342 | + //反向适配 | ||
343 | + this.$refs.tree.setCheckedKeys(this.roleIds); | ||
344 | + }); | ||
330 | }, | 345 | }, |
331 | getRoles() { | 346 | getRoles() { |
332 | let para = { | 347 | let para = { |
@@ -336,7 +351,6 @@ | @@ -336,7 +351,6 @@ | ||
336 | NProgress.start(); | 351 | NProgress.start(); |
337 | getList(para).then((res) => { | 352 | getList(para).then((res) => { |
338 | this.roles = res.data.list; | 353 | this.roles = res.data.list; |
339 | - this.roleFormVisible = true; | ||
340 | NProgress.done(); | 354 | NProgress.done(); |
341 | }).catch((error) => { | 355 | }).catch((error) => { |
342 | if(null!= error.response && error.response!==undefined){ | 356 | if(null!= error.response && error.response!==undefined){ |
@@ -348,6 +362,7 @@ | @@ -348,6 +362,7 @@ | ||
348 | } | 362 | } |
349 | }); | 363 | }); |
350 | 364 | ||
365 | + | ||
351 | }, | 366 | }, |
352 | //显示新增界面,每次点开初始化数据 | 367 | //显示新增界面,每次点开初始化数据 |
353 | handleAdd: function () { | 368 | handleAdd: function () { |
@@ -420,7 +435,10 @@ | @@ -420,7 +435,10 @@ | ||
420 | this.getUsers(); | 435 | this.getUsers(); |
421 | }).catch(error => { | 436 | }).catch(error => { |
422 | this.addLoading = false; | 437 | this.addLoading = false; |
423 | - alert(error.message); | 438 | + this.$message({ |
439 | + message: error.message, | ||
440 | + type: 'error' | ||
441 | + }); | ||
424 | }); | 442 | }); |
425 | }); | 443 | }); |
426 | } | 444 | } |
@@ -455,11 +473,14 @@ | @@ -455,11 +473,14 @@ | ||
455 | this.$confirm('确认提交吗?', '提示', {}).then(() => { | 473 | this.$confirm('确认提交吗?', '提示', {}).then(() => { |
456 | // this.editLoading = true; | 474 | // this.editLoading = true; |
457 | let userId = this.roleEditForm.userId; | 475 | let userId = this.roleEditForm.userId; |
458 | - let roleIds = this.roleIds; | 476 | + let roleIds = this.$refs.tree.getCheckedKeys(); |
459 | let para = {userId,roleIds}; | 477 | let para = {userId,roleIds}; |
460 | setUserRole(para).then((res) => { | 478 | setUserRole(para).then((res) => { |
461 | if (res.status ===200) { | 479 | if (res.status ===200) { |
462 | - alert("ok"); | 480 | + this.$message({ |
481 | + message: '岗位设置成功', | ||
482 | + type: 'success' | ||
483 | + }); | ||
463 | } | 484 | } |
464 | this.getUsers(); | 485 | this.getUsers(); |
465 | this.roleFormVisible = false; | 486 | this.roleFormVisible = false; |
@@ -474,6 +495,15 @@ | @@ -474,6 +495,15 @@ | ||
474 | }, | 495 | }, |
475 | beforeAvatarUpload: function () { | 496 | beforeAvatarUpload: function () { |
476 | 497 | ||
498 | + }, | ||
499 | + treeHandleCheckChange: function (data, checked, indeterminate) { | ||
500 | + if(checked) { | ||
501 | + this.roleIds.push(data.roleId); | ||
502 | + }else { | ||
503 | + this.roleIds.splice(this.roleIds.contains(data.roleId),1); | ||
504 | + } | ||
505 | +// console.log(data, checked, indeterminate); | ||
506 | + console.log(this.roleIds); | ||
477 | } | 507 | } |
478 | }, | 508 | }, |
479 | mounted() { | 509 | mounted() { |
static/images/air-banner.png
0 → 100644

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