import{c as x,x as k,w as y,a7 as R,a6 as C,y as T,_ as I}from"./index-fNs72j9w.js";import v from"./popupForm-BKduR-G3.js";import{b as w,d as A,T as D,a as K}from"./index-CgMrKa77.js";import{B,a8 as p,o as E,I as G,C as u,D as O,u as l,O as b,W as g,H as i,au as F}from"./vue-DweYBrEc.js";import"./index-BlEwok4a.js";import"./validate-CEOscgyN.js";import"./index-DMA3A9_B.js";function N(){return x({url:"/admin/auth.Rule/index",method:"get"})}const S={class:"default-main ba-table-box"},q=B({name:"auth/group",__name:"index",setup(H){const{t:a}=k.useI18n(),h=y(),d=p("formRef"),m=p("tableRef"),e=new w(new R("/admin/auth.Group/"),{expandAll:!0,dblClickNotEditColumn:[void 0],column:[{type:"selection",align:"center"},{label:a("auth.group.Group name"),prop:"name",align:"left",width:"200"},{label:a("auth.group.jurisdiction"),prop:"rules",align:"center"},{label:a("State"),prop:"status",align:"center",render:"tag",custom:{0:"danger",1:"success"},replaceValue:{0:a("Disable"),1:a("Enable")}},{label:a("Update time"),prop:"update_time",align:"center",width:"160",render:"datetime"},{label:a("Create time"),prop:"create_time",align:"center",width:"160",render:"datetime"},{label:a("Operate"),align:"center",width:"130",render:"buttons",buttons:A(["edit","delete"])}]},{defaultItems:{status:1}});e.before.onSubmit=({formEl:t,operate:o,items:r})=>{let n=()=>{var s;e.form.submitLoading=!0,e.api.postData(o,{...r,rules:(s=d.value)==null?void 0:s.getCheckeds()}).then(_=>{var c;e.onTableHeaderAction("refresh",{}),e.form.submitLoading=!1,(c=e.form.operateIds)==null||c.shift(),e.form.operateIds.length>0?e.toggleForm("Edit",e.form.operateIds):e.toggleForm(),e.runAfter("onSubmit",{res:_})}).catch(()=>{e.form.submitLoading=!1})};return t?(e.form.ref=t,t.validate(s=>{s&&n()})):n(),!1},e.before.onTableDblclick=({row:t})=>e.table.extend.adminGroup.indexOf(t.id)===-1,e.after.getData=({res:t})=>{e.table.extend.adminGroup=t.data.group;let o=C(e.table.column,"render","buttons");e.table.column[o].buttons.forEach(r=>{r.display=n=>t.data.group.indexOf(n.id)===-1})},e.after.toggleForm=({operate:t})=>{t=="Add"&&f()},e.after.getEditData=()=>{f()};const f=()=>{N().then(t=>{if(e.form.extend.menuRules=t.data.list,e.form.items.rules&&e.form.items.rules.length)if(e.form.items.rules.includes("*")){let o=[];for(const r in e.form.extend.menuRules)o.push(e.form.extend.menuRules[r].id);e.form.extend.defaultCheckedKeys=o}else e.form.extend.defaultCheckedKeys=e.form.items.rules;else e.form.extend.defaultCheckedKeys=[];e.form.extend.treeKey=T()})};return F("baTable",e),E(()=>{e.table.ref=m.value,e.mount(),e.getData()}),(t,o)=>{const r=G("el-alert");return u(),O("div",S,[l(h).super?g("",!0):(u(),b(r,{key:0,class:"ba-table-alert group-super-alert",title:l(a)("auth.group.Manage subordinate role groups here"),type:"info","show-icon":""},null,8,["title"])),l(e).table.remark?(u(),b(r,{key:1,class:"ba-table-alert",title:l(e).table.remark,type:"info","show-icon":""},null,8,["title"])):g("",!0),i(D,{buttons:["refresh","add","edit","delete","unfold","quickSearch","columnDisplay"],"quick-search-placeholder":l(a)("Quick search placeholder",{fields:l(a)("auth.group.GroupName")})},null,8,["quick-search-placeholder"]),i(K,{ref_key:"tableRef",ref:m,pagination:!1},null,512),i(v,{ref_key:"formRef",ref:d},null,512)])}}}),W=I(q,[["__scopeId","data-v-391a6960"]]);export{W as default};
