/*
 * @Author: your name
 * @Date: 2021-12-25 11:50:58
 * @LastEditTime: 2021-12-25 17:55:41
 * @LastEditors: Please set LastEditors
 * @Description: 权限树操作
 * @FilePath: \Foshan4A2.0\src\store\modules\auths.js
 */
const state = {
  authMsg: [],
  authArrs: [], //新增-权限规则数据
  authList: [], //编辑-初始化数据
  authId: null, //新增-选中的权限树id
}

const mutations = {
  SET_AUTHARRS: (state, authArrs) => {
    state.authArrs = authArrs
  },
  SET_AUTHLIST: (state, authList) => {
    state.authList = authList
  },
  SET_AUTHID: (state, authId) => {
    state.authId = authId
  },
  SET_AUTHMSG: (state, authMsg) => {
    state.authMsg = authMsg
  },
}

const actions = {
  changeAuthArrs ({ commit }, data) {
    commit('SET_AUTHARRS', data)
  },
  changeAuthList ({ commit }, data) {
    commit('SET_AUTHLIST', data)
  },
  changeAuthId ({ commit }, data) {
    commit('SET_AUTHID', data)
  },
  changeAuthMsg ({ commit }, data) {
    commit('SET_AUTHMSG', data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}