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