UserForm-2b946d98.js 6.1 KB

1
  1. import{d as M,X as R,J as X,r as m,e as Y,K as z,k as H,v as J,a,o as p,q as f,w as l,f as e,O as K,c as x,n as E,F as S,Y as O,h as P,U as $,z as G,E as Q,i as W,x as Z,y as ee,C as ae,H as le,__tla as te}from"./index-2eab2d23.js";import{E as se,__tla as re}from"./el-tree-select-4ae7c290.js";import{a as de,D as ue,__tla as oe}from"./dict-1ad71b6f.js";import{C as q}from"./constants-40f13f5e.js";import{d as me,h as ne}from"./tree-fd3a041e.js";import{g as pe,__tla as ie}from"./index-2402488f.js";import{g as _e,__tla as ce}from"./index-06f833f4.js";import{a as fe,c as ve,u as be,__tla as ye}from"./index-e191a423.js";import{u as Ve,__tla as ge}from"./useMessage-171aa63e.js";import{_ as he}from"./_plugin-vue_export-helper-1b428a4d.js";let D,we=Promise.all([(()=>{try{return te}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return ie}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return ye}catch{}})(),(()=>{try{return ge}catch{}})()]).then(async()=>{D=he(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:F,emit:ke}){const B=R(),T=X(()=>B.getMobile),{t:y}=P(),V=Ve(),g=m(!1);m("");const i=m(!1),h=m(""),s=m({nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:q.ENABLE,roleIds:[],categoryId:1,avatar:""}),N=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([]),b=v;z(b,d=>{s.value.avatar=d.avatar},{immediate:!0}),H(()=>{(async(d,r)=>{if(g.value=!0,h.value=d,j(),r){i.value=!0;try{s.value=await fe(r)}finally{i.value=!1}}w.value=ne(await _e()),k.value=await pe()})(b.openType,b.obj.id)}),F({submitForm:async()=>{if(!c||!await c.value.validate())return;i.value=!0;const d=m(!1);try{const r=s.value;h.value==="create"?(await ve(r),V.success(y("common.createSuccess"))):(await be(r),V.success(y("common.updateSuccess"))),g.value=!1,d.value=!0}finally{i.value=!1}return d.value}});const j=()=>{var d;s.value={nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:q.ENABLE,roleIds:[],categoryId:1,avatar:""},(d=c.value)==null||d.resetFields()};return(d,r)=>{const n=$,u=G,o=Q,A=se,_=W,I=Z,U=ee,C=ae,L=le;return J((p(),f(C,{ref_key:"formRef",ref:c,model:a(s),rules:a(N),"label-width":"120px",style:{padding:"10px"},disabled:v.isDetail,class:O({view:v.isDetail,"mobile-card":a(T)})},{default:l(()=>[e(_,null,{default:l(()=>[e(o,{span:12},{default:l(()=>[e(u,{label:"\u7528\u6237\u6635\u79F0",prop:"nickname"},{default:l(()=>[e(n,{modelValue:a(s).nickname,"onUpdate:modelValue":r[0]||(r[0]=t=>a(s).nickname=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u6635\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:l(()=>[e(u,{label:"\u5F52\u5C5E\u90E8\u95E8",prop:"deptId"},{default:l(()=>[e(A,{modelValue:a(s).deptId,"onUpdate:modelValue":r[1]||(r[1]=t=>a(s).deptId=t),data:a(w),props:a(me),"check-strictly":"","node-key":"id",placeholder:"\u8BF7\u9009\u62E9\u5F52\u5C5E\u90E8\u95E8"},null,8,["modelValue","data","props"])]),_:1})]),_:1})]),_:1}),e(_,null,{default:l(()=>[e(o,{span:12},{default:l(()=>[e(u,{label:"\u624B\u673A\u53F7\u7801",prop:"mobile"},{default:l(()=>[e(n,{modelValue:a(s).mobile,"onUpdate:modelValue":r[2]||(r[2]=t=>a(s).mobile=t),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:l(()=>[e(u,{label:"\u90AE\u7BB1",prop:"email"},{default:l(()=>[e(n,{modelValue:a(s).email,"onUpdate:modelValue":r[3]||(r[3]=t=>a(s).email=t),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),a(s).id===void 0?(p(),f(_,{key:0},{default:l(()=>[e(o,{span:12},{default:l(()=>[e(u,{label:"\u7528\u6237\u540D\u79F0",prop:"username"},{default:l(()=>[e(n,{modelValue:a(s).username,"onUpdate:modelValue":r[4]||(r[4]=t=>a(s).username=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D\u79F0"},null,8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:l(()=>[e(u,{label:"\u7528\u6237\u5BC6\u7801",prop:"password"},{default:l(()=>[e(n,{modelValue:a(s).password,"onUpdate:modelValue":r[5]||(r[5]=t=>a(s).password=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u5BC6\u7801","show-password":"",type:"password"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})):K("",!0),e(_,null,{default:l(()=>[e(o,{span:12},{default:l(()=>[e(u,{label:"\u7528\u6237\u6027\u522B"},{default:l(()=>[e(U,{modelValue:a(s).sex,"onUpdate:modelValue":r[6]||(r[6]=t=>a(s).sex=t),placeholder:"\u8BF7\u9009\u62E9"},{default:l(()=>[(p(!0),x(S,null,E(a(de)(a(ue).SYSTEM_USER_SEX),t=>(p(),f(I,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(o,{span:12},{default:l(()=>[e(u,{label:"\u5C97\u4F4D"},{default:l(()=>[e(U,{modelValue:a(s).postIds,"onUpdate:modelValue":r[7]||(r[7]=t=>a(s).postIds=t),multiple:"",placeholder:"\u8BF7\u9009\u62E9"},{default:l(()=>[(p(!0),x(S,null,E(a(k),t=>(p(),f(I,{key:t.id,label:t.name,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(_,null,{default:l(()=>[e(o,{span:24},{default:l(()=>[e(u,{label:"\u5907\u6CE8"},{default:l(()=>[e(n,{modelValue:a(s).remark,"onUpdate:modelValue":r[8]||(r[8]=t=>a(s).remark=t),placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9",type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules","disabled","class"])),[[L,a(i)]])}}}),[["__scopeId","data-v-5ee1cf77"]])});export{we as __tla,D as default};