dict.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: 'system_user_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_enterprise_type' },
  23. { type: 'menduner_pay_scope' }
  24. ]
  25. export const useDictStore = defineStore('dict',
  26. {
  27. state: () => ({
  28. isSetDict: false
  29. }),
  30. actions: {
  31. getDictTypeData () {
  32. if (this.isSetDict) return
  33. this.isSetDict = true
  34. list.forEach(e => {
  35. getDict(e.type, e.params || null, e.apiFn)
  36. })
  37. }
  38. }
  39. },
  40. {
  41. persist: true
  42. }
  43. )