import{_ as W,q as X,A as Y,a4 as A,B as _,C as Z,aQ 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,aM as ne}from"./index.d8ce26ef.js";import{useColumns as le}from"./columns.d3115b6a.js";import{e as se,h as ue}from"./index.d7823ef3.js";import{T as ie}from"./index.4ed99b91.js";import{u as g}from"./hooks.3def80f5.js";import{s as re}from"./status.fad06285.js";import{r as ce}from"./responseHandle.f073653a.js";import me from"./addEdit.5ba3ead4.js";const de={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:M}=le(),k=_(!1),B=_(""),L=_("add"),z=_(),b=A({total:0,pageSize:15,currentPage:1,background:!0}),P=async t=>{const{id:a,status:h}=t,{code:d,message:i}=await se({id:a,status:h+""=="1"?"0":"1"});ce({code:d,message:i,logout:x,handler:()=>m()})};async function R(t){o.page=t,await m()}async function T(t){o.size=t,o.page=1,await m()}function $(t){}async function m(){C.value=!0;const{code:t,data:a,message:h}=await ue(o);if(t===0){const{list:d,count:i}=a;w.value=d!=null?d:[],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 m()}function F(t,a){B.value=t,L.value=a,k.value=!0}const U=()=>{k.value=!1,m()},q=()=>{k.value=!1},J=t=>{!t||(t.resetFields(),o.page=1,m())};return Z(()=>{u.value=ee().getMenuActions("role"),u.value.some(t=>t=="001")&&m()}),(t,a)=>{const h=r("el-option"),d=r("el-select"),i=r("el-form-item"),K=r("el-input"),v=r("el-button"),O=r("el-form"),Q=r("el-popconfirm"),j=r("PureTable"),G=r("NoAuth");return f(),I("div",de,[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(d,{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(re),(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(ie),{title:"\u89D2\u8272\u7BA1\u7406",loading:C.value,dataList:w.value,onRefresh:m},{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(j,{border:"",align:"left",showOverflowTooltip:"","table-layout":"auto",size:e,data:w.value,columns:c(M),checkList:D,pagination:b,paginationSmall:e==="small","header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:$,onSizeChange:T,onCurrentChange:R},{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(Q,{key:2,title:p.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:s=>P(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(me,{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(G,null,null,512),[[E,!u.value.some(e=>e=="001")]])])}}});var Ve=W(ge,[["__scopeId","data-v-8a781c4e"]]);export{Ve as default};
