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