2 lines
3.0 KiB
JavaScript
2 lines
3.0 KiB
JavaScript
var p=(r,u,t)=>new Promise((l,i)=>{var c=a=>{try{n(t.next(a))}catch(o){i(o)}},d=a=>{try{n(t.throw(a))}catch(o){i(o)}},n=a=>a.done?l(a.value):Promise.resolve(a.value).then(c,d);n((t=t.apply(r,u)).next())});import{q as E,a as _,v as b,f as g,o as v,j as y,B as F,p as P,k as s,aF as w,cI as m,eU as C,eV as D}from"./index.d39002cd.js";import{u as h,B as A}from"./useForm.36793474.js";import{a as S,B as $}from"./index.48e0a0bc.js";const O=[{title:"\u5E74\u4EFD",dataIndex:"year",customRender:({text:r})=>r+"\u5E74"},{title:"\u5B63\u5EA6",dataIndex:"quarter"},{title:"\u4EF7\u683C",dataIndex:"price"},{title:"\u521B\u5EFA\u4EBA",dataIndex:"name",customRender:({record:{created_by:r}})=>r.name},{width:180,title:"\u64CD\u4F5C",dataIndex:"action",align:"center",fixed:void 0}],U=[{field:"year",label:"\u5E74\u4EFD",component:"DatePicker",componentProps:{picker:"year",mode:"year"},colProps:{span:8}},{field:"quarter",label:"\u5B63\u5EA6",component:"Select",componentProps:{options:[{label:"\u7B2C\u4E00\u5B63\u5EA6",value:"1"},{label:"\u7B2C\u4E8C\u5B63\u5EA6",value:"2"},{label:"\u7B2C\u4E09\u5B63\u5EA6",value:"3"},{label:"\u7B2C\u56DB\u5B63\u5EA6",value:"4"}]},colProps:{span:8}}],x=[{field:"id",label:"ID",required:!1,dynamicDisabled:!0,component:"Input",ifShow:({values:r})=>!!r.id},{field:"year",label:"\u5E74\u4EFD",component:"DatePicker",required:!0,componentProps:{picker:"year",mode:"year"}},{field:"quarter",label:"\u5B63\u5EA6",component:"Select",required:!0,componentProps:{options:[{label:"\u7B2C\u4E00\u5B63\u5EA6",value:"1"},{label:"\u7B2C\u4E8C\u5B63\u5EA6",value:"2"},{label:"\u7B2C\u4E09\u5B63\u5EA6",value:"3"},{label:"\u7B2C\u56DB\u5B63\u5EA6",value:"4"}]}},{field:"price",label:"\u4EF7\u683C",required:!0,component:"InputNumber",componentProps:{formatter:r=>{const u=/^(-)*(\d+)\.(\d\d).*$/;return`${r}`.replace(/\B(?=(\d{3})+(?!\d))/g,"").replace(u,"$1$2.$3")},parser:r=>{const u=/^(-)*(\d+)\.(\d\d).*$/;return`${r}`.replace(/\B(?=(\d{3})+(?!\d))/g,"").replace(u,"$1$2.$3")}}}];const I=_({__name:"PriceDrawer",emits:["success","register"],setup(r,{emit:u}){const t=b(!1),l=g(()=>t.value?"\u7F16\u8F91\u4EF7\u683C":"\u65B0\u589E\u4EF7\u683C"),[i,{resetFields:c,setFieldsValue:d,validate:n}]=h({labelWidth:120,baseColProps:{span:24},schemas:x,showActionButtonGroup:!1}),[a,{setDrawerProps:o,closeDrawer:f}]=S(e=>p(this,null,function*(){c(),o({confirmLoading:!1}),t.value=e==null?void 0:e.isUpdate,s(t)&&(yield d({id:e.id,quarter:e.quarter.toString(),year:m(e.year.toString()),price:e.price}))})),B=()=>p(this,null,function*(){try{const e=yield n();e.year=m(e.year.toString()).format("YYYY"),o({confirmLoading:!0}),e.id?yield C(e.id,e):yield D(e),f(),u("success")}finally{o({confirmLoading:!1})}});return(e,k)=>(v(),y(s($),w(e.$attrs,{onRegister:s(a),showFooter:"",title:s(l),width:"500px",onOk:B}),{default:F(()=>[P(s(A),{onRegister:s(i)},null,8,["onRegister"])]),_:1},16,["onRegister","title"]))}});var q=E(I,[["__scopeId","data-v-2a680bfa"]]),V=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"}));export{q as P,V as a,O as c,U as s};
|