import { queryAllOrgan } from "../../api/dashboard" const loadings = {} const filterOrganId = [36, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 54, 55, 56] const state = { allBranch: [] } const mutations = { commit_all_branch: (state, allBranch) => { state.allBranch = allBranch } } const actions = { async setAllBranch({ commit, state }, force) { if ((!state.allBranch.length || force === true) && !loadings.commit_all_branch) { loadings.commit_all_branch = await queryAllOrgan() try { const res = await loadings.commit_all_branch const result = res.data let tempOrgan = [] // 过滤不会显示的分部 result.forEach(item => { if (!filterOrganId.includes(item.id)) { tempOrgan.push(item) } }) commit('commit_all_branch', tempOrgan) } catch (error) { // } loadings.commit_all_branch = false } }, } export default { namespaced: true, state, mutations, actions }