数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1 lines
14 KiB

import{o as c,b as k,g as m,d as Se,r as p,aV as de,ag as H,ar as I,ae as Me,X as Ne,aY as Ae,a as e,w as t,f as a,D as X,ah as Pe,j as i,a7 as D,c as v,N as qe,F as He,e as Xe,O as K,be as Ke,E as g,bf as Qe,bg as Ze,bh as Ge,bi as We,bj as Ye,bk as Je,bl as el,bm as ll,ai as tl,ao as ol,ap as al,aj as nl,aP as sl,aQ as il,G as dl,k as rl,h as ul,i as pl,aT as cl,$ as ml,aU as _l,an as fl,aW as hl,b6 as gl,b4 as bl,H as vl,az as wl,aA as xl,aM as yl,bn as Vl,bo as kl}from"./index-b0696d90.js";/* empty css *//* empty css *//* empty css *//* empty css */import{_ as Cl}from"./index-ced84a6e.js";import{_ as Ul}from"./edit-b02c4768.js";/* empty css *//* empty css *//* empty css */import{_ as El}from"./delete-a6250ce4.js";import{_ as $l}from"./plus-15786e11.js";import{_ as Ll}from"./refresh-2973caed.js";/* empty css */import{_ as Rl}from"./search-b60582af.js";import{b as Il}from"./index-6ed1a060.js";import{l as Dl}from"./index-d76b01fb.js";const Bl={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},Tl=m("path",{fill:"currentColor",d:"M544 864V672h128L512 480L352 672h128v192H320v-1.6c-5.376.32-10.496 1.6-16 1.6A240 240 0 0 1 64 624c0-123.136 93.12-223.488 212.608-237.248A239.808 239.808 0 0 1 512 192a239.872 239.872 0 0 1 235.456 194.752c119.488 13.76 212.48 114.112 212.48 237.248a240 240 0 0 1-240 240c-5.376 0-10.56-1.28-16-1.6v1.6H544z"},null,-1),Fl=[Tl];function zl(B,w){return c(),k("svg",Bl,Fl)}const Ol={name:"ep-upload-filled",render:zl},jl={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},Sl=m("path",{fill:"currentColor",d:"M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88a384 384 0 0 1-383.936 384a384 384 0 0 1-384-384h64a320 320 0 1 0 640 0a320 320 0 0 0-555.712-216.448z"},null,-1),Ml=[Sl];function Nl(B,w){return c(),k("svg",jl,Ml)}const Al={name:"ep-refresh-left",render:Nl},Pl={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},ql=m("path",{fill:"currentColor",d:"M572.235 205.282v600.365a30.118 30.118 0 1 1-60.235 0V205.282L292.382 438.633a28.913 28.913 0 0 1-42.646 0a33.43 33.43 0 0 1 0-45.236l271.058-288.045a28.913 28.913 0 0 1 42.647 0L834.5 393.397a33.43 33.43 0 0 1 0 45.176a28.913 28.913 0 0 1-42.647 0l-219.618-233.23z"},null,-1),Hl=[ql];function Xl(B,w){return c(),k("svg",Pl,Hl)}const Kl={name:"ep-top",render:Xl},Ql={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},Zl=m("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64zm384-253.696l236.288-236.352l45.248 45.248L508.8 704L192 387.2l45.248-45.248L480 584.704V128h64v450.304z"},null,-1),Gl=[Zl];function Wl(B,w){return c(),k("svg",Ql,Gl)}const Yl={name:"ep-download",render:Wl},Jl={class:"app-container"},et={class:"search"},lt={class:"flex justify-between"},tt={class:"dialog-footer"},ot=m("div",{class:"el-upload__text"},[i(" 将文件拖到此处,或 "),m("em",null,"点击上传")],-1),at=m("div",{class:"el-upload__tip"},"xls/xlsx files",-1),nt={class:"dialog-footer"},Vt=Se({name:"user",inheritAttrs:!1,__name:"index",setup(B){const w=p(de),Q=p(H),T=p(H),x=p(!1),S=p([]),C=p(0),b=I({visible:!1}),d=I({page:1,pagesize:10}),Z=p(),s=I({status:1}),re=I({username:[{required:!0,message:"用户名不能为空",trigger:"blur"}],nickname:[{required:!0,message:"用户昵称不能为空",trigger:"blur"}],deptId:[{required:!0,message:"所属部门不能为空",trigger:"blur"}],roleIds:[{required:!0,message:"用户角色不能为空",trigger:"blur"}],email:[{pattern:/\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,message:"请输入正确的邮箱地址",trigger:"blur"}],mobile:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:"请输入正确的手机号码",trigger:"blur"}]}),F=p(),z=p(),G=p(),U=I({title:"用户导入",visible:!1}),E=p(0),$=p(),M=p([]);Me(()=>{w.value.filter(F.value)},{flush:"post"});function ue(n,l){return n?l.label.indexOf(n)!==-1:!0}function pe(n){d.deptId=n.value,y()}async function W(){Dl().then(n=>{G.value=n.data})}function ce(n){const l=n.status===1?"启用":"停用";K.confirm("确认要"+l+n.username+"用户吗?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>Ke(n.id,n.status)).then(()=>{g.success(l+"成功")}).catch(()=>{n.status=n.status===1?0:1})}function y(){x.value=!0,Qe(d).then(({data:n})=>{Z.value=n.list,C.value=n.total}).finally(()=>{x.value=!1})}function L(){Q.value.resetFields(),d.page=1,d.deptId=void 0,y()}function me(n){S.value=n.map(l=>l.id)}function _e(n){K.prompt("请输入用户「"+n.username+"」的新密码","重置密码",{confirmButtonText:"确定",cancelButtonText:"取消"}).then(({value:l})=>{if(!l)return g.warning("请输入新密码"),!1;Ze(n.id,l).then(()=>{g.success("密码重置成功,新密码是:"+l)})}).catch(()=>{})}async function Y(n){await N(),await W(),b.visible=!0,n?(b.title="修改用户",Ge(n).then(({data:l})=>{Object.assign(s,l)})):b.title="新增用户"}function O(){b.visible=!1,fe()}function fe(){T.value.resetFields(),T.value.clearValidate(),s.id=void 0,s.status=1}const he=We(()=>{T.value.validate(n=>{if(n){const l=s.id;x.value=!0,l?Vl(l,s).then(()=>{g.success("修改用户成功"),O(),L()}).finally(()=>x.value=!1):kl(s).then(()=>{g.success("新增用户成功"),O(),L()}).finally(()=>x.value=!1)}})},3e3);function J(n){const l=[n||S.value].join(",");if(!l){g.warning("请勾选删除项");return}K.confirm("确认删除用户?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){Ye(l).then(()=>{g.success("删除成功"),L()})})}async function N(){Il().then(n=>{z.value=n.data})}function ge(){Je().then(n=>{const l=new Blob([n.data],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"}),r=document.createElement("a"),_=window.URL.createObjectURL(l);r.href=_,r.download=decodeURI(n.headers["content-disposition"].split(";")[1].split("=")[1]),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(_)})}async function be(){await N(),await W(),U.visible=!0}function ve(n){if(!/\.(xlsx|xls|XLSX|XLS)$/.test(n.name))return g.warning("上传Excel只能为xlsx、xls格式"),$.value=void 0,M.value=[],!1;$.value=n.raw}function we(){if(E.value){if(!$.value)return g.warning("上传Excel文件不能为空"),!1;el(E.value,$.value).then(n=>{g.success(n.data),A(),L()})}}function A(){U.visible=!1,$.value=void 0,M.value=[]}function xe(){ll(d).then(n=>{const l=new Blob([n.data],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"}),r=document.createElement("a"),_=window.URL.createObjectURL(l);r.href=_,r.download=decodeURI(n.headers["content-disposition"].split(";")[1].split("=")[1]),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(_)})}return Ne(()=>{N(),y()}),(n,l)=>{const r=Rl,_=tl,ye=de,ee=ol,le=al,u=nl,V=sl,P=il,f=dl,Ve=Ll,q=H,ke=$l,te=El,oe=Yl,ae=rl,Ce=Kl,Ue=ul,Ee=pl,h=cl,$e=ml,Le=Al,Re=Ul,Ie=_l,De=Cl,Be=fl,ne=hl,se=gl,Te=bl,ie=vl,Fe=Ol,ze=wl,Oe=xl,j=Ae("hasPerm"),je=yl;return c(),k("div",Jl,[e(Be,{gutter:20},{default:t(()=>[e(le,{lg:4,xs:24,class:"mb-[12px]"},{default:t(()=>[e(ee,{shadow:"never"},{default:t(()=>[e(_,{modelValue:a(F),"onUpdate:modelValue":l[0]||(l[0]=o=>X(F)?F.value=o:null),placeholder:"部门名称",clearable:""},{prefix:t(()=>[e(r)]),_:1},8,["modelValue"]),e(ye,{ref_key:"deptTreeRef",ref:w,class:"mt-2",data:a(z),props:{children:"children",label:"label",disabled:""},"expand-on-click-node":!1,"filter-node-method":ue,"default-expand-all":"",onNodeClick:pe},null,8,["data"])]),_:1})]),_:1}),e(le,{lg:20,xs:24},{default:t(()=>[m("div",et,[e(q,{ref_key:"queryFormRef",ref:Q,model:a(d),inline:!0},{default:t(()=>[e(u,{label:"关键字",prop:"keywords"},{default:t(()=>[e(_,{modelValue:a(d).keywords,"onUpdate:modelValue":l[1]||(l[1]=o=>a(d).keywords=o),placeholder:"用户名/昵称/手机号",clearable:"",style:{width:"200px"},onKeyup:Pe(y,["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),e(u,{label:"状态",prop:"status"},{default:t(()=>[e(P,{modelValue:a(d).status,"onUpdate:modelValue":l[2]||(l[2]=o=>a(d).status=o),placeholder:"全部",clearable:"",style:{width:"200px"}},{default:t(()=>[e(V,{label:"启用",value:"1"}),e(V,{label:"禁用",value:"0"})]),_:1},8,["modelValue"])]),_:1}),e(u,null,{default:t(()=>[e(f,{type:"primary",onClick:y},{default:t(()=>[e(r),i("搜索")]),_:1}),e(f,{onClick:L},{default:t(()=>[e(Ve),i(" 重置")]),_:1})]),_:1})]),_:1},8,["model"])]),e(ee,{shadow:"never"},{header:t(()=>[m("div",lt,[m("div",null,[D((c(),v(f,{type:"success",onClick:l[3]||(l[3]=o=>Y())},{default:t(()=>[e(ke),i("新增")]),_:1})),[[j,["sys:user:add"]]]),D((c(),v(f,{type:"danger",disabled:a(S).length===0,onClick:l[4]||(l[4]=o=>J())},{default:t(()=>[e(te),i("删除")]),_:1},8,["disabled"])),[[j,["sys:user:delete"]]])]),m("div",null,[e(Ee,{"split-button":""},{dropdown:t(()=>[e(Ue,null,{default:t(()=>[e(ae,{onClick:ge},{default:t(()=>[e(oe),i("下载模板")]),_:1}),e(ae,{onClick:be},{default:t(()=>[e(Ce),i("导入数据")]),_:1})]),_:1})]),default:t(()=>[i(" 导入 ")]),_:1}),e(f,{class:"ml-3",onClick:xe},{icon:t(()=>[e(oe)]),default:t(()=>[i("导出")]),_:1})])])]),default:t(()=>[D((c(),v(Ie,{data:a(Z),onSelectionChange:me},{default:t(()=>[e(h,{type:"selection",width:"50",align:"center"}),e(h,{key:"id",label:"编号",align:"center",prop:"id",width:"100"}),e(h,{key:"username",label:"用户名",align:"center",prop:"username"}),e(h,{label:"用户昵称",width:"120",align:"center",prop:"nickname"}),e(h,{label:"性别",width:"100",align:"center",prop:"genderLabel"}),e(h,{label:"部门",width:"120",align:"center",prop:"deptName"}),e(h,{label:"手机号码",align:"center",prop:"mobile",width:"120"}),e(h,{label:"状态",align:"center",prop:"status"},{default:t(o=>[e($e,{modelValue:o.row.status,"onUpdate:modelValue":R=>o.row.status=R,"inactive-value":0,"active-value":1,onChange:R=>ce(o.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),e(h,{label:"创建时间",align:"center",prop:"createTime",width:"180"}),e(h,{label:"操作",fixed:"right",width:"220"},{default:t(o=>[e(f,{type:"primary",size:"small",link:"",onClick:R=>_e(o.row)},{default:t(()=>[e(Le),i("重置密码")]),_:2},1032,["onClick"]),D((c(),v(f,{type:"primary",link:"",size:"small",onClick:R=>Y(o.row.id)},{default:t(()=>[e(Re),i("编辑")]),_:2},1032,["onClick"])),[[j,["sys:user:edit"]]]),D((c(),v(f,{type:"primary",link:"",size:"small",onClick:R=>J(o.row.id)},{default:t(()=>[e(te),i("删除")]),_:2},1032,["onClick"])),[[j,["sys:user:delete"]]])]),_:1})]),_:1},8,["data"])),[[je,a(x)]]),a(C)>0?(c(),v(De,{key:0,total:a(C),"onUpdate:total":l[5]||(l[5]=o=>X(C)?C.value=o:null),page:a(d).page,"onUpdate:page":l[6]||(l[6]=o=>a(d).page=o),limit:a(d).pagesize,"onUpdate:limit":l[7]||(l[7]=o=>a(d).pagesize=o),onPagination:y},null,8,["total","page","limit"])):qe("",!0)]),_:1})]),_:1})]),_:1}),e(ie,{modelValue:a(b).visible,"onUpdate:modelValue":l[16]||(l[16]=o=>a(b).visible=o),title:a(b).title,width:"600px","append-to-body":"",onClose:O},{footer:t(()=>[m("div",tt,[e(f,{type:"primary",onClick:a(he)},{default:t(()=>[i("确 定")]),_:1},8,["onClick"]),e(f,{onClick:O},{default:t(()=>[i("取 消")]),_:1})])]),default:t(()=>[e(q,{ref_key:"userFormRef",ref:T,model:a(s),rules:a(re),"label-width":"80px"},{default:t(()=>[e(u,{label:"用户名",prop:"username"},{default:t(()=>[e(_,{modelValue:a(s).username,"onUpdate:modelValue":l[8]||(l[8]=o=>a(s).username=o),readonly:!!a(s).id,placeholder:"请输入用户名"},null,8,["modelValue","readonly"])]),_:1}),e(u,{label:"用户昵称",prop:"nickname"},{default:t(()=>[e(_,{modelValue:a(s).nickname,"onUpdate:modelValue":l[9]||(l[9]=o=>a(s).nickname=o),placeholder:"请输入用户昵称"},null,8,["modelValue"])]),_:1}),e(u,{label:"所属部门",prop:"deptId"},{default:t(()=>[e(ne,{modelValue:a(s).deptId,"onUpdate:modelValue":l[10]||(l[10]=o=>a(s).deptId=o),placeholder:"请选择所属部门",data:a(z),filterable:"","check-strictly":"","render-after-expand":!1},null,8,["modelValue","data"])]),_:1}),e(u,{label:"性别",prop:"gender"},{default:t(()=>[e(P,{modelValue:a(s).gender,"onUpdate:modelValue":l[11]||(l[11]=o=>a(s).gender=o),placeholder:"请选择"},{default:t(()=>[e(V,{label:"未知",value:0}),e(V,{label:"男",value:1}),e(V,{label:"女",value:2})]),_:1},8,["modelValue"])]),_:1}),e(u,{label:"角色",prop:"roleIds"},{default:t(()=>[e(P,{modelValue:a(s).roleIds,"onUpdate:modelValue":l[12]||(l[12]=o=>a(s).roleIds=o),multiple:"",placeholder:"请选择"},{default:t(()=>[(c(!0),k(He,null,Xe(a(G),o=>(c(),v(V,{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),e(u,{label:"手机号码",prop:"mobile"},{default:t(()=>[e(_,{modelValue:a(s).mobile,"onUpdate:modelValue":l[13]||(l[13]=o=>a(s).mobile=o),placeholder:"请输入手机号码",maxlength:"11"},null,8,["modelValue"])]),_:1}),e(u,{label:"邮箱",prop:"email"},{default:t(()=>[e(_,{modelValue:a(s).email,"onUpdate:modelValue":l[14]||(l[14]=o=>a(s).email=o),placeholder:"请输入邮箱",maxlength:"50"},null,8,["modelValue"])]),_:1}),e(u,{label:"状态",prop:"status"},{default:t(()=>[e(Te,{modelValue:a(s).status,"onUpdate:modelValue":l[15]||(l[15]=o=>a(s).status=o)},{default:t(()=>[e(se,{label:1},{default:t(()=>[i("正常")]),_:1}),e(se,{label:0},{default:t(()=>[i("禁用")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"]),e(ie,{modelValue:a(U).visible,"onUpdate:modelValue":l[18]||(l[18]=o=>a(U).visible=o),title:a(U).title,width:"600px","append-to-body":"",onClose:A},{footer:t(()=>[m("div",nt,[e(f,{type:"primary",onClick:we},{default:t(()=>[i("确 定")]),_:1}),e(f,{onClick:A},{default:t(()=>[i("取 消")]),_:1})])]),default:t(()=>[e(q,{"label-width":"80px"},{default:t(()=>[e(u,{label:"部门"},{default:t(()=>[e(ne,{modelValue:a(E),"onUpdate:modelValue":l[17]||(l[17]=o=>X(E)?E.value=o:null),placeholder:"请选择部门",data:a(z),filterable:"","check-strictly":""},null,8,["modelValue","data"])]),_:1}),e(u,{label:"Excel"},{default:t(()=>[e(Oe,{class:"upload-demo",action:"",drag:"","auto-upload":!1,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel","file-list":a(M),"on-change":ve,limit:1},{tip:t(()=>[at]),default:t(()=>[e(ze,{class:"el-icon--upload"},{default:t(()=>[e(Fe)]),_:1}),ot]),_:1},8,["file-list"])]),_:1})]),_:1})]),_:1},8,["modelValue","title"])])}}});export{Vt as default};