import setting from '@/mixins/theme.js'
// 定义所需的 mutations
const mutations = {
  SET_THEME: (state, color) => {
    //		console.log(state,color);
    state.theme = color;
  },
  /* 是否有数据报表权限 */
  SET_DATA_AUTH(state, bool) {
    state.dataAuth = bool;
  },
  SET_COLLAPSE(state,bool) {
    state.isCollapse = bool;
  },
  //面包屑的二级动态name
  SET_TITLE(state,str) {
    state.breadSelfName = str;
  },

  //设置动态的外部链接
  SET_DYNAMIC_LINK(state,obj) {
    let filterObj = {};
    obj.forEach(item => {
        if(!filterObj[item.ConfKey]) {
          filterObj[item.ConfKey] = item.ConfVal;
        }
    });
    localStorage.setItem('dynamicOutLinks',JSON.stringify(filterObj))
    state.dynamicOutLinks = filterObj; 
    setting.dynamicOutLinks = state.dynamicOutLinks;

  }
};

export default mutations;
