import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as t,useEffect as i}from"react";import{DICTIONARY_APP_KEY_ENUM as r}from"../../../enum/dictionary/index.js";import{executeWithCache as a}from"../../../utils/index.js";import o from"../Basic/index.js";import{jsx as c}from"react/jsx-runtime";function n(n){const{appKey:s=r.DEFAULT,dictValue:d="",nameKey:l="dictLabel",idKey:m="dictValue",...p}=n,[u,y]=t([]);return i(()=>{(async()=>{if(!Object.values(r).includes(s))return void console.error(`【DictionarySelectTree】 传入的 appKey 不在 DICTIONARY_APP_KEY_ENUM 中，当前传入的 appKey 是 ${s}`);if(!d)return void console.error("【DictionarySelectTree】 缺少 dictValue 参数");const t={appKey:s,dictValue:d};await a(t,async()=>{const{data:t}=await e("/config/dict-trees/list/by/dictValues","get",{appKey:s,dictValue:d});return t},y)})()},[d]),c(o,{treeData:u,nameKey:l,idKey:m,...p})}n.displayName="DictionarySelectTree";export{n as default};
