schangxiang@126.com
2024-09-05 e0dfde82cb2a33b3058ceaa225c82614b22075cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import store from '@/store'
 
export function actionToObject (json) {
  try {
    return JSON.parse(json)
  } catch (e) {
  }
  return []
}
 
/**
 * 控制按钮是否显示
 *
 * @author yubaoshan
 * @date 2020/06/27 02:34
 */
export function hasBtnPermission (permission) {
  const myBtns = store.getters.buttons
  const allBtns = store.getters.allButtons
  const admintype = store.getters.admintype
  // eslint-disable-next-line eqeqeq
  if (admintype == '1') {
     return true
  }
  // 所有系统按钮中不存在,则不限制
  return allBtns.indexOf(permission) === -1 || myBtns.indexOf(permission) > -1
}