提交 84c02c95 authored 作者: liqiufan's avatar liqiufan

导入模版修改

上级 6931c086
...@@ -45,14 +45,14 @@ const calcColumns = (columns) => { ...@@ -45,14 +45,14 @@ const calcColumns = (columns) => {
export default class ImportUtil extends React.PureComponent { export default class ImportUtil extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
const { api, serviceBean, serviceKey } = props; const { api, serviceBean, serviceKey, diyExportTemplateUrl } = props;
var importFileUrl, analyseFileUrl, queryFileUrl, exportTemplateUrl; var importFileUrl, analyseFileUrl, queryFileUrl, exportTemplateUrl;
if (api != null) { if (api != null) {
const x = api; // 学工的 接口地址 const x = api; // 学工的 接口地址
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 = exportTemplateUrl = diyExportTemplateUrl ? x + diyExportTemplateUrl+ `?serviceBean=${serviceBean}&serviceKey=${serviceKey}` :
x + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`; x + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`;
} else { } else {
importFileUrl = props.importFileUrl; importFileUrl = props.importFileUrl;
...@@ -80,13 +80,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -80,13 +80,13 @@ export default class ImportUtil extends React.PureComponent {
static getDerivedStateFromProps(props, state) { static getDerivedStateFromProps(props, state) {
if (props.api != null) { if (props.api != null) {
const { api, serviceBean, serviceKey } = props; const { api, serviceBean, serviceKey, diyExportTemplateUrl } = props;
const x = api; // // 学工的 接口地址 const x = api; // // 学工的 接口地址
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 = state.exportTemplateUrl = diyExportTemplateUrl ? x + diyExportTemplateUrl+ `?serviceBean=${serviceBean}&serviceKey=${serviceKey}` :
x + `/importApi/downLoadTemplate?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;
...@@ -344,12 +344,19 @@ export default class ImportUtil extends React.PureComponent { ...@@ -344,12 +344,19 @@ export default class ImportUtil extends React.PureComponent {
// key='pass', 导出通过数据; key='notPass',导出未通过数据 // key='pass', 导出通过数据; key='notPass',导出未通过数据
exportData = (isPass) => { exportData = (isPass) => {
const type = isPass ? 'passList' : 'noPassList'; const type = isPass ? 'passList' : 'noPassList';
const { filekey, exportTemplateUrl } = this.state; const { api, serviceBean, serviceKey, exportTemplateUrl } = this.props;
const { filekey } = this.state;
let downLoadUrl;
if(api !== null){
downLoadUrl = api + `/importApi/downLoadTemplate?serviceBean=${serviceBean}&serviceKey=${serviceKey}`;
}else {
downLoadUrl = exportTemplateUrl;
};
let splitCode = '?'; let splitCode = '?';
if(exportTemplateUrl && exportTemplateUrl.indexOf('?') > -1){ if(downLoadUrl && downLoadUrl.indexOf('?') > -1){
splitCode = '&'; splitCode = '&';
} }
window.open(`${exportTemplateUrl}${splitCode}cacheKey=${filekey}&dataType=${type}&token=${getToken()}`); window.open(`${downLoadUrl}${splitCode}cacheKey=${filekey}&dataType=${type}&token=${getToken()}`);
}; };
continueImport = () => { continueImport = () => {
...@@ -405,6 +412,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -405,6 +412,7 @@ export default class ImportUtil extends React.PureComponent {
const column = calcColumns(this.state.column); const column = calcColumns(this.state.column);
const hasErrorData = !!errData && !!errData.length; const hasErrorData = !!errData && !!errData.length;
const hasSucData = !!sucData && !!sucData.length; const hasSucData = !!sucData && !!sucData.length;
console.log(this.state.exportTemplateUrl,'exportTemplateUrl');
return ( return (
<span> <span>
<ButtonDiy <ButtonDiy
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论