Commit 83c0f277 authored by 皮倩雯's avatar 皮倩雯

gis底图配置新增离线地图配置,限制方案删除最后一个底图

parent a3fbb117
Pipeline #59534 waiting for manual action with stages
......@@ -51,6 +51,7 @@ const AddModal = props => {
const [o, setO] = useState('');
const [r, setR] = useState('');
const [current, setCurrent] = useState(false);
const [type1, setType] = useState(0);
const [form] = Form.useForm();
const arr = [
'assets/images/thumbnail/thumbnail_1.jpg',
......@@ -66,7 +67,7 @@ const AddModal = props => {
setLoading(true);
let obj = form.getFieldsValue();
let arr = {};
console.log(obj.servicename);
console.log(obj.url);
// 连点
if (obj.servicename) {
if (mapType == 1) {
......@@ -75,9 +76,10 @@ const AddModal = props => {
terminalType: 'base',
isBaseMap: true,
jsonCfg: JSON.stringify({
alpha: alpha,
alpha,
label: obj.label,
url: obj.url,
taggingUrl: obj.taggingUrl,
icon: obj.icon,
type: obj.type,
extent: obj.range,
......@@ -114,9 +116,10 @@ const AddModal = props => {
terminalType: 'base',
isBaseMap: true,
jsonCfg: JSON.stringify({
alpha: alpha,
alpha,
label: obj.label,
url: url,
url: obj.url || url,
taggingUrl: obj.taggingUrl,
icon: obj.icon,
type: obj.type,
}),
......@@ -156,6 +159,7 @@ const AddModal = props => {
useEffect(() => {
setLoading(false);
setMapType(0);
setType(0);
setAdvanced(0);
setCurrent(false);
setPickItem('');
......@@ -215,9 +219,7 @@ const AddModal = props => {
let silderData = value == 100 ? 1 : value / 100;
setAlpha(silderData);
};
const tipFormatter = value => {
return `${value}%`;
};
const tipFormatter = value => `${value}%`;
const imgURL = [
{
......@@ -250,6 +252,11 @@ const AddModal = props => {
} else {
setMapType(0);
}
if (value == 'offline-map') {
setType(1);
} else {
setType(0);
}
};
// 添加地图类型
const servicenameToType = type => {
......@@ -347,12 +354,13 @@ const AddModal = props => {
return 'arcgis影像';
case 'arcgis-i-ia':
return 'arcgis影像注记';
case 'offline-map':
return '离线地图';
// case 'google-user':
// return;
// case 'pipenet-tile':
// return;
default:
return;
}
};
// 选择坐标系
......@@ -512,7 +520,7 @@ const AddModal = props => {
return (
<Modal
title="添加基础底图"
bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll', minHeight: '360px' }}
bodyStyle={{ width: '100%', maxHeight: '600px', overflow: 'scroll', minHeight: '300px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
......@@ -541,6 +549,7 @@ const AddModal = props => {
<Option value="mapbox-i-ia">mapbox影像(mapbox-i-ia)</Option>
<Option value="tianditu-arcgis-i">arcgis影像(tianditu-arcgis-i)</Option>
<Option value="arcgis-i-ia">arcgis影像注记(arcgis-i-ia)</Option>
<Option value="offline-map">离线地图(offline-map)</Option>
</Select>
</Item>
<Item
......@@ -568,7 +577,7 @@ const AddModal = props => {
{/* <Item label="URL" name="url">
<Input placeholder="请输入URL" allowClear />
</Item> */}
<Item label="透明度" name="alpha">
{/* <Item label="透明度" name="alpha">
<Slider
marks={marks}
min={0}
......@@ -579,39 +588,51 @@ const AddModal = props => {
// tooltipVisible
defaultValue={100}
/>
</Item>
</Item> */}
<Item
label="选择缩略图"
name="icon"
rules={[{ required: true, message: '请选择缩略图' }]}
>
<div style={{ display: 'flex', justifyContent: 'space-around' }}>
{imgURL.map((item, index) => {
return (
<div
className={classnames({
[styles.imgHidden]: index !== pickItem,
[styles.imgItem]: index === pickItem,
})}
key={index}
>
<img
width="100"
height="63"
src={item.url}
onClick={e => {
setPickItem(index);
form.setFieldsValue({ icon: arr[index] });
}}
/>
{/* <Radio.Group options={item} onChange={radioChange} value={radio}>
{imgURL.map((item, index) => (
<div
className={classnames({
[styles.imgHidden]: index !== pickItem,
[styles.imgItem]: index === pickItem,
})}
key={index}
>
<img
width="100"
height="63"
src={item.url}
onClick={e => {
setPickItem(index);
form.setFieldsValue({ icon: arr[index] });
}}
/>
{/* <Radio.Group options={item} onChange={radioChange} value={radio}>
<Radio value={arr[index]} />
</Radio.Group> */}
</div>
);
})}
</div>
))}
</div>
</Item>
{type1 === 1 && (
<>
<Item label="URL" name="url" rules={[{ required: true, message: '请输入url' }]}>
<Input placeholder="请输入url" allowClear />
</Item>
<Item
label="注记URL"
name="taggingUrl"
rules={[{ required: true, message: '请输入url' }]}
>
<Input placeholder="请输入url" allowClear />
</Item>
</>
)}
{/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
<Input placeholder="请输入URL" disabled />
</Item> */}
......@@ -646,13 +667,11 @@ const AddModal = props => {
>
<Select onChange={handleWorkSpance}>
{keyData
? keyData.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
? keyData.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))
: ''}
</Select>
</Item>
......@@ -663,13 +682,11 @@ const AddModal = props => {
>
<Select onChange={handleLayer}>
{data
? data.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
? data.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))
: ''}
</Select>
</Item>
......@@ -680,13 +697,11 @@ const AddModal = props => {
>
<Select onChange={handleCoordinate}>
{areaData
? areaData.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
? areaData.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))
: ''}
</Select>
</Item>
......
......@@ -49,6 +49,7 @@ const NewEditModal = props => {
const [areaData, setAreaData] = useState([]);
const [pickItem, setPickItem] = useState('');
const [current, setCurrent] = useState(false);
const [type1, setType] = useState(0);
const [form] = Form.useForm();
const arr = [
'assets/images/thumbnail/thumbnail_1.jpg',
......@@ -71,9 +72,10 @@ const NewEditModal = props => {
terminalType: 'base',
isBaseMap: true,
jsonCfg: JSON.stringify({
alpha: alpha,
alpha,
label: obj.label,
url: obj.url,
taggingUrl: obj.taggingUrl,
icon: obj.icon,
type: obj.type,
extent: obj.range,
......@@ -110,9 +112,10 @@ const NewEditModal = props => {
terminalType: 'base',
isBaseMap: true,
jsonCfg: JSON.stringify({
alpha: alpha,
alpha,
label: obj.label,
url: url,
url: obj.url || url,
taggingUrl: obj.taggingUrl,
icon: obj.icon,
type: obj.type,
extent: null,
......@@ -182,6 +185,11 @@ const NewEditModal = props => {
} else {
setMapType(0);
}
if (formObj.type == 'offline-map') {
setType(1);
} else {
setType(0);
}
if (formObj.m_User) {
setAdvanced(1);
setCurrent(true);
......@@ -246,9 +254,7 @@ const NewEditModal = props => {
let silderData = value == 100 ? 1 : value / 100;
setAlpha(silderData);
};
const tipFormatter = value => {
return `${value}%`;
};
const tipFormatter = value => `${value}%`;
const imgURL = [
{
......@@ -293,6 +299,11 @@ const NewEditModal = props => {
} else {
setMapType(0);
}
if (value == 'offline-map') {
setType(1);
} else {
setType(0);
}
};
// 添加地图类型
const servicenameToType = type => {
......@@ -316,7 +327,6 @@ const NewEditModal = props => {
// case 'pipenet-tile':
// return;
default:
return;
}
};
// 选择坐标系
......@@ -502,6 +512,7 @@ const NewEditModal = props => {
<Option value="mapbox-i-ia">mapbox影像(mapbox-i-ia)</Option>
<Option value="tianditu-arcgis-i">arcgis影像(tianditu-arcgis-i)</Option>
<Option value="arcgis-i-ia">arcgis影像注记(arcgis-i-ia)</Option>
<Option value="offline-map">离线地图(offline-map)</Option>
</Select>
</Item>
<Item
......@@ -521,7 +532,7 @@ const NewEditModal = props => {
{/* <Item label="URL" name="url">
<Input placeholder="请输入URL" allowClear />
</Item> */}
<Item label="透明度" name="alpha">
{/* <Item label="透明度" name="alpha">
{console.log(formObj.alpha)}
<Slider
marks={marks}
......@@ -532,39 +543,51 @@ const NewEditModal = props => {
// // tooltipVisible={true}
defaultValue={formObj.alpha * 100}
/>
</Item>
</Item> */}
<Item
label="选择缩略图"
name="icon"
rules={[{ required: true, message: '请选择缩略图' }]}
>
<div style={{ display: 'flex', justifyContent: 'space-around' }}>
{imgURL.map((item, index) => {
return (
<div
className={classnames({
[styles.imgHidden]: index !== pickItem,
[styles.imgItem]: index === pickItem,
})}
key={index}
>
<img
width="100"
height="63"
src={item.url}
onClick={e => {
setPickItem(index);
form.setFieldsValue({ icon: arr[index] });
}}
/>
{/* <Radio.Group options={item} onChange={radioChange} value={radio}>
{imgURL.map((item, index) => (
<div
className={classnames({
[styles.imgHidden]: index !== pickItem,
[styles.imgItem]: index === pickItem,
})}
key={index}
>
<img
width="100"
height="63"
src={item.url}
onClick={e => {
setPickItem(index);
form.setFieldsValue({ icon: arr[index] });
}}
/>
{/* <Radio.Group options={item} onChange={radioChange} value={radio}>
<Radio value={arr[index]} />
</Radio.Group> */}
</div>
);
})}
</div>
))}
</div>
</Item>
{type1 === 1 && (
<>
<Item label="URL" name="url" rules={[{ required: true, message: '请输入url' }]}>
<Input placeholder="请输入url" allowClear />
</Item>
<Item
label="注记URL"
name="taggingUrl"
rules={[{ required: true, message: '请输入url' }]}
>
<Input placeholder="请输入url" allowClear />
</Item>
</>
)}
{/* <Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
<Input placeholder="请输入URL" disabled />
</Item> */}
......@@ -599,13 +622,11 @@ const NewEditModal = props => {
>
<Select onChange={handleWorkSpance}>
{keyData
? keyData.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
? keyData.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))
: ''}
</Select>
</Item>
......@@ -616,13 +637,11 @@ const NewEditModal = props => {
>
<Select onChange={handleLayer}>
{data
? data.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
? data.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))
: ''}
</Select>
</Item>
......@@ -633,13 +652,11 @@ const NewEditModal = props => {
>
<Select onChange={handleCoordinate}>
{areaData
? areaData.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
? areaData.map((item, index) => (
<Option value={item} key={index}>
{item}
</Option>
))
: ''}
</Select>
</Item>
......
......@@ -48,23 +48,30 @@ const CardData = props => {
setCardData(keepData);
console.log(props.item);
}, [cardFlag]);
const deletebaseMap = (item, baseMapItem) => {
unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => {
if (res.code == '0') {
notification.success({
message: '提示',
duration: 3,
description: '底图方案删除成功',
});
deletebaseMaps();
} else {
notification.error({
message: '提示',
duration: 3,
description: '底图方案删除失败',
});
}
});
console.log(item);
console.log(baseMapItem);
if (item.baseMap.length > 1) {
unbindSchemeBaseMap({ schemename: item.schemename, basemapName: baseMapItem }).then(res => {
if (res.code == '0') {
notification.success({
message: '提示',
duration: 3,
description: '底图方案删除成功',
});
deletebaseMaps();
} else {
notification.error({
message: '提示',
duration: 3,
description: '底图方案删除失败',
});
}
});
} else {
message.error('方案至少需要一张底图');
}
};
// 删除方案
const deleteTile = item => {
......@@ -286,47 +293,45 @@ const CardData = props => {
</div>
<div style={{ overflowY: 'scroll', height: '11.4rem' }}>
{props.item.baseMap && props.item.baseMap.length
? props.item.baseMap.map((baseMapItem, baseindex) => {
return (
<div className={styles.mapItem} key={baseindex}>
<div
onClick={() => pick(props.item.schemename, baseMapItem)}
className={classnames({
[styles.defaultTile]: true,
[styles.activeTile]: baseindex == props.item.defaultBaseMap,
})}
? props.item.baseMap.map((baseMapItem, baseindex) => (
<div className={styles.mapItem} key={baseindex}>
<div
onClick={() => pick(props.item.schemename, baseMapItem)}
className={classnames({
[styles.defaultTile]: true,
[styles.activeTile]: baseindex == props.item.defaultBaseMap,
})}
>
默认
{cardData.indexOf(baseMapItem) == -1 ? (
<BlockOutlined style={{ marginTop: '5px' }} />
) : (
<GlobalOutlined style={{ marginTop: '5px' }} />
)}
</div>
<div className={styles.mapText}>
<Tooltip title={baseMapItem}>{baseMapItem}</Tooltip>
</div>
<div className={styles.mapIcon}>
<Popconfirm
title={
cardData.indexOf(baseMapItem) == -1 ? (
<span>是否删除该分级底图?</span>
) : (
<span>是否删除该底图?</span>
)
}
okText="确认"
cancelText="取消"
onConfirm={() => {
deletebaseMap(props.item, baseMapItem);
}}
>
默认
{cardData.indexOf(baseMapItem) == -1 ? (
<BlockOutlined style={{ marginTop: '5px' }} />
) : (
<GlobalOutlined style={{ marginTop: '5px' }} />
)}
</div>
<div className={styles.mapText}>
<Tooltip title={baseMapItem}>{baseMapItem}</Tooltip>
</div>
<div className={styles.mapIcon}>
<Popconfirm
title={
cardData.indexOf(baseMapItem) == -1 ? (
<span>是否删除该分级底图?</span>
) : (
<span>是否删除该底图?</span>
)
}
okText="确认"
cancelText="取消"
onConfirm={() => {
deletebaseMap(props.item, baseMapItem);
}}
>
<CloseOutlined />
</Popconfirm>{' '}
</div>
<CloseOutlined />
</Popconfirm>{' '}
</div>
);
})
</div>
))
: ''}
</div>
</Card>
......
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