Files
zyt/server/public/admin/assets/edit-CK_XVuzl.js
T
2026-07-03 12:07:34 +08:00

2 lines
3.8 KiB
JavaScript

import{o as T,q as r,r as p,v as n,D as s,b9 as z,u as l,b6 as A,bp as J,bm as K,F as h,G as g,O as k,cB as L,bn as j,s as V,T as H,bK as Q,J as W,b7 as X,a8 as v,M as Z,p as $,ba as ee}from"./.pnpm-BGZW0UGg.js";import{a as ae,b as te,c as oe}from"./finance-eAWFK1Mm.js";import{_ as le}from"./index-BeJT5uVo.js";import{_ as ne}from"./index-CeIwrh_6.js";const se={class:"edit-popup"},de={class:"channel-opt-row"},re={class:"opt-name"},ce=T({__name:"edit",props:{mediaChannelGroups:{},deptOptions:{},defaultMediaChannelCode:{}},emits:["success","close"],setup(m,{expose:w,emit:C}){const y=m,_=C,f=v(),i=v(),c=Z("add"),E=$(()=>c.value==="edit"?"编辑账户消耗":"新增账户消耗"),x={value:"id",label:"name",children:"children"},e=ee({id:"",cost_date:"",media_channel_code:"",dept_id:"",amount:0,remark:""}),D={cost_date:[{required:!0,message:"请选择日期",trigger:["change"]}],media_channel_code:[{required:!0,message:"请选择自媒体渠道",trigger:["change"]}],dept_id:[{required:!0,message:"请选择绑定部门",trigger:["change"]}],amount:[{required:!0,message:"请输入账户消耗金额",trigger:["blur","change"]}]},R=()=>{e.id="",e.cost_date="",e.media_channel_code=y.defaultMediaChannelCode||"",e.dept_id="",e.amount=0,e.remark=""},F=async()=>{var t,a;await((t=f.value)==null?void 0:t.validate()),c.value==="edit"?await ae(e):await te(e),(a=i.value)==null||a.close(),_("success")},q=(t="add")=>{var a;c.value=t,R(),(a=i.value)==null||a.open()},b=t=>{e.id=t.id??"",e.cost_date=t.cost_date??"",e.media_channel_code=t.media_channel_code??"",e.dept_id=t.dept_id?Number(t.dept_id):"",e.amount=Number(t.amount??0),e.remark=t.remark??""},B=async t=>{const a=await oe({id:t.id});b(a)},M=()=>{_("close")};return w({open:q,setFormData:b,getDetail:B}),(t,a)=>{const N=J,d=A,O=j,U=L,G=K,I=Q,S=W,Y=X,P=z;return r(),p("div",se,[n(le,{ref_key:"popupRef",ref:i,title:l(E),async:!0,width:"560px",onConfirm:F,onClose:M},{default:s(()=>[n(P,{ref_key:"formRef",ref:f,model:l(e),"label-width":"100px",rules:D},{default:s(()=>[n(d,{label:"日期",prop:"cost_date"},{default:s(()=>[n(N,{modelValue:l(e).cost_date,"onUpdate:modelValue":a[0]||(a[0]=o=>l(e).cost_date=o),type:"date","value-format":"YYYY-MM-DD",placeholder:"请选择日期",disabled:l(c)==="edit"},null,8,["modelValue","disabled"])]),_:1}),n(d,{label:"自媒体渠道",prop:"media_channel_code"},{default:s(()=>[n(G,{modelValue:l(e).media_channel_code,"onUpdate:modelValue":a[1]||(a[1]=o=>l(e).media_channel_code=o),placeholder:"请选择自媒体渠道",class:"account-cost-channel-select w-full",filterable:""},{default:s(()=>[(r(!0),p(h,null,g(m.mediaChannelGroups,o=>(r(),k(U,{key:o.group_name,label:o.group_name},{default:s(()=>[(r(!0),p(h,null,g(o.channels,u=>(r(),k(O,{key:u.channel_code,label:u.channel_name,value:u.channel_code},{default:s(()=>[V("div",de,[V("span",re,H(u.channel_name),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(d,{label:"部门",prop:"dept_id"},{default:s(()=>[n(I,{modelValue:l(e).dept_id,"onUpdate:modelValue":a[2]||(a[2]=o=>l(e).dept_id=o),data:m.deptOptions,"node-key":"id",props:x,"default-expand-all":!0,"check-strictly":"",placeholder:"请选择绑定部门",clearable:"",filterable:"",class:"w-full"},null,8,["modelValue","data"])]),_:1}),n(d,{label:"账户消耗",prop:"amount"},{default:s(()=>[n(S,{modelValue:l(e).amount,"onUpdate:modelValue":a[3]||(a[3]=o=>l(e).amount=o),min:0,step:.01,precision:2,class:"w-full"},null,8,["modelValue"])]),_:1}),n(d,{label:"备注",prop:"remark"},{default:s(()=>[n(Y,{modelValue:l(e).remark,"onUpdate:modelValue":a[4]||(a[4]=o=>l(e).remark=o),type:"textarea",autosize:{minRows:4,maxRows:6},maxlength:"255","show-word-limit":"",placeholder:"请输入备注"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}}),_e=ne(ce,[["__scopeId","data-v-4080ff8b"]]);export{_e as default};