import{b as z,u as P,ah as b,e as R,cE as q,o as c,c as B,p as s,q as a,aH as g,y as u,P as i,x as d,n as o,t as h,aj as I,v as T,S as x,l as U,k as j,j as F,m as L,D as M}from"./index.8d733f79.js";import{c as H,d as A}from"./role.fbf902eb.js";const G={class:"page-content"},J=T("div",{class:"page-title"},"\u89D2\u8272\u7BA1\u7406",-1),X={__name:"index",setup(K){const{t:N,locale:O}=z(),{proxy:v}=M(),y=P(),m=b({total:0,tableData:[],columns:[{prop:"name",label:"roleName"},{prop:"createTime",label:"createTime"},{label:"action",type:"action",width:180,fixed:"right"}]}),l=b({name:"",pageNo:1,pageSize:10});R(()=>{p()});async function p(){const e=await H(l);m.total=e.data.totalElements,m.tableData=e.data.content}const w=()=>{y.push({path:"/system/role/add"})},C=()=>{l.name="",p()},D=e=>{y.push({path:"/system/role/edit",query:{id:e.id}})},$=e=>{v.$modal.confirm(N("confirmDelete")).then(()=>{A({roleId:e.id}).then(n=>{x.success(n.msg),p()})}).catch(()=>{})},E=e=>{y.push({path:"/system/role/edit",query:{id:e.id,type:e.type}})};return(e,n)=>{const r=U,_=j,S=F,V=L,f=q("hasPermi");return c(),B("div",G,[J,s(V,{ref:"formRef",model:o(l),inline:!0,"label-width":"68px"},{default:a(()=>[s(_,null,{default:a(()=>[g((c(),u(r,{type:"primary",onClick:w},{default:a(()=>[i(d(e.$t("addRole")),1)]),_:1})),[[f,["system_role_add"]]])]),_:1}),s(_,{label:e.$t("roleName"),prop:"name"},{default:a(()=>[s(S,{modelValue:o(l).name,"onUpdate:modelValue":n[0]||(n[0]=t=>o(l).name=t),placeholder:e.$t("roleNameP"),maxlength:"20",style:{width:"236px"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(_,null,{default:a(()=>[s(r,{type:"primary",onClick:p},{default:a(()=>[i(d(e.$t("query")),1)]),_:1}),s(r,{onClick:C},{default:a(()=>[i(d(e.$t("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),s(o(I),{class:"f-h",columns:o(m).columns,tableData:o(m).tableData,total:o(m).total,pageNum:o(l).pageNo,"onUpdate:pageNum":n[1]||(n[1]=t=>o(l).pageNo=t),pageSize:o(l).pageSize,"onUpdate:pageSize":n[2]||(n[2]=t=>o(l).pageSize=t),onPagination:p},{action:a(({scope:t})=>[t.row.type===0?(c(),u(r,{key:0,link:"",type:"primary",onClick:k=>E(t.row)},{default:a(()=>[i(d(e.$t("view")),1)]),_:2},1032,["onClick"])):h("",!0),t.row.type===1?g((c(),u(r,{key:1,link:"",type:"primary",onClick:k=>D(t.row)},{default:a(()=>[i(d(e.$t("edit")),1)]),_:2},1032,["onClick"])),[[f,["system_role_edit"]]]):h("",!0),t.row.type===1?g((c(),u(r,{key:2,link:"",type:"primary",onClick:k=>$(t.row)},{default:a(()=>[i(d(e.$t("delete")),1)]),_:2},1032,["onClick"])),[[f,["system_role_delete"]]]):h("",!0)]),_:1},8,["columns","tableData","total","pageNum","pageSize"])])}}};export{X as default};
