| 1 |
- import{O,S as A,y as N,r as K,m as W,aa as G,ab as J,a3 as R,P as Q}from"./index.BeV-poOC.js";import{M as z}from"./md5.DLPczxzP.js";import{c as Z,g as X,r as Y}from"./crud.DvCLH6JS.js";import{a as B,i as ee,r,ae as _,af as T,c as U,o as h,G as n,H as l,D as te,U as c,u as a,Q as j,b as g,y as oe,q as se,R as ae,E as le,x as M,K as ne,M as re}from"./vue.D_RgHSVm.js";import"./echarts.Bybs1aDD.js";import{_ as ie}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./dictionary.BZivG88R.js";import"./authFunction.BbBLN5Mf.js";const de={style:{display:"inline-block"}},ue={class:"dialog-footer"},pe=B({name:"importExcel"}),fe=B({...pe,props:{upload:{type:Object,default(){return{open:!0,title:"",isUploading:!1,updateSupport:0,headers:{Authorization:"JWT "+A.get("token")},url:O()+"api/system/file/"}}},api:{type:String,default(){}}},setup($){const D=ee("refreshView");let m=$,d=r(!1);const x=r(),u=r(!1),y=r(!1),V=function(){u.value=!0},b=function(){N({url:m.api+"import_data/",params:{},method:"get"})},p=function(){N({url:m.api+"update_template/",params:{},method:"get"})},w=function(v,e,f){y.value=!0},o=function(v,e,f){return y.value=!1,d.value=!0,x.value.clearFiles(),K({url:m.api+"import_data/",method:"post",data:{url:v.data.url}}).then(P=>{d.value=!1,W.alert("导入成功","导入完成",{confirmButtonText:"OK",callback:k=>{D()}})}).catch(()=>{d.value=!1})},F=function(){x.value.submit()};return(v,e)=>{const f=_("el-button"),P=_("el-upload"),k=_("el-dialog"),I=T("loading");return h(),U("div",de,[n(f,{size:"default",type:"success",onClick:e[0]||(e[0]=s=>V())},{default:l(()=>[te(v.$slots,"default",{},()=>[e[3]||(e[3]=c("导入",-1))])]),_:3}),n(k,{title:a(m).upload.title,modelValue:u.value,"onUpdate:modelValue":e[2]||(e[2]=s=>u.value=s),width:"400px","append-to-body":""},{footer:l(()=>[g("div",ue,[n(f,{type:"primary",disabled:a(d),onClick:F},{default:l(()=>[...e[9]||(e[9]=[c("确 定",-1)])]),_:1},8,["disabled"]),n(f,{disabled:a(d),onClick:e[1]||(e[1]=s=>u.value=!1)},{default:l(()=>[...e[10]||(e[10]=[c("取 消",-1)])]),_:1},8,["disabled"])])]),default:l(()=>[j((h(),U("div",null,[n(P,{ref_key:"uploadRef",ref:x,limit:1,accept:".xlsx, .xls",headers:a(m).upload.headers,action:a(m).upload.url,disabled:y.value,"on-progress":w,"on-success":o,"auto-upload":!1,drag:""},{tip:l(()=>[...e[4]||(e[4]=[g("div",{class:"el-upload__tip",style:{color:"red"}},"提示:仅允许导入“xls”或“xlsx”格式文件!",-1)])]),default:l(()=>[e[5]||(e[5]=g("i",{class:"el-icon-upload"},null,-1)),e[6]||(e[6]=g("div",{class:"el-upload__text"},[c(" 将文件拖到此处,或 "),g("em",null,"点击上传")],-1))]),_:1},8,["headers","action","disabled"]),g("div",null,[n(f,{type:"warning",style:{"font-size":"14px","margin-top":"20px"},onClick:b},{default:l(()=>[...e[7]||(e[7]=[c("下载导入模板",-1)])]),_:1}),n(f,{type:"warning",style:{"font-size":"14px","margin-top":"20px"},onClick:p},{default:l(()=>[...e[8]||(e[8]=[c("批量更新模板",-1)])]),_:1})])])),[[I,a(d)]])]),_:1},8,["title","modelValue"])])}}}),ce={key:0,style:{display:"flex","justify-content":"center","align-items":"center"}},me={class:"dialog-footer"},we=B({name:"user"}),ve=B({...we,setup($,{expose:D}){let m;const d=r(),x=r(),{crudExpose:u}=G({crudRef:d,crudBinding:x});let y=r("");r(),r();let V=r(!1),b=r({}),p=r(!1),w=r(!1),o=oe({id:0,newPassword:"",newPassword2:""});const F=()=>{var t,C,S;const s={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:((t=b.value.gender)==null?void 0:t.male)||0,name:"男"},{value:((C=b.value.gender)==null?void 0:C.female)||0,name:"女"},{value:((S=b.value.gender)==null?void 0:S.unknown)||0,name:"未知"}]}]};m.setOption(s)},v=async()=>{const s=await X(y.value,V.value?"1":"0");(s==null?void 0:s.code)===2e3&&(b.value=s.data,F())},e=s=>{y.value=s,u.doSearch({form:{dept:s}}),v()},f=({id:s})=>{o.id=s,w.value=!0},P=()=>{w.value=!1,o.id=0,o.newPassword="",o.newPassword2=""},k=async()=>{if(!o.id){R("请选择用户!");return}if(!o.newPassword||!o.newPassword2){R("请输入密码!");return}if(o.newPassword!==o.newPassword2){R("两次输入密码不一致");return}const s=new RegExp("(?=.*[0-9])(?=.*[a-zA-Z]).{8,30}");if(!s.test(o.newPassword)||!s.test(o.newPassword2)){R("您的密码复杂度太低(密码中必须包含字母、数字)");return}const t=await Y(o.id,{newPassword:z.hashStr(o.newPassword),newPassword2:z.hashStr(o.newPassword2)});(t==null?void 0:t.code)===2e3&&(Q(t.msg||"修改成功!"),P())};se(()=>{v(),u.doRefresh()}),D({handleDoRefreshUser:e});const{crudOptions:I}=Z({crudExpose:u,context:{getDeptInfo:v,isShowChildFlag:V,handleResetPwdOpen:f}});return J({crudExpose:u,crudOptions:I,context:{}}),(s,t)=>{const C=_("el-button"),S=_("el-image"),H=_("fs-crud"),E=_("el-input"),L=_("el-dialog"),q=T("auth");return h(),U(re,null,[n(H,ne({ref_key:"crudRef",ref:d},x.value,{customClass:a(p)?"dept-user-com-box dept-user-com-table-cover":"dept-user-com-box dept-user-com-table"}),{"toolbar-left":l(()=>[n(C,{icon:a(p)?"View":"Hide",circle:"",onClick:t[0]||(t[0]=i=>M(p)?p.value=!a(p):p=!a(p))},null,8,["icon"])]),"actionbar-right":l(()=>[j((h(),le(fe,{api:"api/system/user/"},{default:l(()=>[...t[4]||(t[4]=[c("导入 ",-1)])]),_:1})),[[q,"user:Import"]])]),cell_avatar:l(i=>[i.row.avatar?(h(),U("div",ce,[n(S,{style:{width:"50px",height:"50px","border-radius":"50%","aspect-ratio":"1 /1"},src:a(O)(i.row.avatar),"preview-src-list":[a(O)(i.row.avatar)],"preview-teleported":!0},null,8,["src","preview-src-list"])])):ae("",!0)]),_:1},16,["customClass"]),n(L,{modelValue:a(w),"onUpdate:modelValue":t[3]||(t[3]=i=>M(w)?w.value=i:w=i),title:"重设密码",width:"400px",draggable:"","before-close":P},{footer:l(()=>[g("span",me,[n(C,{onClick:P},{default:l(()=>[...t[5]||(t[5]=[c("取消",-1)])]),_:1}),n(C,{type:"primary",onClick:k},{default:l(()=>[...t[6]||(t[6]=[c(" 保存 ",-1)])]),_:1})])]),default:l(()=>[g("div",null,[n(E,{modelValue:a(o).newPassword,"onUpdate:modelValue":t[1]||(t[1]=i=>a(o).newPassword=i),type:"password",placeholder:"请输入密码","show-password":"",style:{"margin-bottom":"20px"}},null,8,["modelValue"]),n(E,{modelValue:a(o).newPassword2,"onUpdate:modelValue":t[2]||(t[2]=i=>a(o).newPassword2=i),type:"password",placeholder:"请再次输入密码","show-password":""},null,8,["modelValue"])])]),_:1},8,["modelValue"])],64)}}}),Ve=ie(ve,[["__scopeId","data-v-8ef2ae19"]]);export{Ve as default};
|