12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import {defineStore} from "pinia";
- import {ref} from "vue";
- import { getCoachList,getQuestionnaireList,getCoachProgramList,getTeamListById } from '@/api/agent/index.js'
- export const useAgentStore = defineStore('agent', () => {
- const companyList = ref([]);
- const companyMap = ref(new Map());
- const getCompanyData = () => {
- getCoachProgramList({enterpriseName:''}).then((res) => {
- companyList.value = res.data;
- const map = new Map();
- companyList.value.forEach((supplier) => {
- map.set(supplier.id, supplier);
- });
- companyMap.value = map;
- });
- };
- const teamList = ref([]);
- const teamMap = ref(new Map());
- const getTeamData = () => {
- getTeamListById({enterpriseId:''}).then((res) => {
- teamList.value = res.data;
- const map = new Map();
- teamList.value.forEach((supplier) => {
- map.set(supplier.id, supplier);
- });
- teamMap.value = map;
- });
- };
- const coachList = ref([]);
- const coachMap = ref(new Map());
- const getCoachData = () => {
- getCoachList({page:1,limit:-1}).then((res) => {
- coachList.value = res.data.list;
- const map = new Map();
- coachList.value.forEach((supplier) => {
- map.set(supplier.id, supplier);
- });
- coachMap.value = map;
- });
- };
- const questionnaireList = ref([]);
- const questionnaireMap = ref(new Map());
- const getQuestionnaireData = () => {
- getQuestionnaireList({page:1,limit:-1}).then((res) => {
- questionnaireList.value = res.data.list;
- const map = new Map();
- questionnaireList.value.forEach((supplier) => {
- map.set(supplier.id, supplier);
- });
- questionnaireMap.value = map;
- });
- };
- return {
- companyList,
- companyMap,
- getCompanyData,
- teamList,
- teamMap,
- getTeamData,
- coachList,
- coachMap,
- getCoachData,
- questionnaireList,
- questionnaireMap,
- getQuestionnaireData,
- };
- })
|