import{d as P,r as g,o as B,k as l,w as a,p as s,q as D,v as r,h as m,m as h,i,l as u,K as N,E as V}from"./index-ByQGGPf6.js";import{a as q,d as A}from"./auth-BK7QRp6Y.js";const S={class:"inner-toolbar w-11/12 flex justify-between"},j={class:"toolbar-btns"},L={class:"toolbar-search"},F=P({__name:"packagePermissions",setup(T){const v=D(),c=g(!1),o=g({page_no:1,page_size:10,keyword:""}),t=g({}),p=e=>!0,k=e=>{o.value.page_size=e,n()},y=e=>{o.value.page_no=e,n()},f=()=>{v.push({name:"packageAdd",query:{id:0}})},C=e=>{v.push({name:"packageAdd",query:{id:e.role_id}})},z=e=>{N.confirm("确定要删除这个角色吗？","提示",{type:"warning"}).then(()=>{A(e.role_id).then(()=>{V.success("删除成功！"),n()})}).catch(()=>{})},w=e=>{o.value.keyword=e,o.value.page_no=1,n()},n=()=>{c.value=!0,q(o.value).then(e=>{c.value=!1,t.value=e}).catch(()=>{c.value=!1})};return B(()=>{n()}),(e,$)=>{const d=s("el-button"),x=s("en-table-search"),_=s("el-table-column"),R=s("el-pagination"),E=s("en-table-layout");return r(),l(E,{tableData:t.value.records,loading:c.value},{toolbar:a(()=>[m("div",S,[m("div",j,[p(["roleManage:add"])?(r(),l(d,{key:0,size:"mini",type:"primary",icon:"el-icon-circle-plus-outline",onClick:f},{default:a(()=>[h("添加")]),_:1})):u("",!0)]),m("div",L,[i(x,{onSearch:w,placeholder:"请输入关键字"})])])]),"table-columns":a(()=>[i(_,{prop:"role_name",label:"角色名称"}),i(_,{prop:"role_describe",label:"角色描述"}),i(_,{label:"操作"},{default:a(b=>[p(["roleManage:edit"])?(r(),l(d,{key:0,size:"mini",type:"primary",onClick:M=>C(b.row)},{default:a(()=>[h("编辑")]),_:2},1032,["onClick"])):u("",!0),p(["roleManage:del"])?(r(),l(d,{key:1,size:"mini",type:"danger",onClick:M=>z(b.row)},{default:a(()=>[h("删除")]),_:2},1032,["onClick"])):u("",!0)]),_:1})]),pagination:a(()=>[t.value?(r(),l(R,{key:0,onSizeChange:k,onCurrentChange:y,"current-page":t.value.page,"page-sizes":[10,20,50,100],"page-size":t.value.size,layout:"total, sizes, prev, pager, next, jumper",total:t.value.total},null,8,["current-page","page-size","total"])):u("",!0)]),_:1},8,["tableData","loading"])}}});export{F as default};
