diff --git a/core/core-frontend/src/api/setting/sysParameter.ts b/core/core-frontend/src/api/setting/sysParameter.ts index 0e61578..63112f9 100644 --- a/core/core-frontend/src/api/setting/sysParameter.ts +++ b/core/core-frontend/src/api/setting/sysParameter.ts @@ -3,4 +3,6 @@ import request from '@/config/axios' export const queryMapKeyApi = () => request.get({ url: '/sysParameter/queryOnlineMap' }) export const queryMapKeyApiByType = (type: string) => request.get({ url: `/sysParameter/queryOnlineMap/${type}` }) +export const getMapServer = (id: string) => + request.get({ url: `/dataVisualization/getMapServer/${id}` }) export const saveMapKeyApi = data => request.post({ url: '/sysParameter/saveOnlineMap', data }) diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index 26ade8f..6b1a685 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -387,7 +387,7 @@ const boardMoveActive = computed(() => { 'heat-map', 't-heatmap', 'circle-packing', - 'three-map' + 'three-map', ] return element.value.isPlugin || CHARTS.includes(element.value.innerType) }) diff --git a/core/core-frontend/src/components/visualization/SettingMenu.vue b/core/core-frontend/src/components/visualization/SettingMenu.vue index 9138e07..f48a45c 100644 --- a/core/core-frontend/src/components/visualization/SettingMenu.vue +++ b/core/core-frontend/src/components/visualization/SettingMenu.vue @@ -177,7 +177,7 @@ const state = reactive({ 'flow-map', 'bidirectional-bar', 'symbolic-map', - 'three-map' + 'three-map', ], linkageExcludeViewType: [ 'richTextView', @@ -189,7 +189,7 @@ const state = reactive({ 'flow-map', 'bidirectional-bar', 'symbolic-map', - 'three-map' + 'three-map', ], copyData: null, hyperlinksSetVisible: false, diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 8f64bfe..6f2c6c6 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -1528,6 +1528,7 @@ export default { export_details: 'Export details', chart_data: 'Data', chart_style: 'Style', + chart_base:'base map', drag_block_type_axis: 'Category axis', drag_block_type_axis_left: 'Left subcategory', drag_block_type_axis_right: 'Right subcategory', @@ -1968,6 +1969,9 @@ export default { hide: 'Hide', show_label: 'Show label', security_code: 'Security key', + map_interface:'url', + layer_name:'Layer Name', + update_base:'Update base map', auto_fit: 'Adaptive zoom', zoom_level: 'Zoom level', central_point: 'Center point', @@ -2078,6 +2082,7 @@ export default { no_data_or_not_positive: 'No data available, or all data are not positive, unable to plot', map_type: 'Map Provider', map_type_gaode: 'Gaode Map', + map_type_customize:'Geoserver', map_type_tianditu: 'Tianditu', map_type_baidu: 'Baidu Map', map_type_tencent: 'Tencent Map', @@ -4609,6 +4614,7 @@ export default { answer: 'Answering', example: 'You can ask me: Pie chart of sales share of each sales department in 2020', switch_chart: 'Switch chart type', + switch_base:'Switch base map', switch_table: 'Switch to detailed table', download: 'Download' }, diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index ee26a80..ab2c015 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -1488,6 +1488,7 @@ export default { export_details: '導出明細', chart_data: '資料', chart_style: '樣式', + chart_base:'底圖', drag_block_type_axis: '類別軸', drag_block_type_axis_left: '左子類別', drag_block_type_axis_right: '右子類別', @@ -1861,6 +1862,7 @@ export default { enable_view_loading: '圖表載入提示', minute: '分', switch_chart: '切換圖表', + switch_base:'切換底圖', update_chart_data: '更新圖表資料', second: '秒', more_settings: '更多設定', @@ -1917,6 +1919,9 @@ export default { hide: '隱藏', show_label: '顯示標籤', security_code: '安全金鑰', + map_interface:'url', + layer_name:'圖層名稱', + update_base:'更新底圖', auto_fit: '自適應縮放', zoom_level: '縮放等級', central_point: '中心點', @@ -2019,6 +2024,7 @@ export default { no_data_or_not_positive: '暫無數據,或數據均不是正數,無法繪製', map_type: '地圖提供商', map_type_gaode: '高德地圖', + map_type_customize:'geoserver服務', map_type_tianditu: '天地圖', map_type_baidu: '百度地圖', map_type_tencent: '騰訊地圖', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 7ba761e..3e5ad41 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1493,6 +1493,7 @@ export default { export_details: '导出明細', chart_data: '数据', chart_style: '样式', + chart_base:'底图', drag_block_type_axis: '类别轴', drag_block_type_axis_left: '左子类别', drag_block_type_axis_right: '右子类别', @@ -1866,6 +1867,7 @@ export default { enable_view_loading: '图表加载提示', minute: '分', switch_chart: '切换图表', + switch_base:'切换底图', update_chart_data: '更新图表数据', second: '秒', more_settings: '更多设置', @@ -1922,6 +1924,9 @@ export default { hide: '隐藏', show_label: '显示标签', security_code: '安全密钥', + map_interface:'url', + layer_name:'图层名称', + update_base:'更新底图', auto_fit: '自适应缩放', zoom_level: '缩放等级', central_point: '中心点', @@ -2025,6 +2030,7 @@ export default { no_data_or_not_positive: '暂无数据,或数据均不是正数,无法绘制', map_type: '地图提供商', map_type_gaode: '高德地图', + map_type_customize:'geoserver服务', map_type_tianditu: '天地图', map_type_baidu: '百度地图', map_type_tencent: '腾讯地图', diff --git a/core/core-frontend/src/views/chart/components/editor/index.vue b/core/core-frontend/src/views/chart/components/editor/index.vue index bc08bb2..31ed3e5 100644 --- a/core/core-frontend/src/views/chart/components/editor/index.vue +++ b/core/core-frontend/src/views/chart/components/editor/index.vue @@ -130,7 +130,41 @@ const editCalcField = ref(false) const isCalcFieldAdd = ref(true) const calcEdit = ref() const route = useRoute() - +const mapList = ref([ + { + type: 'tianditu', + title: t('chart.map_type_tianditu'), + }, + { + type: 'gaode', + title: t('chart.map_type_gaode'), + }, + { + type: 'zidingyi', + title: t('chart.map_type_customize'), + }, +]) +const mapServer: any = ref([ + { + mapType: 'tianditu', + key: 'f55afadf5ef52c1c479d1776e135c4f3', + securityCode: '', + status: true, + }, + { + mapType: 'gaode', + key: '', + securityCode: '', + status: false, + }, + { + mapType: 'zidingyi', + url: '', + layers: '', + status: false, + }, +]) +const mapSelect: any = ref({}) const onComponentNameChange = () => { snapshotStore.recordSnapshotCache('onComponentNameChange') } @@ -330,6 +364,13 @@ const expandKeys = ref([]) watch( () => [view.value.type, view.value], newVal => { + if (curComponent.value && curComponent.value.mapServer) { + mapServer.value = JSON.parse(JSON.stringify(curComponent.value.mapServer)) + mapSelect.value = JSON.parse(JSON.stringify(mapServer.value.find(server => server.status === true))) ; + } else { + mapSelect.value =JSON.parse(JSON.stringify(mapServer.value.find(server => server.status === true))); + } + // debugger if (showAxis('area')) { if (!state.worldTree?.length) { getWorldTree().then(async res => { @@ -948,7 +989,54 @@ const updateChartData = view => { useEmitt().emitter.emit('checkShowEmpty', { allFields: allFields.value, view: view }) calcData(view, true, 'updateQuery') } - +const changestatus = () => { + + mapServer.value.forEach((item: any) => { + if (item.mapType == mapSelect.value.mapType) { + item.status = true + mapSelect.value=JSON.parse(JSON.stringify(item)) + } else { + item.status = false + } + }) + console.log(mapServer.value) + console.log(mapSelect.value) + // mapSelect.value = mapServer.value.find(server => server.status === true); +} +const updatamap = () => { + const updatedServers = [...mapServer.value]; + + // 1. 先将所有对象的 status 设为 false + updatedServers.forEach(server => { + server.status = false; + }); + + // 2. 找到匹配的索引并替换对象,同时设置 status 为 true + const index = updatedServers.findIndex(s => s.mapType === mapSelect.value.mapType); + if (index !== -1) { + updatedServers[index] = { + ...mapSelect.value, + status: true // 确保替换后的对象 status 为 true + }; + } + + // 3. 更新响应式数据 + mapServer.value = updatedServers; + console.log(mapServer.value) + curComponent.value['mapServer'] = mapServer.value + snapshotStore.recordSnapshotCacheToMobile('mapServer') + batchOptChange('mapServer') + calcData(view.value, true) +} +const batchOptChange = (custom: any, property, value, subProp?) => { + dvMainStore.setChangeProperties({ + custom: custom, + property: property, + value: value, + subProp: subProp + }) + snapshotStore.recordSnapshotCache('renderChart') +} const renderChart = view => { if (mobileInPc.value) { //移动端设计 @@ -1976,61 +2064,28 @@ const deleteChartFieldItem = id => {