index.9c091c.js 5.3 KB

1
  1. import{_ as ue,d as ie,w as re,Z as P,x as y,W as ce,ai as me,aP as N,y as de,ad as pe,A as fe,r,o as p,c as $,a as h,H as M,K as T,h as ve,l,D as s,F as _e,E as ye,m as o,by as ge,G as C,J as g,M as B,bA as he,ar as Ce,bx as be,aZ as H}from"./index.js";import{useColumns as ke}from"./columns.172b29.js";import{e as we,h as Fe}from"./index.04e98f94.js";import Ne from"./addEdit.d6abaf.js";import De from"./role-copy.793bec.js";const Se={class:"main role"},xe={name:"role"},Ee=ie({...xe,setup(Be){const{logout:I}=re(),n=P({level:"",role_name:"",status:"",page:1,size:15}),c=y([]),D=y([]),b=y(!0),{columns:Z}=ke(),k=y(!1),R=y(""),z=y("add"),V=y(),{currentCompany:S}=ce(),{isSuperUser:j,userInfo:G}=me(),w=P({total:0,pageSize:15,currentPage:1,background:!0}),J=async a=>{const{id:t,status:f}=a,{code:v,message:m}=await we({roleid:t,status:f+""=="1"?"0":"1"});be({code:v,message:m,logout:I,handler:()=>i()})};async function K(a){n.page=a,await i()}async function O(a){n.size=a,n.page=1,await i()}function W(a){}async function i(){b.value=!0;const{code:a,data:t,message:f}=await Fe({...n,level:"2",companyNo:S.value.companyNo});if(a===0){const{list:v,count:m}=t;D.value=v!=null?v:[],w.total=m!=null?m:0,w.pageSize=n.size,w.currentPage=n.page}else a>100&&a<140?I():H.error(f);b.value=!1}async function q(){n.page=1,await i()}function x(a,t){if(!S.value.companyNo){H.warning("\u8BF7\u9009\u62E9\u4E00\u4E2A\u516C\u53F8");return}R.value=a,z.value=t,k.value=!0}const Q=()=>{k.value=!1,i()},X=()=>{k.value=!1},Y=a=>{!a||(a.resetFields(),n.page=1,i())},A=N(""),L=N(""),U=N(""),F=N(!1);function ee(a){const{id:t,role_name:f}=a;A.value=t,L.value=f,U.value=a.companyNo,F.value=!0}return de(()=>{c.value=pe().getMenuActions("role"),c.value.some(a=>a=="001")&&i()}),fe(()=>S.value,()=>i()),(a,t)=>{const f=r("el-option"),v=r("el-select"),m=r("el-form-item"),ae=r("el-input"),_=r("el-button"),te=r("el-form"),oe=r("el-popconfirm"),le=r("el-tooltip"),ne=r("PureTable"),se=r("NoAuth");return p(),$("div",Se,[h(' <el-button @click="setRoles">\u8BBE\u7F6E\u89D2\u8272</el-button> '),M(ve("div",null,[l(te,{ref_key:"formRef",ref:V,inline:!0,model:n,size:"small","label-width":0,class:"bg-white w-99/100 pl-8 pt-4"},{default:s(()=>[l(m,{prop:"status"},{default:s(()=>[l(v,{modelValue:n.status,"onUpdate:modelValue":t[0]||(t[0]=e=>n.status=e),style:{width:"100%"},placeholder:"\u89D2\u8272\u72B6\u6001",clearable:""},{default:s(()=>[(p(!0),$(_e,null,ye(o(ge),(e,E)=>(p(),C(f,{key:"status"+e.value+E,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(m,{prop:"role_name"},{default:s(()=>[l(ae,{modelValue:n.role_name,"onUpdate:modelValue":t[1]||(t[1]=e=>n.role_name=e),placeholder:"\u89D2\u8272\u540D\u79F0",clearable:""},null,8,["modelValue"])]),_:1}),l(m,null,{default:s(()=>[l(_,{type:"primary",icon:o(g)("search"),loading:b.value,onClick:q},{default:s(()=>[B(" \u641C\u7D22 ")]),_:1},8,["icon","loading"]),l(_,{icon:o(g)("refresh"),onClick:t[2]||(t[2]=e=>Y(V.value))},{default:s(()=>[B(" \u91CD\u7F6E ")]),_:1},8,["icon"])]),_:1})]),_:1},8,["model"]),l(o(he),{title:"\u516C\u53F8\u89D2\u8272\u7BA1\u7406",loading:b.value,dataList:D.value,onRefresh:i},{buttons:s(()=>[c.value.some(e=>e=="002")?(p(),C(_,{key:0,type:"primary",size:"small",icon:o(g)("add"),onClick:t[3]||(t[3]=e=>x("","add"))},{default:s(()=>[B(" \u65B0\u589E\u89D2\u8272 ")]),_:1},8,["icon"])):h("v-if",!0)]),default:s(({size:e,checkList:E})=>[l(ne,{border:"",align:"left",showOverflowTooltip:"","table-layout":"auto",size:"small",data:D.value,columns:o(Z),checkList:E,pagination:w,paginationSmall:e==="small","header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:W,onSizeChange:O,onCurrentChange:K},{operation:s(({row:d})=>[c.value.some(u=>u=="007")?(p(),C(_,{key:0,class:"reset-margin",link:"",type:"primary",size:e,onClick:u=>x(d.id,"view"),icon:o(g)("eye-view")},null,8,["size","onClick","icon"])):h("v-if",!0),c.value.some(u=>u=="005")?(p(),C(_,{key:1,class:"reset-margin",link:"",type:"primary",size:e,onClick:u=>x(d.id,"edit"),icon:o(g)("edits")},null,8,["size","onClick","icon"])):h("v-if",!0),c.value.some(u=>u=="004")&&d.status+""=="1"||c.value.some(u=>u=="003")&&d.status+""=="0"?(p(),C(oe,{key:2,title:d.status==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:u=>J(d)},{reference:s(()=>[l(_,{class:"reset-margin",link:"",type:"primary",size:e,icon:o(g)(d.status==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"])):h("v-if",!0),o(j)&&String(o(G).id)!=="156"?(p(),C(le,{key:3,content:"\u590D\u5236\u89D2\u8272"},{default:s(()=>[l(_,{class:"reset-margin",link:"",type:"primary",onClick:u=>ee(d),size:e,icon:o(g)("dict")},null,8,["onClick","size","icon"])]),_:2},1024)):h("v-if",!0)]),_:2},1032,["data","columns","checkList","pagination","paginationSmall"])]),_:1},8,["loading","dataList"]),l(Ne,{itemId:R.value,isDetails:z.value,"show-model":k.value,onRefresh:Q,onCancel:X},null,8,["itemId","isDetails","show-model"]),l(De,{visible:o(F),"onUpdate:visible":t[4]||(t[4]=e=>Ce(F)?F.value=e:null),roleId:o(A),roleName:o(L),companyNo:o(U),onRefresh:i},null,8,["visible","roleId","roleName","companyNo"])],512),[[T,c.value.some(e=>e=="001")]]),M(l(se,null,null,512),[[T,!c.value.some(e=>e=="001")]])])}}});var Le=ue(Ee,[["__scopeId","data-v-2ee5bcd4"],["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/interest/role/index.vue"]]);export{Le as default};