Newer
Older
Nanping_sponge_GCGL / src / hooks / useDicts.js
@liyingjing liyingjing on 25 Oct 2023 1 KB 海绵工程管理
export default function useDicts(proxy) {
  const { build_category } = proxy.useDict("build_category")
  const { drainage_partition } = proxy.useDict("drainage_partition")
  const { sponge_engineering_type } = proxy.useDict("sponge_engineering_type")
  const { sponge_land_type } = proxy.useDict("sponge_land_type")
  const { project_content_type } = proxy.useDict("project_content_type");
  const { project_library_type } = proxy.useDict("project_library_type");
  const { task_type } = proxy.useDict("task_type");
  const { project_operation_pattern } = proxy.useDict("project_operation_pattern");
  const { build_status } = proxy.useDict("build_status");
  const dicts = {
    build_category,
    drainage_partition,
    sponge_engineering_type,
    sponge_land_type,
    project_content_type,
    project_library_type,
    task_type,
    project_operation_pattern,
    build_status
  }
  const findText = (prop, type) => {
    const item = dicts[prop].value.find(it => it.value === type)
    return item?.label || ''
  }

  return {
    ...dicts,
    findText
  }
}