import{_ as Y,d as Z,l as ee,a8 as A,m as f,n as ae,R as te,w as oe,r as c,o as v,c as L,B as R,E as I,b as le,h as l,x as n,F as ne,y as se,u as m,A as y,D as g,H as N,a as w,cQ as ue,cN as ie,cc as P}from"./index.e80c366d.js";import{useColumns as re}from"./columns.7a2c9a19.js";import{e as ce,h as me}from"./index.a292e2d1.js";import{a as de}from"./status.3ccd5ebb.js";import pe from"./addEdit.bf5b839d.js";import{u as fe}from"./useCompany.1643e7d1.js";const ve={class:"main role"},_e={name:"role"},ge=Z({..._e,setup(he){const{logout:z}=ee(),o=A({level:"",role_name:"",status:"",page:1,size:15}),u=f([]),F=f([]),C=f(!0),{columns:T}=re(),k=f(!1),B=f(""),E=f("add"),V=f(),{currentCompany:S}=fe(),b=A({total:0,pageSize:15,currentPage:1,background:!0}),$=async a=>{const{id:t,status:h}=a,{code:d,message:r}=await ce({roleid:t,status:h+""=="1"?"0":"1"});ie({code:d,message:r,logout:z,handler:()=>i()})};async function M(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 me({...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?z():P.error(h);C.value=!1}async function j(){o.page=1,await i()}function D(a,t){if(!S.value.companyNo){P.warning("\u8BF7\u9009\u62E9\u4E00\u4E2A\u516C\u53F8");return}B.value=a,E.value=t,k.value=!0}const O=()=>{k.value=!1,i()},Q=()=>{k.value=!1},q=a=>{!a||(a.resetFields(),o.page=1,i())};return ae(()=>{u.value=te().getMenuActions("role"),u.value.some(a=>a=="001")&&i()}),oe(()=>S.value,()=>i()),(a,t)=>{const h=c("el-option"),d=c("el-select"),r=c("el-form-item"),G=c("el-input"),_=c("el-button"),J=c("el-form"),K=c("el-popconfirm"),W=c("PureTable"),X=c("NoAuth");return v(),L("div",ve,[R(le("div",null,[l(J,{ref_key:"formRef",ref:V,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(ne,null,se(m(de),(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(G,{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(()=>[N(" \u641C\u7D22 ")]),_:1},8,["icon","loading"]),l(_,{icon:m(g)("refresh"),onClick:t[2]||(t[2]=e=>q(V.value))},{default:n(()=>[N(" \u91CD\u7F6E ")]),_:1},8,["icon"])]),_:1})]),_:1},8,["model"]),l(m(ue),{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(()=>[N(" \u65B0\u589E\u89D2\u8272 ")]),_:1},8,["icon"])):w("v-if",!0)]),default:n(({size:e,checkList:x})=>[l(W,{border:"",align:"left",showOverflowTooltip:"","table-layout":"auto",size:"small",data:F.value,columns:m(T),checkList:x,pagination:b,paginationSmall:e==="small","header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:H,onSizeChange:U,onCurrentChange:M},{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(K,{key:2,title:p.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:s=>$(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(pe,{itemId:B.value,isDetails:E.value,"show-model":k.value,onRefresh:O,onCancel:Q},null,8,["itemId","isDetails","show-model"])],512),[[I,u.value.some(e=>e=="001")]]),R(l(X,null,null,512),[[I,!u.value.some(e=>e=="001")]])])}}});var Se=Y(ge,[["__scopeId","data-v-2ee5bcd4"],["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/interest/role/index.vue"]]);export{Se as default};
