Commit 667c0333 authored by mayongxin's avatar mayongxin

方案添加范围设置

parent 31e7efcc
Pipeline #26606 skipped with stages
......@@ -10,7 +10,7 @@ const MapScope = props => {
const [options, setOptions] = useState([])
//const [mouseTool,setMouseTool] = useState(null)
const { confirmModal, stationId, distinct, extent } = props
const { confirmModal, extent,mapId } = props
const [currentExtent, setCurrentExtent] = useState()
const [isDistrict, setIsDistrict] = useState(false)
const [currentAreaName, setCurrentAreaName] = useState(null)
......@@ -21,10 +21,10 @@ const MapScope = props => {
useEffect(() => {
if (document.getElementById("map-container")) {
if (document.getElementById(mapId)) {
if (!mapID.current) {
//1.加载底图
let m = new window.AMap.Map('map-container');
let m = new window.AMap.Map(mapId);
mapID.current = m
//2.加载管网配置
GetAllConfig().then(
......@@ -205,7 +205,7 @@ const MapScope = props => {
>
<div style={{ width: "750px", height: "500px" }}>
<div style={{ width: "750px", height: "500px", position: "absolute" }} >
<div id="map-container" style={{ width: "750px", height: "500px" }}></div>
<div id={mapId} style={{ width: "750px", height: "500px" }}></div>
<div style={{ top: "10px", left: "10px", position: "absolute" }}>
<Cascader
......
......@@ -268,10 +268,10 @@ const EditModal = props => {
>
<VisibleRoleModal
onSubmit={onPushSubmit}
title={"推送人员"}
initValues={["58","13"]}
/>
onSubmit={onPushSubmit}
title={"推送人员"}
/>
</Item>
<Item
label="定时计划"
......
import React, { useState, useEffect } from 'react';
import classnames from 'classnames'
import styles from '../../SchemeConfig.less'
import { Popconfirm, notification, Card, Button } from 'antd';
import { Popconfirm, notification, Card, Button, message } from 'antd';
import {
unbindSchemeBaseMap,GetAllConfig
unbindSchemeBaseMap, GetAllConfig,SetServiceConfig
} from '@/services/webConfig/api';
import {
CloseOutlined, PlusOutlined
} from '@ant-design/icons';
import AddModal from '../AddModal'
import MapScope from '@/components/MapScope'
import {createGuid} from '@/utils/transformUtil'
const CardData = props => {
const { deletebaseMaps = () => { } } = props;
const { deletebaseMaps = () => { },item } = props;
const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 状态更新
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({});
const [serviceList, setServiceList] = useState([]);
const [mapScopeVisible,setMapScopeVisible] = useState(false)
const [currentAreaName,setCurrentAreaName] = useState("")
//删除瓦片
const deletebaseMap = (item, baseMapItem) => {
unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => {
......@@ -78,21 +82,47 @@ const CardData = props => {
}
})
}
if(serverList.length){
if (serverList.length) {
setServiceList(serverList)
setType('add');
setVisible(true);
}
else{
else {
notification.warning({
message: '提示',
duration: 3,
description: '请先在基础配置-配置底图',
});
});
}
})
}
}
const submitExtent = (extent,areaName)=>{
const jsConfig = {
extent:extent,
areaName:areaName,
boundColor:"#86c8f8",
boundWidth:"10px",
backgroundColor:"#000000",
backgroundOpacity:"0.6"
}
SetServiceConfig(
{
schemename:item.schemename,
terminalType:"web",
isBaseMap:false,
jsconCfg:JSON.stringify(jsConfig)
}
).then(
res =>{
if(res.IsSuccess == true){
setMapScopeVisible(true)
message.info("范围设置成功")
}
}
)
}
return (
......@@ -134,6 +164,10 @@ const CardData = props => {
</div>
}) : ''}
</div>
<div>
<span className={styles.schemeName}>矢量</span>
<Button onClick={()=>setMapScopeVisible(true)}>选择范围</Button>
</div>
</Card>
<AddModal
visible={visible}
......@@ -143,6 +177,12 @@ const CardData = props => {
serviceList={serviceList}
formObj={formObj}
/>
<MapScope
mapId={createGuid()}
visible={mapScopeVisible}
onCancel={() => setMapScopeVisible(false)}
confirmModal={submitExtent}
/>
</>
)
}
......
......@@ -57,7 +57,7 @@ import EditUserModal from './EditUserModal';
import ChangePasswordModal from './ChangePasswordModal';
import MapScopeEditModal from '@/components/MapScope'
import styles from './UserManage.less';
import { useTheme } from 'bizcharts';
import {createGuid} from '@/utils/transformUtil'
const UserManage = () => {
const [treeLoading, setTreeLoading] = useState(false);
......@@ -1043,6 +1043,7 @@ const UserManage = () => {
</p>
</Modal>
<MapScopeEditModal
mapId={createGuid()}
visible={editOrgExtentVisible}
stationId={currentSelectOrg}
onCancel={() => setEditOrgExtentVisible(false)}
......
......@@ -7,3 +7,4 @@ export const GetMetaData = param =>
get(`${CITY_SERVICE}/MapServer.svc/${param}`);
......@@ -201,7 +201,14 @@ const positionByGaode = (callback) => {
});
});
}
// 生成随机
const createGuid = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
}).toUpperCase();
}
export {
......@@ -213,4 +220,5 @@ export {
lngLat2WebMercator,
plan2AMapbound,
gcj_decrypt,
createGuid
};
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