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

导入模版修改

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