提交 59aeec82 authored 作者: tb53863844's avatar tb53863844

自定义导出

上级 679e34fa
......@@ -59,13 +59,9 @@ export default class ExportCurrentInfo extends React.Component {
query:this.props.query,
custom:this.props.custom,
sql:this.props.sql,
index:this.props.index
};
this.downloadFile(downloadUrl, param);
};
downloadFile(url, params) {
......@@ -84,7 +80,7 @@ export default class ExportCurrentInfo extends React.Component {
if (data instanceof Blob) {
let a = document.createElement('a');
let url = window.URL.createObjectURL(data);
let filename = (this.props.fileName ? this.props.fileName : '导出文件.') + this.props.ext;
let filename = (this.props.fileName ? this.props.fileName : '导出文件.') + (this.props.ext||"xlsx");
a.href = url;
a.download = filename;
a.click();
......@@ -109,12 +105,12 @@ export default class ExportCurrentInfo extends React.Component {
render() {
const btn = this.props.btn?this.props.btn:{name:'导出',
type:'default',
className:'defaultBlue'}
return (
<span>
<ButtonDiy name='导出'
type='default'
className='defaultBlue'
<ButtonDiy {...btn}
loading={this.state.confirmLoading}
handleClick={this.exportData}/>
<div id='downloadDiv' style={{ display: 'none' }}></div>
......
......@@ -1295,12 +1295,24 @@ class TreeList extends React.Component {
<ExportCurrentInfo
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={
custom={
this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null
}
sql={Base16Encode(this.props.sql)}
/>
)}
{this.props.value &&this.props.value.exportConfig?
this.props.value.exportConfig.map((r,i)=> <ExportCurrentInfo
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null}
index={i}
btn={r.btn}
ext={r.ext?r.ext:"xlsx"}
sql={Base16Encode(this.props.sql)}
/>):""}
{rights && !rights.includes('exportData') ? (
''
) : (
......
......@@ -1341,10 +1341,22 @@ class FormList extends React.Component {
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null}
ext={this.props.value &&this.props.value.exportConfig&&this.props.value.exportConfig.ext?this.props.value.exportConfig.ext:"xlsx"}
sql={Base16Encode(this.props.sql)}
/>
)}
{this.props.value &&this.props.value.exportConfig?
this.props.value.exportConfig.map((r,i)=> <ExportCurrentInfo
objId={this.state.objId}
query={JSON.stringify(this.state.formValues)}
custom={this.props.value ? Base16Encode(JSON.stringify(this.props.value)) : null}
index={i}
btn={r.btn}
ext={r.ext?r.ext:"xlsx"}
sql={Base16Encode(this.props.sql)}
/>):""}
{rights && !rights.includes('exportData') ? (
''
) : (
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论