index.a616ac24.js 4.5 KB

1
  1. import{_ as W,d as X,l as Y,a8 as A,m as f,n as Z,R as ee,r,o as _,c as E,B as L,E as N,b as ae,h as l,x as n,F as te,y as oe,u as c,A as y,D as g,H as x,a as S,cU as le,cR as ne,ce as se}from"./index.56449854.js";import{a as ue,h as ie,b as re}from"./addEdit.925dc8c3.js";import{u as ce}from"./useCompany.e9cb4fed.js";import{a as me}from"./status.3ccd5ebb.js";import{useColumns as de}from"./columns.2d9d5f5a.js";const pe={class:"main role"},fe={name:"role"},_e=X({...fe,setup(ve){const{logout:z}=Y(),o=A({level:"",role_name:"",status:"",page:1,size:15}),u=f([]),w=f([]),C=f(!0),{columns:I}=de(),k=f(!1),V=f(""),B=f("add"),R=f();ce();const b=A({total:0,pageSize:15,currentPage:1,background:!0}),P=async a=>{const{id:t,status:h}=a,{code:d,message:i}=await ie({id:t,status:h+""=="1"?"0":"1"});ne({code:d,message:i,logout:z,handler:()=>m()})};async function T(a){o.page=a,await m()}async function U(a){o.size=a,o.page=1,await m()}function $(a){}async function m(){C.value=!0;const{code:a,data:t,message:h}=await re(o);if(C.value=!1,a===1){const{list:d,count:i}=t;w.value=d!=null?d:[],b.total=i!=null?i:0,b.pageSize=o.size,b.currentPage=o.page}else a>100&&a<140?z():se.error(h)}async function M(){o.page=1,await m()}function F(a,t){V.value=a,B.value=t,k.value=!0}const H=()=>{k.value=!1,m()},j=()=>{k.value=!1},O=a=>{!a||(a.resetFields(),o.page=1,m())};return Z(()=>{u.value=ee().getMenuActions("role"),u.value.some(a=>a=="3")&&m()}),(a,t)=>{const h=r("el-option"),d=r("el-select"),i=r("el-form-item"),q=r("el-input"),v=r("el-button"),G=r("el-form"),J=r("el-popconfirm"),K=r("PureTable"),Q=r("NoAuth");return _(),E("div",pe,[L(ae("div",null,[l(G,{ref_key:"formRef",ref:R,inline:!0,model:o,size:"small","label-width":0,class:"bg-white w-99/100 pl-8 pt-4"},{default:n(()=>[l(i,{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(()=>[(_(!0),E(te,null,oe(c(me),(e,D)=>(_(),y(h,{key:"status"+e.value+D,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,{prop:"role_name"},{default:n(()=>[l(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}),l(i,null,{default:n(()=>[l(v,{type:"primary",icon:c(g)("search"),loading:C.value,onClick:M},{default:n(()=>[x(" \u641C\u7D22 ")]),_:1},8,["icon","loading"]),l(v,{icon:c(g)("refresh"),onClick:t[2]||(t[2]=e=>O(R.value))},{default:n(()=>[x(" \u91CD\u7F6E ")]),_:1},8,["icon"])]),_:1})]),_:1},8,["model"]),l(c(le),{title:"\u516C\u53F8\u89D2\u8272\u7BA1\u7406",loading:C.value,dataList:w.value,onRefresh:m},{buttons:n(()=>[u.value.some(e=>e=="2")?(_(),y(v,{key:0,type:"primary",size:"small",icon:c(g)("add"),onClick:t[3]||(t[3]=e=>F("","add"))},{default:n(()=>[x(" \u65B0\u589E\u89D2\u8272 ")]),_:1},8,["icon"])):S("v-if",!0)]),default:n(({size:e,checkList:D})=>[l(K,{border:"",align:"left",showOverflowTooltip:"","table-layout":"auto",size:"small",data:w.value,columns:c(I),checkList:D,pagination:b,paginationSmall:e==="small","header-cell-style":{background:"#fafafa",color:"#606266"},onSelectionChange:$,onSizeChange:U,onCurrentChange:T},{operation:n(({row:p})=>[u.value.some(s=>s=="5")?(_(),y(v,{key:0,class:"reset-margin",link:"",type:"primary",size:e,onClick:s=>F(p.id,"view"),icon:c(g)("eye-view")},null,8,["size","onClick","icon"])):S("v-if",!0),u.value.some(s=>s=="4")?(_(),y(v,{key:1,class:"reset-margin",link:"",type:"primary",size:e,onClick:s=>F(p.id,"edit"),icon:c(g)("edits")},null,8,["size","onClick","icon"])):S("v-if",!0),u.value.some(s=>s=="7")&&p.status+""=="1"||u.value.some(s=>s=="6")&&p.status+""=="0"?(_(),y(J,{key:2,title:String(p.status)==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:s=>P(p)},{reference:n(()=>[l(v,{class:"reset-margin",link:"",type:"primary",size:e,icon:c(g)(String(p.status)==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["size","icon"])]),_:2},1032,["title","onConfirm"])):S("v-if",!0)]),_:2},1032,["data","columns","checkList","pagination","paginationSmall"])]),_:1},8,["loading","dataList"]),l(ue,{itemId:V.value,isDetails:B.value,"show-model":k.value,onRefresh:H,onCancel:j},null,8,["itemId","isDetails","show-model"])],512),[[N,u.value.some(e=>e=="3")]]),L(l(Q,null,null,512),[[N,!u.value.some(e=>e=="3")]])])}}});var be=W(_e,[["__scopeId","data-v-5fc99eaf"],["__file","C:/Users/89793/Desktop/projects/report-v3/src/views/system/role/index.vue"]]);export{be as default};