index.67dacc.js 4.7 KB

1
  1. import{_ as Q,d as Y,v as ee,Z as A,w as f,W as ae,x as te,ad as oe,z as le,r as c,o as v,c as L,a as y,H as R,K as I,h as ne,j as l,C as n,F as se,D as ue,l as m,G as C,J as g,M as z,aW as ie,aX as re,aN as M}from"./index.js";import{useColumns as ce}from"./columns.4c46e9.js";import{c as me,h as de}from"./index.84fc395c.js";import{a as pe}from"./status.151ccddb.js";import fe from"./addEdit.7daa18.js";const ve={class:"main role"},_e={name:"role"},ge=Y({..._e,setup(he){const{logout:B}=ee(),o=A({level:"",role_name:"",status:"",page:1,size:15}),u=f([]),F=f([]),k=f(!0),{columns:P}=ce(),b=f(!1),E=f(""),N=f("add"),V=f(),{currentCompany:D}=ae(),w=A({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:B,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(){k.value=!0;const{code:a,data:t,message:h}=await de({...o,level:"2",companyNo:D.value.companyNo});if(a===0){const{list:d,count:r}=t;F.value=d!=null?d:[],w.total=r!=null?r:0,w.pageSize=o.size,w.currentPage=o.page}else a>100&&a<140?B():M.error(h);k.value=!1}async function j(){o.page=1,await i()}function S(a,t){if(!D.value.companyNo){M.warning("\u8BF7\u9009\u62E9\u4E00\u4E2A\u516C\u53F8");return}E.value=a,N.value=t,b.value=!0}const W=()=>{b.value=!1,i()},G=()=>{b.value=!1},J=a=>{!a||(a.resetFields(),o.page=1,i())};return te(()=>{u.value=oe().getMenuActions("role"),u.value.some(a=>a=="001")&&i()}),le(()=>D.value,()=>i()),(a,t)=>{const h=c("el-option"),d=c("el-select"),r=c("el-form-item"),K=c("el-input"),_=c("el-button"),O=c("el-form"),X=c("el-popconfirm"),Z=c("PureTable"),q=c("NoAuth");return v(),L("div",ve,[y(' <el-button @click="setRoles">\u8BBE\u7F6E\u89D2\u8272</el-button> '),R(ne("div",null,[l(O,{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(se,null,ue(m(pe),(e,x)=>(v(),C(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(K,{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:k.value,onClick:j},{default:n(()=>[z(" \u641C\u7D22 ")]),_:1},8,["icon","loading"]),l(_,{icon:m(g)("refresh"),onClick:t[2]||(t[2]=e=>J(V.value))},{default:n(()=>[z(" \u91CD\u7F6E ")]),_:1},8,["icon"])]),_:1})]),_:1},8,["model"]),l(m(ie),{title:"\u516C\u53F8\u89D2\u8272\u7BA1\u7406",loading:k.value,dataList:F.value,onRefresh:i},{buttons:n(()=>[u.value.some(e=>e=="002")?(v(),C(_,{key:0,type:"primary",size:"small",icon:m(g)("add"),onClick:t[3]||(t[3]=e=>S("","add"))},{default:n(()=>[z(" \u65B0\u589E\u89D2\u8272 ")]),_:1},8,["icon"])):y("v-if",!0)]),default:n(({size:e,checkList:x})=>[l(Z,{border:"",align:"left",showOverflowTooltip:"","table-layout":"auto",size:"small",data:F.value,columns:m(P),checkList:x,pagination:w,paginationSmall:e==="small","header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:H,onSizeChange:U,onCurrentChange:$},{operation:n(({row:p})=>[u.value.some(s=>s=="007")?(v(),C(_,{key:0,class:"reset-margin",link:"",type:"primary",size:e,onClick:s=>S(p.id,"view"),icon:m(g)("eye-view")},null,8,["size","onClick","icon"])):y("v-if",!0),u.value.some(s=>s=="005")?(v(),C(_,{key:1,class:"reset-margin",link:"",type:"primary",size:e,onClick:s=>S(p.id,"edit"),icon:m(g)("edits")},null,8,["size","onClick","icon"])):y("v-if",!0),u.value.some(s=>s=="004")&&p.status+""=="1"||u.value.some(s=>s=="003")&&p.status+""=="0"?(v(),C(X,{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"])):y("v-if",!0)]),_:2},1032,["data","columns","checkList","pagination","paginationSmall"])]),_:1},8,["loading","dataList"]),l(fe,{itemId:E.value,isDetails:N.value,"show-model":b.value,onRefresh:W,onCancel:G},null,8,["itemId","isDetails","show-model"])],512),[[I,u.value.some(e=>e=="001")]]),R(l(q,null,null,512),[[I,!u.value.some(e=>e=="001")]])])}}});var Fe=Q(ge,[["__scopeId","data-v-2ee5bcd4"],["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/interest/role/index.vue"]]);export{Fe as default};