Commit dfa2dba6 authored by 皮倩雯's avatar 皮倩雯

fix: 'gis全部接口替换成pandagis,接入新地图组件,接入管网组件'

parent 27b4a9af
Pipeline #58305 passed with stages
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"@esri/calcite-colors": "6.0.3", "@esri/calcite-colors": "6.0.3",
"@wisdom-cesium/cesium": "^1.0.78", "@wisdom-cesium/cesium": "^1.0.78",
"@wisdom-map/amap": "1.1.0-beta.36", "@wisdom-map/amap": "1.1.0-beta.37",
"@wisdom-map/arcgismap": "1.4.0-23", "@wisdom-map/arcgismap": "1.4.0-29",
"@wisdom-map/basemap": "1.1.0-8", "@wisdom-map/basemap": "1.1.0-9",
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"antd-img-crop": "^3.13.2", "antd-img-crop": "^3.13.2",
"bizcharts": "^4.0.15", "bizcharts": "^4.0.15",
......
...@@ -211,7 +211,7 @@ const VectorData = props => { ...@@ -211,7 +211,7 @@ const VectorData = props => {
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetServiceConfig(query).then(res => { SetServiceConfig(query).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = false; changehandData[index].isDefault = false;
setHandData(changehandData); setHandData(changehandData);
...@@ -232,7 +232,7 @@ const VectorData = props => { ...@@ -232,7 +232,7 @@ const VectorData = props => {
}), }),
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = true; changehandData[index].isDefault = true;
setHandData(changehandData); setHandData(changehandData);
...@@ -296,7 +296,7 @@ const VectorData = props => { ...@@ -296,7 +296,7 @@ const VectorData = props => {
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
prompt('success', '删除成功'); prompt('success', '删除成功');
setFlag(flag + 1); setFlag(flag + 1);
} else { } else {
......
/* eslint-disable no-case-declarations */
/* eslint-disable import/no-duplicates */
/* eslint-disable no-new */ /* eslint-disable no-new */
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { ArcGISMap, Drawtool, geomUtils } from '@wisdom-map/arcgismap'; import {
ArcGISMap,
ArcGISSceneMap,
Drawtool,
geomUtils,
PipenetStylesCenter,
MapImageLayer,
watchUtils,
} from '@wisdom-map/arcgismap';
import { getPipenetLayer } from '@wisdom-map/basemap';
import { import {
Form, Form,
Input, Input,
...@@ -11,12 +22,15 @@ import { ...@@ -11,12 +22,15 @@ import {
Cascader, Cascader,
notification, notification,
Tooltip, Tooltip,
Radio,
message,
} from 'antd'; } from 'antd';
import { EnvironmentOutlined } from '@ant-design/icons'; import { EnvironmentOutlined } from '@ant-design/icons';
import classnames from 'classnames'; import classnames from 'classnames';
import { GetWebSiteConfig } from '@/services/gis/gis'; import { GetWebSiteConfig } from '@/services/gis/gis';
import { SetServiceConfig } from '@/services/webConfig/api'; import { SetServiceConfig } from '@/services/webConfig/api';
import styles from './index.less'; import styles from './index.less';
import { ContinuousLegend } from '@antv/g2/lib/dependents';
const { Option } = Select; const { Option } = Select;
const defaultMap = { const defaultMap = {
basemaps: [ basemaps: [
...@@ -72,6 +86,7 @@ const defaultMap = { ...@@ -72,6 +86,7 @@ const defaultMap = {
backgroundColor: '#000000', backgroundColor: '#000000',
boundWidth: '10px', boundWidth: '10px',
backgroundOpacity: '0.6', backgroundOpacity: '0.6',
exportScheme: 'pandagis',
}; };
const widgets = [ const widgets = [
{ {
...@@ -127,24 +142,27 @@ const Map = props => { ...@@ -127,24 +142,27 @@ const Map = props => {
const [options, setOptions] = useState([]); const [options, setOptions] = useState([]);
const [mapsettings, setMapsettings] = useState({}); const [mapsettings, setMapsettings] = useState({});
const [setttingsSave, setSetttingsSave] = useState({}); const [setttingsSave, setSetttingsSave] = useState({});
const [flag, setFlag] = useState(0); const [name, setName] = useState('');
const [Schemename, setSchemename] = useState('');
const [radio, setRadio] = useState();
const mapRef = useRef(); const mapRef = useRef();
const mapInfo = useRef(null); const mapInfo = useRef(null);
const [keep, setKeep] = useState('');
const [keepSave, setKeepSave] = useState('');
const [map, setMap] = useState(null);
useEffect(() => { useEffect(() => {
GetWebSiteConfig({ client: 'sandbox' }).then(res => { GetWebSiteConfig({ client: 'sandbox' }).then(res => {
console.log(res.data[0].mapsettings, 'res.data[0].mapsettings');
let setttings = {}; let setttings = {};
if (res.data.length === 0) {
if (res.data[0].mapsettings.layers.length === 0) { res.data.layers = [defaultMap];
res.data[0].mapsettings.layers = [defaultMap];
setttings = defaultMap; setttings = defaultMap;
} }
setSchemeList(res.data[0].mapsettings.layers); setSchemeList(res.data);
setMapsettings(res.data[0].mapsettings); setMapsettings(res.data);
setSetttingsSave(res.data[0].mapsettings); setSetttingsSave(res.data);
res.data[0].mapsettings.layers.forEach(item => { res.data.forEach(item => {
if (item.layerType === 'PipenetLayer') { if (item.layerType === 'PipenetLayer') {
setttings = item; setttings = item;
} }
...@@ -158,8 +176,16 @@ const Map = props => { ...@@ -158,8 +176,16 @@ const Map = props => {
boundWidth: parseInt(setttings.boundWidth), boundWidth: parseInt(setttings.boundWidth),
extent: setttings.extent, extent: setttings.extent,
schemename: setttings.schemename, schemename: setttings.schemename,
exportScheme: setttings.exportScheme || 'pandagis',
}); });
setRadio(setttings.exportScheme || 'pandagis');
if (setttings.id) {
setKeep(setttings);
setName(setttings.id);
setSchemename(setttings.schemename);
} else {
setName('');
}
setCanLoadMap(true); setCanLoadMap(true);
}, 0); }, 0);
}); });
...@@ -183,57 +209,101 @@ const Map = props => { ...@@ -183,57 +209,101 @@ const Map = props => {
}, []); }, []);
// 获取地图实例 // 获取地图实例
const getMapInfo = viewObject => { const getMapInfo = viewObject => {
setMap(viewObject);
const { layer } = getPipenetLayer(viewObject?.map);
if (layer) {
layer.visible = false;
}
watchUtils.watch(viewObject, ['zoom'], newzoom => {
// 鼠标滚动隐藏前端绘制的管网图
viewObject.map.layers.find(layer => {
if (layer.layerType == 'PipenetLayer') {
layer.visible = false;
}
});
});
if (radio == 'pandagis') {
// 用户自定义创建的管网图
viewObject.map.add(pandagis);
}
mapInfo.current = viewObject; mapInfo.current = viewObject;
}; };
// 选择颜色 // 选择颜色
const checkColor = color => { const checkColor = color => {
form.setFieldsValue({ backgroundColor: color }); form.setFieldsValue({ backgroundColor: color });
mapRef.current.updateAreaColor(color); mapRef.current.updateAreaColor(color);
setFlag(flag + 1);
}; };
// 表单修改后对地图进行配置 // 表单修改后对地图进行配置
const changeValue = changedFields => { const changeValue = changedFields => {
if (changedFields.length === 0) { if (changedFields.length === 0) {
return; return;
} }
console.log(changedFields, 'changedFields[0].name[0]');
let obj = JSON.parse(JSON.stringify(setttingsSave)); let obj = JSON.parse(JSON.stringify(setttingsSave));
const index = obj.layers.findIndex( const index = obj.findIndex(item => item.schemename === form.getFieldValue('schemename'));
item => item.schemename === form.getFieldValue('schemename'),
);
switch (changedFields[0].name[0]) { switch (changedFields[0].name[0]) {
case 'backgroundOpacity': case 'backgroundOpacity':
obj.layers[index].backgroundOpacity = changedFields[0].value / 100; obj[index].backgroundOpacity = changedFields[0].value / 100;
mapRef.current.changeBackgroundOpacity(obj.layers[index].backgroundOpacity); mapRef.current.changeBackgroundOpacity(obj[index].backgroundOpacity);
break; break;
case 'boundWidth': case 'boundWidth':
obj.layers[index].boundWidth = changedFields[0].value; obj[index].boundWidth = changedFields[0].value;
mapRef.current.changeBoundWidthValue(obj.layers[index].boundWidth); mapRef.current.changeBoundWidthValue(obj[index].boundWidth);
break; break;
case 'areaName': case 'areaName':
Drawtool.deactivate(false); Drawtool.deactivate(false);
obj.layers[index].areaName = changedFields[0].value[changedFields[0].value.length - 1]; obj[index].areaName = changedFields[0].value[changedFields[0].value.length - 1];
mapRef.current.changeAreaName(obj.layers[index].areaName); mapRef.current.changeAreaName(obj[index].areaName);
break; break;
case 'schemename': case 'schemename':
GetWebSiteConfig({ client: 'sandbox' }).then(res => {
setSchemeList(res.data);
setMapsettings(res.data);
setSetttingsSave(res.data);
});
Drawtool.deactivate(false); Drawtool.deactivate(false);
let setttings; let setttings;
obj.layers.forEach(item => { obj.forEach(item => {
if (item.schemename.schemename) {
item.schemename = item.schemename.schemename;
}
if (item.schemename === changedFields[0].value) { if (item.schemename === changedFields[0].value) {
item.layerType = 'PipenetLayer'; item.layerType = 'PipenetLayer';
setttings = item; setttings = item;
setSchemename(item.schemename);
setName(item.id);
setKeep(item);
} else { } else {
item.layerType = 'dynamic'; item.layerType = 'dynamic';
} }
}); });
form.setFieldsValue({ form.setFieldsValue({
areaName: [setttings.areaName], areaName: setttings.areaName,
backgroundColor: setttings.backgroundColor, backgroundColor: setttings.backgroundColor,
backgroundOpacity: setttings.backgroundOpacity * 100, backgroundOpacity: setttings.backgroundOpacity * 100,
boundColor: setttings.boundColor, boundColor: setttings.boundColor,
boundWidth: parseInt(setttings.boundWidth), boundWidth: parseInt(setttings.boundWidth),
extent: setttings.extent, extent: setttings.extent,
exportScheme: setttings.exportScheme || 'pandagis',
}); });
setRadio(setttings.exportScheme || 'pandagis');
mapRef.current.mapchange(obj);
// 清除原有接口返回后端绘制的管网图
const { layer } = getPipenetLayer(mapRef.current?.map);
if (layer) {
layer.visible = false;
}
// 若方案是后端绘制每次切换首先创建用户自定义的后端绘制管网
if (setttings.exportScheme != 'webgis') {
const pandagisaa = new MapImageLayer({
id: setttings.id,
url: `/PandaGIS/MapServer/${setttings.id}`,
layerType: 'PipenetLayertest',
title: setttings.id,
});
// 用户自定义创建的管网图
mapInfo.current.map.add(pandagisaa);
}
setMapsettings(obj); setMapsettings(obj);
break; break;
...@@ -273,14 +343,25 @@ const Map = props => { ...@@ -273,14 +343,25 @@ const Map = props => {
}); });
return; return;
} }
if (radio == 'webgis' && keepSave != 'success') {
message.error('请先保存管网前端绘制方案');
return;
}
const obj = form.getFieldsValue(); const obj = form.getFieldsValue();
let aa = '';
if (Array.isArray(obj.areaName)) {
aa = obj.areaName[obj.areaName.length - 1];
} else {
aa = obj.areaName;
}
const jsConfig = { const jsConfig = {
extent: form.getFieldValue('extent'), extent: form.getFieldValue('extent'),
areaName: obj.areaName[obj.areaName.length - 1], areaName: aa,
boundColor: '#86c8f8', boundColor: '#86c8f8',
boundWidth: `${obj.boundWidth}px`, boundWidth: `${obj.boundWidth}px`,
backgroundColor: obj.backgroundColor, backgroundColor: obj.backgroundColor,
backgroundOpacity: obj.backgroundOpacity / 100, backgroundOpacity: obj.backgroundOpacity / 100,
exportScheme: obj.exportScheme == '' ? 'pandagis' : obj.exportScheme,
}; };
SetServiceConfig({ SetServiceConfig({
schemename: obj.schemename, schemename: obj.schemename,
...@@ -288,24 +369,31 @@ const Map = props => { ...@@ -288,24 +369,31 @@ const Map = props => {
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify(jsConfig), jsonCfg: JSON.stringify(jsConfig),
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code == '0') {
SetServiceConfig({
schemename: obj.schemename,
terminalType: 'phone',
isBaseMap: false,
jsonCfg: JSON.stringify({ extent: form.getFieldValue('extent') }),
}).then();
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '保存成功', description: '保存成功',
}); });
let mapObj = JSON.parse(JSON.stringify(mapsettings)); let mapObj = JSON.parse(JSON.stringify(mapsettings));
const index = mapObj.layers.findIndex( const index = mapObj.findIndex(
item => item.schemename === form.getFieldValue('schemename'), item => item.schemename === form.getFieldValue('schemename'),
); );
mapObj.layers[index].backgroundOpacity = obj.backgroundOpacity / 100; mapObj[index].backgroundOpacity = obj.backgroundOpacity / 100;
mapObj.layers[index].boundWidth = `${obj.boundWidth}px`; mapObj[index].boundWidth = `${obj.boundWidth}px`;
mapObj.layers[index].areaName = obj.areaName[obj.areaName.length - 1]; mapObj[index].areaName = obj.areaName[obj.areaName.length - 1];
mapObj.layers[index].backgroundColor = obj.backgroundColor; mapObj[index].backgroundColor = obj.backgroundColor;
mapObj.layers[index].extent = form.getFieldValue('extent'); mapObj[index].extent = form.getFieldValue('extent');
console.log(mapObj); mapObj[index].exportScheme = obj.exportScheme;
setSetttingsSave(mapObj); setSetttingsSave(mapObj);
Drawtool.deactivate(false); Drawtool.deactivate(false);
setKeepSave('');
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -314,14 +402,34 @@ const Map = props => { ...@@ -314,14 +402,34 @@ const Map = props => {
}); });
} }
}); });
SetServiceConfig({
schemename: obj.schemename,
terminalType: 'phone',
isBaseMap: false,
jsonCfg: JSON.stringify({ extent: form.getFieldValue('extent') }),
}).then();
}; };
console.log(mapsettings);
const pandagis = new MapImageLayer({
id: keep.id,
url: `/PandaGIS/MapServer/${keep.id}`,
layerType: 'PipenetLayertest',
title: keep.id,
});
const onChange = e => {
if (e.target.value == 'webgis') {
// 选择前端绘制时,如果界面有自定义的管网图就隐藏
mapInfo.current.map.layers.forEach(item => {
if (item.layerType && item.layerType == 'PipenetLayertest') {
mapInfo.current.map.remove(item);
}
});
} else {
// 选择后端绘制时创建自定义的管网图
mapInfo.current.map.add(pandagis);
}
setRadio(e.target.value);
};
const onSave = e => {
setKeepSave(e);
};
return ( return (
<div> <div>
<div className={styles.mapContent}> <div className={styles.mapContent}>
...@@ -377,6 +485,16 @@ const Map = props => { ...@@ -377,6 +485,16 @@ const Map = props => {
<Form.Item label="边界宽度" name="boundWidth"> <Form.Item label="边界宽度" name="boundWidth">
<InputNumber min={1} max={10} /> <InputNumber min={1} max={10} />
</Form.Item> </Form.Item>
{name ? (
<Form.Item label="管网方案" name="exportScheme">
<Radio.Group onChange={onChange} value={radio}>
<Radio value="pandagis">后端绘制</Radio>
<Radio value="webgis">前端绘制</Radio>
</Radio.Group>
</Form.Item>
) : (
<></>
)}
<Form.Item label="复位范围"> <Form.Item label="复位范围">
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
...@@ -401,12 +519,28 @@ const Map = props => { ...@@ -401,12 +519,28 @@ const Map = props => {
</div> </div>
<div className={styles.mapBox}> <div className={styles.mapBox}>
{canLoadMap && ( {canLoadMap && (
<ArcGISMap // <ArcGISMap
// ref={mapRef}
// getMapInfo={e => getMapInfo(e)}
// config={mapsettings}
// widgets={widgets}
// />
<ArcGISSceneMap
ref={mapRef} ref={mapRef}
getMapInfo={e => getMapInfo(e)} getMapInfo={e => getMapInfo(e)}
config={mapsettings}
widgets={widgets} widgets={widgets}
client="sandbox"
/>
)}
{radio == 'webgis' ? (
<PipenetStylesCenter
schemeName={Schemename}
mapServerName={name}
view={map}
savaCallback={onSave}
/> />
) : (
<></>
)} )}
</div> </div>
</div> </div>
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
display: flex; display: flex;
width: 100%; width: 100%;
height: calc(100vh - 160px); height: calc(100vh - 160px);
.ant-radio-wrapper {
min-width: 100px;
}
.mapTool { .mapTool {
width: 400px; width: 400px;
.title { .title {
......
...@@ -125,7 +125,7 @@ const AddModal = props => { ...@@ -125,7 +125,7 @@ const AddModal = props => {
SetServiceConfig(arr) SetServiceConfig(arr)
.then(res => { .then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
onCancel(); onCancel();
setLoading(false); setLoading(false);
form.resetFields(); form.resetFields();
......
...@@ -63,7 +63,7 @@ const AddProjectModal = props => { ...@@ -63,7 +63,7 @@ const AddProjectModal = props => {
SetBaseMapschemeName(data) SetBaseMapschemeName(data)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '基础底图新增成功'); prompt('success', '基础底图新增成功');
...@@ -114,7 +114,7 @@ const AddProjectModal = props => { ...@@ -114,7 +114,7 @@ const AddProjectModal = props => {
SetBaseMapschemeName(data) SetBaseMapschemeName(data)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '分级底图新增成功'); prompt('success', '分级底图新增成功');
...@@ -178,7 +178,7 @@ const AddProjectModal = props => { ...@@ -178,7 +178,7 @@ const AddProjectModal = props => {
let pipeArr = [], let pipeArr = [],
baseMap = []; baseMap = [];
Promise.all([req1, req2]).then(res => { Promise.all([req1, req2]).then(res => {
if (res[0].msg === 'Ok') { if (res[0].code == '0') {
(res[0].data.general.baseMap.layers || []).map(item => { (res[0].data.general.baseMap.layers || []).map(item => {
baseMap.push(item.servicename); baseMap.push(item.servicename);
}); });
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-05-25 15:07:30 * @Date: 2022-05-25 15:07:30
* @LastEditTime: 2022-06-10 15:36:33 * @LastEditTime: 2022-08-16 17:27:15
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -73,7 +73,7 @@ const BaseMap = props => { ...@@ -73,7 +73,7 @@ const BaseMap = props => {
zoom: obj.zoom, zoom: obj.zoom,
}; };
SetBaseMapschemeName(data).then(res => { SetBaseMapschemeName(data).then(res => {
if (res.code === 0) { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '编辑成功'); prompt('success', '编辑成功');
......
...@@ -57,7 +57,7 @@ const EditModal = props => { ...@@ -57,7 +57,7 @@ const EditModal = props => {
SetServiceConfig(arr) SetServiceConfig(arr)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
......
...@@ -135,7 +135,7 @@ const NewEditModal = props => { ...@@ -135,7 +135,7 @@ const NewEditModal = props => {
SetServiceConfig(arr) SetServiceConfig(arr)
.then(res => { .then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
form.resetFields(); form.resetFields();
onCancel(); onCancel();
setLoading(false); setLoading(false);
......
...@@ -101,9 +101,10 @@ const TileData = props => { ...@@ -101,9 +101,10 @@ const TileData = props => {
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
console.log('res', res); console.log('res', res);
if (res.msg === 'Ok') { if (res.code == '0') {
setTreeLoading(false); setTreeLoading(false);
setCardData(res.data.baseMapscheme.optionalLayer.layers); console.log(res.data.optionalLayer.layers);
setCardData(res.data.optionalLayer.layers);
} else { } else {
setTreeLoading(false); setTreeLoading(false);
} }
...@@ -136,7 +137,7 @@ const TileData = props => { ...@@ -136,7 +137,7 @@ const TileData = props => {
.then(res => { .then(res => {
setFlag(flag + 1); setFlag(flag + 1);
setTreeLoading(false); setTreeLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
// form.resetFields(); // form.resetFields();
// callBackSubmit(); // callBackSubmit();
notification.success({ notification.success({
...@@ -188,7 +189,7 @@ const TileData = props => { ...@@ -188,7 +189,7 @@ const TileData = props => {
terminalType: 'base', terminalType: 'base',
isBaseMap: true, isBaseMap: true,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
setTreeLoading(false); setTreeLoading(false);
setTileData(res.data.general.baseMap.layers); setTileData(res.data.general.baseMap.layers);
let data = []; let data = [];
......
...@@ -34,7 +34,7 @@ const CardData = props => { ...@@ -34,7 +34,7 @@ const CardData = props => {
}, []); }, []);
const deletebaseMap = (item, baseMapItem) => { const deletebaseMap = (item, baseMapItem) => {
DeletMapServicename({ schemename: item.schemename, servicename: baseMapItem }).then(res => { DeletMapServicename({ schemename: item.schemename, servicename: baseMapItem }).then(res => {
if (res.code === 0) { if (res.code == '0') {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -57,7 +57,7 @@ const CardData = props => { ...@@ -57,7 +57,7 @@ const CardData = props => {
terminalType: 'baseMapscheme', terminalType: 'baseMapscheme',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -84,7 +84,7 @@ const CardData = props => { ...@@ -84,7 +84,7 @@ const CardData = props => {
setFormObj(value); setFormObj(value);
if (JSON.stringify(value) != '{}') { if (JSON.stringify(value) != '{}') {
GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => { GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
res.data.general.baseMap.layers.map(item => { res.data.general.baseMap.layers.map(item => {
console.log(value); console.log(value);
console.log(value.baseMap); console.log(value.baseMap);
...@@ -131,7 +131,7 @@ const CardData = props => { ...@@ -131,7 +131,7 @@ const CardData = props => {
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify(jsConfig), jsonCfg: JSON.stringify(jsConfig),
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
setMapScopeVisible(false); setMapScopeVisible(false);
message.info('范围设置成功'); message.info('范围设置成功');
} }
...@@ -146,7 +146,7 @@ const CardData = props => { ...@@ -146,7 +146,7 @@ const CardData = props => {
defaultBaseMap: index, defaultBaseMap: index,
}), }),
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
deletebaseMaps(); deletebaseMaps();
message.info('设置成功'); message.info('设置成功');
} else { } else {
......
...@@ -11,7 +11,15 @@ import { ...@@ -11,7 +11,15 @@ import {
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => {}, type, formObj, visible, serviceList, keepData } = props; const {
callBackSubmit = () => {},
type,
formObj,
visible,
serviceList,
keepData,
nameData,
} = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [baseMap, setBaseMap] = useState([]); const [baseMap, setBaseMap] = useState([]);
const [pipeArr, setPipeArr] = useState([]); const [pipeArr, setPipeArr] = useState([]);
...@@ -31,7 +39,7 @@ const AddModal = props => { ...@@ -31,7 +39,7 @@ const AddModal = props => {
basemapName: obj.serverName, basemapName: obj.serverName,
}).then(res => { }).then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '分级底图新增成功'); prompt('success', '分级底图新增成功');
...@@ -77,7 +85,7 @@ const AddModal = props => { ...@@ -77,7 +85,7 @@ const AddModal = props => {
SetServiceConfig(query) SetServiceConfig(query)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '方案新增成功'); prompt('success', '方案新增成功');
...@@ -130,7 +138,7 @@ const AddModal = props => { ...@@ -130,7 +138,7 @@ const AddModal = props => {
let pipeArr = [], let pipeArr = [],
baseMap = []; baseMap = [];
Promise.all([req1, req2]).then(res => { Promise.all([req1, req2]).then(res => {
if (res[0].code === 0) { if (res[0].code == '0') {
(res[0].data || []).map(item => { (res[0].data || []).map(item => {
baseMap.push(item); baseMap.push(item);
}); });
...@@ -140,6 +148,7 @@ const AddModal = props => { ...@@ -140,6 +148,7 @@ const AddModal = props => {
pipeArr.push(item.ServiceName.split('.')[0]); pipeArr.push(item.ServiceName.split('.')[0]);
}); });
} }
console.log(baseMap);
setPipeArr(pipeArr); setPipeArr(pipeArr);
setBaseMap(baseMap); setBaseMap(baseMap);
// form.setFieldsValue({ // form.setFieldsValue({
...@@ -164,7 +173,7 @@ const AddModal = props => { ...@@ -164,7 +173,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
label: value, label: value,
// url: `http://{IP}/PandaGIS/MapServer/Export?mapServerName=${value}`, // url: `http://{IP}/PandaGIS/MapServer/Export?mapServerName=${value}`,
url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}`, url: `http://{IP}/PandaGIS/MapServer/${value}`,
}); });
}; };
...@@ -221,11 +230,22 @@ const AddModal = props => { ...@@ -221,11 +230,22 @@ const AddModal = props => {
<Item <Item
label="方案名" label="方案名"
name="schemename" name="schemename"
rules={[{ required: true, message: '请输入方案名' }]} rules={[
{ required: true, message: '请输入方案名' },
{
validator: (rule, value) => {
let aa = form.getFieldValue().schemename;
if (nameData.indexOf(aa) != -1) {
return Promise.reject('方案名已存在');
}
return Promise.resolve();
},
},
]}
> >
<Input placeholder="请输入方案名" allowClear /> <Input placeholder="请输入方案名" allowClear />
</Item> </Item>
<Item label="管网" name="servicename"> <Item label="管网" name="servicename" placeholder="请选择管网">
<Select onChange={handleService}> <Select onChange={handleService}>
{pipeArr.length {pipeArr.length
? pipeArr.map((item, index) => { ? pipeArr.map((item, index) => {
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => {}, type, formObj, visible, serviceList } = props; const { callBackSubmit = () => {}, type, formObj, visible, serviceList, nameData } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [baseMap, setBaseMap] = useState([]); const [baseMap, setBaseMap] = useState([]);
const [pipeArr, setPipeArr] = useState([]); const [pipeArr, setPipeArr] = useState([]);
...@@ -28,7 +28,7 @@ const AddModal = props => { ...@@ -28,7 +28,7 @@ const AddModal = props => {
basemapName: obj.serverName, basemapName: obj.serverName,
}).then(res => { }).then(res => {
setLoading(false); setLoading(false);
if (res.code === 0) { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '基础底图新增成功'); prompt('success', '基础底图新增成功');
...@@ -74,7 +74,7 @@ const AddModal = props => { ...@@ -74,7 +74,7 @@ const AddModal = props => {
SetServiceConfig(query) SetServiceConfig(query)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
prompt('success', '方案新增成功'); prompt('success', '方案新增成功');
...@@ -115,7 +115,7 @@ const AddModal = props => { ...@@ -115,7 +115,7 @@ const AddModal = props => {
let pipeArr = [], let pipeArr = [],
baseMap = []; baseMap = [];
Promise.all([req1, req2]).then(res => { Promise.all([req1, req2]).then(res => {
if (res[0].msg === 'Ok') { if (res[0].code == '0') {
(res[0].data.general.baseMap.layers || []).map(item => { (res[0].data.general.baseMap.layers || []).map(item => {
baseMap.push(item.servicename); baseMap.push(item.servicename);
}); });
...@@ -149,7 +149,7 @@ const AddModal = props => { ...@@ -149,7 +149,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
label: value, label: value,
// url: `http://{IP}/PandaGIS/MapServer/Export?mapServerName=${value}`, // url: `http://{IP}/PandaGIS/MapServer/Export?mapServerName=${value}`,
url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}`, url: `http://{IP}/PandaGIS/MapServer/${value}`,
}); });
}; };
...@@ -192,7 +192,18 @@ const AddModal = props => { ...@@ -192,7 +192,18 @@ const AddModal = props => {
<Item <Item
label="方案名" label="方案名"
name="schemename" name="schemename"
rules={[{ required: true, message: '请输入方案名' }]} rules={[
{ required: true, message: '请输入方案名' },
{
validator: (rule, value) => {
let aa = form.getFieldValue().schemename;
if (nameData.indexOf(aa) != -1) {
return Promise.reject('方案名已存在');
}
return Promise.resolve();
},
},
]}
> >
<Input placeholder="请输入方案名" allowClear /> <Input placeholder="请输入方案名" allowClear />
</Item> </Item>
......
/* eslint-disable indent */
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification } from 'antd';
import {
GetVectorService,
bindSchemeBaseMap,
UpdateSchemPipeNetwork,
} from '@/services/webConfig/api';
const { Item } = Form;
const { Option } = Select;
const EditModal = props => {
const { callBackSubmit = () => {}, formObj, visible } = props;
const [loading, setLoading] = useState(false);
const [pipeArr, setPipeArr] = useState([]);
const [form] = Form.useForm();
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
UpdateSchemPipeNetwork({
schemename: formObj.schemename,
...obj,
}).then(res => {
setLoading(false);
if (res.code == '0') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '修改成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
}
});
};
useEffect(() => {
if (visible) {
pipeNetwork();
form.setFieldsValue({
servicename: formObj.servicename,
label: formObj.label,
url: formObj.url,
});
} else {
form.resetFields();
}
}, [visible]);
// 获取管网及默认底图
const pipeNetwork = () => {
form.resetFields();
let pipeArr1 = [];
GetVectorService().then(res => {
if (res.code === 0) {
if (res.data.VectorList.length > 0) {
res.data.VectorList.map(item => {
pipeArr1.push(item.ServiceName.split('.')[0]);
});
}
setPipeArr(pipeArr1);
}
});
};
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 18,
},
};
// 选择管网
const handleService = value => {
form.setFieldsValue({
label: value,
// url: `http://{IP}/PandaGIS/MapServer/Export?mapServerName=${value}`,
url: `http://{IP}/PandaGIS/MapServer/${value}`,
});
};
return (
<Modal
title="修改管网"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
{visible && (
<Form form={form} {...layout}>
<Item label="管网" name="servicename">
<Select onChange={handleService} placeholder="请选择管网">
{pipeArr.length
? pipeArr.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item label="标签" name="label">
<Input placeholder="请输入标签" allowClear />
</Item>
<Item label="url" name="url">
<Input placeholder="请输入url" allowClear />
</Item>
</Form>
)}
</Modal>
);
};
export default EditModal;
...@@ -10,14 +10,21 @@ import { ...@@ -10,14 +10,21 @@ import {
deleteConfig, deleteConfig,
GetbaseMapschemeName, GetbaseMapschemeName,
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import { CloseOutlined, PlusOutlined, GlobalOutlined, BlockOutlined } from '@ant-design/icons'; import {
CloseOutlined,
PlusOutlined,
GlobalOutlined,
BlockOutlined,
FormOutlined,
} from '@ant-design/icons';
import AddModal from '../AddModal'; import AddModal from '../AddModal';
import EditModal from '../EditModal';
import MapScope from '@/components/MapScope'; import MapScope from '@/components/MapScope';
import { createGuid } from '@/utils/transformUtil'; import { createGuid } from '@/utils/transformUtil';
import AddModalBase from '../AddModalBase'; import AddModalBase from '../AddModalBase';
import styles from '../../SchemeConfig.less'; import styles from '../../SchemeConfig.less';
const CardData = props => { const CardData = props => {
const { deletebaseMaps = () => {}, item, cardFlag, keepData } = props; const { deletebaseMaps = () => {}, item, cardFlag, keepData, nameData } = props;
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [basevisible, setBaseVisible] = useState(false); // 弹窗 const [basevisible, setBaseVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 状态更新 const [flag, setFlag] = useState(0); // 状态更新
...@@ -26,6 +33,7 @@ const CardData = props => { ...@@ -26,6 +33,7 @@ const CardData = props => {
const [serviceList, setServiceList] = useState([]); const [serviceList, setServiceList] = useState([]);
const [mapScopeVisible, setMapScopeVisible] = useState(false); const [mapScopeVisible, setMapScopeVisible] = useState(false);
const [cardData, setCardData] = useState([]); const [cardData, setCardData] = useState([]);
const [editVisible, setEditVisible] = useState(false);
// 删除瓦片 // 删除瓦片
useEffect(() => { useEffect(() => {
...@@ -42,7 +50,7 @@ const CardData = props => { ...@@ -42,7 +50,7 @@ const CardData = props => {
}, [cardFlag]); }, [cardFlag]);
const deletebaseMap = (item, baseMapItem) => { const deletebaseMap = (item, baseMapItem) => {
unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => { unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => {
if (res.code === 0) { if (res.code == '0') {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -65,7 +73,7 @@ const CardData = props => { ...@@ -65,7 +73,7 @@ const CardData = props => {
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -86,13 +94,14 @@ const CardData = props => { ...@@ -86,13 +94,14 @@ const CardData = props => {
deletebaseMaps(); deletebaseMaps();
setBaseVisible(false); setBaseVisible(false);
}; };
// 增加瓦片 // 增加瓦片
const addTile = value => { const addTile = value => {
let serverList = []; let serverList = [];
setFormObj(value); setFormObj(value);
if (JSON.stringify(value) != '{}') { if (JSON.stringify(value) != '{}') {
GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => { GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
res.data.general.baseMap.layers.map(item => { res.data.general.baseMap.layers.map(item => {
if (value.baseMap.indexOf(item.servicename) == -1) { if (value.baseMap.indexOf(item.servicename) == -1) {
serverList.push(item.servicename); serverList.push(item.servicename);
...@@ -135,7 +144,7 @@ const CardData = props => { ...@@ -135,7 +144,7 @@ const CardData = props => {
setFormObj(value); setFormObj(value);
if (JSON.stringify(value) != '{}') { if (JSON.stringify(value) != '{}') {
GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => { GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
res.data.general.baseMap.layers.map(item => { res.data.general.baseMap.layers.map(item => {
if (value.baseMap.indexOf(item.servicename) == -1) { if (value.baseMap.indexOf(item.servicename) == -1) {
serverList.push(item.servicename); serverList.push(item.servicename);
...@@ -156,6 +165,12 @@ const CardData = props => { ...@@ -156,6 +165,12 @@ const CardData = props => {
}); });
} }
}; };
const editTile = value => {
setFormObj(value);
setEditVisible(true);
};
const submitExtent = (extent, areaName, flag) => { const submitExtent = (extent, areaName, flag) => {
if (flag === 0) { if (flag === 0) {
notification.warn({ notification.warn({
...@@ -178,7 +193,7 @@ const CardData = props => { ...@@ -178,7 +193,7 @@ const CardData = props => {
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify(jsConfig), jsonCfg: JSON.stringify(jsConfig),
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
setMapScopeVisible(false); setMapScopeVisible(false);
message.info('范围设置成功'); message.info('范围设置成功');
} }
...@@ -196,7 +211,7 @@ const CardData = props => { ...@@ -196,7 +211,7 @@ const CardData = props => {
defaultBaseMap: i, defaultBaseMap: i,
}), }),
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
deletebaseMaps(); deletebaseMaps();
message.info('设置成功'); message.info('设置成功');
} else { } else {
...@@ -204,6 +219,12 @@ const CardData = props => { ...@@ -204,6 +219,12 @@ const CardData = props => {
} }
}); });
}; };
const onEditSubmit = () => {
setEditVisible(false);
deletebaseMaps();
};
return ( return (
<> <>
<Card <Card
...@@ -229,9 +250,18 @@ const CardData = props => { ...@@ -229,9 +250,18 @@ const CardData = props => {
} }
style={{ width: 360 }} style={{ width: 360 }}
> >
<p> <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '13px' }}>
<span className={styles.schemeName}>管网</span> {props.item.servicename} <div>
</p> <span className={styles.schemeName}>管网</span> {props.item.servicename}
</div>
<div>
<FormOutlined
style={{ marginRight: '10px', color: '#1890ff' }}
onClick={() => editTile(props.item)}
/>
</div>
</div>
{/* <div> {/* <div>
<span className={styles.schemeName}>范围</span> <span className={styles.schemeName}>范围</span>
<Button <Button
...@@ -307,6 +337,13 @@ const CardData = props => { ...@@ -307,6 +337,13 @@ const CardData = props => {
type={type} type={type}
serviceList={serviceList} serviceList={serviceList}
formObj={formObj} formObj={formObj}
nameData={nameData}
/>
<EditModal
visible={editVisible}
onCancel={() => setEditVisible(false)}
callBackSubmit={onEditSubmit}
formObj={formObj}
/> />
<AddModalBase <AddModalBase
visible={basevisible} visible={basevisible}
...@@ -315,6 +352,7 @@ const CardData = props => { ...@@ -315,6 +352,7 @@ const CardData = props => {
type={type} type={type}
serviceList={serviceList} serviceList={serviceList}
formObj={formObj} formObj={formObj}
nameData={nameData}
/> />
<MapScope <MapScope
mapId={createGuid()} mapId={createGuid()}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2022-01-13 10:47:32 * @Date: 2022-01-13 10:47:32
* @LastEditTime: 2022-06-22 11:56:59 * @LastEditTime: 2022-08-17 11:04:24
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
/* eslint-disable indent */ /* eslint-disable indent */
...@@ -15,6 +15,7 @@ import Cards from './components/card'; ...@@ -15,6 +15,7 @@ import Cards from './components/card';
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // 页面初始化数据 const [tileData, setTileData] = useState([]); // 页面初始化数据
const [nameData, setNameData] = useState([]);
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 状态更新 const [flag, setFlag] = useState(0); // 状态更新
const [cardFlag, setCardFlag] = useState(false); // 状态更新 const [cardFlag, setCardFlag] = useState(false); // 状态更新
...@@ -46,13 +47,10 @@ const VectorData = props => { ...@@ -46,13 +47,10 @@ const VectorData = props => {
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false, isBaseMap: false,
}).then(resdata => { }).then(resdata => {
console.log(123); if (resdata.code == '0') {
if (resdata.code == 0) {
console.log(333);
setTreeLoading(false); setTreeLoading(false);
GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => { GettMaplayer({ terminalType: 'base', isBaseMap: true }).then(res => {
if (res.code == 0) { if (res.code == '0') {
console.log(666);
let arr = []; let arr = [];
res.data.general.baseMap.layers.map(i => { res.data.general.baseMap.layers.map(i => {
console.log(i); console.log(i);
...@@ -60,7 +58,8 @@ const VectorData = props => { ...@@ -60,7 +58,8 @@ const VectorData = props => {
}); });
console.log(arr); console.log(arr);
setKeepData(arr); setKeepData(arr);
resdata.data.scheme.optionalLayer.layers.map((j, index) => { let list = [];
resdata.data.map((j, index) => {
let data = []; let data = [];
let aa = []; let aa = [];
j.baseMap.map(k => { j.baseMap.map(k => {
...@@ -70,13 +69,16 @@ const VectorData = props => { ...@@ -70,13 +69,16 @@ const VectorData = props => {
aa.push(k); aa.push(k);
} }
}); });
list.push(j.schemename);
let bb = aa.concat(data); let bb = aa.concat(data);
let i = bb.indexOf(j.baseMap[j.defaultBaseMap]); let i = bb.indexOf(j.baseMap[j.defaultBaseMap]);
resdata.data.scheme.optionalLayer.layers[index].defaultOldBaseMap = j.baseMap; resdata.data[index].defaultOldBaseMap = j.baseMap;
resdata.data.scheme.optionalLayer.layers[index].baseMap = bb; resdata.data[index].baseMap = bb;
resdata.data.scheme.optionalLayer.layers[index].defaultBaseMap = i; resdata.data[index].defaultBaseMap = i;
}); });
setTileData(resdata.data.scheme.optionalLayer.layers); console.log(list);
setNameData(list);
setTileData(resdata.data);
} }
}); });
} else { } else {
...@@ -119,6 +121,7 @@ const VectorData = props => { ...@@ -119,6 +121,7 @@ const VectorData = props => {
cardFlag={cardFlag} cardFlag={cardFlag}
deletebaseMaps={onDeletebaseMap} deletebaseMaps={onDeletebaseMap}
keepData={keepData} keepData={keepData}
nameData={nameData}
/> />
</div> </div>
); );
...@@ -134,6 +137,7 @@ const VectorData = props => { ...@@ -134,6 +137,7 @@ const VectorData = props => {
type={type} type={type}
formObj={formObj} formObj={formObj}
keepData={keepData} keepData={keepData}
nameData={nameData}
/> />
</div> </div>
</Spin> </Spin>
......
...@@ -25,7 +25,7 @@ const AddModal = props => { ...@@ -25,7 +25,7 @@ const AddModal = props => {
}) })
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
......
...@@ -167,7 +167,7 @@ const VectorData = props => { ...@@ -167,7 +167,7 @@ const VectorData = props => {
}; };
SetServiceConfig(query) SetServiceConfig(query)
.then(res => { .then(res => {
if (res.code == 0) { if (res.code == '0') {
prompt('success', '关联角色成功'); prompt('success', '关联角色成功');
setFlag(flag + 1); setFlag(flag + 1);
} else { } else {
...@@ -227,7 +227,7 @@ const VectorData = props => { ...@@ -227,7 +227,7 @@ const VectorData = props => {
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetDefaultsSchemeName(query).then(res => { SetDefaultsSchemeName(query).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code == 0) { if (res.code == '0') {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'dynamic'; changehandData[index].type = 'dynamic';
console.log(changehandData); console.log(changehandData);
...@@ -248,7 +248,7 @@ const VectorData = props => { ...@@ -248,7 +248,7 @@ const VectorData = props => {
uncheck: false, uncheck: false,
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code == 0) { if (res.code == '0') {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'pipenet'; changehandData[index].type = 'pipenet';
console.log(changehandData); console.log(changehandData);
...@@ -294,7 +294,7 @@ const VectorData = props => { ...@@ -294,7 +294,7 @@ const VectorData = props => {
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetDefaultsSchemeName(query).then(res => { SetDefaultsSchemeName(query).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code == 0) { if (res.code == '0') {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'dynamic'; changehandData[index].type = 'dynamic';
// setWebData(changehandData); // setWebData(changehandData);
...@@ -312,7 +312,7 @@ const VectorData = props => { ...@@ -312,7 +312,7 @@ const VectorData = props => {
uncheck: false, uncheck: false,
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code == 0) { if (res.code == '0') {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'pipenet'; changehandData[index].type = 'pipenet';
// setWebData(changehandData); // setWebData(changehandData);
...@@ -359,7 +359,7 @@ const VectorData = props => { ...@@ -359,7 +359,7 @@ const VectorData = props => {
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetDefaultsSchemeName(query).then(res => { SetDefaultsSchemeName(query).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code === 0) { if (res.code == '0') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = false; changehandData[index].isDefault = false;
setHandData(changehandData); setHandData(changehandData);
...@@ -377,7 +377,7 @@ const VectorData = props => { ...@@ -377,7 +377,7 @@ const VectorData = props => {
uncheck: false, uncheck: false,
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code === 0) { if (res.code == '0') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = true; changehandData[index].isDefault = true;
setHandData(changehandData); setHandData(changehandData);
...@@ -418,7 +418,7 @@ const VectorData = props => { ...@@ -418,7 +418,7 @@ const VectorData = props => {
if (!newLoadings[index]) { if (!newLoadings[index]) {
SetDefaultsSchemeName(query).then(res => { SetDefaultsSchemeName(query).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code === 0) { if (res.code == '0') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = false; changehandData[index].isDefault = false;
// setHandData(changehandData); // setHandData(changehandData);
...@@ -436,7 +436,7 @@ const VectorData = props => { ...@@ -436,7 +436,7 @@ const VectorData = props => {
uncheck: false, uncheck: false,
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.code === 0) { if (res.code == '0') {
const changehandData = [...handData]; const changehandData = [...handData];
changehandData[index].isDefault = true; changehandData[index].isDefault = true;
// setHandData(changehandData); // setHandData(changehandData);
...@@ -495,7 +495,7 @@ const VectorData = props => { ...@@ -495,7 +495,7 @@ const VectorData = props => {
terminalType: 'web', terminalType: 'web',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.code == '0') {
prompt('success', '删除成功'); prompt('success', '删除成功');
setFlag(flag + 1); setFlag(flag + 1);
} else { } else {
...@@ -512,7 +512,7 @@ const VectorData = props => { ...@@ -512,7 +512,7 @@ const VectorData = props => {
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.msg === 'Ok') { if (res.code == '0') {
prompt('success', '删除成功'); prompt('success', '删除成功');
setFlag(flag + 1); setFlag(flag + 1);
} else { } else {
...@@ -532,18 +532,19 @@ const VectorData = props => { ...@@ -532,18 +532,19 @@ const VectorData = props => {
terminalType: 'scheme', terminalType: 'scheme',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
if (res.data.scheme && res.data.scheme.optionalLayer.layers.length) { if (res.data && res.data.length > 0) {
setTreeLoading(false); setTreeLoading(false);
listData.map(item => { listData.map(item => {
webSchemenameArr.push(item.schemename); webSchemenameArr.push(item.schemename);
}); });
res.data.scheme.optionalLayer.layers.map(item => { res.data.map(item => {
if (!webSchemenameArr.includes(item.schemename)) schemeArr.push(item.schemename); if (!webSchemenameArr.includes(item.schemename)) schemeArr.push(item.schemename);
}); });
setSchemename(schemeArr); setSchemename(schemeArr);
if (schemeArr.length) { if (schemeArr.length) {
setVisible(true); setVisible(true);
} else { } else {
console.log(12);
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -551,6 +552,7 @@ const VectorData = props => { ...@@ -551,6 +552,7 @@ const VectorData = props => {
}); });
} }
} else { } else {
console.log(34);
setTreeLoading(false); setTreeLoading(false);
notification.warning({ notification.warning({
message: '提示', message: '提示',
...@@ -575,10 +577,9 @@ const VectorData = props => { ...@@ -575,10 +577,9 @@ const VectorData = props => {
}); });
Promise.all([schemeConfigQueryRequest]) Promise.all([schemeConfigQueryRequest])
.then(res => { .then(res => {
console.log('res', res); if (res[0].code == '0') {
if (res[0].msg === 'Ok' && res[0].data.phone) {
let arr = []; let arr = [];
res[0].data.phone.optionalLayer.layers.map((item, index) => { res[0].data.optionalLayer.layers.map((item, index) => {
if (item.isDefault) { if (item.isDefault) {
arr.push(true); arr.push(true);
} else { } else {
...@@ -587,13 +588,13 @@ const VectorData = props => { ...@@ -587,13 +588,13 @@ const VectorData = props => {
item.isStatus = 'phone'; item.isStatus = 'phone';
return item; return item;
}); });
setHandData(res[0].data.phone.optionalLayer.layers); setHandData(res[0].data.optionalLayer.layers);
if (arr.indexOf(true) == -1) { if (arr.indexOf(true) == -1) {
arr[arr.length - 1] = true; arr[arr.length - 1] = true;
setHandStatus(arr); setHandStatus(arr);
onChangeHand1( onChangeHand1(
'', '',
res[0].data.phone.optionalLayer.layers[arr.length - 1], res[0].data.optionalLayer.layers[arr.length - 1],
arr.length - 1, arr.length - 1,
arr, arr,
); );
...@@ -618,10 +619,9 @@ const VectorData = props => { ...@@ -618,10 +619,9 @@ const VectorData = props => {
}); });
Promise.all([webSchemeQueryRequest]) Promise.all([webSchemeQueryRequest])
.then(res => { .then(res => {
console.log('res', res); if (res[0].code == '0') {
if (res[0].msg === 'Ok' && res[0].data.web) {
let arr = []; let arr = [];
res[0].data.web.optionalLayer.layers.map((item, index) => { res[0].data.optionalLayer.layers.map((item, index) => {
if (item.type === 'pipenet') { if (item.type === 'pipenet') {
arr.push(true); arr.push(true);
} else { } else {
...@@ -630,14 +630,13 @@ const VectorData = props => { ...@@ -630,14 +630,13 @@ const VectorData = props => {
item.isStatus = 'web'; item.isStatus = 'web';
return item; return item;
}); });
console.log(res[0].data.web.optionalLayer.layers); setWebData(res[0].data.optionalLayer.layers);
setWebData(res[0].data.web.optionalLayer.layers);
if (arr.indexOf(true) == -1) { if (arr.indexOf(true) == -1) {
arr[arr.length - 1] = true; arr[arr.length - 1] = true;
setWebStatus(arr); setWebStatus(arr);
onChangeCheck1( onChangeCheck1(
'', '',
res[0].data.web.optionalLayer.layers[arr.length - 1], res[0].data.optionalLayer.layers[arr.length - 1],
arr.length - 1, arr.length - 1,
arr, arr,
); );
......
...@@ -7,4 +7,4 @@ export const GetMetaData = param => get(`${PANDA_GIS}/${param.mapServerName}`); ...@@ -7,4 +7,4 @@ 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(`${PUBLISH_SERVICE}/WebSite/GetWebSiteConfig`, param); export const GetWebSiteConfig = param => get(`${PANDA_GIS}/MapLayer/LayerSetting`, param);
...@@ -144,18 +144,17 @@ export const omsDeleteWebsite = client => ...@@ -144,18 +144,17 @@ export const omsDeleteWebsite = client =>
// 获取全部 // 获取全部
export const GetMaplayerByTerminalType = query => export const GetMaplayerByTerminalType = query =>
get(`${PUBLISH_SERVICE}/Maplayer/GetMaplayerByTerminalType`, query); get(`${PANDA_GIS}/Maplayer/GetMaplayerByTerminalType`, query);
// 获取全部 // 获取全部
export const GettMaplayer = query => get(`${PUBLISH_SERVICE}/Maplayer/GetMaplayer`, query); export const GettMaplayer = query => get(`${PANDA_GIS}/Maplayer/GetMaplayer`, query);
// 添加底图方案 // 添加底图方案
export const SetBaseMapschemeName = param => export const SetBaseMapschemeName = param =>
post(`${PUBLISH_SERVICE}/Maplayer/SetBaseMapschemeName`, param); post(`${PANDA_GIS}/Maplayer/SetBaseMapschemeName`, param);
// 设置底图数据 // 设置底图数据
export const SetServiceConfig = query => export const SetServiceConfig = query => post(`${PANDA_GIS}/Maplayer/SetServiceConfig`, query);
post(`${PUBLISH_SERVICE}/Maplayer/SetServiceConfig`, query);
// 获取方矢量数据列表 // 获取方矢量数据列表
export const GetVectorService = () => export const GetVectorService = () =>
...@@ -182,28 +181,26 @@ export const updatePublishedMetaData = query => ...@@ -182,28 +181,26 @@ export const updatePublishedMetaData = query =>
get(`${PANDA_GIS}/MetaData/D_UpdatePublishedMetaData`, query); get(`${PANDA_GIS}/MetaData/D_UpdatePublishedMetaData`, query);
// 删除配置 // 删除配置
export const deleteConfig = query => get(`${PUBLISH_SERVICE}/Maplayer/DeletMaplayer`, query); export const deleteConfig = query => get(`${PANDA_GIS}/MapLayer/DeleteMapLayer`, query);
// 增加瓦片 // 增加瓦片
export const bindSchemeBaseMap = query => export const bindSchemeBaseMap = query => get(`${PANDA_GIS}/Maplayer/BindSchemeBaseMap`, query);
get(`${PUBLISH_SERVICE}/Maplayer/BindSchemeBaseMap`, query);
// 删除瓦片 // 删除瓦片
export const unbindSchemeBaseMap = query => export const unbindSchemeBaseMap = query => get(`${PANDA_GIS}/Maplayer/UnBindSchemeBaseMap`, query);
get(`${PUBLISH_SERVICE}/Maplayer/UnBindSchemeBaseMap`, query);
// 删除底图分级显示方案 // 删除底图分级显示方案
export const DeletMapServicename = query => export const DeletMapServicename = query =>
get(`${PUBLISH_SERVICE}/Maplayer/DeletMapServicename`, query); get(`${PANDA_GIS}/MapLayer/DeleteMapServiceName`, query);
// 获取底图分级显示方案名 // 获取底图分级显示方案名
export const GetbaseMapschemeName = query => export const GetbaseMapschemeName = query =>
get(`${PUBLISH_SERVICE}/Maplayer/GetbaseMapschemeName`, query); get(`${PANDA_GIS}/Maplayer/GetbaseMapschemeName`, query);
// 设置web状态 // 设置web状态
export const setServiceType = query => get(`${PANDA_GIS}/MetaData/SetServiceType`, query); export const setServiceType = query => get(`${PANDA_GIS}/MetaData/SetServiceType`, query);
// 设置web的默认方案 // 设置web的默认方案
export const SetDefaultsSchemeName = param => export const SetDefaultsSchemeName = param =>
post(`${PUBLISH_SERVICE}/Maplayer/SetDefaultsSchemeName`, param); post(`${PANDA_GIS}/Maplayer/SetDefaultsSchemeName`, param);
// 获取角色 // 获取角色
export const getUserRelationList = query => export const getUserRelationList = query =>
get(`${CITY_SERVICE}/OMS.svc/WebGIS_GetUserRelationList`, query); get(`${CITY_SERVICE}/OMS.svc/WebGIS_GetUserRelationList`, query);
...@@ -308,3 +305,6 @@ export const GetCustomBaseMapByName = param => ...@@ -308,3 +305,6 @@ export const GetCustomBaseMapByName = param =>
export const DragSingleWebsite = param => export const DragSingleWebsite = param =>
get(`${CITY_SERVICE}/OMS.svc/Web4_DragSingleWebsite?_version=9999&_dc=1653360044919`, param); get(`${CITY_SERVICE}/OMS.svc/Web4_DragSingleWebsite?_version=9999&_dc=1653360044919`, param);
export const UpdateSchemPipeNetwork = param =>
get(`${PANDA_GIS}/MapLayer/UpdateSchemPipeNetwork`, 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