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