提交 21a482ab authored 作者: 钟是志's avatar 钟是志

屏蔽导入组件的 错误信息 导入 导出功能

因为要报错 Bad range (0): A1:[2 Reduce of empty array with no initial value 28492 参军入伍管理、政治考核管理、役前集训管理、体检管理,批量导入错误时--导出错误信息无反应(101458,bdk@2022*$)
上级 beb746e3
...@@ -14,10 +14,8 @@ const Modal = getModal(); ...@@ -14,10 +14,8 @@ const Modal = getModal();
const message = getMessage(); const message = getMessage();
const Step = Steps.Step; const Step = Steps.Step;
const TabPane = Tabs.TabPane; const TabPane = Tabs.TabPane;
const exportExcel = CLIENT_TYPE == 'mobile' ? null : require('xlsx-oc').exportExcel; // const exportExcel = CLIENT_TYPE == 'mobile' ? null : require('xlsx-oc').exportExcel;
let tempCallback = () => { let tempCallback = () => {};
};
@connect(({ DataObj, loading }) => ({ @connect(({ DataObj, loading }) => ({
DataObj, DataObj,
...@@ -90,15 +88,18 @@ export default class ImportUtil extends React.PureComponent { ...@@ -90,15 +88,18 @@ export default class ImportUtil extends React.PureComponent {
} }
if (current === 3) { if (current === 3) {
console.log('current === 3'); console.log('current === 3');
this.setState({ this.setState(
{
current: current, current: current,
isShow: true, isShow: true,
}, () => { },
() => {
if (tempCallback && typeof tempCallback === 'function') { if (tempCallback && typeof tempCallback === 'function') {
tempCallback(); tempCallback();
tempCallback = null; tempCallback = null;
} }
}); },
);
} }
} }
...@@ -198,23 +199,29 @@ export default class ImportUtil extends React.PureComponent { ...@@ -198,23 +199,29 @@ export default class ImportUtil extends React.PureComponent {
}, },
}); });
}; };
changePane = (activeKey) => { changePane = (activeKey) => {
this.setState({ currentKey: activeKey }); this.setState({ currentKey: activeKey });
}; };
exportError = (column, dataSource) => {
if (exportExcel == null) { // exportError = (column, dataSource) => {
message.info('当前终端暂不支持此功能'); // if (exportExcel == null) {
return; // message.info('当前终端暂不支持此功能');
} // return;
var _headers = []; // }
for (var i = 0; i < column.length; i++) { // var _headers = [];
_headers.push({ k: column[i].dataIndex, v: column[i].title }); // for (var i = 0; i < column.length; i++) {
} // _headers.push({
for (var j = 0; j < dataSource.length; j++) { // k: column[i].dataIndex,
dataSource[j].index = j + 1; // v: column[i].title,
} // });
exportExcel(_headers, dataSource); // }
}; // for (var j = 0; j < dataSource.length; j++) {
// dataSource[j].index = j + 1;
// }
// exportExcel(_headers, dataSource);
// };
downloadFile = async () => { downloadFile = async () => {
this.setState({ confirmLoading: true }); this.setState({ confirmLoading: true });
...@@ -227,7 +234,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -227,7 +234,7 @@ export default class ImportUtil extends React.PureComponent {
}; };
let url = `${config.httpServer}/DataObjApi/importTemplateDownload`; let url = `${config.httpServer}/DataObjApi/importTemplateDownload`;
let newParams = giveFilePostDataInfoForTrue(params, url); let newParams = giveFilePostDataInfoForTrue(params, url);
if(newParams && newParams.datas){ if (newParams && newParams.datas) {
newParams.datas.token = getToken(); newParams.datas.token = getToken();
} }
const { transformApi, headersApi } = await getTransformApi(newParams.url); const { transformApi, headersApi } = await getTransformApi(newParams.url);
...@@ -236,7 +243,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -236,7 +243,7 @@ export default class ImportUtil extends React.PureComponent {
body: FormdataWrapper(newParams.datas), body: FormdataWrapper(newParams.datas),
headers: { headers: {
apis: headersApi, apis: headersApi,
} },
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
...@@ -367,13 +374,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -367,13 +374,13 @@ export default class ImportUtil extends React.PureComponent {
<Step key={item.title} title={item.title} /> <Step key={item.title} title={item.title} />
))} ))}
</Steps> </Steps>
<div className='steps-content'>{steps[this.state.current].content}</div> <div className="steps-content">{steps[this.state.current].content}</div>
<div className={styles.button}> <div className={styles.button}>
{this.state.current < steps.length - 1 && {this.state.current < steps.length - 1 &&
this.state.current !== 0 && ( this.state.current !== 0 && (
<ButtonDiy <ButtonDiy
name={this.state.current == 3 ? '确认导入' : '下一步'} name={this.state.current == 3 ? '确认导入' : '下一步'}
type='primary' type="primary"
disabled={this.state.current != 3 && this.state.isNextDisabled} disabled={this.state.current != 3 && this.state.isNextDisabled}
// className='primaryBlue' // className='primaryBlue'
handleClick={() => this.next()} handleClick={() => this.next()}
...@@ -383,8 +390,8 @@ export default class ImportUtil extends React.PureComponent { ...@@ -383,8 +390,8 @@ export default class ImportUtil extends React.PureComponent {
{this.state.current > 0 && ( {this.state.current > 0 && (
<ButtonDiy <ButtonDiy
style={{ marginLeft: 8 }} style={{ marginLeft: 8 }}
name='上一步' name="上一步"
className='defaultBlue' className="defaultBlue"
handleClick={() => this.prev()} handleClick={() => this.prev()}
/> />
)} )}
...@@ -403,13 +410,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -403,13 +410,13 @@ export default class ImportUtil extends React.PureComponent {
<div className={styles.buttonDown}> <div className={styles.buttonDown}>
<Upload {...props}> <Upload {...props}>
<Button> <Button>
<Icon type='upload' /> <Icon type="upload" />
点击上传 点击上传
</Button> </Button>
</Upload> </Upload>
<ButtonDiy <ButtonDiy
name={'下载模板'} name={'下载模板'}
type='primary' type="primary"
// className='primaryBlue' // className='primaryBlue'
handleClick={() => this.downloadFile()} handleClick={() => this.downloadFile()}
loading={this.state.confirmLoading} loading={this.state.confirmLoading}
...@@ -418,7 +425,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -418,7 +425,7 @@ export default class ImportUtil extends React.PureComponent {
) : ( ) : (
<Upload {...props}> <Upload {...props}>
<Button> <Button>
<Icon type='upload' /> <Icon type="upload" />
重新上传 重新上传
</Button> </Button>
</Upload> </Upload>
...@@ -438,21 +445,21 @@ export default class ImportUtil extends React.PureComponent { ...@@ -438,21 +445,21 @@ export default class ImportUtil extends React.PureComponent {
activeKey={this.state.currentKey} activeKey={this.state.currentKey}
key={this.state.ch} key={this.state.ch}
onChange={this.changePane} onChange={this.changePane}
type='card'> type="card">
{this.state.errData && this.state.errData.length == 0 ? ( {this.state.errData && this.state.errData.length == 0 ? (
'' ''
) : ( ) : (
<TabPane tab={<span style={{ color: 'red' }}>验证错误列表</span>} key='1'> <TabPane tab={<span style={{ color: 'red' }}>验证错误列表</span>} key="1">
<Button {/*<Button
style={{ marginTop: 5, marginBottom: 5 }} style={{ marginTop: 5, marginBottom: 5 }}
type='danger' type='danger'
onClick={this.exportError.bind(this, column1, this.state.errData)}> onClick={this.exportError.bind(this, column1, this.state.errData)}>
导出错误信息 导出错误信息
</Button> </Button>*/}
<Table <Table
columns={column1} columns={column1}
size='small' size="small"
style={{ overflow: 'auto' }} style={{ overflow: 'auto' }}
dataSource={this.state.errData} dataSource={this.state.errData}
bordered={true} bordered={true}
...@@ -460,17 +467,20 @@ export default class ImportUtil extends React.PureComponent { ...@@ -460,17 +467,20 @@ export default class ImportUtil extends React.PureComponent {
/> />
</TabPane> </TabPane>
)} )}
<TabPane tab={<span style={{ color: 'green' }}>验证成功列表</span>} key='2'> <TabPane tab={<span style={{ color: 'green' }}>验证成功列表</span>} key="2">
<Button {/*<Button
style={{ marginTop: 5, marginBottom: 5 }} style={{
type='primary' marginTop: 5,
marginBottom: 5,
}}
type="primary"
onClick={this.exportError.bind(this, column2, this.state.sucData)}> onClick={this.exportError.bind(this, column2, this.state.sucData)}>
导出正确信息 导出正确信息
</Button> </Button>*/}
<Table <Table
columns={column2} columns={column2}
size='small' size="small"
style={{ overflow: 'auto' }} style={{ overflow: 'auto' }}
dataSource={this.state.sucData} dataSource={this.state.sucData}
bordered={true} bordered={true}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论