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

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

上级 d06980af
...@@ -11,7 +11,8 @@ const Step = Steps.Step; ...@@ -11,7 +11,8 @@ 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 }) => ({
...@@ -81,7 +82,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -81,7 +82,7 @@ export default class ImportUtil extends React.PureComponent {
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;
...@@ -247,6 +248,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -247,6 +248,7 @@ export default class ImportUtil extends React.PureComponent {
this.setState({ confirmLoading: false }); this.setState({ confirmLoading: false });
}); });
}; };
render() { render() {
const props = { const props = {
name: 'file', name: 'file',
...@@ -286,7 +288,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -286,7 +288,7 @@ export default class ImportUtil extends React.PureComponent {
]; ];
const { current } = this.state; const { current } = this.state;
const { name, loading } = this.props; const { name } = this.props;
const column1 = this.state.column const column1 = this.state.column
? [ ? [
{ {
...@@ -299,12 +301,23 @@ export default class ImportUtil extends React.PureComponent { ...@@ -299,12 +301,23 @@ export default class ImportUtil extends React.PureComponent {
...this.state.column, ...this.state.column,
] ]
: []; : [];
var column2 = this.state.column ? [...this.state.column] : []; let column2 = this.state.column ? [...this.state.column] : [];
if (column1.length > 1) if (column1.length > 1) {
column1[1].render = (val) => <span style={{ color: 'red' }}>{val}</span>; column1[1].render = (val) => <span style={{ color: 'red' }}>{val}</span>;
}
column2.splice(0, 1); if (column2) {
column2 = [{ title: '序号', fixed: 'left', width: 50, render: (v, r, i) => i + 1 }, ...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 = { const btn = {
name: name || '批量导入', name: name || '批量导入',
...@@ -333,13 +346,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -333,13 +346,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()}
...@@ -349,8 +362,8 @@ export default class ImportUtil extends React.PureComponent { ...@@ -349,8 +362,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()}
/> />
)} )}
...@@ -369,13 +382,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -369,13 +382,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}
...@@ -384,7 +397,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -384,7 +397,7 @@ export default class ImportUtil extends React.PureComponent {
) : ( ) : (
<Upload {...props}> <Upload {...props}>
<Button> <Button>
<Icon type="upload" /> <Icon type='upload' />
重新上传 重新上传
</Button> </Button>
</Upload> </Upload>
...@@ -404,21 +417,21 @@ export default class ImportUtil extends React.PureComponent { ...@@ -404,21 +417,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}
...@@ -426,17 +439,17 @@ export default class ImportUtil extends React.PureComponent { ...@@ -426,17 +439,17 @@ 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={{ marginTop: 5, marginBottom: 5 }}
type="primary" 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论