import{R as h,d as p,e as R,f as M}from"./api.bxrrZdQM.js";import{R as k}from"./RoleMenuTreeStores.DRP8kLzh.js";import{R as _}from"./RoleMenuBtnStores._366l0YX.js";import{R as g,a as C}from"./RoleMenuFieldStores.DM9AuVhQ.js";import{a7 as y,E as S}from"./index.CL7yl-Wb.js";import{a as I,r as c,q as v,aj as T,J as w,o as B}from"./vue.D1BjjNmv.js";const q=I({__name:"RoleMenuTree",setup(F){const o=h(),d=k(),s=_(),l=g(),u=C(),a=c([]),r=c([]),i={children:"children",label:"name",value:"id"},m=(e,t)=>{R({roleId:o.roleId,menuId:e.id,isCheck:t}).then(n=>{S({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=y.toTreeArray(a.value).filter(e=>e.isCheck).map(e=>e.id)}),(e,t)=>{const n=T("el-tree");return B(),w(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{q as default};
