@beisen-platform/export-form
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -21,2 +21,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
import Tip from '@beisen-platform/platform-tip'; | ||
import Loading from '@beisen-platform/loading'; | ||
@@ -38,2 +39,3 @@ require('./index.css'); | ||
showTip: false, | ||
showLoading: false, | ||
tipInfo: {}, | ||
@@ -283,3 +285,7 @@ text: 'xls文件', | ||
var formSaveUrl = encodeURI(this.createURL(this.ExportUrl, popOptions.queryUrl, popOptions.cmpContext, popOptions.data, popOptions)); | ||
var formSaveUrl = encodeURI(this.createURL(this.ExportUrl, popOptions.queryUrl, popOptions.cmpContext, popOptions.data, popOptions)); // TODO 这里需要做loading处理 | ||
this.setState({ | ||
showLoading: true | ||
}); | ||
fetchWithCors(formSaveUrl + '&exportFileType=' + this.state.value, { | ||
@@ -289,6 +295,10 @@ method: 'POST', | ||
}).then(function (resp) { | ||
// TODO 这里需要做loading处理 | ||
_this3.setState({ | ||
showLoading: false | ||
}); | ||
_this3.afterSave(resp); | ||
}, function (error) { | ||
_this3.setState({ | ||
showLoading: false, | ||
showTip: true, | ||
@@ -317,6 +327,15 @@ tipInfo: { | ||
}, { | ||
key: "renderLoading", | ||
value: function renderLoading() { | ||
if (this.state.showLoading) { | ||
return React.createElement("div", { | ||
className: "loading-wraper" | ||
}, React.createElement(Loading, null)); | ||
} | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var options = this.assambleOptions(); | ||
return React.createElement("div", null, this.renderTip(), React.createElement(DropdownList, _extends({}, options, this.props, { | ||
return React.createElement("div", null, this.renderLoading(), this.renderTip(), React.createElement(DropdownList, _extends({}, options, this.props, { | ||
value: this.state.value, | ||
@@ -323,0 +342,0 @@ text: this.state.text, |
{ | ||
"name": "@beisen-platform/export-form", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,2 +6,3 @@ import React,{ Component } from 'react'; | ||
import Tip from '@beisen-platform/platform-tip'; | ||
import Loading from '@beisen-platform/loading'; | ||
require('./index.scss'); | ||
@@ -12,3 +13,4 @@ export default class ExportSetting extends Component { | ||
this.state = { | ||
showTip: false, | ||
showTip: false, | ||
showLoading: false, | ||
tipInfo: {}, | ||
@@ -215,8 +217,10 @@ text: 'xls文件', | ||
// TODO 这里还没有传递日志相关的数据 | ||
const formSaveUrl = encodeURI(this.createURL(this.ExportUrl,popOptions.queryUrl, popOptions.cmpContext,popOptions.data,popOptions)); | ||
const formSaveUrl = encodeURI(this.createURL(this.ExportUrl,popOptions.queryUrl, popOptions.cmpContext,popOptions.data,popOptions)); | ||
// TODO 这里需要做loading处理 | ||
this.setState({showLoading: true}); | ||
fetchWithCors(formSaveUrl + '&exportFileType=' + this.state.value,{ method: 'POST', params: popOptions.searchData }).then(resp => { | ||
// TODO 这里需要做loading处理 | ||
this.setState({showLoading: false}); | ||
this.afterSave(resp); | ||
},error => { | ||
this.setState({ showTip: true, tipInfo: { infoType: 'error',title: error.json.message } }); | ||
this.setState({ showLoading: false,showTip: true, tipInfo: { infoType: 'error',title: error.json.message } }); | ||
}); | ||
@@ -234,3 +238,9 @@ } | ||
} | ||
} | ||
} | ||
renderLoading() { | ||
if(this.state.showLoading) { | ||
return <div className='loading-wraper'><Loading /></div>; | ||
} | ||
} | ||
@@ -241,3 +251,4 @@ render() { | ||
<div> | ||
{this.renderTip()} | ||
{this.renderLoading()} | ||
{this.renderTip()} | ||
<DropdownList {...options} {...this.props} value={this.state.value} text={this.state.text} onChange={this.onChange.bind(this)} form_errors={this.state.form_errors} /> | ||
@@ -244,0 +255,0 @@ <div className="form-footer bfc base-button-component"> |
26824
637