text: let e=document.createElement("style");e.innerHTML=".wrapper .item{padding:20px;border-bottom:1px solid #e9e9e9}.wrapper .item:last-child{border:none}.wrapper .item .title{padding-bottom:20px}",document.head.appendChild(e);import{bZ as t,bP as a,d8 as i,d as s,dm as l,dn as o,dp as r,dq as n,M as d,dh as c,i as h,h as p,dr as m,ds as u,dt as g,du as b,r as k,o as f,p as w,v,w as j,z as C,s as _,aE as y,bc as D,m as A,q as x}from"./index.5b397b81.js";import{g as L}from"./tableData.909006fb.js";import{a as M,u as O}from"./index.55a98ad3.js";import{g as S,a as R,u as T}from"./useTable.9ae0cfa5.js";import{s as z}from"./useTable.edd65bfa.js";import"./index.f0b9f698.js";import B from"./Dialog.acf152a9.js";import{b as E}from"./_baseDifference.b5f90f88.js";import"./index.be505e56.js";import"./useWindowSizeFn.39afe110.js";import"./useFullScreen.36959c2f.js";import"./index.b8c2752b.js";import"./zh_CN.0242bd16.js";import"./upload.97995f59.js";import"./domUtils.a209b89e.js";import"./CheckOutlined.849f8089.js";import"./index.9b68ed0e.js";var G=t((function(e,t){return a(e)?E(e,i(t,1,a,!0)):[]})),U=s({components:{BasicModal:M,BasicTable:z,Dialog:B},data:()=>({group_id:null,hadCheckedList:[],checkedList:[[],[],[]],indeterminate:[!1,!1,!1],checkAll:[!1,!1,!1]}),methods:{onChange(e,t){const a=this.permissionGroup[t].children;this.checkAll[t]=e.length===a.length,this.indeterminate[t]=!!e.length&&e.length<a.length},onCheckAllChange(e,t){this.checkedList[t]=e.target.checked?this.permissionGroup[t].children:[],this.indeterminate[t]=!1},async dispatchBatch(){const e=l(this.checkedList),t=G(e,this.hadCheckedList),a=G(this.hadCheckedList,e);a.length&&await o({group_id:this.group_id,auths:a}),t.length&&await r({group_id:this.group_id,auths:t}),this.closeModal()},dispatchModal(e){this.group_id=e,n(e).then((e=>{const t=e.auths.map((e=>Object.values(e)[0])).map((e=>e.map((e=>e.auth))));this.hadCheckedList=l(t);const a=l(e.auths.map((e=>Object.keys(e)[0])));this.permissionGroup.map(((e,i)=>{const s=a.findIndex((t=>e.label===t));if(s>-1){const a=t[s].length;this.indeterminate[i]=!!a&&e.children.length!==a,this.checkAll[i]=e.children.length===a,this.checkedList[i]=t[s]}else this.checkAll[i]=!1,this.indeterminate[i]=!1,this.checkedList[i]=[]}))})),this.openModal()}},setup(e,t){d("schemas",S(L));const a={fetchSetting:{listField:null},pagination:!1,api:c,title:"分组",columns:R(L)},i=h({id:null,append:"分组",title:"新增分组"}),s={rowSaveApi:u,rowEditApi:g,rowDeleteApi:b};let l=p([]);m().then((e=>{l.value=Object.keys(e).map(((t,a)=>({label:t,value:a,children:Object.keys(e[t])})))}));const[o,{openModal:r,closeModal:n}]=O(),[{registerTable:k},{registerDialog:f},{rowDelete:w,rowSave:v,rowEdit:j,rowAdd:C}]=T({...a,...s,relyObject:i});return{register:o,closeModal:n,openModal:r,permissionGroup:l,registerTable:k,registerDialog:f,rowDelete:w,rowSave:v,rowEdit:j,rowAdd:C,relyObject:i}}});const F=C(" 权限 "),$=C("编辑 "),q=C("删除"),H={class:"item"},I={class:"title"};U.render=function(e,t,a,i,s,l){const o=k("a-button"),r=k("BasicTable"),n=k("a-checkbox"),d=k("a-checkbox-group"),c=k("BasicModal"),h=k("Dialog");return f(),w("div",null,[v(o,{type:"primary",onClick:t[0]||(t[0]=t=>e.rowAdd(e.$refs.Dialog))},{default:j((()=>[C("新增"+_(e.relyObject.append),1)])),_:1}),v(r,{onRegister:e.registerTable},{create_time:j((({record:e})=>[C(_(e.create_time),1)])),operate:j((({record:t})=>[v(o,{class:"mr_btn",size:"small",shape:"round",type:"primary",onClick:a=>e.dispatchModal(t.id)},{default:j((()=>[F])),_:2},1032,["onClick"]),v(o,{class:"mr_btn",size:"small",shape:"round",type:"primary",onClick:a=>e.rowEdit(e.$refs.Dialog,t)},{default:j((()=>[$])),_:2},1032,["onClick"]),v(o,{size:"small",disabled:1===t.id,shape:"round",type:"danger",onClick:a=>e.rowDelete(t.id)},{default:j((()=>[q])),_:2},1032,["disabled","onClick"])])),_:1},8,["onRegister"]),v(c,A(e.$attrs,{onRegister:e.register,onOk:t[1]||(t[1]=t=>e.dispatchBatch()),class:"wrapper",width:"50vw",title:"权限分配"}),{default:j((()=>[(f(!0),w(y,null,D(e.permissionGroup,(t=>(f(),w("div",H,[x("div",I,[v(n,{checked:e.checkAll[t.value],"onUpdate:checked":a=>e.checkAll[t.value]=a,indeterminate:e.indeterminate[t.value],onChange:a=>e.onCheckAllChange(a,t.value)},{default:j((()=>[C(_(t.label),1)])),_:2},1032,["checked","onUpdate:checked","indeterminate","onChange"])]),v(d,{value:e.checkedList[t.value],"onUpdate:value":a=>e.checkedList[t.value]=a,options:t.children,onChange:a=>e.onChange(a,t.value)},null,8,["value","onUpdate:value","options","onChange"])])))),256))])),_:1},16,["onRegister"]),v(h,{ref:"Dialog",onRowSave:e.rowSave,title:e.relyObject.title,onRegister:e.registerDialog},null,8,["onRowSave","title","onRegister"])])};export{U as default};
  