index.7cfce76b.js 4.7 KB

1
  1. 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 R,B as L,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 z,a as w,cU as ue,cR as ie,ce as P}from"./index.56449854.js";import{useColumns as re}from"./columns.9bb989b1.js";import{e as ce,h as me}from"./index.1844ab0a.js";import{a as de}from"./status.3ccd5ebb.js";import pe from"./addEdit.98fee7ba.js";import{u as fe}from"./useCompany.e9cb4fed.js";const ve={class:"main role"},_e={name:"role"},ge=Z({..._e,setup(he){const{logout:B}=ee(),o=A({level:"",role_name:"",status:"",page:1,size:15}),u=f([]),F=f([]),C=f(!0),{columns:T}=re(),k=f(!1),E=f(""),N=f("add"),V=f(),{currentCompany:S}=fe(),b=A({total:0,pageSize:15,currentPage:1,background:!0}),U=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:B,handler:()=>i()})};async function $(a){o.page=a,await i()}async function M(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?B():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}E.value=a,N.value=t,k.value=!0}const O=()=>{k.value=!1,i()},q=()=>{k.value=!1},G=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"),J=c("el-input"),_=c("el-button"),K=c("el-form"),Q=c("el-popconfirm"),W=c("PureTable"),X=c("NoAuth");return v(),R("div",ve,[L(le("div",null,[l(K,{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),R(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(J,{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=>G(V.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(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:M,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=>U(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:E.value,isDetails:N.value,"show-model":k.value,onRefresh:O,onCancel:q},null,8,["itemId","isDetails","show-model"])],512),[[I,u.value.some(e=>e=="001")]]),L(l(X,null,null,512),[[I,!u.value.some(e=>e=="001")]])])}}});var Se=Y(ge,[["__scopeId","data-v-2ee5bcd4"],["__file","C:/Users/89793/Desktop/projects/report-v3/src/views/interest/role/index.vue"]]);export{Se as default};