UserForm-a3417d77.js 6.1 KB

1
  1. import{d as M,Y as P,K as R,r as m,e as Y,L as C,l as K,x as X,a,o as p,v as f,w as t,f as e,P as Z,c as U,q as E,F as S,Z as $,h as G,V as H,A as J,E as O,i as Q,y as W,z as ee,D as ae,I as le,_ as te,__tla as se}from"./index-bd9277a1.js";import{E as re,__tla as ue}from"./el-tree-select-9425e295.js";import{a as de,D as oe,__tla as me}from"./dict-4b2e9fd3.js";import{C as F}from"./constants-40f13f5e.js";import{d as ne,h as pe}from"./tree-0af4953a.js";import{g as ie,__tla as _e}from"./index-625cfa10.js";import{g as ce,__tla as fe}from"./index-6e4b3436.js";import{a as ve,c as ye,u as be,__tla as ge}from"./index-71b25432.js";import{u as Ve,__tla as he}from"./useMessage-274788d4.js";let q,we=Promise.all([(()=>{try{return se}catch{}})(),(()=>{try{return ue}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return _e}catch{}})(),(()=>{try{return fe}catch{}})(),(()=>{try{return ge}catch{}})(),(()=>{try{return he}catch{}})()]).then(async()=>{q=te(M({name:"SystemUserForm",__name:"UserForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:{}},openType:{default:"create"},avatar:{type:String,default:""}},emits:["success"],setup(v,{expose:D,emit:ke}){const z=P(),A=R(()=>z.getMobile),{t:b}=G(),g=Ve(),V=m(!1);m("");const i=m(!1),h=m(""),l=m({name:"",nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:F.ENABLE,roleIds:[],categoryId:1,avatar:""}),j=Y({username:[{required:!0,message:"\u7528\u6237\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],nickname:[{required:!0,message:"\u7528\u6237\u6635\u79F0\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],password:[{required:!0,message:"\u7528\u6237\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],email:[{type:"email",message:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u90AE\u7BB1\u5730\u5740",trigger:["blur","change"]}],mobile:[{required:!0,pattern:/^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/,message:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801",trigger:"blur"}]}),c=m(),w=m([]),k=m([]),y=v;C(y,u=>{l.value.avatar=u.avatar},{immediate:!0}),K(()=>{(async(u,r)=>{if(V.value=!0,h.value=u,B(),r){i.value=!0;try{l.value=await ve(r)}finally{i.value=!1}}w.value=pe(await ce()),k.value=await ie()})(y.openType,y.obj.id)}),D({submitForm:async()=>{if(l.value.mobile=l.value.username,!c||!await c.value.validate())return;i.value=!0;const u=m(!1);try{const r=l.value;h.value==="create"?(await ye(r),g.success(b("common.createSuccess"))):(await be(r),g.success(b("common.updateSuccess"))),V.value=!1,u.value=!0}finally{i.value=!1}return u.value}});const B=()=>{var u;l.value={nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:F.ENABLE,roleIds:[],categoryId:1,avatar:""},(u=c.value)==null||u.resetFields()};return(u,r)=>{const n=H,d=J,o=O,L=re,_=Q,I=W,x=ee,N=ae,T=le;return X((p(),f(N,{ref_key:"formRef",ref:c,model:a(l),rules:a(j),"label-width":"120px",style:{padding:"10px"},disabled:v.isDetail,class:$({view:v.isDetail,"mobile-card":a(A)})},{default:t(()=>[e(_,null,{default:t(()=>[e(o,{span:12},{default:t(()=>[e(d,{label:"\u7528\u6237\u6635\u79F0",prop:"nickname"},{default:t(()=>[e(n,{modelValue:a(l).nickname,"onUpdate:modelValue":r[0]||(r[0]=s=>a(l).nickname=s),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u6635\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:t(()=>[e(d,{label:"\u5F52\u5C5E\u90E8\u95E8",prop:"deptId"},{default:t(()=>[e(L,{modelValue:a(l).deptId,"onUpdate:modelValue":r[1]||(r[1]=s=>a(l).deptId=s),data:a(w),props:a(ne),"check-strictly":"","node-key":"id",placeholder:"\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8"},null,8,["modelValue","data","props"])]),_:1})]),_:1})]),_:1}),e(_,null,{default:t(()=>[e(o,{span:12},{default:t(()=>[e(d,{label:"\u59D3\u540D",prop:"name"},{default:t(()=>[e(n,{modelValue:a(l).name,"onUpdate:modelValue":r[2]||(r[2]=s=>a(l).name=s),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:t(()=>[e(d,{label:"\u90AE\u7BB1",prop:"email"},{default:t(()=>[e(n,{modelValue:a(l).email,"onUpdate:modelValue":r[3]||(r[3]=s=>a(l).email=s),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(_,null,{default:t(()=>[e(o,{span:12},{default:t(()=>[e(d,{label:"\u624B\u673A\u53F7",prop:"username"},{default:t(()=>[e(n,{modelValue:a(l).username,"onUpdate:modelValue":r[4]||(r[4]=s=>a(l).username=s),placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"},null,8,["modelValue"])]),_:1})]),_:1}),a(l).id===void 0?(p(),f(o,{key:0,span:12},{default:t(()=>[e(d,{label:"\u7528\u6237\u5BC6\u7801",prop:"password"},{default:t(()=>[e(n,{modelValue:a(l).password,"onUpdate:modelValue":r[5]||(r[5]=s=>a(l).password=s),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u5BC6\u7801","show-password":"",type:"password"},null,8,["modelValue"])]),_:1})]),_:1})):Z("",!0)]),_:1}),e(_,null,{default:t(()=>[e(o,{span:12},{default:t(()=>[e(d,{label:"\u7528\u6237\u6027\u522B"},{default:t(()=>[e(x,{modelValue:a(l).sex,"onUpdate:modelValue":r[6]||(r[6]=s=>a(l).sex=s),placeholder:"\u8BF7\u9009\u62E9"},{default:t(()=>[(p(!0),U(S,null,E(a(de)(a(oe).SYSTEM_USER_SEX),s=>(p(),f(I,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:t(()=>[e(d,{label:"\u5C97\u4F4D"},{default:t(()=>[e(x,{modelValue:a(l).postIds,"onUpdate:modelValue":r[7]||(r[7]=s=>a(l).postIds=s),multiple:"",placeholder:"\u8BF7\u9009\u62E9"},{default:t(()=>[(p(!0),U(S,null,E(a(k),s=>(p(),f(I,{key:s.id,label:s.name,value:s.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(_,null,{default:t(()=>[e(o,{span:24},{default:t(()=>[e(d,{label:"\u5907\u6CE8"},{default:t(()=>[e(n,{modelValue:a(l).remark,"onUpdate:modelValue":r[8]||(r[8]=s=>a(l).remark=s),placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9",type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules","disabled","class"])),[[T,a(i)]])}}}),[["__scopeId","data-v-04729edc"],["__file","D:/zhongxing/mall-newfeifan-zx-admin/src/views/system/user/UserForm.vue"]])});export{we as __tla,q as default};