import{c as h,x as g,a7 as k,y as _}from"./index-fNs72j9w.js";import x from"./popupForm-BsJ7vG5V.js";import{b as R,d as y,T as C,a as I}from"./index-CgMrKa77.js";import{B as T,a8 as f,o as v,I as w,C as p,D as A,u as s,O as E,W as D,H as n,au as N}from"./vue-DweYBrEc.js";import"./index-BlEwok4a.js";import"./validate-CEOscgyN.js";import"./index-DMA3A9_B.js";function B(){return h({url:"/admin/user.Rule/index",method:"get"})}const F={class:"default-main ba-table-box"},U=T({name:"user/group",__name:"index",setup(G){const{t}=g.useI18n(),u=f("formRef"),i=f("tableRef"),e=new R(new k("/admin/user.Group/"),{column:[{type:"selection",align:"center",operator:!1},{label:t("Id"),prop:"id",align:"center",operator:"=",operatorPlaceholder:t("Id"),width:70},{label:t("user.group.Group name"),prop:"name",align:"center",operator:"LIKE",operatorPlaceholder:t("Fuzzy query")},{label:t("State"),prop:"status",align:"center",render:"tag",custom:{0:"danger",1:"success"},replaceValue:{0:t("Disable"),1:t("Enable")}},{label:t("Update time"),prop:"update_time",align:"center",render:"datetime",sortable:"custom",operator:"RANGE",width:160},{label:t("Create time"),prop:"create_time",align:"center",render:"datetime",sortable:"custom",operator:"RANGE",width:160},{label:t("Operate"),align:"center",width:"130",render:"buttons",buttons:y(["edit","delete"]),operator:!1}],dblClickNotEditColumn:[void 0]},{defaultItems:{status:1}});e.before.onSubmit=({formEl:r,operate:a,items:o})=>{let d=()=>{var l;e.form.submitLoading=!0,e.api.postData(a,{...o,rules:(l=u.value)==null?void 0:l.getCheckeds()}).then(b=>{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:b})}).catch(()=>{e.form.submitLoading=!1})};return r?(e.form.ref=r,r.validate(l=>{l&&d()})):d(),!1},e.after.toggleForm=({operate:r})=>{r=="Add"&&m()},e.after.getEditData=()=>{m()};const m=()=>{B().then(r=>{if(e.form.extend.menuRules=r.data.list,e.form.items.rules&&e.form.items.rules.length)if(e.form.items.rules.includes("*")){let a=[];for(const o in e.form.extend.menuRules)a.push(e.form.extend.menuRules[o].id);e.form.extend.defaultCheckedKeys=a}else e.form.extend.defaultCheckedKeys=e.form.items.rules;else e.form.extend.defaultCheckedKeys=[];e.form.extend.treeKey=_()})};return N("baTable",e),v(()=>{e.table.ref=i.value,e.mount(),e.getData()}),(r,a)=>{const o=w("el-alert");return p(),A("div",F,[s(e).table.remark?(p(),E(o,{key:0,class:"ba-table-alert",title:s(e).table.remark,type:"info","show-icon":""},null,8,["title"])):D("",!0),n(C,{buttons:["refresh","add","edit","delete","comSearch","quickSearch","columnDisplay"],"quick-search-placeholder":s(t)("Quick search placeholder",{fields:s(t)("user.group.GroupName")})},null,8,["quick-search-placeholder"]),n(I,{ref_key:"tableRef",ref:i},null,512),n(x,{ref_key:"formRef",ref:u},null,512)])}}});export{U as default};
