Newer
Older
Nanping_sponge_JXKH / src / hooks / useDicts.js
@liyingjing liyingjing on 25 Oct 2023 611 bytes 海绵绩效考个
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 dicts = {
    build_category,
    drainage_partition,
    sponge_engineering_type,
    sponge_land_type
  }
  const findText = (prop, type) => {
    const item = dicts[prop].value.find(it => it.value === type)
    return item?.label || ''
  }

  return {
    ...dicts,
    findText
  }
}