import{a as q,r as i,f as F,q as J,aj as o,c as m,o as d,M as Q,S as n,u as y,b as c,R as f,a9 as b,K as s,L as M,J as w,T as B,P as g,Q as X,Y}from"./vue.D1BjjNmv.js";import{R as z,a as G,s as H,b as O}from"./api.dZz7V3_l.js";import{R as W}from"./RoleMenuBtnStores.DfUoOZZZ.js";import{R as Z}from"./RoleMenuTreeStores.CZ0jnT_Y.js";import{a7 as x,E as D}from"./index.CL7yl-Wb.js";import{_ as ee}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ae={key:0,class:"pccm-item"},te={class:"btn-item"},le=["onClick"],oe={class:"pc-dialog"},ne=q({__name:"RoleMenuBtn",setup(se){const h=z(),S=Z(),p=W(),u=i(!1),l=i({id:0,menu_btn_pre_id:0,isCheck:!1,name:"",data_range:0,dept:[]}),k=i([{label:"仅本人数据权限",value:0},{label:"本部门及以下数据权限",value:1},{label:"本部门数据权限",value:2},{label:"全部数据权限",value:3},{label:"自定数据权限",value:4}]),T={children:"children",label:"name",value:"id"},I=async t=>{t<4&&(l.value.dept=[])},U=F(()=>function(t){return x.find(k.value,r=>{if(r.value===t)return r.label}).label}),$=async t=>{const a={isCheck:t.isCheck,roleId:h.roleId,menuId:S.id,btnId:t.id},{data:r,msg:_}=await O(a);p.updateState(r),D({message:_,type:"success"})},E=async()=>{const{data:t,msg:a}=await H(l.value);l.value=t,u.value=!1,D({message:a,type:"success"})},C=()=>{u.value=!1},N=async t=>{l.value=t,u.value=!0},R=i([]);return J(async()=>{const t=await G({role:h.roleId,menu_button:l.value.id}),a=x.toArrayTree(t.data,{parentKey:"parent",strict:!1});R.value=a}),(t,a)=>{const r=o("Setting"),_=o("el-icon"),P=o("el-checkbox"),A=o("el-option"),K=o("el-select"),L=o("el-tree-select"),V=o("el-button"),j=o("el-dialog");return d(),m(f,null,[y(p).$state.length>0?(d(),m("div",ae,[a[3]||(a[3]=c("div",{class:"menu-form-alert"},"配置操作功能接口权限，配置数据权限点击小齿轮",-1)),(d(!0),m(f,null,b(y(p).$state,e=>(d(),w(P,{key:e.id,modelValue:e.isCheck,"onUpdate:modelValue":v=>e.isCheck=v,onChange:v=>$(e)},{default:s(()=>[c("div",te,[g(X(e.data_range!==null?`${e.name}(${U.value(e.data_range)})`:e.name)+" ",1),M(c("span",{onClick:Y(v=>N(e),["stop","prevent"])},[n(_,null,{default:s(()=>[n(r)]),_:1})],8,le),[[B,e.isCheck]])])]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"]))),128))])):Q("",!0),n(j,{modelValue:u.value,"onUpdate:modelValue":a[2]||(a[2]=e=>u.value=e),title:"数据权限配置",width:"400px","close-on-click-modal":!1,"before-close":C},{footer:s(()=>[c("div",null,[n(V,{type:"primary",onClick:E},{default:s(()=>a[4]||(a[4]=[g(" 确定")])),_:1}),n(V,{onClick:C},{default:s(()=>a[5]||(a[5]=[g(" 取消")])),_:1})])]),default:s(()=>[c("div",oe,[n(K,{modelValue:l.value.data_range,"onUpdate:modelValue":a[0]||(a[0]=e=>l.value.data_range=e),onChange:I,placeholder:"请选择"},{default:s(()=>[(d(!0),m(f,null,b(k.value,e=>(d(),w(A,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),M(n(L,{"node-key":"id",modelValue:l.value.dept,"onUpdate:modelValue":a[1]||(a[1]=e=>l.value.dept=e),props:T,data:R.value,multiple:"","check-strictly":"","render-after-expand":!1,"show-checkbox":"",class:"dialog-tree"},null,8,["modelValue","data"]),[[B,l.value.data_range===4]])])]),_:1},8,["modelValue"])],64)}}}),pe=ee(ne,[["__scopeId","data-v-279590c6"]]);export{pe as default};
