beancount-gs/public/static/js/18.a83e9c12.chunk.js

1 line
5.0 KiB
JavaScript
Raw Normal View History

2022-03-11 15:27:45 +00:00
(this["webpackJsonpbeancount-web"]=this["webpackJsonpbeancount-web"]||[]).push([[18],{126:function(e,t,a){"use strict";var n=a(115),c=a(41),i=a(42),s=a(44),r=a(43),o=a(0),l=a(3);t.a=function(e){return function(t){Object(s.a)(o,t);var a=Object(r.a)(o);function o(){var e;Object(c.a)(this,o);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=a.call.apply(a,[this].concat(n))).defaultCommodity={currency:"CNY",symbol:"\uffe5"},e.currentCommodity=window.localStorage.getItem("ledgerCurrency"),e}return Object(i.a)(o,[{key:"render",value:function(){return Object(l.jsx)(e,Object(n.a)(Object(n.a)({},this.props),{},{commodity:this.currentCommodity?JSON.parse(this.currentCommodity):this.defaultCommodity}))}}]),o}(o.Component)}},481:function(e,t,a){"use strict";a.r(t);var n=a(41),c=a(42),i=a(44),s=a(43),r=a(471),o=a(256),l=a(314),h=a(488),d=a(473),u=a(241),b=a(0),j=a.n(b),m=a(62),p=a(46),f=a(126),O=a(3),g={required:"${label} \u4e0d\u80fd\u4e3a\u7a7a\uff01"},y=function(e){Object(i.a)(a,e);var t=Object(s.a)(a);function a(){var e;Object(n.a)(this,a);for(var c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];return(e=t.call.apply(t,[this].concat(i))).formRef=j.a.createRef(),e.state={loading:!1,checkStatus:"loading",showForm:!1,config:{}},e.checkReq=function(){e.setState({loading:!0}),Object(m.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(m.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(m.b)("/api/config",{method:"POST",body:t}).then((function(){e.props.history.replace("/ledger")})).finally((function(){e.setState({loading:!1})}))},e}return Object(c.a)(a,[{key:"componentDidMount",value:function(){this.checkReq()}},{key:"render",value:function(){return"error"===this.state.checkStatus?Object(O.jsxs)("div",{children:[Object(O.jsx)(r.a,{message:"\u68c0\u6d4b\u5931\u8d25",description:"\u4f9d\u8d56\u672a\u5b89\u88c5\uff0c\u8bf7\u5148\u5b89\u88c5 beancount",type:"error",showIcon:!0}),Object(O.jsx)("div",{style:{marginTop:"1rem"},children:Object(O.jsx)(o.a,{block:!0,type:"danger",loading:this.state.loading,onClick:this.handleReCheck,children:"\u91cd\u65b0\u68c0\u6d4b"})}),Object(O.jsx)("div",{style:{marginTop:"1rem"},children:Object(O.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(O.jsx)("div",{children:Object(O.jsxs)(l.a,{name:"init-form",className:"page-form",size:"middle",layout:"vertical",style:{textAlign:"left"},ref:this.formRef,onFinish:this.handleSubmitServerConfig,validateMessages:g,children:[Object(O.jsx)(l.a.Item,{label:"\u8d26\u672c\u5b58\u50a8\u4f4d\u7f6e",name:"dataPath",initialValue:this.state.config.dataPath,rules:[{required:!0}],children:Object(O.jsx)(h.a,{placeholder:"\u8d26\u672c\u5b58\u50a8\u4f4d\u7f6e"})}),Object(O.jsx)(l.a.Item,{label:"\u8d26\u672c\u5f00\u59cb\u65e5\u671f",name:"startDate",initialValue:this.state.config.startDate,rules:[{required:!0}],children:Object(O.jsx)(h.a,{type:"date",placeholder:"\u8d26\u672c\u5f00\u59cb\u65e5\u671f"})}),Object(O.jsx)(l.a.Item,{label:"\u5e01\u79cd",name:"operatingCurrency",initialValue:this.state.config.operatingCurrency,rules:[{required:!0}],children:Object(O.jsx)(h.a,{placeholder:"\u5e01\u79cd"})}),Object(O.jsx)(l.a.Item,{label:"\u5e73\u8861\u8d26\u6237\u540d\u79f0\u8bbe\u7f6e",name:"openingBalances",initialValue:this.state.config.openingBalances,rules:[{required:!0}],children:Object(O.jsx)(h.a,{placeholder:"\u5e73\u8861\u8d26\u6237\u540d\u79f0\u8bbe\u7f6e"})}),Object(O.jsx)(l.a.Item,{label:"\u4fee\u6539\u6e90\u6587\u4ef6\u65f6\u662f\u5426\u5907\u4efd\u6570\u636e",name:"isBak",valuePropName