Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
enilu committed Jan 10, 2019
1 parent 063c4f1 commit 7103e7d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion guns-admin-vuejs/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = {
* then assetsPublicPath should be set to "/bar/".
* In most cases please use '/' !!!
*/
assetsPublicPath: '/vue/', // If you are deployed on the root path, please use '/'
assetsPublicPath: '/', // If you are deployed on the root path, please use '/'

/**
* Source Maps
Expand Down
1 change: 1 addition & 0 deletions guns-admin-vuejs/src/views/system/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default {
return false
},
add() {
this.form = {}
this.formTitle = '添加菜单'
this.formVisible = true
this.isAdd = true
Expand Down
75 changes: 35 additions & 40 deletions guns-admin-vuejs/src/views/system/role/role.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@

import { remove , getList , save , getRoleTree ,getPermissons , savePermissons } from '@/api/system/role'
import { list as getDeptList } from '@/api/system/dept'
import { remove, getList, save, getRoleTree, getPermissons, savePermissons } from '@/api/system/role'
import { list as getDeptList } from '@/api/system/dept'
import { menuTreeListByRoleId } from '@/api/system/menu'



export default {
data() {
return {
formVisible: false,
formTitle: '添加角色',
deptList:[],
roleList:[],
deptList: [],
roleList: [],
isAdd: true,
checkedPermissionKeys:[],
permissons:[],
checkedPermissionKeys: [],
permissons: [],
defaultProps: {
id: "id",
label: 'name',
children: 'children'
},
permissonVisible:false,
deptTree:{
permissonVisible: false,
deptTree: {
show: false,
defaultProps: {
id: "id",
label: 'simplename',
children: 'children'
}
},
roleTree:{
roleTree: {
show: false,
defaultProps: {
id: "id",
Expand All @@ -42,12 +40,12 @@ export default {
tips: '',
name: '',
deptid: '',
pid: '',
pid: 0,
id: '',
version: '',
deptName: '',
pName: '',
num:1
num: 1
},
rules: {
tips: [
Expand All @@ -62,10 +60,10 @@ export default {
listQuery: {
name: undefined
},
total:0,
total: 0,
list: null,
listLoading: true,
selRow:{}
selRow: {}
}
},
filters: {
Expand All @@ -83,9 +81,9 @@ export default {
},
methods: {
init() {
getDeptList().then(response => {
this.deptList = response.data
})
getDeptList().then(response => {
this.deptList = response.data
})
this.fetchData()
},
fetchData() {
Expand All @@ -107,38 +105,36 @@ export default {
handleFilter() {
this.getList()
},
fetchNext(){
fetchNext() {
this.listQuery.page = this.listQuery.page + 1
this.fetchData();
},
fetchPrev(){
fetchPrev() {
this.listQuery.page = this.listQuery.page - 1
this.fetchData();
},
fetchPage(page){
fetchPage(page) {
this.listQuery.page = page
this.fetchData()
},
changeSize(limit){
changeSize(limit) {
this.listQuery.limit = limit;
this.fetchData();
},
handleCurrentChange(currentRow,oldCurrentRow){
console.log('-------')
console.log(currentRow)
handleCurrentChange(currentRow, oldCurrentRow) {
this.selRow = currentRow
},
resetForm() {
this.form = {
this.form = {
tips: '',
name: '',
deptid: '',
pid: '',
pid: 0,
id: '',
version: '',
deptName: '',
pName: '',
num:1
num: 1

}
},
Expand All @@ -149,7 +145,6 @@ export default {
this.isAdd = true
},
save() {
var self = this
this.$refs['form'].validate((valid) => {
if (valid) {
save(this.form).then(response => {
Expand All @@ -171,8 +166,8 @@ export default {


},
checkSel(){
if(this.selRow && this.selRow.id){
checkSel() {
if (this.selRow && this.selRow.id) {
return true
}
this.$message({
Expand All @@ -181,8 +176,8 @@ export default {
});
return false
},
edit(){
if(this.checkSel()){
edit() {
if (this.checkSel()) {
this.isAdd = false
console.log(this.selRow)
this.form = this.selRow
Expand All @@ -192,8 +187,8 @@ export default {
this.formVisible = true
}
},
remove(){
if(this.checkSel()){
remove() {
if (this.checkSel()) {
var id = this.selRow.id

this.$confirm('确定删除该记录?', '提示', {
Expand All @@ -218,7 +213,7 @@ export default {
},

openPermissions() {
if(this.checkSel()){
if (this.checkSel()) {
console.log(this.selRow)
menuTreeListByRoleId(this.selRow.id).then(response => {
console.log(response.data)
Expand All @@ -232,12 +227,12 @@ export default {
savePermissions() {
var checkedPermissons = this.$refs.permissonTree.getCheckedKeys()
var menuIds = '';
for(var index in checkedPermissons){
menuIds+=checkedPermissons[index]+','
for (var index in checkedPermissons) {
menuIds += checkedPermissons[index] + ','
}
var data = {
roleId:this.selRow.id,
permissions:menuIds
roleId: this.selRow.id,
permissions: menuIds
}
savePermissons(data).then(response => {
console.log(response.data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ public String getSingleRoleTip(Long roleId) {
*/
@Override
public String getDeptName(Long deptId) {
if(deptId==null){
return null;
}
String val = get(CacheKey.DEPT_NAME+deptId);
if(StringUtils.isNotEmpty(val)){
return val;
Expand Down

0 comments on commit 7103e7d

Please sign in to comment.