提交 7cf71dcb authored 作者: 钟是志's avatar 钟是志

导入按钮样式修改..

在宝鸡的环境里面 下一步的 文字显示不出来
上级 f6761176
......@@ -15,10 +15,11 @@ import ButtonDiy from './ButtonDiy/ButtonDiy';
import config from '@/webPublic/one_stop_public/config';
import { connect } from 'dva';
const Step = Steps.Step;
const TabPane = Tabs.TabPane;
const exportExcel = (CLIENT_TYPE == "mobile") ? null : require('xlsx-oc').exportExcel
const exportExcel = (CLIENT_TYPE == 'mobile') ? null : require('xlsx-oc').exportExcel;
@connect(({ DataObj, loading }) => ({
DataObj,
......@@ -32,7 +33,7 @@ export default class ImportUtil extends React.PureComponent {
this.state = {
ch: false,
currentKey: "1",
currentKey: '1',
visible: false,
current: 0,
isShow: true,
......@@ -119,8 +120,8 @@ export default class ImportUtil extends React.PureComponent {
if (this.props.callback) {
this.props.callback();
}
}
})
},
});
}
......@@ -142,8 +143,8 @@ export default class ImportUtil extends React.PureComponent {
});
this.queryFile(res.cacheKey);
}
})
},
});
};
......@@ -163,7 +164,7 @@ export default class ImportUtil extends React.PureComponent {
sucData: res.pass,
errData: res.noPass,
column: res.column
column: res.column,
});
if (res.noPass && res.noPass.length == 0) {
......@@ -171,50 +172,51 @@ export default class ImportUtil extends React.PureComponent {
if (res.pass.length == 0) {
message.error('当前没有验证成功的数据,无法导入。');
this.setState({
currentKey: "1",
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true
isNextDisabled: true,
});
} else {
message.success('所有数据验证通过,请确认后点击下一步。');
this.setState({
currentKey: "2",
currentKey: '2',
ch: !this.state.ch,
isNextDisabled: false
isNextDisabled: false,
});
}
} else {
message.error('当前存在未验证通过的数据,请按错误提示检测更正导入文件');
this.setState({
currentKey: "1",
currentKey: '1',
ch: !this.state.ch,
isNextDisabled: true
isNextDisabled: true,
});
}
}
})
},
});
};
changePane = (activeKey) => {
this.setState({ currentKey: activeKey })
}
this.setState({ currentKey: activeKey });
};
exportError = (column, dataSource) => {
if (exportExcel == null) {
message.info("当前终端暂不支持此功能")
return
message.info('当前终端暂不支持此功能');
return;
}
var _headers = []
var _headers = [];
for (var i = 0; i < column.length; i++) {
_headers.push({ k: column[i].dataIndex, v: column[i].title })
_headers.push({ k: column[i].dataIndex, v: column[i].title });
}
for (var j = 0; j < dataSource.length; j++) {
dataSource[j].index = j + 1
dataSource[j].index = j + 1;
}
exportExcel(_headers, dataSource);
}
};
render() {
const props = {
......@@ -235,7 +237,6 @@ export default class ImportUtil extends React.PureComponent {
let x = info.file.response;
this.getCachKey(x);
} else if (info.file.status === 'error') {
......@@ -250,25 +251,31 @@ export default class ImportUtil extends React.PureComponent {
}, {
title: '数据导入',
},
{
title: '导入完成',
}];
{
title: '导入完成',
}];
const { current } = this.state;
const { name, loading } = this.props
const column1 = this.state.column ? [{ title: "序号", dataIndex: "index", fixed: "left", width: 50, render: (v, r, i) => i + 1 }, ...this.state.column] : []
var 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]
const { name, loading } = this.props;
const column1 = this.state.column ? [{
title: '序号',
dataIndex: 'index',
fixed: 'left',
width: 50,
render: (v, r, i) => i + 1,
}, ...this.state.column] : [];
var 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];
return (
<span>
<ButtonDiy name={name || '批量导入'}
type='default'
className='defaultBlue'
handleClick={this.showModal} />
type='default'
className='defaultBlue'
handleClick={this.showModal}/>
<Modal
visible={this.state.visible}
onOk={this.handleOk}
......@@ -277,7 +284,7 @@ export default class ImportUtil extends React.PureComponent {
onCancel={this.handleCancel}
title={null}
footer={null}
width={"80%"}
width={'80%'}
>
<div className={styles.nomal}>
......@@ -288,7 +295,7 @@ export default class ImportUtil extends React.PureComponent {
<Steps current={current}>
{steps.map(item =>
<Step key={item.title}
title={item.title} />)}
title={item.title}/>)}
</Steps>
<div className="steps-content">
{steps[this.state.current].content}
......@@ -297,14 +304,19 @@ export default class ImportUtil extends React.PureComponent {
{
(this.state.current < steps.length - 1 && this.state.current !== 0)
&&
<ButtonDiy name={this.state.current == 3 ? "确认导入" : "下一步"} type="primary" disabled={this.state.current != 3 && this.state.isNextDisabled} className='primaryBlue' handleClick={() => this.next()} />
<ButtonDiy name={this.state.current == 3 ? '确认导入' : '下一步'}
type="primary"
disabled={this.state.current != 3 && this.state.isNextDisabled}
// className='primaryBlue'
handleClick={() => this.next()}/>
}
{
this.state.current > 0
&&
<ButtonDiy style={{ marginLeft: 8 }} name="上一步" className='defaultBlue' handleClick={() => this.prev()} />
<ButtonDiy style={{ marginLeft: 8 }} name="上一步" className='defaultBlue'
handleClick={() => this.prev()}/>
}
</div>
......@@ -322,49 +334,52 @@ export default class ImportUtil extends React.PureComponent {
<div className={styles.buttonDown}>
<Upload {...props}>
<Button>
<Icon type="upload" />点击上传
</Button>
<Icon type="upload"/>点击上传
</Button>
</Upload>
<Button href={this.state.exportTemplateUrl}
target="_blank"
type="danger">
target="_blank"
type="danger">
下载模板
</Button>
</Button>
</div> :
<Upload {...props}>
<Button>
<Icon type="upload" />
重新上传
</Button>
<Icon type="upload"/>
重新上传
</Button>
</Upload>
}
{
this.state.isShow ? <div className={styles.attentionItem}>
<p>导入事项</p>
<p>1. 导入操作一次只能上传 1 EXCEL文件。</p>
<p>2. 导入文件最大文件大小上传 1 GB</p>
<p>3. 只能上传EXCEL文件(XLS, XLSX) 默认支持EXCEL 2003EXCEL 2007</p>
<p>4. 请将EXCEL文件的所有单元格格式设置为“文本”格式</p>
</div> :
<p>导入事项</p>
<p>1. 导入操作一次只能上传 1 EXCEL文件。</p>
<p>2. 导入文件最大文件大小上传 1 GB</p>
<p>3. 只能上传EXCEL文件(XLS, XLSX) 默认支持EXCEL 2003EXCEL 2007</p>
<p>4. 请将EXCEL文件的所有单元格格式设置为“文本”格式</p>
</div> :
<div className={styles.error} style={{ marginTop: 20 }}>
<Tabs activeKey={this.state.currentKey} key={this.state.ch} onChange={this.changePane} type="card">
{this.state.errData && this.state.errData.length == 0 ? "" : <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>
{this.state.errData && this.state.errData.length == 0 ? '' :
<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>
<Table columns={column1} size="small"
style={{ overflow: 'auto' }}
dataSource={this.state.errData}
bordered={true} /></TabPane>}
<TabPane tab={<span style={{ color: "green" }}>验证成功列表</span>} key="2">
<Table columns={column1} size="small"
style={{ overflow: 'auto' }}
dataSource={this.state.errData}
bordered={true}/></TabPane>}
<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 style={{ marginTop: 5, marginBottom: 5 }} type="primary"
onClick={this.exportError.bind(this, column2, this.state.sucData)}>导出正确信息</Button>
<Table columns={column2} size="small"
style={{ overflow: 'auto' }}
dataSource={this.state.sucData}
bordered={true} /></TabPane>
style={{ overflow: 'auto' }}
dataSource={this.state.sucData}
bordered={true}/></TabPane>
</Tabs>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论