优化代码

This commit is contained in:
smallchill 2019-02-21 22:49:01 +08:00
parent 9c6db088d1
commit e6809d5325
5 changed files with 34 additions and 7 deletions

View File

@ -71,3 +71,9 @@ export const getRole = (roleIds) => {
}) })
} }
export const getRoleTree = () => {
return request({
url: 'api/blade-system/role/tree',
method: 'get'
})
}

View File

@ -85,7 +85,8 @@
{ {
label: "排序", label: "排序",
prop: "sort" prop: "sort",
type: "number"
} }
] ]
}, },

View File

@ -84,11 +84,13 @@
}, },
{ {
label: "字典键值", label: "字典键值",
prop: "dictKey" prop: "dictKey",
type: "number"
}, },
{ {
label: "排序", label: "排序",
prop: "sort" prop: "sort",
type: "number"
} }
] ]
}, },

View File

@ -104,7 +104,8 @@
}, },
{ {
label: "排序", label: "排序",
prop: "sort" prop: "sort",
type: "number"
}, },
{ {
label: "按钮功能", label: "按钮功能",

View File

@ -63,7 +63,8 @@
add, add,
grant, grant,
getTree, getTree,
getRole getRole,
getRoleTree
} from "@/api/system/role"; } from "@/api/system/role";
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
@ -102,8 +103,19 @@
search: true search: true
}, },
{ {
label: "排序", label: "上级角色",
prop: "sort" prop: "parentId",
dicData: [],
type: "tree",
hide: true,
props: {
label: "title"
}
},
{
label: "角色排序",
prop: "sort",
type: "number"
} }
] ]
}, },
@ -228,6 +240,11 @@
getList(page.currentPage, page.pageSize, params).then(res => { getList(page.currentPage, page.pageSize, params).then(res => {
const data = res.data.data; const data = res.data.data;
this.data = data; this.data = data;
getRoleTree().then(res => {
const data = res.data.data;
const index = this.$refs.crud.findColumnIndex("parentId");
this.option.column[index].dicData = data;
});
}); });
} }
} }