UserForm-f7279c99.js 6.1 KB

1
  1. import{d as J,n as K,r as m,f as M,o as n,l as c,w as a,i as e,a as l,j as I,C as P,a2 as E,c as S,F,k as q,y as T,U as Y,H as $,E as O,s as Q,D as W,G as Z,K as ee,J as le,N as ae,_ as te,__tla as se}from"./index-afaf388d.js";import{_ as ue,__tla as re}from"./Dialog-82c2009c.js";import{E as de,__tla as oe}from"./el-tree-select-190eecb6.js";import{a as me,D as ne,__tla as pe}from"./dict-0449a0a1.js";import{C}from"./constants-a1da293a.js";import{d as ie,h as _e}from"./tree-0af4953a.js";import{g as ce,__tla as fe}from"./index-8ff8f0a1.js";import{g as ve,__tla as ye}from"./index-c8161a65.js";import{b as Ve,c as be,u as he,__tla as ke}from"./index-5a3d9119.js";import{u as ge,__tla as we}from"./useMessage-a290df31.js";let D,Ue=Promise.all([(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return pe}catch{}})(),(()=>{try{return fe}catch{}})(),(()=>{try{return ye}catch{}})(),(()=>{try{return ke}catch{}})(),(()=>{try{return we}catch{}})()]).then(async()=>{D=te(J({name:"SystemUserForm",__name:"UserForm",emits:["success"],setup(xe,{expose:N,emit:R}){const{t:y}=K(),V=ge(),p=m(!1),b=m(""),i=m(!1),h=m(""),u=m({nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:C.ENABLE,roleIds:[]}),A=M({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:[{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"}]}),v=m(),k=m([]),g=m([]);N({open:async(r,s)=>{if(p.value=!0,b.value=y("action."+r),h.value=r,L(),s){i.value=!0;try{u.value=await Ve(s)}finally{i.value=!1}}k.value=_e(await ve()),g.value=await ce()}});const B=R,H=async()=>{if(v&&await v.value.validate()){i.value=!0;try{const r=u.value;h.value==="create"?(await be(r),V.success(y("common.createSuccess"))):(await he(r),V.success(y("common.updateSuccess"))),p.value=!1,B("success")}finally{i.value=!1}}},L=()=>{var r;u.value={nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:C.ENABLE,roleIds:[]},(r=v.value)==null||r.resetFields()};return(r,s)=>{const _=Y,d=$,o=O,X=de,f=Q,w=W,U=Z,j=ee,x=le,z=ue,G=ae;return n(),c(z,{modelValue:l(p),"onUpdate:modelValue":s[10]||(s[10]=t=>T(p)?p.value=t:null),title:l(b)},{footer:a(()=>[e(x,{disabled:l(i),type:"primary",onClick:H},{default:a(()=>[I("\u786E \u5B9A")]),_:1},8,["disabled"]),e(x,{onClick:s[9]||(s[9]=t=>p.value=!1)},{default:a(()=>[I("\u53D6 \u6D88")]),_:1})]),default:a(()=>[P((n(),c(j,{ref_key:"formRef",ref:v,model:l(u),rules:l(A),"label-width":"80px"},{default:a(()=>[e(f,null,{default:a(()=>[e(o,{span:12},{default:a(()=>[e(d,{label:"\u7528\u6237\u6635\u79F0",prop:"nickname"},{default:a(()=>[e(_,{modelValue:l(u).nickname,"onUpdate:modelValue":s[0]||(s[0]=t=>l(u).nickname=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u6635\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:a(()=>[e(d,{label:"\u5F52\u5C5E\u90E8\u95E8",prop:"deptId"},{default:a(()=>[e(X,{modelValue:l(u).deptId,"onUpdate:modelValue":s[1]||(s[1]=t=>l(u).deptId=t),data:l(k),props:l(ie),"check-strictly":"","node-key":"id",placeholder:"\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8"},null,8,["modelValue","data","props"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:a(()=>[e(o,{span:12},{default:a(()=>[e(d,{label:"\u624B\u673A\u53F7\u7801",prop:"mobile"},{default:a(()=>[e(_,{modelValue:l(u).mobile,"onUpdate:modelValue":s[2]||(s[2]=t=>l(u).mobile=t),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:a(()=>[e(d,{label:"\u90AE\u7BB1",prop:"email"},{default:a(()=>[e(_,{modelValue:l(u).email,"onUpdate:modelValue":s[3]||(s[3]=t=>l(u).email=t),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:a(()=>[e(o,{span:12},{default:a(()=>[l(u).id===void 0?(n(),c(d,{key:0,label:"\u7528\u6237\u540D\u79F0",prop:"username"},{default:a(()=>[e(_,{modelValue:l(u).username,"onUpdate:modelValue":s[4]||(s[4]=t=>l(u).username=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D\u79F0"},null,8,["modelValue"])]),_:1})):E("",!0)]),_:1}),e(o,{span:12},{default:a(()=>[l(u).id===void 0?(n(),c(d,{key:0,label:"\u7528\u6237\u5BC6\u7801",prop:"password"},{default:a(()=>[e(_,{modelValue:l(u).password,"onUpdate:modelValue":s[5]||(s[5]=t=>l(u).password=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u5BC6\u7801","show-password":"",type:"password"},null,8,["modelValue"])]),_:1})):E("",!0)]),_:1})]),_:1}),e(f,null,{default:a(()=>[e(o,{span:12},{default:a(()=>[e(d,{label:"\u7528\u6237\u6027\u522B"},{default:a(()=>[e(U,{modelValue:l(u).sex,"onUpdate:modelValue":s[6]||(s[6]=t=>l(u).sex=t),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(n(!0),S(F,null,q(l(me)(l(ne).SYSTEM_USER_SEX),t=>(n(),c(w,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:a(()=>[e(d,{label:"\u5C97\u4F4D"},{default:a(()=>[e(U,{modelValue:l(u).postIds,"onUpdate:modelValue":s[7]||(s[7]=t=>l(u).postIds=t),multiple:"",placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(n(!0),S(F,null,q(l(g),t=>(n(),c(w,{key:t.id,label:t.name,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(f,null,{default:a(()=>[e(o,{span:24},{default:a(()=>[e(d,{label:"\u5907\u6CE8"},{default:a(()=>[e(_,{modelValue:l(u).remark,"onUpdate:modelValue":s[8]||(s[8]=t=>l(u).remark=t),placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9",type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])),[[G,l(i)]])]),_:1},8,["modelValue","title"])}}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/system/user/UserForm.vue"]])});export{Ue as __tla,D as default};