lcny-vue3-antd-admin/dist/assets/FlowsDrawer.a89daf4b.js

2 lines
3.3 KiB
JavaScript

var p=(r,a,u)=>new Promise((c,n)=>{var d=t=>{try{l(u.next(t))}catch(o){n(o)}},i=t=>{try{l(u.throw(t))}catch(o){n(o)}},l=t=>t.done?c(t.value):Promise.resolve(t.value).then(d,i);l((u=u.apply(r,a)).next())});import{q as E,a as b,v as F,f as w,o as _,j as g,B as D,p as v,k as s,aF as y,cI as m,f5 as C,f6 as A}from"./index.203f4f59.js";import{u as h,B as I}from"./useForm.00f4ca4b.js";import{a as P,B as S}from"./index.659a3b4b.js";const O=[{title:"\u5E74\u4EFD",dataIndex:"year",customRender:({text:r})=>r+"\u5E74"},{title:"\u5B63\u5EA6",dataIndex:"quarter"},{title:"\u5730\u533A",dataIndex:"area"},{title:"\u9500\u91CF",dataIndex:"sales",customRender:({record:{sales:r,unit:a}})=>r+a},{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:"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}}],q=[{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:"area",label:"\u5730\u533A",required:!0,component:"Input"},{field:"sales",label:"\u9500\u91CF",required:!0,component:"InputNumber",componentProps:{formatter:r=>{const a=/^(-)*(\d+)\.(\d\d).*$/;return`${r}`.replace(/\B(?=(\d{3})+(?!\d))/g,"").replace(a,"$1$2.$3")},parser:r=>{const a=/^(-)*(\d+)\.(\d\d).*$/;return`${r}`.replace(/\B(?=(\d{3})+(?!\d))/g,"").replace(a,"$1$2.$3")}}},{field:"unit",label:"\u5355\u4F4D",required:!0,component:"Input"}];const x=b({__name:"FlowsDrawer",emits:["success","register"],setup(r,{emit:a}){const u=F(!1),c=w(()=>u.value?"\u7F16\u8F91\u6D41\u5411":"\u65B0\u589E\u6D41\u5411"),[n,{resetFields:d,setFieldsValue:i,validate:l}]=h({labelWidth:120,baseColProps:{span:24},schemas:q,showActionButtonGroup:!1}),[t,{setDrawerProps:o,closeDrawer:f}]=P(e=>p(this,null,function*(){d(),o({confirmLoading:!1}),u.value=e==null?void 0:e.isUpdate,s(u)?yield i({id:e.id,quarter:e.quarter.toString(),year:m(e.year.toString()),area:e.area,sales:e.sales,unit:e.unit}):i({unit:"\u5428"})})),B=()=>p(this,null,function*(){try{const e=yield l();e.year=m(e.year.toString()).format("YYYY"),o({confirmLoading:!0}),e.id?yield C(e.id,e):yield A(e),f(),a("success")}finally{o({confirmLoading:!1})}});return(e,k)=>(_(),g(s(S),y(e.$attrs,{onRegister:s(t),showFooter:"",title:s(c),width:"500px",onOk:B}),{default:D(()=>[v(s(I),{onRegister:s(n)},null,8,["onRegister"])]),_:1},16,["onRegister","title"]))}});var $=E(x,[["__scopeId","data-v-1ccabbfc"]]),T=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));export{$ as F,T as a,O as c,N as s};