Commit 667c0333 authored by mayongxin's avatar mayongxin

方案添加范围设置

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