MerchantUserForm-597efb24.js 6.5 KB

1
  1. import{d as P,Y as R,K as C,h as K,r as n,e as X,L as Z,l as $,x as G,a as l,o as m,v as _,w as a,f as e,g as S,t as T,P as y,c as M,F as q,q as D,Z as J,V as O,A as Q,E as W,i as ee,y as ae,z as le,D as te,I as se,_ as re,__tla as ue}from"./index-8e30b17f.js";import{a as de,D as oe,__tla as ne}from"./dict-500f7ec9.js";import{C as F}from"./constants-40f13f5e.js";import{a as me,c as pe,u as ie,__tla as ce}from"./index-ef7d0f22.js";import{S as _e,__tla as fe}from"./index-b9eb558c.js";import{f as ve,__tla as be}from"./formatTime-a0199d3b.js";import{u as ye,__tla as ge}from"./useMessage-ee50bd51.js";let Y,he=Promise.all([(()=>{try{return ue}catch{}})(),(()=>{try{return ne}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return fe}catch{}})(),(()=>{try{return be}catch{}})(),(()=>{try{return ge}catch{}})()]).then(async()=>{let g,h;g={class:"el-input el-input--default is-disabled el-input__inner",style:{padding:"1px 11px"}},h={class:"el-input el-input--default is-disabled el-input__inner",style:{padding:"1px 11px"}},Y=re(P({name:"SystemUserForm",__name:"MerchantUserForm",props:{isDetail:{type:Boolean,default:!1},obj:{default:{}},openType:{default:"create"},merchantId:{default:0},avatar:{type:String,default:""}},emits:["success"],setup(p,{expose:A,emit:Ve}){const B=R(),z=C(()=>B.getMobile),{t:V}=K(),x=ye(),I=n(!1);n("");const f=n(!1),k=n(""),t=n({nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:F.ENABLE,roleIds:[],categoryId:2,shopId:"",avatar:""}),H=X({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"}],shopId:[{required:!0,message:"\u6240\u5728\u5E97\u94FA\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"}]}),v=n();n([]),n([]);const b=p;Z(b,o=>{t.value.avatar=o.avatar,console.log(t.value.avatar)},{immediate:!0});const w=n({});$(async()=>{(async(o,r)=>{if(I.value=!0,k.value=o,L(),r){f.value=!0;try{t.value=await me(r)}finally{f.value=!1}}})(b.openType,b.obj.id),w.value=await _e.getAllUserByMer(b.merchantId)}),A({submitForm:async()=>{if(!v||!await v.value.validate())return;f.value=!0;const o=n(!1);try{const r=t.value;k.value==="create"?(await pe(r),x.success(V("common.createSuccess"))):(await ie(r),x.success(V("common.updateSuccess"))),I.value=!1,o.value=!0}finally{f.value=!1}return o.value}});const L=()=>{var o;t.value={nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:F.ENABLE,roleIds:[],categoryId:2,shopId:"",avatar:""},(o=v.value)==null||o.resetFields()};return(o,r)=>{const i=O,u=Q,d=W,c=ee,U=ae,E=le,j=te,N=se;return G((m(),_(j,{ref_key:"formRef",ref:v,model:l(t),rules:l(H),"label-width":"120px",style:{padding:"10px"},disabled:p.isDetail,class:J({view:p.isDetail,"mobile-card":l(z)})},{default:a(()=>[e(c,null,{default:a(()=>[e(d,{span:12},{default:a(()=>[e(u,{label:"\u59D3\u540D",prop:"nickname"},{default:a(()=>[e(i,{modelValue:l(t).nickname,"onUpdate:modelValue":r[0]||(r[0]=s=>l(t).nickname=s),placeholder:"\u8BF7\u8F93\u5165\u59D3\u540D"},null,8,["modelValue"])]),_:1})]),_:1}),e(d,{span:12},{default:a(()=>[e(u,{label:"\u624B\u673A\u53F7",prop:"mobile"},{default:a(()=>[e(i,{modelValue:l(t).mobile,"onUpdate:modelValue":r[1]||(r[1]=s=>l(t).mobile=s),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(c,null,{default:a(()=>[e(d,{span:12},{default:a(()=>[e(u,{label:"\u7528\u6237\u540D",prop:"username"},{default:a(()=>[e(i,{modelValue:l(t).username,"onUpdate:modelValue":r[2]||(r[2]=s=>l(t).username=s),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u540D"},null,8,["modelValue"])]),_:1})]),_:1}),p.openType!="create"?(m(),_(d,{key:0,span:12},{default:a(()=>[e(u,{label:"\u521B\u5EFA\u65F6\u95F4",prop:"createTime"},{default:a(()=>[S("div",g,T(l(ve)(l(t).createTime,"YYYY-MM-DD HH:mm")),1)]),_:1})]),_:1})):y("",!0),p.openType=="create"?(m(),_(d,{key:1,span:12},{default:a(()=>[e(u,{label:"\u7528\u6237\u5BC6\u7801",prop:"password"},{default:a(()=>[e(i,{modelValue:l(t).password,"onUpdate:modelValue":r[3]||(r[3]=s=>l(t).password=s),placeholder:"\u8BF7\u8F93\u5165\u7528\u6237\u5BC6\u7801",maxlength:"50"},null,8,["modelValue"])]),_:1})]),_:1})):y("",!0)]),_:1}),p.openType!="create"?(m(),_(c,{key:0},{default:a(()=>[e(d,{span:12},{default:a(()=>[e(u,{label:"\u521B\u5EFA\u4EBA",prop:"createTime"})]),_:1}),e(d,{span:12},{default:a(()=>[e(u,{label:"\u72B6\u6001",prop:"status"},{default:a(()=>[S("div",h,T(l(t).status==1?"\u505C\u7528":"\u5728\u7528"),1)]),_:1})]),_:1})]),_:1})):y("",!0),e(c,null,{default:a(()=>[e(d,{span:12},{default:a(()=>[e(u,{label:"\u6027\u522B"},{default:a(()=>[e(E,{modelValue:l(t).sex,"onUpdate:modelValue":r[4]||(r[4]=s=>l(t).sex=s),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(m(!0),M(q,null,D(l(de)(l(oe).SYSTEM_USER_SEX),s=>(m(),_(U,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(d,{span:12},{default:a(()=>[e(u,{label:"\u90AE\u7BB1",prop:"email"},{default:a(()=>[e(i,{modelValue:l(t).email,"onUpdate:modelValue":r[5]||(r[5]=s=>l(t).email=s),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165\u90AE\u7BB1"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(c,null,{default:a(()=>[e(d,{span:24},{default:a(()=>[e(u,{label:"\u6240\u5728\u5E97\u94FA",prop:"shopId"},{default:a(()=>[e(E,{modelValue:l(t).shopId,"onUpdate:modelValue":r[6]||(r[6]=s=>l(t).shopId=s),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(m(!0),M(q,null,D(l(w),s=>(m(),_(U,{key:s.id,label:s.name,value:s.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(c,null,{default:a(()=>[e(d,{span:24},{default:a(()=>[e(u,{label:"\u5907\u6CE8"},{default:a(()=>[e(i,{modelValue:l(t).remark,"onUpdate:modelValue":r[7]||(r[7]=s=>l(t).remark=s),placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9",type:"textarea"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules","disabled","class"])),[[N,l(f)]])}}}),[["__scopeId","data-v-ec0dd247"],["__file","D:/zx/mall-newfeifan-zx-admin/src/views/system/sale/merchant/components/MerchantUserForm.vue"]])});export{he as __tla,Y as default};