import{R as h,a as p,s as R,b as M}from"./api.BfKiC2-d.js";import{R as _}from"./RoleMenuTreeStores.BwM-aj6s.js";import{R as k}from"./RoleMenuBtnStores.MtvC5Uax.js";import{R as g,a as y}from"./RoleMenuFieldStores.BdyqQ-H_.js";import{X as S,e as C}from"./index.lP_uh0LI.js";import{d as I,a as c,o as v,b as T,h as b,f as w}from"./vue.BxlDVA1H.js";const A=I({__name:"RoleMenuTree",setup(B){const o=h(),d=_(),s=k(),l=g(),u=y(),a=c([]),r=c([]),i={children:"children",label:"name",value:"id"},m=(e,t)=>{R({roleId:o.roleId,menuId:e.id,is_check:t}).then(n=>{C({message:n.msg,type:"success"})})},f=async e=>{if(e.is_catalog)s.setState([]),l.setState([]);else{d.setRoleMenuTree(e);const{data:t}=await M({roleId:o.roleId,menuId:e.id});s.setState(t.menu_btn),l.setState(t.menu_field)}u.$reset()};return v(async()=>{a.value=await p({roleId:o.roleId}),r.value=S.toTreeArray(a.value).filter(e=>e.is_check).map(e=>e.id)}),(e,t)=>{const n=T("el-tree");return w(),b(n,{ref:"treeRef",data:a.value,props:i,"default-checked-keys":r.value,onCheckChange:m,onNodeClick:f,"node-key":"id","check-strictly":"","highlight-current":"","show-checkbox":"","default-expand-all":""},null,8,["data","default-checked-keys"])}}});export{A as default};
