提交 16681aee authored 作者: 钟是志's avatar 钟是志

导入组件格式化代码

上级 c0c7eb1b
...@@ -52,8 +52,9 @@ export default class ImportUtil extends React.PureComponent { ...@@ -52,8 +52,9 @@ export default class ImportUtil extends React.PureComponent {
importFileUrl = x + `/importApi/execute?token=${getToken()}&cacheKey=`; importFileUrl = x + `/importApi/execute?token=${getToken()}&cacheKey=`;
queryFileUrl = x + `/importApi/findData?token=${getToken()}&cacheKey=`; queryFileUrl = x + `/importApi/findData?token=${getToken()}&cacheKey=`;
analyseFileUrl = x + `/importApi/analyse?token=${getToken()}&filePath=`; analyseFileUrl = x + `/importApi/analyse?token=${getToken()}&filePath=`;
exportTemplateUrl = diyExportTemplateUrl ? x + diyExportTemplateUrl+ `?serviceBean=${serviceBean}&serviceKey=${serviceKey}` : exportTemplateUrl = diyExportTemplateUrl
x + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`; ? x + diyExportTemplateUrl + `?serviceBean=${serviceBean}&serviceKey=${serviceKey}`
: x + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`;
} else { } else {
importFileUrl = props.importFileUrl; importFileUrl = props.importFileUrl;
queryFileUrl = props.queryFileUrl; queryFileUrl = props.queryFileUrl;
...@@ -85,8 +86,9 @@ export default class ImportUtil extends React.PureComponent { ...@@ -85,8 +86,9 @@ export default class ImportUtil extends React.PureComponent {
state.importFileUrl = x + `/importApi/execute?token=${getToken()}&cacheKey=`; state.importFileUrl = x + `/importApi/execute?token=${getToken()}&cacheKey=`;
state.queryFileUrl = x + `/importApi/findData?token=${getToken()}&cacheKey=`; state.queryFileUrl = x + `/importApi/findData?token=${getToken()}&cacheKey=`;
state.analyseFileUrl = x + `/importApi/analyse?token=${getToken()}&filePath=`; state.analyseFileUrl = x + `/importApi/analyse?token=${getToken()}&filePath=`;
state.exportTemplateUrl = diyExportTemplateUrl ? x + diyExportTemplateUrl+ `?serviceBean=${serviceBean}&serviceKey=${serviceKey}` : state.exportTemplateUrl = diyExportTemplateUrl
x + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`; ? x + diyExportTemplateUrl + `?serviceBean=${serviceBean}&serviceKey=${serviceKey}`
: x + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`;
} else { } else {
state.importFileUrl = props.importFileUrl; state.importFileUrl = props.importFileUrl;
state.queryFileUrl = props.queryFileUrl; state.queryFileUrl = props.queryFileUrl;
...@@ -347,16 +349,19 @@ export default class ImportUtil extends React.PureComponent { ...@@ -347,16 +349,19 @@ export default class ImportUtil extends React.PureComponent {
const { api, serviceBean, serviceKey, exportTemplateUrl } = this.props; const { api, serviceBean, serviceKey, exportTemplateUrl } = this.props;
const { filekey } = this.state; const { filekey } = this.state;
let downLoadUrl; let downLoadUrl;
if(api !== null){ if (api !== null) {
downLoadUrl = api + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`; downLoadUrl =
}else { api + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`;
} else {
downLoadUrl = exportTemplateUrl; downLoadUrl = exportTemplateUrl;
}; }
let splitCode = '?'; let splitCode = '?';
if(downLoadUrl && downLoadUrl.indexOf('?') > -1){ if (downLoadUrl && downLoadUrl.indexOf('?') > -1) {
splitCode = '&'; splitCode = '&';
} }
window.open(`${downLoadUrl}${splitCode}cacheKey=${filekey}&dataType=${type}&token=${getToken()}`); window.open(
`${downLoadUrl}${splitCode}cacheKey=${filekey}&dataType=${type}&token=${getToken()}`,
);
}; };
continueImport = () => { continueImport = () => {
...@@ -371,12 +376,12 @@ export default class ImportUtil extends React.PureComponent { ...@@ -371,12 +376,12 @@ export default class ImportUtil extends React.PureComponent {
const props = { const props = {
name: 'file', name: 'file',
action: getUploadUrl(), action: getUploadUrl(),
headers: { headers: {
Authorization: `bearer ${getToken()}`, Authorization: `bearer ${getToken()}`,
}, },
data: { data: {
token: getToken(), token: getToken(),
}, },
accept: '.xlsx', accept: '.xlsx',
showUploadList: false, showUploadList: false,
onChange: (info) => { onChange: (info) => {
...@@ -433,7 +438,11 @@ export default class ImportUtil extends React.PureComponent { ...@@ -433,7 +438,11 @@ export default class ImportUtil extends React.PureComponent {
<Spin spinning={loading}> <Spin spinning={loading}>
<div className={styles.nomal}> <div className={styles.nomal}>
<p className={styles.import}>EXCEL导入向导</p> <p className={styles.import}>EXCEL导入向导</p>
<div style={{ margin: 'auto 12px', fontSize: '12px' }}> <div
style={{
margin: 'auto 12px',
fontSize: '12px',
}}>
<Steps current={current}> <Steps current={current}>
{steps.map((item) => ( {steps.map((item) => (
<Step key={item.title} title={item.title} /> <Step key={item.title} title={item.title} />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论