2 lines
2.8 KiB
JavaScript
2 lines
2.8 KiB
JavaScript
var c=(r,o,t)=>new Promise((u,l)=>{var d=a=>{try{n(t.next(a))}catch(s){l(s)}},p=a=>{try{n(t.throw(a))}catch(s){l(s)}},n=a=>a.done?u(a.value):Promise.resolve(a.value).then(d,p);n((t=t.apply(r,o)).next())});import{eY as f,q as g,a as F,v as y,f as P,o as k,j as b,B as D,p as h,k as i,aF as v,cI as m,eZ as E,e_ as B}from"./index.203f4f59.js";import{u as S,B as $}from"./useForm.00f4ca4b.js";import{a as x,B as I}from"./index.659a3b4b.js";const O=[{title:"\u5E74\u4EFD",dataIndex:"year",customRender:({text:r})=>r+"\u5E74"},{title:"\u5468",dataIndex:"week_label"},{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}],N=[{field:"year",label:"\u5E74\u4EFD",component:"DatePicker",componentProps:{picker:"year",mode:"year"},colProps:{span:8}},{field:"week",label:"\u5468",component:"ApiSelect",componentProps:{api:()=>c(void 0,null,function*(){const{data:r}=yield f();return r}),labelField:"name",valueField:"id"},colProps:{span:8}}],C=[{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:"week",label:"\u5468",component:"ApiSelect",required:!0,componentProps:{api:()=>c(void 0,null,function*(){const{data:r}=yield f();return r}),labelField:"name",valueField:"id"}},{field:"price",label:"\u4EF7\u683C",required:!0,component:"InputNumber",componentProps:{formatter:r=>{const o=/^(-)*(\d+)\.(\d\d).*$/;return`${r}`.replace(/\B(?=(\d{3})+(?!\d))/g,"").replace(o,"$1$2.$3")},parser:r=>{const o=/^(-)*(\d+)\.(\d\d).*$/;return`${r}`.replace(/\B(?=(\d{3})+(?!\d))/g,"").replace(o,"$1$2.$3")}}}];const W=F({__name:"PriceDrawerWeek",emits:["success","register"],setup(r,{emit:o}){const t=y(!1),u=P(()=>t.value?"\u7F16\u8F91\u4EF7\u683C":"\u65B0\u589E\u4EF7\u683C"),[l,{resetFields:d,setFieldsValue:p,validate:n}]=S({labelWidth:120,baseColProps:{span:24},schemas:C,showActionButtonGroup:!1}),[a,{setDrawerProps:s,closeDrawer:_}]=x(e=>c(this,null,function*(){d(),s({confirmLoading:!1}),t.value=e==null?void 0:e.isUpdate,i(t)&&(yield p({id:e.id,week:e.week,year:m(e.year.toString()),price:e.price}))})),w=()=>c(this,null,function*(){try{const e=yield n();e.year=m(e.year.toString()).format("YYYY"),s({confirmLoading:!0}),e.id?yield E(e.id,e):yield B(e),_(),o("success")}finally{s({confirmLoading:!1})}});return(e,Y)=>(k(),b(i(I),v(e.$attrs,{onRegister:i(a),showFooter:"",title:i(u),width:"500px",onOk:w}),{default:D(()=>[h(i($),{onRegister:i(l)},null,8,["onRegister"])]),_:1},16,["onRegister","title"]))}});var R=g(W,[["__scopeId","data-v-2205fa1a"]]),T=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"}));export{R as P,T as a,O as c,N as s};
|