Newer
Older
KaiFengPC / src / hooks / useDicts.js
@鲁yixuan 鲁yixuan on 14 Jun 1 KB update
  1. export default function useDicts(proxy) {
  2. const { build_category } = proxy.useDict('build_category');
  3. const { drainage_partition } = proxy.useDict('drainage_partition');
  4. const { sponge_engineering_type } = proxy.useDict('sponge_engineering_type');
  5. const { sponge_land_type } = proxy.useDict('sponge_land_type');
  6. const { project_content_type } = proxy.useDict('project_content_type');
  7. const { project_library_type } = proxy.useDict('project_library_type');
  8. const { task_type } = proxy.useDict('task_type');
  9. const { project_drainage_zone } = proxy.useDict('project_drainage_zone');
  10. const { project_operation_pattern } = proxy.useDict('project_operation_pattern');
  11. const { build_status } = proxy.useDict('build_status');
  12. const dicts = {
  13. build_category,
  14. drainage_partition,
  15. sponge_engineering_type,
  16. sponge_land_type,
  17. project_content_type,
  18. project_library_type,
  19. task_type,
  20. project_operation_pattern,
  21. build_status,
  22. project_drainage_zone,
  23. };
  24. const findText = (prop, type) => {
  25. const item = dicts[prop].value.find(it => it.value === type);
  26. return item?.label || '';
  27. };
  28.  
  29. return {
  30. ...dicts,
  31. findText,
  32. };
  33. }