MerchantUserForm-03ca0f4e.js 6.4 KB

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