index.be831821.js 4.7 KB

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