UserForm-e4fc86bd.js 6.4 KB

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