adminInfo-9e20d1e4.js 6.1 KB

1
  1. import{h as D,y as G,r as P,p as c,l as U,q as n,N as i,o as u,V as p,k as t,M as V,a0 as k,$ as F,W as w,ay as H,a6 as J,T as Q,U as X,t as r,a7 as Y}from"./vue-a39e6937.js";import{i as y,f as ee,e as ae,g as z,t as ne,a1 as oe,Z as te,_ as le}from"./index-ba596ae9.js";import{c as ie}from"./controllerUrls-941681c3.js";import{b}from"./validate-4ecec794.js";const S="/admin/routine.AdminInfo/",x=new Map([["index",S+"index"],["edit",S+"edit"],["log",ie+"index"]]);function de(){return y({url:x.get("index"),method:"get"})}function re(_={}){return y({url:x.get("log"),method:"get",params:_})}function $(_){return y({url:x.get("edit"),method:"post",data:_},{showSuccessMessage:!0})}const se={class:"default-main"},me={class:"admin-info"},ue={class:"image-slot"},fe={class:"admin-info-base"},pe={class:"admin-nickname"},ge={class:"admin-other"},ce={class:"admin-info-form"},_e=D({name:"routine/adminInfo"}),Ie=D({..._e,setup(_){const{t:o}=ee(),g=G(),I=ae(),e=P({adminInfo:{},formKey:z(),buttonLoading:!1,log:[],logFilter:{limit:12},logCurrentPage:1,logPageSize:12,logTotal:100,logLoading:!0});de().then(d=>{e.adminInfo=d.data.info,e.formKey=z(),e.logFilter.search=[{field:"admin_id",val:d.data.info.id,operator:"="}],v()});const v=()=>{re(e.logFilter).then(d=>{e.log=d.data.list,e.logTotal=d.data.total,e.logLoading=!1}).catch(()=>{e.logLoading=!1})},K=d=>{e.logPageSize=d,e.logFilter.limit=d,v()},T=d=>{e.logCurrentPage=d,e.logFilter.page=d,v()},A=P({nickname:[b({name:"required",title:o("routine.adminInfo.User nickname")})],email:[b({name:"email",title:o("routine.adminInfo.e-mail address")})],mobile:[b({name:"mobile",message:o("Please enter the correct field",{field:o("routine.adminInfo.phone number")})})],password:[b({name:"password"})]}),B=d=>{let a=new FormData;a.append("file",d.raw),te(a).then(s=>{s.code==1&&$({id:e.adminInfo.id,avatar:s.data.file.url}).then(()=>{I.dataFill({...I.$state,avatar:s.data.file.full_url}),e.adminInfo.avatar=s.data.file.full_url})})},h=d=>{d&&d.validate(a=>{if(a){let s={...e.adminInfo};delete s.lastlogintime,delete s.username,delete s.avatar,e.buttonLoading=!0,$(s).then(()=>{I.dataFill({...I.$state,nickname:e.adminInfo.nickname}),e.buttonLoading=!1}).catch(()=>{e.buttonLoading=!1})}})};return(d,a)=>{const s=r("Icon"),N=r("el-image"),M=r("el-upload"),f=r("el-input"),m=r("el-form-item"),C=r("el-button"),L=r("el-col"),R=r("el-timeline-item"),j=r("el-timeline"),q=r("el-pagination"),E=r("el-card"),O=r("el-row"),W=Y("loading");return c(),U("div",se,[n(O,{gutter:30},{default:i(()=>[n(L,{class:"lg-mb-20",xs:24,sm:24,md:24,lg:10},{default:i(()=>[u("div",me,[n(M,{class:"avatar-uploader",action:"","show-file-list":!1,onChange:B,"auto-upload":!1,accept:"image/gif, image/jpg, image/jpeg, image/bmp, image/png, image/webp"},{default:i(()=>[n(N,{src:e.adminInfo.avatar,class:"avatar"},{error:i(()=>[u("div",ue,[n(s,{size:"30",color:"#c0c4cc",name:"el-icon-Picture"})])]),_:1},8,["src"])]),_:1}),u("div",fe,[u("div",pe,p(e.adminInfo.nickname),1),u("div",ge,[u("div",null,p(t(o)("routine.adminInfo.Last logged in on"))+" "+p(e.adminInfo.lastlogintime),1)])]),u("div",ce,[(c(),V(t(H),{onKeyup:a[10]||(a[10]=k(l=>h(g.value),["enter"])),key:e.formKey,"label-position":"top",rules:A,ref_key:"formRef",ref:g,model:e.adminInfo},{default:i(()=>[n(m,{label:t(o)("routine.adminInfo.user name")},{default:i(()=>[n(f,{disabled:"",modelValue:e.adminInfo.username,"onUpdate:modelValue":a[0]||(a[0]=l=>e.adminInfo.username=l)},null,8,["modelValue"])]),_:1},8,["label"]),n(m,{label:t(o)("routine.adminInfo.User nickname"),prop:"nickname"},{default:i(()=>[n(f,{placeholder:t(o)("routine.adminInfo.Please enter a nickname"),modelValue:e.adminInfo.nickname,"onUpdate:modelValue":a[1]||(a[1]=l=>e.adminInfo.nickname=l)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),n(m,{label:t(o)("routine.adminInfo.e-mail address"),prop:"email"},{default:i(()=>[n(f,{placeholder:t(o)("Please input field",{field:t(o)("routine.adminInfo.e-mail address")}),modelValue:e.adminInfo.email,"onUpdate:modelValue":a[2]||(a[2]=l=>e.adminInfo.email=l)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),n(m,{label:t(o)("routine.adminInfo.phone number"),prop:"mobile"},{default:i(()=>[n(f,{placeholder:t(o)("Please input field",{field:t(o)("routine.adminInfo.phone number")}),modelValue:e.adminInfo.mobile,"onUpdate:modelValue":a[3]||(a[3]=l=>e.adminInfo.mobile=l)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),n(m,{label:t(o)("routine.adminInfo.autograph"),prop:"motto"},{default:i(()=>[n(f,{onKeyup:[a[4]||(a[4]=k(F(()=>{},["stop"]),["enter"])),a[5]||(a[5]=k(F(l=>h(g.value),["ctrl"]),["enter"]))],placeholder:t(o)("routine.adminInfo.This guy is lazy and doesn write anything"),type:"textarea",modelValue:e.adminInfo.motto,"onUpdate:modelValue":a[6]||(a[6]=l=>e.adminInfo.motto=l)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),n(m,{label:t(o)("routine.adminInfo.New password"),prop:"password"},{default:i(()=>[n(f,{type:"password",placeholder:t(o)("routine.adminInfo.Please leave blank if not modified"),modelValue:e.adminInfo.password,"onUpdate:modelValue":a[7]||(a[7]=l=>e.adminInfo.password=l)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),n(m,null,{default:i(()=>[n(C,{type:"primary",loading:e.buttonLoading,onClick:a[8]||(a[8]=l=>h(g.value))},{default:i(()=>[w(p(t(o)("routine.adminInfo.Save changes")),1)]),_:1},8,["loading"]),n(C,{onClick:a[9]||(a[9]=l=>t(ne)(g.value))},{default:i(()=>[w(p(t(o)("Reset")),1)]),_:1})]),_:1})]),_:1},8,["rules","model"]))])])]),_:1}),J((c(),V(L,{xs:24,sm:24,md:24,lg:12},{default:i(()=>[n(E,{header:t(o)("routine.adminInfo.Operation log"),shadow:"never"},{default:i(()=>[n(j,null,{default:i(()=>[(c(!0),U(Q,null,X(e.log,(l,Z)=>(c(),V(R,{key:Z,size:"large",timestamp:t(oe)(l.createtime)},{default:i(()=>[w(p(l.title),1)]),_:2},1032,["timestamp"]))),128))]),_:1}),n(q,{currentPage:e.logCurrentPage,"page-size":e.logPageSize,"page-sizes":[12,22,52,100],background:"",layout:"prev, next, jumper",total:e.logTotal,onSizeChange:K,onCurrentChange:T},null,8,["currentPage","page-size","total"])]),_:1},8,["header"])]),_:1})),[[W,e.logLoading]])]),_:1})])}}});const ke=le(Ie,[["__scopeId","data-v-b17ba511"]]);export{ke as default};