import{_ as Y,d as Z,v as ee,ad as A,w as f,x as ae,X as te,z as oe,r as c,o as v,c as L,H as I,K as R,b as le,l,C as n,F as ne,D as se,u as m,G as y,J as g,M as z,a as w,b5 as ue,b2 as ie,au as M}from"./index.1d5f2f42.js";import{useColumns as re}from"./columns.2618251d.js";import{e as ce,h as me}from"./index.52a82cd1.js";import{a as de}from"./status.3ccd5ebb.js";import pe from"./addEdit.58cb4de5.js";import{u as fe}from"./useCompany.f3b703c8.js";const ve={class:"main role"},_e={name:"role"},ge=Z({..._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}=re(),k=f(!1),V=f(""),B=f("add"),E=f(),{currentCompany:S}=fe(),b=A({total:0,pageSize:15,currentPage:1,background:!0}),T=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:N,handler:()=>i()})};async function $(a){o.page=a,await i()}async function H(a){o.size=a,o.page=1,await i()}function U(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?N():M.error(h);C.value=!1}async function G(){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 J=()=>{k.value=!1,i()},K=()=>{k.value=!1},O=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"),X=c("el-input"),_=c("el-button"),j=c("el-form"),q=c("el-popconfirm"),Q=c("PureTable"),W=c("NoAuth");return v(),L("div",ve,[I(le("div",null,[l(j,{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(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(X,{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:G},{default:n(()=>[z(" \u641C\u7D22 ")]),_:1},8,["icon","loading"]),l(_,{icon:m(g)("refresh"),onClick:t[2]||(t[2]=e=>O(E.value))},{default:n(()=>[z(" \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(()=>[z(" \u65B0\u589E\u89D2\u8272 ")]),_:1},8,["icon"])):w("v-if",!0)]),default:n(({size:e,checkList:x})=>[l(Q,{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:U,onSizeChange:H,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(q,{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(pe,{itemId:V.value,isDetails:B.value,"show-model":k.value,onRefresh:J,onCancel:K},null,8,["itemId","isDetails","show-model"])],512),[[R,u.value.some(e=>e=="001")]]),I(l(W,null,null,512),[[R,!u.value.some(e=>e=="001")]])])}}});var Se=Y(ge,[["__scopeId","data-v-2ee5bcd4"],["__file","D:/work/rep-v3/report-v3/src/views/interest/role/index.vue"]]);export{Se as default};
