/** * 按钮的权限控制,按钮数据源来至后台,此方模块用户筛选数据是否显示 * @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; // } // } //};