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