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