import{_ as W,q as X,A as Y,a4 as A,B as _,C as Z,aD as ee,r,o as f,n as I,L as N,M as E,p as te,t as n,H as l,I as ae,J as oe,v as c,K as y,P as S,S as V,aF as ne}from"./index.7a111e62.js";import{useColumns as le}from"./columns.ec864101.js";import{a as se,h as ue,b as ie}from"./addEdit.b914c1d9.js";import{T as re}from"./index.3ac3c8f0.js";import{u as g}from"./hooks.f4063c52.js";import{s as ce}from"./status.8b8d6c88.js";import{r as de}from"./responseHandle.6edfaed2.js";const me={class:"main role"},pe=V(" \u641C\u7D22 "),_e=V(" \u91CD\u7F6E "),fe=V(" \u65B0\u589E\u89D2\u8272 "),ve={name:"role"},ge=X({...ve,setup(he){const{logout:x}=Y(),o=A({level:"",role_name:"",status:"",page:1,size:15}),u=_([]),w=_([]),C=_(!0),{columns:P}=le(),k=_(!1),B=_(""),L=_("add"),z=_(),b=A({total:0,pageSize:15,currentPage:1,background:!0}),R=async t=>{const{id:a,status:h}=t,{code:m,message:i}=await ue({id:a,status:h+""=="1"?"0":"1"});de({code:m,message:i,logout:x,handler:()=>d()})};async function T(t){o.page=t,await d()}async function M(t){o.size=t,o.page=1,await d()}function $(t){}async function d(){C.value=!0;const{code:t,data:a,message:h}=await ie(o);if(t===0){const{list:m,count:i}=a;w.value=m!=null?m:[],b.total=i!=null?i:0,b.pageSize=o.size,b.currentPage=o.page}else t>100&&t<140?x():ne.error(h);C.value=!1}async function H(){o.page=1,await d()}function F(t,a){B.value=t,L.value=a,k.value=!0}const U=()=>{k.value=!1,d()},q=()=>{k.value=!1},J=t=>{!t||(t.resetFields(),o.page=1,d())};return Z(()=>{u.value=ee().getMenuActions("role"),u.value.some(t=>t=="001")&&d()}),(t,a)=>{const h=r("el-option"),m=r("el-select"),i=r("el-form-item"),K=r("el-input"),v=r("el-button"),O=r("el-form"),j=r("el-popconfirm"),G=r("PureTable"),Q=r("NoAuth");return f(),I("div",me,[N(te("div",null,[n(O,{ref_key:"formRef",ref:z,inline:!0,model:o,"label-width":0,class:"bg-white w-99/100 pl-8 pt-4"},{default:l(()=>[n(i,{prop:"status"},{default:l(()=>[n(m,{modelValue:o.status,"onUpdate:modelValue":a[0]||(a[0]=e=>o.status=e),style:{width:"100%"},placeholder:"\u89D2\u8272\u72B6\u6001",clearable:""},{default:l(()=>[(f(!0),I(ae,null,oe(c(ce),(e,D)=>(f(),y(h,{key:"status"+e.value+D,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(i,{prop:"role_name"},{default:l(()=>[n(K,{modelValue:o.role_name,"onUpdate:modelValue":a[1]||(a[1]=e=>o.role_name=e),placeholder:"\u89D2\u8272\u540D\u79F0",clearable:""},null,8,["modelValue"])]),_:1}),n(i,null,{default:l(()=>[n(v,{type:"primary",icon:c(g)("search"),loading:C.value,onClick:H},{default:l(()=>[pe]),_:1},8,["icon","loading"]),n(v,{icon:c(g)("refresh"),onClick:a[2]||(a[2]=e=>J(z.value))},{default:l(()=>[_e]),_:1},8,["icon"])]),_:1})]),_:1},8,["model"]),n(c(re),{title:"\u89D2\u8272\u7BA1\u7406",loading:C.value,dataList:w.value,onRefresh:d},{buttons:l(()=>[u.value.some(e=>e=="002")?(f(),y(v,{key:0,type:"primary",icon:c(g)("add"),onClick:a[3]||(a[3]=e=>F("","add"))},{default:l(()=>[fe]),_:1},8,["icon"])):S("",!0)]),default:l(({size:e,checkList:D})=>[n(G,{border:"",align:"left",showOverflowTooltip:"","table-layout":"auto",size:e,data:w.value,columns:c(P),checkList:D,pagination:b,paginationSmall:e==="small","header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:$,onSizeChange:M,onCurrentChange:T},{operation:l(({row:p})=>[u.value.some(s=>s=="007")?(f(),y(v,{key:0,class:"reset-margin",link:"",type:"primary",size:e,onClick:s=>F(p.id,"view"),icon:c(g)("eye-view")},null,8,["size","onClick","icon"])):S("",!0),u.value.some(s=>s=="005")?(f(),y(v,{key:1,class:"reset-margin",link:"",type:"primary",size:e,onClick:s=>F(p.id,"edit"),icon:c(g)("edits")},null,8,["size","onClick","icon"])):S("",!0),u.value.some(s=>s=="004")&&p.status+""=="1"||u.value.some(s=>s=="003")&&p.status+""=="0"?(f(),y(j,{key:2,title:p.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:s=>R(p)},{reference:l(()=>[n(v,{class:"reset-margin",link:"",type:"primary",size:e,icon:c(g)(p.status==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"])):S("",!0)]),_:2},1032,["size","data","columns","checkList","pagination","paginationSmall"])]),_:1},8,["loading","dataList"]),n(se,{itemId:B.value,isDetails:L.value,"show-model":k.value,onRefresh:U,onCancel:q},null,8,["itemId","isDetails","show-model"])],512),[[E,u.value.some(e=>e=="001")]]),N(n(Q,null,null,512),[[E,!u.value.some(e=>e=="001")]])])}}});var De=W(ge,[["__scopeId","data-v-8a781c4e"]]);export{De as default};
