beancount-gs/public/static/js/16.e1595fcb.chunk.js

1 line
6.4 KiB
JavaScript
Raw Normal View History

2021-12-01 09:34:07 +00:00
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[16],{473:function(e,t,n){"use strict";n.r(t);var a=n(12),i=n(13),r=n(15),c=n(14),o=n(461),s=n(271),l=n(475),u=n(476),d=n(464),h=n(124),b=n(0),f=n.n(b),j=n(59),m=n(16),p=n(70),g=n(1),O={required:"${label} \u4e0d\u80fd\u4e3a\u7a7a\uff01"},y=function(e){Object(r.a)(n,e);var t=Object(c.a)(n);function n(){var e;Object(a.a)(this,n);for(var i=arguments.length,r=new Array(i),c=0;c<i;c++)r[c]=arguments[c];return(e=t.call.apply(t,[this].concat(r))).formRef=f.a.createRef(),e.state={loading:!1,checkStatus:"loading",showForm:!1,config:{}},e.checkReq=function(){e.setState({loading:!0}),Object(j.b)("/api/check",{method:"POST"}).then((function(t){e.setState({checkStatus:"ok"})})).catch((function(){e.setState({checkStatus:"error"})})).finally((function(){e.setState({loading:!1})}))},e.handleNextStep=function(){e.setState({loading:!0}),Object(j.b)("/api/config",{method:"GET"}).then((function(t){e.setState({config:t,showForm:!0})})).finally((function(){e.setState({loading:!1})}))},e.handleReCheck=function(){e.checkReq()},e.handleSubmitServerConfig=function(t){e.setState({loading:!0}),Object(j.b)("/api/config",{method:"POST",body:t}).then((function(){e.props.history.replace("/ledger")})).finally((function(){e.setState({loading:!1})}))},e}return Object(i.a)(n,[{key:"componentDidMount",value:function(){this.checkReq()}},{key:"render",value:function(){return"error"===this.state.checkStatus?Object(g.jsxs)("div",{children:[Object(g.jsx)(o.a,{message:"\u68c0\u6d4b\u5931\u8d25",description:"\u4f9d\u8d56\u672a\u5b89\u88c5\uff0c\u8bf7\u5148\u5b89\u88c5 beancount",type:"error",showIcon:!0}),Object(g.jsx)("div",{style:{marginTop:"1rem"},children:Object(g.jsx)(s.a,{block:!0,type:"danger",loading:this.state.loading,onClick:this.handleReCheck,children:"\u91cd\u65b0\u68c0\u6d4b"})}),Object(g.jsx)("div",{style:{marginTop:"1rem"},children:Object(g.jsx)("a",{href:"https://www.yuque.com/chuyi-ble7p/beancount-ns/sqwwqa#RwqnF",target:"_blank",children:"\u600e\u4e48\u5b89\u88c5 beancount ?"})})]}):"ok"===this.state.checkStatus?this.state.showForm?Object(g.jsx)("div",{children:Object(g.jsxs)(l.a,{name:"init-form",className:"page-form",size:"middle",layout:"vertical",style:{textAlign:"left"},ref:this.formRef,onFinish:this.handleSubmitServerConfig,validateMessages:O,children:[Object(g.jsx)(l.a.Item,{label:"\u8d26\u672c\u5b58\u50a8\u4f4d\u7f6e",name:"dataPath",initialValue:this.state.config.dataPath,rules:[{required:!0}],children:Object(g.jsx)(u.a,{placeholder:"\u8d26\u672c\u5b58\u50a8\u4f4d\u7f6e"})}),Object(g.jsx)(l.a.Item,{label:"\u521d\u59cb\u5316\u65e5\u671f",name:"startDate",initialValue:this.state.config.startDate,rules:[{required:!0}],children:Object(g.jsx)(u.a,{type:"date",placeholder:"\u521d\u59cb\u5316\u65e5\u671f"})}),Object(g.jsx)(l.a.Item,{label:"\u672c\u5e01\u4f4d",name:"operatingCurrency",initialValue:this.state.config.operatingCurrency,rules:[{required:!0}],children:Object(g.jsx)(u.a,{placeholder:"\u672c\u5e01\u4f4d"})}),Object(g.jsx)(l.a.Item,{label:"\u5e73\u8861\u8d26\u6237",name:"openingBalances",initialValue:this.state.config.openingBalances,rules:[{required:!0}],children:Object(g.jsx)(u.a,{placeholder:"\u5e73\u8861\u8d26\u6237"})}),Object(g.jsx)(l.a.Item,{label:"\u4fee\u6539\u6e90\u6587\u4ef6\u65f6\u662f\u5426\u5907\u4efd\u6570\u636e",name:"isBak",valuePropName:"checked",initialValue:this.state.config.isBak,children:Object(g.jsx)(d.a,{})}),Object(g.jsx)(l.a.Item,{children:Object(g.jsx)(s.a,{block:!0,type:"primary",htmlType:"submit",loading:this.state.loading,className:"submit-button",children:"\u786e\u8ba4"})})]})}):Object(g.jsxs)("div",{children:[Object(g.jsx)(o.a,{message:"\u68c0\u6d4b\u901a\u8fc7",description:"beancount\u5df2\u5b89\u88c5\uff0c\u70b9\u51fb\u4e0b\u4e00\u6b65\u6765\u5b8c\u6210\u521d\u59cb\u914d\u7f6e",type:"success",showIcon:!0}),Object(g.jsx)("div",{style:{marginTop:"1rem"}}),Object(g.jsx)(s.a,{type:"primary",block:!0,onClick:this.handleNextStep,children:"\u4e0b\u4e00\u6b65"})]}):Object(g.jsx)(h.a,{tip:"Loading...",children:Object(g.jsx)(o.a,{mes