Commit b43fdad0 by zhaochengxiang

spreadjs

parent f1aefb60
import React, { useEffect, useState } from 'react';
import { Modal, Form, Button, Space, Input, Checkbox, Row, Col, Typography, Spin } from 'antd';
import { Modal, Form, Button, Space, Input, Checkbox, Row, Col, Typography, Spin, InputNumber } from 'antd';
import { dispatch } from '../../../../model';
import { showMessage } from '../../../../util';
......@@ -80,11 +80,11 @@ const WorksheetModal = (props) => {
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 3 },
sm: { span: 4 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 21 },
sm: { span: 20 },
},
};
......@@ -93,7 +93,7 @@ const WorksheetModal = (props) => {
forceRender
title={`${report?.name}工作簿信息`}
visible={ visible }
width={ 600 }
width={ 800 }
onCancel={() => {
reset();
onCancel && onCancel();
......@@ -117,6 +117,15 @@ const WorksheetModal = (props) => {
>
<Input />
</Form.Item>
{
(report?.code === 'SpreadJS') && <Form.Item
label="最大加载行数"
name="limit"
rules={[{ required: true, message: '请选择最大加载行数!' }]}
>
<InputNumber min={0} />
</Form.Item>
}
<Form.Item
label="字段"
name="columns"
......
......@@ -6,22 +6,29 @@ import { getQueryParam } from '../../../../util';
const ts = Date.now()
const FC = (props) => {
const ref = React.useRef()
const url = getQueryParam('downloadurl', props.location?.search);
React.useEffect(() => {
window.addEventListener('message', download)
return () => {
window?.removeEventListener("message", download);
}
}, [])
const download = (e) => {
console.log('type', e.data?.type)
if (e.data?.type === 'excel.mount') {
axios.request({
method: 'GET',
url,
responseType: 'blob'
}).then((resp) => {
var iframe = document.getElementById('myIframe');
setTimeout(() => {
iframe.contentWindow.postMessage({ data: resp.data, type: "preview.excel.file" }, "*");
}, 5000)
})
}, [])
});
}
}
return (
<iframe
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment