2 lines
2.2 KiB
JavaScript
2 lines
2.2 KiB
JavaScript
var l=(r,i,a)=>new Promise((m,o)=>{var c=e=>{try{t(a.next(e))}catch(s){o(s)}},n=e=>{try{t(a.throw(e))}catch(s){o(s)}},t=e=>e.done?m(e.value):Promise.resolve(e.value).then(c,n);t((a=a.apply(r,i)).next())});import{u as _}from"./index-DgJsMh2K.js";import{a3 as g,X as y,aj as S,ak as w,a7 as u,as as v,at as k,a9 as x,$ as T}from"./bootstrap-CRjSNGHY.js";import{m as d,b7 as A,aa as b,ad as F,b2 as h,j as f,u as p,bJ as N,ai as P,b9 as B,w as C,ab as E}from"../jse/index-index-CMeVxoEG.js";import{D as V}from"./dict-enum-CaHgMaDZ.js";const D=["onKeydown"],I=d({__name:"base-setting",props:{formSchema:{default:()=>[]}},emits:["submit"],setup(r,{expose:i,emit:a}){const m=r,o=a,[c,n]=g(A({commonConfig:{componentProps:{class:"w-full"}},layout:"horizontal",schema:b(()=>m.formSchema),showDefaultActions:!1}));function t(){return l(this,null,function*(){const{valid:e}=yield n.validate(),s=yield n.getValues();e&&o("submit",s)})}return i({getFormApi:()=>n}),(e,s)=>(h(),F("div",{onKeydown:S(w(t,["prevent"]),["enter"])},[f(p(c)),f(p(y),{type:"submit",class:"mt-4",onClick:t},{default:N(()=>[...s[0]||(s[0]=[P(" 更新基本信息 ",-1)])]),_:1})],40,D))}}),L=d({__name:"base-setting",props:{profile:{}},emits:["success"],setup(r,{emit:i}){const a=r,m=i,o=B(),c=b(()=>[{label:"用户昵称",fieldName:"nickname",component:"Input",componentProps:{placeholder:"请输入用户昵称"},rules:"required"},{label:"用户手机",fieldName:"mobile",component:"Input",componentProps:{placeholder:"请输入用户手机"},rules:u()},{label:"用户邮箱",fieldName:"email",component:"Input",componentProps:{placeholder:"请输入用户邮箱"},rules:u().email("请输入正确的邮箱")},{label:"用户性别",fieldName:"sex",component:"RadioGroup",componentProps:{options:k(V.SYSTEM_USER_SEX,"number"),buttonStyle:"solid",optionType:"button"},rules:v()}]);function n(t){return l(this,null,function*(){try{o.value.getFormApi().setLoading(!0),yield _(t),m("success"),x.success(T("ui.actionMessage.operationSuccess"))}catch(e){console.error(e)}finally{o.value.getFormApi().setLoading(!1)}})}return C(()=>a.profile,t=>{t&&o.value.getFormApi().setValues(t)},{immediate:!0}),(t,e)=>(h(),E(p(I),{ref_key:"profileBaseSettingRef",ref:o,"form-schema":c.value,onSubmit:n},null,8,["form-schema"]))}});export{L as default};
|