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