index.DGZ9oeZU.js 5.8 KB

1
  1. import{d as W,a as i,r as K,o as Q,b as f,x as X,e as O,f as C,z as L,g as d,E as Y,u as t,s,A as x,$ as V,w as u,j as ee,h as te,l as S,n as oe,F as se}from"./vue.BxlDVA1H.js";import{O as ae,P as ne,g as E,m as le,a1 as y,R as re}from"./index.lP_uh0LI.js";import{M as F}from"./md5.DLPczxzP.js";import{c as ie,g as de,r as pe}from"./crud.DiuvoTwR.js";import{_ as ue}from"./index.vue_vue_type_script_setup_true_name_importExcel_lang.NIlRmFc0.js";import{i as M,L as ce}from"./echarts.DQYQA18e.js";import{_ as me}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./authFunction.z5AMEiSQ.js";import"./dictionary.D0i47SYU.js";const we={class:"dept-user-com-box dept-info"},fe={class:"di-left"},_e={class:"di-cell"},ve={class:"content"},ge={class:"di-cell"},he={class:"content"},xe={class:"di-cell"},ye={class:"content"},Pe={class:"di-cell"},be={key:0,style:{display:"flex","justify-content":"center","align-items":"center"}},Ce={class:"dialog-footer"},Ve=W({name:"user"}),Se=W({...Ve,setup(ke,{expose:j}){let k,D;const R=i(),B=i(),{crudExpose:g}=ae({crudRef:R,crudBinding:B});let _=i(""),I=i(),U=i(),c=i(!1),l=i({}),p=i(!1),m=i(!1),o=K({id:0,newPassword:"",newPassword2:""});const z=()=>{var r,h;const a=((r=l.value.sub_dept_map)==null?void 0:r.map(v=>v.name))||[],e=((h=l.value.sub_dept_map)==null?void 0:h.map(v=>v.count))||[],w={tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},xAxis:{type:"category",data:a,axisTick:{alignWithLabel:!0}},yAxis:{type:"value"},dataZoom:[{type:"inside"}],grid:{top:"6%",right:"5%",bottom:"10%",left:"10%"},series:[{data:e,type:"bar",barWidth:"60%",showBackground:!0,itemStyle:{color:new ce(0,0,0,1,[{offset:0,color:"#83bff6"},{offset:.5,color:"#188df0"},{offset:1,color:"#188df0"}])}}]};k.setOption(w)},H=()=>{var e,w,r;const a={tooltip:{trigger:"item"},legend:{orient:"vertical",right:"0%",left:"65%",top:"center",itemWidth:12,itemHeight:12},series:[{type:"pie",radius:"65%",center:["32%","50%"],label:{show:!1,position:"center"},color:["#188df0","#f56c6c","#dcdfe6"],data:[{value:((e=l.value.gender)==null?void 0:e.male)||0,name:"男"},{value:((w=l.value.gender)==null?void 0:w.female)||0,name:"女"},{value:((r=l.value.gender)==null?void 0:r.unknown)||0,name:"未知"}]}]};D.setOption(a)},P=async()=>{if(_.value){const a=await de(_.value,c.value?"1":"0");(a==null?void 0:a.code)===2e4&&(l.value=a.data,z(),H())}},A=a=>{_.value=a,g.doSearch({form:{dept:a}}),P()},T=()=>{A(_.value)},Z=({id:a})=>{o.id=a,m.value=!0},b=()=>{m.value=!1,o.id=0,o.newPassword="",o.newPassword2=""},$=async()=>{if(!o.id){y("请选择用户!");return}if(!o.newPassword||!o.newPassword2){y("请输入密码!");return}if(o.newPassword!==o.newPassword2){y("两次输入密码不一致");return}const a=new RegExp("(?=.*[0-9])(?=.*[a-zA-Z]).{8,30}");if(!a.test(o.newPassword)||!a.test(o.newPassword2)){y("您的密码复杂度太低(密码中必须包含字母、数字)");return}const e=await pe(o.id,{newPassword:F.hashStr(o.newPassword),newPassword2:F.hashStr(o.newPassword2)});(e==null?void 0:e.code)===2e4&&(re(e.msg||"修改成功!"),b())};Q(()=>{k=M(I.value),D=M(U.value),P(),g.doRefresh()}),j({handleDoRefreshUser:A});const{crudOptions:G}=ie({crudExpose:g,context:{getDeptInfo:P,isShowChildFlag:c,handleResetPwdOpen:Z}});return ne({crudExpose:g,crudOptions:G,context:{}}),(a,e)=>{const w=f("el-switch"),r=f("el-button"),h=f("el-image"),v=f("fs-crud"),N=f("el-input"),q=f("el-dialog"),J=X("auth");return C(),O(se,null,[L(s("div",we,[s("div",fe,[s("h3",null,x(t(l).dept_name||""),1),s("div",_e,[e[5]||(e[5]=s("p",null,"部门负责人:",-1)),s("p",ve,x(t(l).owner||"无"),1)]),s("div",ge,[e[6]||(e[6]=s("p",null,"部门人数:",-1)),s("p",he,x(t(l).dept_user||0)+"人",1)]),s("div",xe,[e[7]||(e[7]=s("p",null,"部门简介:",-1)),s("p",ye,x(t(l).description||"无"),1)]),s("div",Pe,[e[8]||(e[8]=s("p",null,"显示子级:",-1)),d(w,{modelValue:t(c),"onUpdate:modelValue":e[0]||(e[0]=n=>V(c)?c.value=n:c=n),"inline-prompt":"","active-text":"是","inactive-text":"否",disabled:!t(_),onChange:T,style:{"--el-switch-on-color":"var(--el-color-primary)"}},null,8,["modelValue","disabled"])])]),s("div",{style:{height:"180px",width:"380px"},ref_key:"deptCountBar",ref:I},null,512),s("div",{style:{height:"180px",width:"200px"},ref_key:"deptSexPie",ref:U},null,512)],512),[[Y,!t(p)]]),d(v,oe({ref_key:"crudRef",ref:R},B.value,{customClass:t(p)?"dept-user-com-box dept-user-com-table-cover":"dept-user-com-box dept-user-com-table"}),{"toolbar-left":u(()=>[d(r,{icon:t(p)?"View":"Hide",circle:"",onClick:e[1]||(e[1]=n=>V(p)?p.value=!t(p):p=!t(p))},null,8,["icon"])]),"actionbar-right":u(()=>[L((C(),te(ue,{api:`${t(le).system}/user/`},{default:u(()=>e[9]||(e[9]=[S("导入 ")])),_:1,__:[9]},8,["api"])),[[J,"user:Import"]])]),cell_avatar:u(n=>[n.row.avatar?(C(),O("div",be,[d(h,{style:{width:"50px",height:"50px","border-radius":"50%","aspect-ratio":"1 /1"},src:t(E)(n.row.avatar),"preview-src-list":[t(E)(n.row.avatar)],"preview-teleported":!0},null,8,["src","preview-src-list"])])):ee("",!0)]),_:1},16,["customClass"]),d(q,{modelValue:t(m),"onUpdate:modelValue":e[4]||(e[4]=n=>V(m)?m.value=n:m=n),title:"重设密码",width:"400px",draggable:"","before-close":b},{footer:u(()=>[s("span",Ce,[d(r,{onClick:b},{default:u(()=>e[10]||(e[10]=[S("取消")])),_:1,__:[10]}),d(r,{type:"primary",onClick:$},{default:u(()=>e[11]||(e[11]=[S(" 保存 ")])),_:1,__:[11]})])]),default:u(()=>[s("div",null,[d(N,{modelValue:t(o).newPassword,"onUpdate:modelValue":e[2]||(e[2]=n=>t(o).newPassword=n),type:"password",placeholder:"请输入密码","show-password":"",style:{"margin-bottom":"20px"}},null,8,["modelValue"]),d(N,{modelValue:t(o).newPassword2,"onUpdate:modelValue":e[3]||(e[3]=n=>t(o).newPassword2=n),type:"password",placeholder:"请再次输入密码","show-password":""},null,8,["modelValue"])])]),_:1},8,["modelValue"])],64)}}}),Ee=me(Se,[["__scopeId","data-v-14892de7"]]);export{Ee as default};