useConditionPaperType.js 1016 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. *
  3. * */
  4. import {useUserStore} from "@/hooks/useUserStore";
  5. import {useCacheStore} from "@/hooks/useCacheStore";
  6. import {cacheActions} from "@/hooks/defineCacheActions";
  7. import _ from "lodash";
  8. import {conditionSharedConfig} from "@/components/mx-condition/modules/conditionSharedConfig";
  9. export const useConditionPaperType = function (options = {}) {
  10. const {isCultural} = useUserStore()
  11. const {dispatchCache} = useCacheStore()
  12. return {
  13. ...conditionSharedConfig,
  14. handler: async () => {
  15. const result = await dispatchCache(cacheActions.getDicts, 'paper_type')
  16. const source = [...result] // 创建source副本
  17. // TODO:注意跟进,现在`必刷题`只提供给河南的职高对口
  18. if (!isCultural.value) _.remove(source, i => i.dictValue == '必刷题')
  19. return source
  20. },
  21. key: 'paperType',
  22. title: '做题类型',
  23. keyName: 'dictLabel',
  24. keyValue: 'dictValue',
  25. ...options
  26. }
  27. }