dict.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { defineStore } from 'pinia'
  2. import { getDict } from '@/hooks/web/useDictionaries'
  3. const list = [
  4. { type: 'industryTreeData', apiFn: 'industryTreeData' },
  5. { type: 'areaTreeData', apiFn: 'areaTreeData' },
  6. { type: 'positionTreeData', apiFn: 'positionTreeData' },
  7. { type: 'positionData', params: {}, apiFn: 'positionData' },
  8. { type: 'menduner_industry_type', params: {}, apiFn: 'industryList' },
  9. { type: 'menduner_area_type', params: {}, apiFn: 'areaList' },
  10. { type: 'menduner_education_type' },
  11. { type: 'menduner_exp_type' },
  12. { type: 'menduner_sex' },
  13. { type: 'menduner_job_type' },
  14. { type: 'menduner_job_status' },
  15. { type: 'menduner_marital_status' },
  16. { type: 'menduner_pay_unit' },
  17. { type: 'menduner_financing_status' },
  18. { type: 'menduner_scale' },
  19. { type: 'menduner_hire_job_cv_status' },
  20. { type: 'menduner_education_system_type' },
  21. { type: 'menduner_skill_level' },
  22. { type: 'menduner_pay_scope' }
  23. ]
  24. export const useDictStore = defineStore('dict',
  25. {
  26. state: () => ({
  27. isSetDict: false
  28. }),
  29. actions: {
  30. getDictTypeData () {
  31. if (this.isSetDict) return
  32. this.isSetDict = true
  33. list.forEach(e => {
  34. getDict(e.type, e.params || null, e.apiFn)
  35. })
  36. }
  37. }
  38. },
  39. {
  40. persist: true
  41. }
  42. )