Commit 59975fa1 authored by 皮倩雯's avatar 皮倩雯

fix: 'gis接口设置超时时间10s'

parent ffeee370
Pipeline #80066 waiting for manual action with stages
...@@ -111,13 +111,25 @@ const TileData = props => { ...@@ -111,13 +111,25 @@ const TileData = props => {
console.log('res', res); console.log('res', res);
if (res.code == '0') { if (res.code == '0') {
setTreeLoading(false); setTreeLoading(false);
console.log(res.data.optionalLayer.layers);
setCardData(res.data.optionalLayer.layers); setCardData(res.data.optionalLayer.layers);
} else { } else {
setTreeLoading(false); setTreeLoading(false);
} }
}) })
.catch(() => { .catch(err => {
if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false); setTreeLoading(false);
}); });
}, [flagAdd]); }, [flagAdd]);
...@@ -188,11 +200,28 @@ const TileData = props => { ...@@ -188,11 +200,28 @@ const TileData = props => {
}, [flag]); }, [flag]);
useEffect(() => { useEffect(() => {
QueryBaseMapItems().then(res => { QueryBaseMapItems()
if (res.code === '0') { .then(res => {
setJson(res.data); if (res.code === '0') {
} setJson(res.data);
}); }
})
.catch(err => {
if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false);
});
}, []); }, []);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
const renderTile = () => { const renderTile = () => {
...@@ -231,7 +260,20 @@ const TileData = props => { ...@@ -231,7 +260,20 @@ const TileData = props => {
}); });
} }
}) })
.catch(() => { .catch(err => {
if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false); setTreeLoading(false);
}); });
}; };
......
...@@ -192,23 +192,40 @@ const VectorData = props => { ...@@ -192,23 +192,40 @@ const VectorData = props => {
const renderTile = (params = { info: '' }) => { const renderTile = (params = { info: '' }) => {
setTreeLoading(true); setTreeLoading(true);
solutionName(); solutionName();
GetVectorService(params).then(res => { GetVectorService(params)
if (res.msg === 'Ok') { .then(res => {
let arr = []; if (res.msg === 'Ok') {
res.data.VectorList.map(item => { let arr = [];
arr.push(false); res.data.VectorList.map(item => {
}); arr.push(false);
setLoading(arr); });
setTreeLoading(false); setLoading(arr);
setTileData(res.data.VectorList); setTreeLoading(false);
} else { setTileData(res.data.VectorList);
} else {
setTreeLoading(false);
notification.error({
message: '获取失败',
description: res.message,
});
}
})
.catch(err => {
if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false); setTreeLoading(false);
notification.error({ });
message: '获取失败',
description: res.message,
});
}
});
}; };
// 搜索 // 搜索
const handleSearch = text => { const handleSearch = text => {
...@@ -224,7 +241,7 @@ const VectorData = props => { ...@@ -224,7 +241,7 @@ const VectorData = props => {
version: 9999, version: 9999,
solution: solutionNames, solution: solutionNames,
}; };
for (const [index,item] of tileData.entries()) { for (const [index, item] of tileData.entries()) {
setAllLoading(true); setAllLoading(true);
query.serviceName = item.ServiceName; query.serviceName = item.ServiceName;
let res = null; let res = null;
...@@ -245,8 +262,8 @@ const VectorData = props => { ...@@ -245,8 +262,8 @@ const VectorData = props => {
description: '更新元数据失败', description: '更新元数据失败',
}); });
} }
if(index === tileData.length-1) { if (index === tileData.length - 1) {
setFlag(flag + 1) setFlag(flag + 1);
} }
} }
}; };
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @LastEditors: dengchao 754083046@qq.com * @LastEditors: dengchao 754083046@qq.com
*/ */
/* eslint-disable indent */ /* eslint-disable indent */
import { Button, Spin, Empty, Input } from 'antd'; import { Button, Spin, Empty, Input, notification } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { OrderedListOutlined } from '@ant-design/icons'; import { OrderedListOutlined } from '@ant-design/icons';
import styles from '../SchemeConfig.less'; import styles from '../SchemeConfig.less';
...@@ -52,42 +52,59 @@ const VectorData = props => { ...@@ -52,42 +52,59 @@ const VectorData = props => {
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false, isBaseMap: false,
...params, ...params,
}).then(resdata => { })
if (resdata.code == '0') { .then(resdata => {
setTreeLoading(false); if (resdata.code == '0') {
GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => { GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => {
if (res.code == '0') { if (res.code == '0') {
let arr = []; let arr = [];
res.data.general.baseMap.layers.map(i => { res.data.general.baseMap.layers.map(i => {
arr.push(i.servicename); arr.push(i.servicename);
}); });
setKeepData(arr); setKeepData(arr);
let list = []; let list = [];
resdata.data.map((j, index) => { resdata.data.map((j, index) => {
let data = []; let data = [];
let aa = []; let aa = [];
j.baseMap.map(k => { j.baseMap.map(k => {
if (arr.indexOf(k) != -1) { if (arr.indexOf(k) != -1) {
data.push(k); data.push(k);
} else { } else {
aa.push(k); aa.push(k);
} }
});
list.push(j.schemename);
let bb = aa.concat(data);
let i = bb.indexOf(j.baseMap[j.defaultBaseMap]);
resdata.data[index].defaultOldBaseMap = j.baseMap;
resdata.data[index].baseMap = bb;
resdata.data[index].defaultBaseMap = i;
}); });
list.push(j.schemename); setNameData(list);
let bb = aa.concat(data); setTileData(resdata.data);
let i = bb.indexOf(j.baseMap[j.defaultBaseMap]); setTreeLoading(false);
resdata.data[index].defaultOldBaseMap = j.baseMap; }
resdata.data[index].baseMap = bb; });
resdata.data[index].defaultBaseMap = i; } else {
}); setTreeLoading(false);
setNameData(list); }
setTileData(resdata.data); })
} .catch(err => {
}); if (err.message.indexOf('timeout') !== -1) {
} else { notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false); setTreeLoading(false);
} });
});
}; };
useEffect(() => { useEffect(() => {
setCardFlag(true); setCardFlag(true);
...@@ -148,7 +165,7 @@ const VectorData = props => { ...@@ -148,7 +165,7 @@ const VectorData = props => {
<div style={{ height: 'calc(100%)', width: '100%' }}> <div style={{ height: 'calc(100%)', width: '100%' }}>
<div className={styles.cardsList}> <div className={styles.cardsList}>
{/* {console.log(tileData)} */} {/* {console.log(tileData)} */}
{tileData && tileData.length ? ( {tileData.length > 0 ? (
tileData.map((item, index) => ( tileData.map((item, index) => (
<div <div
className={styles.cardItem} className={styles.cardItem}
......
...@@ -535,36 +535,53 @@ const VectorData = props => { ...@@ -535,36 +535,53 @@ const VectorData = props => {
GetMaplayerByTerminalType({ GetMaplayerByTerminalType({
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false, isBaseMap: false,
}).then(res => { })
if (res.data && res.data.length > 0) { .then(res => {
setTreeLoading(false); if (res.data && res.data.length > 0) {
listData.map(item => { setTreeLoading(false);
webSchemenameArr.push(item.schemename); listData.map(item => {
}); webSchemenameArr.push(item.schemename);
res.data.map(item => { });
if (!webSchemenameArr.includes(item.schemename)) schemeArr.push(item.schemename); res.data.map(item => {
}); if (!webSchemenameArr.includes(item.schemename)) schemeArr.push(item.schemename);
setSchemename(schemeArr); });
if (schemeArr.length) { setSchemename(schemeArr);
setVisible(true); if (schemeArr.length) {
setVisible(true);
} else {
console.log(12);
notification.warning({
message: '提示',
duration: 3,
description: '请先配置方案',
});
}
} else { } else {
console.log(12); console.log(34);
setTreeLoading(false);
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '请先配置方案', description: '请先配置方案',
}); });
} }
} else { })
console.log(34); .catch(err => {
if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false); setTreeLoading(false);
notification.warning({ });
message: '提示',
duration: 3,
description: '请先配置方案',
});
}
});
}; };
useEffect(() => { useEffect(() => {
console.log(flag); console.log(flag);
...@@ -608,8 +625,21 @@ const VectorData = props => { ...@@ -608,8 +625,21 @@ const VectorData = props => {
} }
setCheckLoading(false); setCheckLoading(false);
}) })
.catch(e => { .catch(err => {
setCheckLoading(false); if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false);
}); });
}; };
...@@ -650,8 +680,21 @@ const VectorData = props => { ...@@ -650,8 +680,21 @@ const VectorData = props => {
} }
setCheckLoading(false); setCheckLoading(false);
}) })
.catch(e => { .catch(err => {
setCheckLoading(false); if (err.message.indexOf('timeout') !== -1) {
notification.error({
message: '提示',
duration: 3,
description: '请求超时',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: err.message,
});
}
setTreeLoading(false);
}); });
}; };
......
...@@ -7,7 +7,8 @@ export const GetMetaData = param => get(`${PANDA_GIS}/${param.mapServerName}`); ...@@ -7,7 +7,8 @@ export const GetMetaData = param => get(`${PANDA_GIS}/${param.mapServerName}`);
// 3.获取元数据新 // 3.获取元数据新
export const GetMetaDataNew = param => get(`${CITY_SERVICE}/MapServer.svc/${param}`); export const GetMetaDataNew = param => get(`${CITY_SERVICE}/MapServer.svc/${param}`);
// 获取mapsetting配置 // 获取mapsetting配置
export const GetWebSiteConfig = param => get(`${PANDA_GIS}/MapLayer/LayerSetting`, param); export const GetWebSiteConfig = param =>
get(`${PANDA_GIS}/MapLayer/LayerSetting`, param, { timeout: 10000 });
// 获取图层列表 // 获取图层列表
export const GetLayerList = param => get(`${PANDA_GIS}/MetaData/D_GetLayerList`, param); export const GetLayerList = param => get(`${PANDA_GIS}/MetaData/D_GetLayerList`, param);
......
...@@ -155,10 +155,11 @@ export const omsDeleteWebsite = client => ...@@ -155,10 +155,11 @@ export const omsDeleteWebsite = client =>
// 获取全部 // 获取全部
export const GetMaplayerByTerminalType = query => export const GetMaplayerByTerminalType = query =>
get(`${PANDA_GIS}/Maplayer/GetMaplayerByTerminalType`, query); get(`${PANDA_GIS}/Maplayer/GetMaplayerByTerminalType`, query, { timeout: 10000 });
// 获取全部 // 获取全部
export const GettMaplayer = query => get(`${PANDA_GIS}/Maplayer/GetMaplayer`, query); export const GettMaplayer = query =>
get(`${PANDA_GIS}/Maplayer/GetMaplayer`, query, { timeout: 10000 });
// 添加底图方案 // 添加底图方案
export const SetBaseMapschemeName = param => export const SetBaseMapschemeName = param =>
...@@ -169,7 +170,11 @@ export const SetServiceConfig = query => post(`${PANDA_GIS}/Maplayer/SetServiceC ...@@ -169,7 +170,11 @@ export const SetServiceConfig = query => post(`${PANDA_GIS}/Maplayer/SetServiceC
// 获取方矢量数据列表 // 获取方矢量数据列表
export const GetVectorService = query => export const GetVectorService = query =>
get(`${PUBLISH_SERVICE}/Maplayer/GetVectorService`, { ...query, _version: 9999 }); get(
`${PUBLISH_SERVICE}/Maplayer/GetVectorService`,
{ ...query, _version: 9999 },
{ timeout: 10000 },
);
// 获取元数据的工作空间列表 // 获取元数据的工作空间列表
export const GetGISServerMapList = query => export const GetGISServerMapList = query =>
...@@ -329,7 +334,8 @@ export const SyncMapComponent = query => get(`${PUBLISH_SERVICE}/WebSite/SyncMap ...@@ -329,7 +334,8 @@ export const SyncMapComponent = query => get(`${PUBLISH_SERVICE}/WebSite/SyncMap
export const BatchDragSingleWebsite = data => export const BatchDragSingleWebsite = data =>
post(`${PUBLISH_SERVICE}/WebSite/BatchDragSingleWebsite`, data); post(`${PUBLISH_SERVICE}/WebSite/BatchDragSingleWebsite`, data);
export const QueryBaseMapItems = param => get(`${PANDA_GIS}/MapLayer/QueryBaseMapItems`, param); export const QueryBaseMapItems = param =>
get(`${PANDA_GIS}/MapLayer/QueryBaseMapItems`, param, { timeout: 10000 });
// 通过client获取角色 // 通过client获取角色
export const GetRoleGroups = param => get(`${PUBLISH_SERVICE}/UserCenter/GetRoleGroups`, param); export const GetRoleGroups = param => get(`${PUBLISH_SERVICE}/UserCenter/GetRoleGroups`, param);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment