1 |
- import{d as R,X,J as z,h as J,r as n,e as K,K as O,k as P,v as $,a as l,o as m,q as c,w as a,f as e,g as T,t as E,O as y,c as q,F as D,n as M,Y as G,U as Q,z as W,E as Z,i as ee,x as ae,y as le,C as te,H as se,__tla as re}from"./index-2eab2d23.js";import{a as ue,D as de,__tla as oe}from"./dict-1ad71b6f.js";import{C as Y}from"./constants-40f13f5e.js";import{a as ne,c as me,u as pe,__tla as ie}from"./index-e191a423.js";import{S as _e,__tla as ce}from"./index-d43c56c7.js";import{f as fe,__tla as be}from"./formatTime-41155543.js";import{u as ve,__tla as ye}from"./useMessage-171aa63e.js";import{_ as ge}from"./_plugin-vue_export-helper-1b428a4d.js";let F,he=Promise.all([(()=>{try{return re}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return ie}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return be}catch{}})(),(()=>{try{return ye}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"}},F=ge(R({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:B,emit:Ve}){const A=X(),H=z(()=>A.getMobile),{t:V}=J(),k=ve(),x=n(!1);n("");const f=n(!1),I=n(""),t=n({nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:Y.ENABLE,roleIds:[],categoryId:2,shopId:"",avatar:""}),N=K({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"}]}),b=n();n([]),n([]);const v=p;O(v,o=>{t.value.avatar=o.avatar},{immediate:!0});const w=n({});P(async()=>{(async(o,r)=>{if(x.value=!0,I.value=o,j(),r){f.value=!0;try{t.value=await ne(r)}finally{f.value=!1}}})(v.openType,v.obj.id),w.value=await _e.getAllUserByMer(v.merchantId)}),B({submitForm:async()=>{if(!b||!await b.value.validate())return;f.value=!0;const o=n(!1);try{const r=t.value;I.value==="create"?(await me(r),k.success(V("common.createSuccess"))):(await pe(r),k.success(V("common.updateSuccess"))),x.value=!1,o.value=!0}finally{f.value=!1}return o.value}});const j=()=>{var o;t.value={nickname:"",deptId:"",mobile:"",email:"",id:void 0,username:"",password:"",sex:void 0,postIds:[],remark:"",status:Y.ENABLE,roleIds:[],categoryId:2,shopId:"",avatar:""},(o=b.value)==null||o.resetFields()};return(o,r)=>{const i=Q,u=W,d=Z,_=ee,U=ae,S=le,C=te,L=se;return $((m(),c(C,{ref_key:"formRef",ref:b,model:l(t),rules:l(N),"label-width":"120px",style:{padding:"10px"},disabled:p.isDetail,class:G({view:p.isDetail,"mobile-card":l(H)})},{default:a(()=>[e(_,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(_,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(),c(d,{key:0,span:12},{default:a(()=>[e(u,{label:"\u521B\u5EFA\u65F6\u95F4",prop:"createTime"},{default:a(()=>[T("div",g,E(l(fe)(l(t).createTime,"YYYY-MM-DD HH:mm")),1)]),_:1})]),_:1})):y("",!0),p.openType=="create"?(m(),c(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(()=>[T("div",h,E(l(t).status==1?"\u505C\u7528":"\u5728\u7528"),1)]),_:1})]),_:1})]),_:1})):y("",!0),e(_,null,{default:a(()=>[e(d,{span:12},{default:a(()=>[e(u,{label:"\u6027\u522B"},{default:a(()=>[e(S,{modelValue:l(t).sex,"onUpdate:modelValue":r[4]||(r[4]=s=>l(t).sex=s),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(m(!0),q(D,null,M(l(ue)(l(de).SYSTEM_USER_SEX),s=>(m(),c(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(_,null,{default:a(()=>[e(d,{span:24},{default:a(()=>[e(u,{label:"\u6240\u5728\u5E97\u94FA",prop:"shopId"},{default:a(()=>[e(S,{modelValue:l(t).shopId,"onUpdate:modelValue":r[6]||(r[6]=s=>l(t).shopId=s),placeholder:"\u8BF7\u9009\u62E9"},{default:a(()=>[(m(!0),q(D,null,M(l(w),s=>(m(),c(U,{key:s.id,label:s.name,value:s.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(_,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"])),[[L,l(f)]])}}}),[["__scopeId","data-v-1aae7782"]])});export{he as __tla,F as default};
|