角色菜单改造完成,去除权限管理,采用按钮方式显示在菜单管理中

This commit is contained in:
dqjdda
2019-10-29 21:45:53 +08:00
parent b27f7e16b1
commit f005a467a9
28 changed files with 211 additions and 476 deletions

View File

@@ -0,0 +1,29 @@
import Vue from 'vue'
import { get as getDictDetail } from '@/api/dictDetail'
export default class Dict {
constructor(dict) {
this.dict = dict
}
async init(names, completeCallback) {
if (names === undefined || name === null) {
throw new Error('need Dict names')
}
const ps = []
names.forEach(n => {
Vue.set(this.dict.dict, n, {})
Vue.set(this.dict.label, n, {})
Vue.set(this.dict, n, [])
ps.push(getDictDetail(n).then(data => {
this.dict[n].splice(0, 0, ...data.content)
data.content.forEach(d => {
Vue.set(this.dict.dict[n], d.value, d)
Vue.set(this.dict.label[n], d.value, d.label)
})
}))
})
await Promise.all(ps)
completeCallback()
}
}

View File

@@ -0,0 +1,29 @@
import Dict from './Dict'
const install = function(Vue) {
Vue.mixin({
data() {
if (this.$options.dicts instanceof Array) {
const dict = {
dict: {},
label: {}
}
return {
dict
}
}
return {}
},
created() {
if (this.$options.dicts instanceof Array) {
new Dict(this.dict).init(this.$options.dicts, () => {
this.$nextTick(() => {
this.$emit('dictReady')
})
})
}
}
})
}
export default { install }