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

范围设置改变边界颜色交互优化

parent 45dc2769
Pipeline #59975 waiting for manual action with stages
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
Tooltip, Tooltip,
Radio, Radio,
message, message,
Popconfirm,
} from 'antd'; } from 'antd';
import { EnvironmentOutlined } from '@ant-design/icons'; import { EnvironmentOutlined } from '@ant-design/icons';
import classnames from 'classnames'; import classnames from 'classnames';
...@@ -152,7 +153,9 @@ const Map = props => { ...@@ -152,7 +153,9 @@ const Map = props => {
const [keepSave, setKeepSave] = useState(''); const [keepSave, setKeepSave] = useState('');
const [map, setMap] = useState(null); const [map, setMap] = useState(null);
const [color, setColor] = useState(''); const [color, setColor] = useState('');
const [borderColor, setBorderColor] = useState('');
const [colorList, setColorList] = useState(''); const [colorList, setColorList] = useState('');
const [keepColor, setKeepColor] = useState('');
useEffect(() => { useEffect(() => {
// GetSpriteSheet().then(res => { // GetSpriteSheet().then(res => {
...@@ -185,6 +188,7 @@ const Map = props => { ...@@ -185,6 +188,7 @@ const Map = props => {
exportScheme: setttings.exportScheme || 'pandagis', exportScheme: setttings.exportScheme || 'pandagis',
}); });
setColorList(setttings.boundColor || '#86C8F8'); setColorList(setttings.boundColor || '#86C8F8');
setKeepColor(setttings.boundColor || '#86C8F8');
setColor(setttings.backgroundColor || '#000000'); setColor(setttings.backgroundColor || '#000000');
setRadio(setttings.exportScheme || 'pandagis'); setRadio(setttings.exportScheme || 'pandagis');
if (setttings.id) { if (setttings.id) {
...@@ -295,10 +299,10 @@ const Map = props => { ...@@ -295,10 +299,10 @@ const Map = props => {
obj[index].boundWidth = changedFields[0].value; obj[index].boundWidth = changedFields[0].value;
mapRef.current.changeBoundWidthValue(obj[index].boundWidth); mapRef.current.changeBoundWidthValue(obj[index].boundWidth);
break; break;
case 'boundColor': // case 'boundColor':
obj[index].boundColor = changedFields[0].value.hex; // obj[index].boundColor = changedFields[0].value.hex;
mapRef.current.changeBoundColor(obj[index].boundColor); // mapRef.current.changeBoundColor(obj[index].boundColor);
break; // break;
case 'areaName': case 'areaName':
Drawtool.deactivate(false); Drawtool.deactivate(false);
obj[index].areaName = changedFields[0].value[changedFields[0].value.length - 1]; obj[index].areaName = changedFields[0].value[changedFields[0].value.length - 1];
...@@ -337,6 +341,7 @@ const Map = props => { ...@@ -337,6 +341,7 @@ const Map = props => {
exportScheme: setttings.exportScheme || 'pandagis', exportScheme: setttings.exportScheme || 'pandagis',
}); });
setColorList(setttings.boundColor || '#86C8F8'); setColorList(setttings.boundColor || '#86C8F8');
setKeepColor(setttings.boundColor || '#86C8F8');
setColor(setttings.backgroundColor || '#000000'); setColor(setttings.backgroundColor || '#000000');
setRadio(setttings.exportScheme || 'pandagis'); setRadio(setttings.exportScheme || 'pandagis');
mapRef.current.mapchange(obj); mapRef.current.mapchange(obj);
...@@ -472,18 +477,14 @@ const Map = props => { ...@@ -472,18 +477,14 @@ const Map = props => {
}); });
const onChange = e => { const onChange = e => {
console.log(e.target.value);
const { layer } = getPipenetLayer(mapInfo.current?.map); const { layer } = getPipenetLayer(mapInfo.current?.map);
console.log(layer);
if (layer) { if (layer) {
console.log(923423);
layer.visible = false; layer.visible = false;
} }
if (e.target.value == 'arcgis') { if (e.target.value == 'arcgis') {
// 选择前端绘制时,如果界面有自定义的管网图就隐藏,打开组件自动生成前端管网图 // 选择前端绘制时,如果界面有自定义的管网图就隐藏,打开组件自动生成前端管网图
mapInfo.current.map.layers.forEach(item => { mapInfo.current.map.layers.forEach(item => {
if (item.layerType && item.layerType == 'PipenetLayertest') { if (item.layerType && item.layerType == 'PipenetLayertest') {
console.log(123);
mapInfo.current.map.remove(item); mapInfo.current.map.remove(item);
} }
}); });
...@@ -500,6 +501,8 @@ const Map = props => { ...@@ -500,6 +501,8 @@ const Map = props => {
// 颜色选择 // 颜色选择
const colorChange = value => { const colorChange = value => {
form.setFieldsValue({ boundColor: value.hex });
mapRef.current.changeBoundColor(value.hex);
setColorList(value.hex); setColorList(value.hex);
}; };
...@@ -556,7 +559,35 @@ const Map = props => { ...@@ -556,7 +559,35 @@ const Map = props => {
<Slider min={0} max={100} /> <Slider min={0} max={100} />
</Form.Item> </Form.Item>
<Form.Item label="边界颜色" name="boundColor" style={{ marginBottom: '19px' }}> <Form.Item label="边界颜色" name="boundColor" style={{ marginBottom: '19px' }}>
<SketchPicker width="217px" color={colorList} onChange={e => colorChange(e)} /> <div
style={{
background: colorList,
display: 'inline-block',
width: '15px',
height: '15px',
border: '1px solid #ccc',
marginTop: '10px',
}}
/>
<Popconfirm
placement="topLeft"
icon={false}
title={
<SketchPicker width="217px" color={colorList} onChange={e => colorChange(e)} />
}
okText="确认"
cancelText="取消"
onConfirm={() => {
setKeepColor(colorList);
}}
onCancel={() => {
form.setFieldsValue({ boundColor: keepColor });
mapRef.current.changeBoundColor(keepColor);
setColorList(keepColor);
}}
>
<Button style={{ marginLeft: '15px' }}>更改边界颜色</Button>
</Popconfirm>
</Form.Item> </Form.Item>
<Form.Item label="边界宽度" name="boundWidth" style={{ marginBottom: '19px' }}> <Form.Item label="边界宽度" name="boundWidth" style={{ marginBottom: '19px' }}>
<InputNumber min={1} max={10} /> <InputNumber min={1} max={10} />
......
...@@ -51,16 +51,49 @@ const CardData = props => { ...@@ -51,16 +51,49 @@ const CardData = props => {
const deletebaseMap = (item, baseMapItem) => { const deletebaseMap = (item, baseMapItem) => {
console.log(item); console.log(item);
console.log(props.item.defaultOldBaseMap);
console.log(baseMapItem); console.log(baseMapItem);
let j = props.item.defaultOldBaseMap.indexOf(baseMapItem);
let i = props.item.defaultBaseMap;
console.log(j);
console.log(i);
if (item.baseMap.length > 1) { if (item.baseMap.length > 1) {
unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => { unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => {
if (res.code == '0') { if (res.code == '0') {
if (j == i) {
SetServiceConfig({
schemename: props.item.schemename,
terminalType: 'scheme',
isBaseMap: false,
jsonCfg: JSON.stringify({
defaultBaseMap: 0,
}),
}).then(resdata => {
if (resdata.code == '0') {
deletebaseMaps();
}
});
} else if (j < i) {
SetServiceConfig({
schemename: props.item.schemename,
terminalType: 'scheme',
isBaseMap: false,
jsonCfg: JSON.stringify({
defaultBaseMap: i - 1,
}),
}).then(resdata => {
if (resdata.code == '0') {
deletebaseMaps();
}
});
} else {
deletebaseMaps();
}
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '底图方案删除成功', description: '底图方案删除成功',
}); });
deletebaseMaps();
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -206,7 +239,9 @@ const CardData = props => { ...@@ -206,7 +239,9 @@ const CardData = props => {
} }
}); });
}; };
const pick = (schemename, baseMapItem) => { const pick = (schemename, baseMapItem) => {
console.log(schemename);
console.log(props.item.defaultOldBaseMap); console.log(props.item.defaultOldBaseMap);
let i = props.item.defaultOldBaseMap.indexOf(baseMapItem); let i = props.item.defaultOldBaseMap.indexOf(baseMapItem);
console.log(i); console.log(i);
...@@ -220,7 +255,7 @@ const CardData = props => { ...@@ -220,7 +255,7 @@ const CardData = props => {
}).then(res => { }).then(res => {
if (res.code == '0') { if (res.code == '0') {
deletebaseMaps(); deletebaseMaps();
message.info('设置成功'); message.success('设置成功');
} else { } else {
message.warning(res.msg); message.warning(res.msg);
} }
......
...@@ -59,6 +59,7 @@ const VectorData = props => { ...@@ -59,6 +59,7 @@ const VectorData = props => {
console.log(arr); console.log(arr);
setKeepData(arr); setKeepData(arr);
let list = []; let list = [];
console.log(resdata.data);
resdata.data.map((j, index) => { resdata.data.map((j, index) => {
let data = []; let data = [];
let aa = []; let aa = [];
...@@ -70,7 +71,10 @@ const VectorData = props => { ...@@ -70,7 +71,10 @@ const VectorData = props => {
} }
}); });
list.push(j.schemename); list.push(j.schemename);
console.log(aa);
console.log(data);
let bb = aa.concat(data); let bb = aa.concat(data);
console.log(bb);
let i = bb.indexOf(j.baseMap[j.defaultBaseMap]); let i = bb.indexOf(j.baseMap[j.defaultBaseMap]);
resdata.data[index].defaultOldBaseMap = j.baseMap; resdata.data[index].defaultOldBaseMap = j.baseMap;
resdata.data[index].baseMap = bb; resdata.data[index].baseMap = bb;
...@@ -78,6 +82,7 @@ const VectorData = props => { ...@@ -78,6 +82,7 @@ const VectorData = props => {
}); });
console.log(list); console.log(list);
setNameData(list); setNameData(list);
console.log(resdata.data);
setTileData(resdata.data); setTileData(resdata.data);
} }
}); });
...@@ -107,25 +112,23 @@ const VectorData = props => { ...@@ -107,25 +112,23 @@ const VectorData = props => {
<div className={styles.cardsList}> <div className={styles.cardsList}>
{/* {console.log(tileData)} */} {/* {console.log(tileData)} */}
{tileData && tileData.length ? ( {tileData && tileData.length ? (
tileData.map((item, index) => { tileData.map((item, index) => (
return ( <div
<div className={styles.cardItem}
className={styles.cardItem} key={index}
key={index} span={5}
span={5} offset={2}
offset={2} style={{ marginBottom: '1rem' }}
style={{ marginBottom: '1rem' }} >
> <Cards
<Cards item={item}
item={item} cardFlag={cardFlag}
cardFlag={cardFlag} deletebaseMaps={onDeletebaseMap}
deletebaseMaps={onDeletebaseMap} keepData={keepData}
keepData={keepData} nameData={nameData}
nameData={nameData} />
/> </div>
</div> ))
);
})
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: 'auto' }} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} style={{ margin: 'auto' }} />
)} )}
......
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