zhaoxiaoqiang
2023-08-25 9583630b27fdd2f2566995a78d8238ce504f3523
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
 * 按钮的权限控制,按钮数据源来至后台,此方模块用户筛选数据是否显示
 * @param btnId string   按钮编号
 * @returns {boolean}  true 代表此按钮显示,反之不显示
 */
import store from '@/store'
 
const filterBtnById = btnId => {
    btnId = btnId;
    if (store.state.user.qyp_btnIds && btnId) {
        if (store.state.user.qyp_btnIds.findIndex(item=>item.code==btnId) !== -1) {
            return true;
        } else {
            return false;
        }
    } else {
        return true;
    }
}
const install = Vue => {
    if (install.installed) return
    install.installed = true
    Object.defineProperties(Vue.prototype, {
        filterBtnById: {
            get() {
                return filterBtnById
            }
        }
    })
}
export default {install}
//export default {
//    filterBtnById (btnId, vm) {
//        if (btnId) {
//            if (vm.$store.state.app.platBtn.indexOf (btnId) !== -1) {
//                return true;
//            } else {
//                return false;
//            }
//        } else {
//            return true;
//        }
//    }
//};