新增:获取字典管理中label的值

pull/57/head
李强 2022-05-11 20:45:08 +08:00
parent 220896507b
commit a939ac4e53
2 changed files with 14 additions and 37 deletions

View File

@ -188,6 +188,19 @@ selectType.component.props.color = 'auto' // 修改官方的字段类型,设
Vue.prototype.dictionary = function (name) {
return store.state.d2admin.dictionary.data[name]
}
// 获取字典label值
Vue.prototype.getDictionaryLabel = function (name, value) {
const data = store.state.d2admin.dictionary.data[name]
if (data && data instanceof Array) {
for (var i = 0, len = data.length; i < len; i++) {
if (data[i].value === value) {
return data[i].label
}
}
return ''
}
return store.state.d2admin.dictionary.data[name]
}
// 默认Columns 结尾 showForm显示在form中showTable显示在table中
Vue.prototype.commonEndColumns = function (param = {}) {
/**

View File

@ -29,43 +29,7 @@ function supplementPath (menu) {
export const menuHeader = supplementPath([])
// export const menuHeader = supplementPath([
// { path: '/index', title: '控制台', icon: 'home' },
// {
// title: '页面',
// icon: 'folder-o',
// children: [
// { path: '/page1', title: '页面 1' },
// { path: '/page2', title: '页面 2' },
// { path: '/page3', title: '页面 3' }
// ]
// }
// ])
export const menuAside = supplementPath([])
// export const menuAside = supplementPath([
// { path: '/index', title: '控制台', icon: 'home' },
// {
// title: '系统管理',
// icon: 'folder-o',
// children: [
// // { path: '/page1', title: '页面 1' },
// // { path: '/page2', title: '页面 2' },
// // { path: '/page3', title: '页面 3' },
// { path: '/menu', title: '菜单' },
// { path: '/user', title: '用户' },
// { path: '/button', title: '按钮' },
// { path: '/role', title: '角色' },
// { path: '/dept', title: '部门' },
// { path: '/rolePermission', title: '角色权限' },
// {
// title: '日志管理', children: [
// { path: '/operationLog', title: '操作日志' },
// ]
// },
// ]
// }
// ])
// 请求菜单数据,用于解析路由和侧边栏菜单
export const getMenu = function () {
@ -136,7 +100,7 @@ export const handleAsideMenu = function (menuData) {
strict: true
})
const menu = [
{ path: '/index', title: '控制', icon: 'home' },
{ path: '/index', title: '控制1', icon: 'home' },
...data
]
return supplementPath(menu)