|
|
@@ -90,9 +90,10 @@ const MenuGetter = namespace('menu', Getter)
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['toggleMenu']),
|
|
|
- toolfun_gettreejson(rows, idFieldName, pidFieldName, fileds) {
|
|
|
+ toolfun_gettreejson (rows, idFieldName, pidFieldName, fileds) {
|
|
|
// 工具方法,将扁平数据转化成tree格式数据
|
|
|
- function nodejsonexists(rows, ParentId) {
|
|
|
+ function nodejsonexists (rows, ParentId) {
|
|
|
+
|
|
|
for (var i = 0; i < rows.length; i++) {
|
|
|
if (rows[i][idFieldName] === ParentId) {
|
|
|
return true
|
|
|
@@ -165,6 +166,9 @@ export default class Sidebar extends Vue {
|
|
|
async beforeMount () {
|
|
|
// 暂时从本地取菜单
|
|
|
let {data: menus1} = await this.$axios.get('users/getusermoduletree')
|
|
|
+ if (!menus1) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
let menus = this.toolfun_gettreejson(menus1, 'id', 'pId', 'id,name,url,icon')
|
|
|
if (menus[0].id == '30000000') {
|
|
|
menus = menus[0].children
|