Compare commits
2 Commits
668fad014a
...
24768c14fc
| Author | SHA1 | Date |
|---|---|---|
|
|
24768c14fc | |
|
|
98c034fff1 |
File diff suppressed because it is too large
Load Diff
|
|
@ -74,8 +74,9 @@ export const eventCommonHandler = (
|
|||
// 地图事件联动
|
||||
for (let k = 0; k < elementList[j].elementId.length; k++) {
|
||||
if (componentList[i].id == elementList[j].elementId[k]) {
|
||||
if (params) {
|
||||
ceshiFunction[elementList[j].funName](params);
|
||||
console.log("elementList[j].funName",elementList[j])
|
||||
if (elementList[j].params) {
|
||||
ceshiFunction[elementList[j].funName](elementList[j].params);
|
||||
} else {
|
||||
ceshiFunction[elementList[j].funName]();
|
||||
}
|
||||
|
|
@ -88,6 +89,15 @@ export const eventCommonHandler = (
|
|||
EventBus.emit(elementList[j].elementId[k] + type, params);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (elementList[j].movement == 'graphic') {
|
||||
//
|
||||
for (let k = 0; k < elementList[j].elementId.length; k++) {
|
||||
if (componentList[i].id == elementList[j].elementId[k]) {
|
||||
EventBus.emit(elementList[j].elementId[k] + type, params);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (elementList[j].movement == 'style') {
|
||||
// 修改组件样式
|
||||
// for (let k = 0; k < elementList[j].elementId.length; k++) {}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ import { CaretDownOutlined, StarFilled, StarTwoTone,CheckOutlined,CaretRightOutl
|
|||
import * as mars3d from "mars3d";
|
||||
import { option } from '@/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions'
|
||||
|
||||
import { EventBus } from '@/utils/eventBus';
|
||||
|
||||
let map: mars3d.Map; // 地图对象
|
||||
|
||||
|
||||
|
|
@ -60,17 +62,14 @@ const props = defineProps({
|
|||
}
|
||||
})
|
||||
|
||||
console.log("props123",props.chartConfig.option);
|
||||
|
||||
const layers = ref(null)
|
||||
|
||||
const handlerLayers:any = ref([]);
|
||||
|
||||
|
||||
const handlerGetLayerTree = ()=>{
|
||||
axios.get('http://221.2.83.254:9006/applicationMars/getApplicationInfo/feixian').then((res)=>{
|
||||
layers.value = res.data.data
|
||||
console.log("res",layers.value);
|
||||
let configLayers = [];
|
||||
let GEOSERVER_BASE_API = "http://221.2.83.254:9007/";
|
||||
res.data.data.forEach((item, index) => {
|
||||
|
|
@ -86,6 +85,7 @@ const handlerGetLayerTree = ()=>{
|
|||
let layerGroup = group;
|
||||
layerGroup.children = [];
|
||||
configLayers.unshift(group);
|
||||
|
||||
if (item.children && item.children.length > 0) {
|
||||
item.children.forEach((it, idx) => {
|
||||
|
||||
|
|
@ -114,9 +114,9 @@ const handlerGetLayerTree = ()=>{
|
|||
}
|
||||
}
|
||||
attribute.zIndex = 10000000000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 如果是动态线类型
|
||||
if(attribute.dynamic){
|
||||
attribute.type = 'geojson';
|
||||
if(attribute.layers){
|
||||
|
|
@ -136,7 +136,6 @@ const handlerGetLayerTree = ()=>{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 设置标签文字偏移量
|
||||
if(attribute.symbol && attribute.symbol.styleOptions && attribute.symbol.styleOptions.label){
|
||||
|
|
@ -157,6 +156,7 @@ const handlerGetLayerTree = ()=>{
|
|||
|
||||
}
|
||||
|
||||
// 设置PID
|
||||
attribute.pid = group.id;
|
||||
|
||||
// 去掉所有图层点击选中样式
|
||||
|
|
@ -206,37 +206,45 @@ const handlerGetLayerTree = ()=>{
|
|||
}else{ //如果没有匹配到则直接拼接
|
||||
attribute.url = GEOSERVER_BASE_API+attribute.url
|
||||
}
|
||||
|
||||
// 根据图层类型设置数据过滤条件 过滤掉被删除的数据
|
||||
if(attribute.type == 'geojson'){
|
||||
attribute.url = attribute.url + "&cql_filter=is_del%20=0"
|
||||
}else if(attribute.type == 'wms'){
|
||||
attribute.parameters.cql_filter="is_del=0"
|
||||
attribute.zIndex = 1;
|
||||
|
||||
}
|
||||
|
||||
if(attribute.name == '防火驿站'){
|
||||
attribute.show = true;
|
||||
}
|
||||
|
||||
configLayers.unshift(attribute);
|
||||
|
||||
attribute.show = attribute.show ? true : false;
|
||||
|
||||
layerGroup.children.push(attribute)
|
||||
|
||||
layerGroup.children.push(attribute);
|
||||
});
|
||||
}
|
||||
|
||||
handlerLayers.value.push(layerGroup);
|
||||
});
|
||||
|
||||
console.log("configlayers",configLayers);
|
||||
// window.globalMap.setLayersOptions(configLayers);
|
||||
|
||||
console.log("configlayers",handlerLayers.value);
|
||||
window.globalMap.setLayersOptions(configLayers);
|
||||
})
|
||||
}
|
||||
|
||||
const matchHttpIpPort = (url) => { // 匹配“ http://ip:port ”
|
||||
const ipRegex = /^http\:\/\/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b\:\b[0-9]{1,5}\//;
|
||||
const match = url.match(ipRegex)
|
||||
if (match) {
|
||||
return match;
|
||||
}
|
||||
return null;
|
||||
const ipRegex = /^http\:\/\/\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b\:\b[0-9]{1,5}\//;
|
||||
const match = url.match(ipRegex)
|
||||
if (match) {
|
||||
return match;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const handlerChangeAllLayer = (group) =>{
|
||||
if(group.show == false){
|
||||
group.children?.forEach((item,index)=>{
|
||||
|
|
@ -248,12 +256,7 @@ const handlerChangeAllLayer = (group) =>{
|
|||
item.show = false;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
group.show = !group.show;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
const handlerChangeLayer = (options,group)=>{
|
||||
|
|
@ -316,6 +319,11 @@ const vChartRef = ref<HTMLElement>()
|
|||
|
||||
onMounted(()=>{
|
||||
handlerGetLayerTree();
|
||||
|
||||
EventBus.on(props.chartConfig.id + 'GraphicClick', (data) => {
|
||||
console.log('data', data);
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -333,6 +341,7 @@ const initMap = (newData: any) => {
|
|||
|
||||
window.globalMap = map;
|
||||
|
||||
|
||||
return null;
|
||||
// 初始化
|
||||
AMapLoader.load({
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { useChartDataFetch } from '@/hooks'
|
|||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { MarkerEnum, ThemeEnum } from './config'
|
||||
import { isArray } from '@/utils'
|
||||
|
||||
import { EventBus } from '@/utils/eventBus';
|
||||
|
||||
import * as mars3d from "mars3d";
|
||||
import { option } from '@/views/chart/ContentConfigurations/components/CanvasPage/components/CreateColorRenderChart/barOptions'
|
||||
|
|
@ -68,6 +68,28 @@ const initMap = (newData: any) => {
|
|||
|
||||
window.globalMap = map;
|
||||
|
||||
|
||||
// 所有绑定的点击事件
|
||||
let bindEvents = props.chartConfig.events.interactConfigEvents
|
||||
console.log("bindEvents",bindEvents);
|
||||
|
||||
// 图层点击事件
|
||||
window.globalMap.on(mars3d.EventType.click,(event)=>{
|
||||
|
||||
|
||||
// 查找绑定的点击事件的图层
|
||||
for(let i=0;i<bindEvents.length;i++){
|
||||
console.log("bindEvent",bindEvents[i])
|
||||
for(let j=0;j<bindEvents[i].movementList.length;j++){
|
||||
console.log("bindEvent",bindEvents[i].movementList[j])
|
||||
if(event.layer.id == bindEvents[i].movementList[j].params){
|
||||
EventBus.emit(bindEvents[i].movementList[j].elementId[0]+"GraphicClick", event.graphic.options.attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// 初始化矢量图层
|
||||
handlerInitEntityLayer();
|
||||
// 初始化测量工具
|
||||
|
|
@ -168,8 +190,6 @@ const stopWatch = watch(
|
|||
async option => {
|
||||
let options = JSON.parse(JSON.stringify(props.chartConfig.option.mapOptions))
|
||||
|
||||
console.log("props.chartConfig.option.mapOptions123",props.chartConfig.option.mapOptions);
|
||||
|
||||
await nextTick();
|
||||
|
||||
|
||||
|
|
@ -2194,6 +2214,7 @@ const handlerInitDrawLayer = () => {
|
|||
window.drawGraphicLayer = drawGraphicLayer;
|
||||
|
||||
window.globalMap.addLayer(drawGraphicLayer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,18 @@
|
|||
<n-divider vertical style="height: 450px" />
|
||||
|
||||
<div class="movement-type">
|
||||
<<<<<<< HEAD
|
||||
<div class="movement-type__element" v-if="panel.movement != 'newaddress'">
|
||||
关联组件(可多选)
|
||||
<n-select
|
||||
v-model:value="panel.elementId"
|
||||
placeholder="请选择"
|
||||
:options="elementSelectOptions"
|
||||
multiple
|
||||
/>
|
||||
</div>
|
||||
|
||||
=======
|
||||
<template v-if="panel.movement != 'newaddress'">
|
||||
<div class="movement-type__element" v-if="panel.movement == 'style'">
|
||||
关联组件
|
||||
|
|
@ -74,14 +86,28 @@
|
|||
/>
|
||||
</div>
|
||||
</template>
|
||||
>>>>>>> 668fad014ab73cf06fd9f474cd273b9b80799aa7
|
||||
<div class="movement-type__element" v-if="panel.movement == 'map'">
|
||||
组件交互方法
|
||||
<n-select
|
||||
v-model:value="panel.funName"
|
||||
placeholder="请选择"
|
||||
:options="funSelectOptions"
|
||||
@change="handlerMapFunChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="movement-type__element" v-if="panel.movement == 'map' && currentMapFunction?.group == 'layer' || panel.movement == 'graphic'" >
|
||||
选择图层对象
|
||||
<n-select
|
||||
v-model:value="panel.params"
|
||||
placeholder="请选择"
|
||||
value-field="id"
|
||||
label-field="name"
|
||||
:options="layerOptions"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template v-if="panel.movement == 'newaddress'">
|
||||
<div class="movement-type__element">
|
||||
跳转方式
|
||||
|
|
@ -155,7 +181,7 @@
|
|||
import { useTargetData } from '../../../../hooks/useTargetData.hook';
|
||||
import { getMenuList } from '@/api/sys/menu';
|
||||
import { projectListApi } from '@/api/path/project.api';
|
||||
import { funSelectOptions } from '@/hooks/ceshiFun.hook';
|
||||
import { funSelectOptions,layerOptions } from '@/hooks/ceshiFun.hook';
|
||||
import { getLoad } from '@/api/sys/sysDataItemDetail';
|
||||
|
||||
const EventComponent = loadAsyncComponent(() => import('./EventComponent.vue'));
|
||||
|
|
@ -338,6 +364,22 @@
|
|||
getPublishedPageList();
|
||||
getMsgTypeList();
|
||||
});
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
// 地图交互方法改变
|
||||
const currentMapFunction = ref(null);
|
||||
const handlerMapFunChange = (e) => {
|
||||
|
||||
|
||||
let selected = funSelectOptions.filter((item,index)=>{
|
||||
return item.value == e;
|
||||
})
|
||||
if(selected?.length>0){
|
||||
currentMapFunction.value = selected[0];
|
||||
}
|
||||
}
|
||||
=======
|
||||
const changeOption = (index, data) => {
|
||||
props.eventData.movementList[index].option = data;
|
||||
props.eventData.movementList[index].chartConfig = chartConfig.value[index];
|
||||
|
|
@ -360,6 +402,7 @@
|
|||
},
|
||||
{ deep: true },
|
||||
);
|
||||
>>>>>>> 668fad014ab73cf06fd9f474cd273b9b80799aa7
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.event-item {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ export const movementTypeOptions: EventOptionsItemType[] = [
|
|||
label: '地图联动',
|
||||
value: 'map',
|
||||
},
|
||||
{
|
||||
label: '空间数据操作',
|
||||
value: 'graphic',
|
||||
},
|
||||
{
|
||||
label: '组件通信',
|
||||
value: 'communication',
|
||||
|
|
|
|||
Loading…
Reference in New Issue