UserForm-588cf49c.js 6.4 KB

1
  1. import{d as T,Z as R,L as C,r as m,f as G,M as J,l as P,y as Q,a,o as i,x as f,w as l,g as e,Q as W,c as U,v as E,F as S,a0 as X,i as Y,W as Z,B as $,E as H,j as K,z as O,A as ee,G as ae,J as le,_ as te,__tla as se}from"./index-3fb48822.js";import{E as de,__tla as re}from"./el-tree-select-60925c12.js";import{a as ue,D as oe,__tla as me}from"./dict-51415be4.js";import{C as D}from"./constants-637baed6.js";import{d as ne,h as pe}from"./tree-0af4953a.js";import{g as ie,__tla as _e}from"./index-3acbc6ed.js";import{g as ce,__tla as fe}from"./index-61bf3160.js";import{a as ve,c as be,u as ye,__tla as Ve}from"./index-c00dcc25.js";import{u as ge,__tla as he}from"./useMessage-b6c78c26.js";let F,we=Promise.all([(()=>{try{return se}catch{}})(),(()=>{try{return re}catch{}})(),(()=>{try{return me}catch{}})(),(()=>{try{return _e}catch{}})(),(()=>{try{return fe}catch{}})(),(()=>{try{return Ve}catch{}})(),(()=>{try{return he}catch{}})()]).then(async()=>{F=te(T({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 j=R(),q=C(()=>j.getMobile),{t:y}=Y(),V=ge(),g=m(!1);m("");const _=m(!1),h=m(""),s=m({name:"",nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:D.ENABLE,roleIds:[],categoryId:1,avatar:""}),M=G({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;J(b,r=>{s.value.avatar=r.avatar},{immediate:!0}),P(()=>{(async(r,d)=>{if(g.value=!0,h.value=r,z(),d){_.value=!0;try{s.value=await ve(d)}finally{_.value=!1}}w.value=pe(await ce()),k.value=await ie()})(b.openType,b.obj.id)}),B({submitForm:async()=>{if(!c||!await c.value.validate())return;_.value=!0;const r=m(!1);try{const d=s.value;h.value==="create"?(await be(d),V.success(y("common.createSuccess"))):(await ye(d),V.success(y("common.updateSuccess"))),g.value=!1,r.value=!0}finally{_.value=!1}return r.value}});const z=()=>{var r;s.value={nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:D.ENABLE,roleIds:[],categoryId:1,avatar:""},(r=c.value)==null||r.resetFields()};return(r,d)=>{const n=Z,u=$,o=H,A=de,p=K,x=O,I=ee,L=ae,N=le;return Q((i(),f(L,{ref_key:"formRef",ref:c,model:a(s),rules:a(M),"label-width":"120px",style:{padding:"10px"},disabled:v.isDetail,class:X({view:v.isDetail,"mobile-card":a(q)})},{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(n,{modelValue:a(s).nickname,"onUpdate:modelValue":d[0]||(d[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":d[1]||(d[1]=t=>a(s).deptId=t),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(p,null,{default:l(()=>[e(o,{span:12},{default:l(()=>[e(u,{label:"\u59D3\u540D",prop:"name"},{default:l(()=>[e(n,{modelValue:a(s).name,"onUpdate:modelValue":d[2]||(d[2]=t=>a(s).name=t),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(n,{modelValue:a(s).email,"onUpdate:modelValue":d[3]||(d[3]=t=>a(s).email=t),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(n,{modelValue:a(s).username,"onUpdate:modelValue":d[4]||(d[4]=t=>a(s).username=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"},null,8,["modelValue"])]),_:1})]),_:1}),a(s).id===void 0?(i(),f(o,{key:0,span:12},{default:l(()=>[e(u,{label:"\u7528\u6237\u5BC6\u7801",prop:"password"},{default:l(()=>[e(n,{modelValue:a(s).password,"onUpdate:modelValue":d[5]||(d[5]=t=>a(s).password=t),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u5BC6\u7801","show-password":"",type:"password"},null,8,["modelValue"])]),_:1})]),_:1})):W("",!0)]),_:1}),e(p,null,{default:l(()=>[e(o,{span:12},{default:l(()=>[e(u,{label:"\u7528\u6237\u6027\u522B"},{default:l(()=>[e(I,{modelValue:a(s).sex,"onUpdate:modelValue":d[6]||(d[6]=t=>a(s).sex=t),placeholder:"\u8BF7\u9009\u62E9"},{default:l(()=>[(i(!0),U(S,null,E(a(ue)(a(oe).SYSTEM_USER_SEX),t=>(i(),f(x,{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(I,{modelValue:a(s).postIds,"onUpdate:modelValue":d[7]||(d[7]=t=>a(s).postIds=t),multiple:"",placeholder:"\u8BF7\u9009\u62E9"},{default:l(()=>[(i(!0),U(S,null,E(a(k),t=>(i(),f(x,{key:t.id,label:t.name,value:t.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(n,{modelValue:a(s).mobile,"onUpdate:modelValue":d[8]||(d[8]=t=>a(s).mobile=t),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(n,{modelValue:a(s).remark,"onUpdate:modelValue":d[9]||(d[9]=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"])),[[N,a(_)]])}}}),[["__scopeId","data-v-04729edc"],["__file","D:/zx/mall-newfeifan-zx-admin/src/views/system/user/UserForm.vue"]])});export{we as __tla,F as default};