提交 66b8e6f4 authored 作者: 钟是志's avatar 钟是志

23792 【元数据】导入时第一列数据在验证模版上没有显示

上级 d06980af
......@@ -11,7 +11,8 @@ const Step = Steps.Step;
const TabPane = Tabs.TabPane;
const exportExcel = CLIENT_TYPE == 'mobile' ? null : require('xlsx-oc').exportExcel;
let tempCallback = () => {};
let tempCallback = () => {
};
@connect(({ DataObj, loading }) => ({
......@@ -81,7 +82,7 @@ export default class ImportUtil extends React.PureComponent {
this.setState({
current: current,
isShow: true,
},()=>{
}, () => {
if (tempCallback && typeof tempCallback === 'function') {
tempCallback();
tempCallback = null;
......@@ -247,6 +248,7 @@ export default class ImportUtil extends React.PureComponent {
this.setState({ confirmLoading: false });
});
};
render() {
const props = {
name: 'file',
......@@ -286,7 +288,7 @@ export default class ImportUtil extends React.PureComponent {
];
const { current } = this.state;
const { name, loading } = this.props;
const { name } = this.props;
const column1 = this.state.column
? [
{
......@@ -299,12 +301,23 @@ export default class ImportUtil extends React.PureComponent {
...this.state.column,
]
: [];
var column2 = this.state.column ? [...this.state.column] : [];
if (column1.length > 1)
let column2 = this.state.column ? [...this.state.column] : [];
if (column1.length > 1) {
column1[1].render = (val) => <span style={{ color: 'red' }}>{val}</span>;
}
column2.splice(0, 1);
column2 = [{ title: '序号', fixed: 'left', width: 50, render: (v, r, i) => i + 1 }, ...column2];
if (column2) {
let xuhao = column2.find((g) => g.dataIndex === '序号');
if (!xuhao) {
column2.unshift({
title: '序号',
fixed: 'left',
width: 50,
render: (v, r, i) => i + 1,
dataIndex: '序号',
});
}
}
const btn = {
name: name || '批量导入',
......@@ -333,13 +346,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()}
......@@ -349,8 +362,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()}
/>
)}
......@@ -369,13 +382,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}
......@@ -384,7 +397,7 @@ export default class ImportUtil extends React.PureComponent {
) : (
<Upload {...props}>
<Button>
<Icon type="upload" />
<Icon type='upload' />
重新上传
</Button>
</Upload>
......@@ -404,21 +417,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">
<TabPane tab={<span style={{ color: 'red' }}>验证错误列表</span>} key='1'>
<Button
style={{ marginTop: 5, marginBottom: 5 }}
type="danger"
type='danger'
onClick={this.exportError.bind(this, column1, this.state.errData)}>
导出错误信息
</Button>
<Table
columns={column1}
size="small"
size='small'
style={{ overflow: 'auto' }}
dataSource={this.state.errData}
bordered={true}
......@@ -426,17 +439,17 @@ export default class ImportUtil extends React.PureComponent {
/>
</TabPane>
)}
<TabPane tab={<span style={{ color: 'green' }}>验证成功列表</span>} key="2">
<TabPane tab={<span style={{ color: 'green' }}>验证成功列表</span>} key='2'>
<Button
style={{ marginTop: 5, marginBottom: 5 }}
type="primary"
type='primary'
onClick={this.exportError.bind(this, column2, this.state.sucData)}>
导出正确信息
</Button>
<Table
columns={column2}
size="small"
size='small'
style={{ overflow: 'auto' }}
dataSource={this.state.sucData}
bordered={true}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论