MerchantUserForm-4d7f227a.js 6.7 KB

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