1 |
- import{d as K,a2 as M,az as N,r as L,a as T,w as $,K as i,aq as b,e as p,y as c,L as s,u as e,t as g,m as y,f as A,am as h,n as x,j as n,i as w,G as E,ac as _,ae as F,C as W}from"./vue-A59npLRR.js";import{c as O,v as R,_ as G}from"./index-EwE51S_X.js";import{F as H}from"./index-r6iTpmP6.js";import{b as V}from"./validate-_EUdkMt3.js";const J="/admin/user.MoneyLog/";function Q(v){return O({url:J+"add",method:"get",params:{userId:v}})}const X={class:"title"},Y=K({__name:"popupForm",setup(v){const k=R(),{t:a}=M(),l=N("baTable"),U=L({user_id:[V({name:"required",message:a("Please select field",{field:a("user.moneyLog.User")})})],money:[V({name:"required",title:a("user.moneyLog.Change amount")}),{validator:(m,o,u)=>!o||parseFloat(o)==0?u(new Error(a("Please enter the correct field",{field:a("user.moneyLog.Change amount")}))):u(),trigger:"blur"}],memo:[V({name:"required",title:a("user.moneyLog.remarks")})]}),f=T(),r=L({userInfo:{},after:0}),C=()=>{!l.form.items.user_id||parseInt(l.form.items.user_id)<=0||Q(l.form.items.user_id).then(m=>{r.userInfo=m.data.user,r.after=m.data.user.money})},S=m=>{if(!r.userInfo||typeof r.userInfo>"u"){r.after=0;return}let o=m==""?0:parseFloat(m);r.after=parseFloat((parseFloat(r.userInfo.money)+o).toFixed(2))};return $(()=>l.form.operate,m=>{m&&C()}),(m,o)=>{const u=i("el-input"),d=i("el-form-item"),P=i("el-form"),z=i("el-scrollbar"),I=i("el-button"),B=i("el-dialog"),D=b("drag"),j=b("zoom"),q=b("blur");return p(),c(B,{class:"ba-operate-dialog","close-on-click-modal":!1,"model-value":["Add","Edit"].includes(e(l).form.operate),onClose:e(l).toggleForm},{header:s(()=>[h((p(),A("div",X,[y(g(e(l).form.operate?e(a)(e(l).form.operate):""),1)])),[[D,[".ba-operate-dialog",".el-dialog__header"]],[j,".ba-operate-dialog"]])]),footer:s(()=>[w("div",{style:x("width: calc(100% - "+e(l).form.labelWidth/1.8+"px)")},[n(I,{onClick:o[10]||(o[10]=t=>e(l).toggleForm(""))},{default:s(()=>[y(g(e(a)("Cancel")),1)]),_:1}),h((p(),c(I,{loading:e(l).form.submitLoading,onClick:o[11]||(o[11]=t=>e(l).onSubmit(f.value)),type:"primary"},{default:s(()=>[y(g(e(l).form.operateIds.length>1?e(a)("Save and edit next item"):e(a)("Save")),1)]),_:1},8,["loading"])),[[q]])],4)]),default:s(()=>[n(z,{class:"ba-table-form-scrollbar"},{default:s(()=>[w("div",{class:E(["ba-operate-form","ba-"+e(l).form.operate+"-form"]),style:x(e(k).layout.shrink?"":"width: calc(100% - "+e(l).form.labelWidth/2+"px)")},[e(l).form.loading?W("",!0):(p(),c(P,{key:0,ref_key:"formRef",ref:f,onKeyup:o[9]||(o[9]=_(t=>e(l).onSubmit(f.value),["enter"])),model:e(l).form.items,"label-position":e(k).layout.shrink?"top":"right","label-width":e(l).form.labelWidth+"px",rules:U},{default:s(()=>[n(H,{type:"remoteSelect",prop:"user_id",label:e(a)("user.moneyLog.User ID"),modelValue:e(l).form.items.user_id,"onUpdate:modelValue":o[0]||(o[0]=t=>e(l).form.items.user_id=t),placeholder:e(a)("Click select"),"input-attr":{pk:"user.id",field:"nickname_text","remote-url":"/admin/user.User/index",onChange:C}},null,8,["label","modelValue","placeholder","input-attr"]),n(d,{label:e(a)("user.moneyLog.User name")},{default:s(()=>[n(u,{modelValue:r.userInfo.username,"onUpdate:modelValue":o[1]||(o[1]=t=>r.userInfo.username=t),disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),n(d,{label:e(a)("user.moneyLog.User nickname")},{default:s(()=>[n(u,{modelValue:r.userInfo.nickname,"onUpdate:modelValue":o[2]||(o[2]=t=>r.userInfo.nickname=t),disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),n(d,{label:e(a)("user.moneyLog.Current balance")},{default:s(()=>[n(u,{modelValue:r.userInfo.money,"onUpdate:modelValue":o[3]||(o[3]=t=>r.userInfo.money=t),disabled:"",type:"number"},null,8,["modelValue"])]),_:1},8,["label"]),n(d,{prop:"money",label:e(a)("user.moneyLog.Change amount")},{default:s(()=>[n(u,{onInput:S,modelValue:e(l).form.items.money,"onUpdate:modelValue":o[4]||(o[4]=t=>e(l).form.items.money=t),type:"number",placeholder:e(a)("user.moneyLog.Please enter the balance change amount")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(d,{label:e(a)("user.moneyLog.Balance after change")},{default:s(()=>[n(u,{modelValue:r.after,"onUpdate:modelValue":o[5]||(o[5]=t=>r.after=t),type:"number",disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),n(d,{prop:"memo",label:e(a)("user.moneyLog.remarks")},{default:s(()=>[n(u,{onKeyup:[o[6]||(o[6]=_(F(()=>{},["stop"]),["enter"])),o[7]||(o[7]=_(F(t=>e(l).onSubmit(f.value),["ctrl"]),["enter"]))],modelValue:e(l).form.items.memo,"onUpdate:modelValue":o[8]||(o[8]=t=>e(l).form.items.memo=t),type:"textarea",placeholder:e(a)("user.moneyLog.Please enter change remarks / description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["model","label-position","label-width","rules"]))],6)]),_:1})]),_:1},8,["model-value","onClose"])}}}),Z=G(Y,[["__scopeId","data-v-4013ae0e"]]),te=Object.freeze(Object.defineProperty({__proto__:null,default:Z},Symbol.toStringTag,{value:"Module"}));export{Z as P,Q as a,te as p,J as u};
|