/*
 * @Author: your name
 * @Date: 2022-02-25 13:53:11
 * @LastEditTime: 2022-02-25 15:01:59
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /newDev/gassafety-progress/gassafetyprogress-web/src/store/modules/bigWindowDevice.js
 */
import { getCompany } from "@/api/bigWindow/getDevice";

const state = {
  // 公司名称
  company: {},
};

const mutations = {
  SET_COMPANY: (state, company) => {
    state.company = company.map((item) => ({
      conpanyId: item.enterpriseId,
      companyName: item.enterpriseName,
    }));
    console.log(state.company);
  },
};

const actions = {
  // 登录
  GetCompany({ commit }) {
    getCompany().then((res) => {
      commit("SET_COMPANY", res);
    });
  },
};

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