<template>
  <div>
    <el-button type="primary" plain @click="handleModuleJump('myTaskIndex', 'crm', 'CRM系统')">
      CRM系统
    </el-button>
    <el-button type="primary" plain @click="handleModuleJump('Index', 'admin', '爱思系统')">
      系统管理
    </el-button>

  </div>
</template>
<script>
import router from "../router";
import store from "../store";
export default {
  name:"Home",
  data() {
    return {};
  },
  methods: {
    handleModuleJump(name, type, title) {
      let that = this;
      //更改侧边栏参数及title
      // this.$store.commit('SET_SYSTEMTYPE', type)
      this.$store.commit('SET_SYSTEMTITLE', title)
      //生成侧边栏
      store.dispatch("GenerateRoutes").then((accessRoutes) => {
        // 根据roles权限生成可访问的路由表
        router.addRoutes(accessRoutes); // 动态添加可访问路由表
        that.$router.push({ name, query: { type, title } });
      });
    },
  },
};
</script>
