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