import{R as p}from"./RoleDrawerStores.Bmochpay.js";import{R as h}from"./RoleMenuTreeStores.Dj-SlS5F.js";import{R}from"./RoleMenuBtnStores.Ds74f0Jk.js";import{R as M,a as k}from"./RoleMenuFieldStores.1tuZt4kb.js";import{d as _,e as g,f as C}from"./api.B3kiuYtw.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 A=I({__name:"RoleMenuTree",setup(F){const o=p(),d=h(),s=R(),r=M(),u=k(),a=c([]),l=c([]),i={children:"children",label:"name",value:"id"},m=(e,t)=>{g({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([]),r.setState([]);else{d.setRoleMenuTree(e);const{data:t}=await C({roleId:o.roleId,menuId:e.id});s.setState(t.menu_btn),r.setState(t.menu_field)}u.$reset()};return v(async()=>{a.value=await _({roleId:o.roleId}),l.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":l.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};
