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

26873 就业毕业辅助管理-毕业生档案邮寄管理,导出网络超时

上级 dc4254ed
...@@ -9,6 +9,8 @@ import { getToken } from '../utils/token'; ...@@ -9,6 +9,8 @@ import { getToken } from '../utils/token';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import FormdataWrapper from '../utils/object-to-formdata-custom'; import FormdataWrapper from '../utils/object-to-formdata-custom';
import ButtonDiy from './ButtonDiy/ButtonDiy'; import ButtonDiy from './ButtonDiy/ButtonDiy';
import { queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig';
import { giveFilePostData, giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
/** /**
* *
* 2019/02/21 修改导出方式为fetch * 2019/02/21 修改导出方式为fetch
...@@ -52,10 +54,11 @@ export default class ExportCurrentInfo extends React.Component { ...@@ -52,10 +54,11 @@ export default class ExportCurrentInfo extends React.Component {
downloadFile(url, params) { downloadFile(url, params) {
this.setState({ confirmLoading: true }); this.setState({ confirmLoading: true });
let newApi = giveFilePostDataInfoForTrue(params, url);
fetch(url, { fetch(newApi.url, {
method: 'POST', method: 'POST',
body: FormdataWrapper(params), body: FormdataWrapper(newApi.datas,
),
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
......
...@@ -7,6 +7,7 @@ import FormdataWrapper from '../utils/object-to-formdata-custom'; ...@@ -7,6 +7,7 @@ import FormdataWrapper from '../utils/object-to-formdata-custom';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import { connect } from 'dva'; import { connect } from 'dva';
import { getMessage, getModal } from '@/webPublic/one_stop_public/utils/utils'; import { getMessage, getModal } from '@/webPublic/one_stop_public/utils/utils';
import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
const Modal = getModal(); const Modal = getModal();
const message = getMessage(); const message = getMessage();
...@@ -218,9 +219,11 @@ export default class ImportUtil extends React.PureComponent { ...@@ -218,9 +219,11 @@ export default class ImportUtil extends React.PureComponent {
fileName, fileName,
token: getToken(), token: getToken(),
}; };
fetch(`${config.httpServer}/DataObjApi/importTemplateDownload`, { let url = `${config.httpServer}/DataObjApi/importTemplateDownload`;
let newParams = giveFilePostDataInfoForTrue(params, url);
fetch(newParams.url, {
method: 'POST', method: 'POST',
body: FormdataWrapper(params), body: FormdataWrapper(newParams.datas),
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
......
...@@ -4,6 +4,7 @@ import { isJSON } from '@/webPublic/zyd_public/utils/utils'; ...@@ -4,6 +4,7 @@ import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import { queryApiActionPath, queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath, queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig';
import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token'; import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import encryptApiList from './encryptApiList'; import encryptApiList from './encryptApiList';
import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem';
var BASE16 = '0123456789abcdef'; var BASE16 = '0123456789abcdef';
var bs16 = baseX(BASE16); var bs16 = baseX(BASE16);
...@@ -92,20 +93,62 @@ export function requestFileInfo(url, datas) { ...@@ -92,20 +93,62 @@ export function requestFileInfo(url, datas) {
}); });
} }
export function giveFilePostDataInfoForTrue(datas, url){
if(!queryIsSafe()){
return {
datas,
url,
}
}
for (let i in datas) {
if (datas[i] === null || (Array.isArray(datas[i]) && datas[i].length === 0) || datas[i] === undefined) {
delete datas[i];
}
}
if (url) {
const roleGroup = getUserInfo().groupsId;
if (url.indexOf('http') > -1) {
url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`);
} else {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
console.table({
datas,
url,
});
let file = new File([JSON.stringify(datas)], 'fileParams.jpeg', {
type: 'image/jpeg',
});
datas = {
fileParams: file,
};
return {
datas,
url,
}
}
}
function giveFilePostData(datas, url) { function giveFilePostData(datas, url) {
for (let i in datas) { for (let i in datas) {
if (datas[i] === null || (Array.isArray(datas[i]) && datas[i].length === 0) || datas[i] === undefined) { if (datas[i] === null || (Array.isArray(datas[i]) && datas[i].length === 0) || datas[i] === undefined) {
delete datas[i]; delete datas[i];
} }
} }
url = url.replaceAll('//', '/');
if (url && typeof url === 'string') { if (url && typeof url === 'string') {
for (let item of encryptApiList) { for (let item of encryptApiList) {
if (url.indexOf(item.api) > -1) { if (url.indexOf(item.api) > -1) {
const roleGroup = getUserInfo().groupsId; const roleGroup = getUserInfo().groupsId;
url = url.replace(url, `/safe/${roleGroup}/` + url); if (url.indexOf('http') > -1) {
url = url.replaceAll('//', '/'); url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/` + url);
} else {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
console.table({ console.table({
datas, datas,
url, url,
......
import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
export function giveSmartFormGlobalProps({ export function giveSmartFormGlobalProps({
fromStart = false, fromStart = false,
hasSingle = false, hasSingle = false,
...@@ -18,6 +20,10 @@ export function giveSmartFormGlobalProps({ ...@@ -18,6 +20,10 @@ export function giveSmartFormGlobalProps({
nextUsers, nextUsers,
calculateFlowData, calculateFlowData,
onlyRead, onlyRead,
apiList: {
giveFilePostDataInfoForTrue,
remark: 'giveFilePostDataInfoForTrue(params, url); 将接口参数 二进制文件化 并返回新的接口地址与参数',
}
}; };
return true; return true;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论