diff --git a/public/img/map/changeScene.svg b/public/img/map/changeScene.svg new file mode 100644 index 0000000..ce8f133 --- /dev/null +++ b/public/img/map/changeScene.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/map/dike_four.png b/public/img/map/dike_four.png new file mode 100644 index 0000000..82a2c33 Binary files /dev/null and b/public/img/map/dike_four.png differ diff --git a/public/img/map/dike_one.png b/public/img/map/dike_one.png new file mode 100644 index 0000000..b09c1bf Binary files /dev/null and b/public/img/map/dike_one.png differ diff --git a/public/img/map/dike_two_three.png b/public/img/map/dike_two_three.png new file mode 100644 index 0000000..e67ecb9 Binary files /dev/null and b/public/img/map/dike_two_three.png differ diff --git a/public/img/map/icon-folder.png b/public/img/map/icon-folder.png new file mode 100644 index 0000000..02622d7 Binary files /dev/null and b/public/img/map/icon-folder.png differ diff --git a/public/img/map/icon-layer.png b/public/img/map/icon-layer.png new file mode 100644 index 0000000..98de3e1 Binary files /dev/null and b/public/img/map/icon-layer.png differ diff --git a/public/img/map/layer.svg b/public/img/map/layer.svg new file mode 100644 index 0000000..a8a2351 --- /dev/null +++ b/public/img/map/layer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/map/reservoir_big.png b/public/img/map/reservoir_big.png new file mode 100644 index 0000000..7c4b908 Binary files /dev/null and b/public/img/map/reservoir_big.png differ diff --git a/public/img/map/reservoir_normal.png b/public/img/map/reservoir_normal.png new file mode 100644 index 0000000..a54f862 Binary files /dev/null and b/public/img/map/reservoir_normal.png differ diff --git a/public/img/map/reservoir_small.png b/public/img/map/reservoir_small.png new file mode 100644 index 0000000..66cd15d Binary files /dev/null and b/public/img/map/reservoir_small.png differ diff --git a/public/img/map/sluice_big.png b/public/img/map/sluice_big.png new file mode 100644 index 0000000..bda2876 Binary files /dev/null and b/public/img/map/sluice_big.png differ diff --git a/public/img/map/sluice_middle.png b/public/img/map/sluice_middle.png new file mode 100644 index 0000000..ca83f36 Binary files /dev/null and b/public/img/map/sluice_middle.png differ diff --git a/public/img/map/sluice_small.png b/public/img/map/sluice_small.png new file mode 100644 index 0000000..0f60459 Binary files /dev/null and b/public/img/map/sluice_small.png differ diff --git a/src/api/axios/axiosCancel.ts b/src/api/axios/axiosCancel.ts index 654993c..05180b3 100644 --- a/src/api/axios/axiosCancel.ts +++ b/src/api/axios/axiosCancel.ts @@ -21,6 +21,8 @@ export class AxiosCanceler { if (url.indexOf('cameras/previewURLs') > 0) return; // 忽略 重复请求获取预览取流地址 if (url.indexOf('preview/capture') > 0) return; // 忽略 重复请求获取预览取流地址 if (url.indexOf('/sy-engine-backer/cameraInfo/') > 0) return; // 忽略 重复请求获取预览取流地址 + if (url.indexOf('/run/statistic/chart') > 0) return; + // 上传接口忽略重复请求 if (!url.includes('oss')) { config.cancelToken = diff --git a/src/api/safety/index.ts b/src/api/safety/index.ts index 57485ed..77b0e48 100644 --- a/src/api/safety/index.ts +++ b/src/api/safety/index.ts @@ -1,4 +1,5 @@ // import axios from 'axios'; +import { he } from 'element-plus/es/locale'; import { request } from '../axios'; // 预警统计 @@ -85,3 +86,22 @@ export const getObjectStatistic = (params: any) => { params }); }; +function getCookie(name: string): string | null { + const value = `; ${document.cookie}`; + const parts = value.split(`; ${name}=`); + if (parts.length === 2) return parts.pop()?.split(';').shift() || null; + return null; +} +export function getlStatisticChart(data: any) { + // 获取cookie + const shuili = getCookie('Admin-Token'); + return request({ + url: `/run/statistic/chart`, + method: 'post', + data, + headers: { + // 'Admin-Token': shuili, + shuili: 'water ' + shuili + } + }); +} diff --git a/src/components.d.ts b/src/components.d.ts index d5d6e7e..c932a33 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -14,7 +14,6 @@ declare module 'vue' { ElOption: typeof import('element-plus/es')['ElOption'] ElPopover: typeof import('element-plus/es')['ElPopover'] ElSelect: typeof import('element-plus/es')['ElSelect'] - ElTag: typeof import('element-plus/es')['ElTag'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTree: typeof import('element-plus/es')['ElTree'] ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] diff --git a/src/hooks/web/useProject.tsx b/src/hooks/web/useProject.tsx index 85afcc3..22c92e5 100644 --- a/src/hooks/web/useProject.tsx +++ b/src/hooks/web/useProject.tsx @@ -1,7 +1,9 @@ import { reactive } from 'vue'; import * as SyCim from 'sy-cesium-sdk'; import { LayerTypeEnum } from '@/enums/projectEnum'; +import { queryLayersByPos } from "@/utils/mapUtils"; import axios from 'axios'; +import { throttle } from "lodash-es"; const clustering = reactive({ enabled: true, pixelRange: 200, @@ -105,7 +107,7 @@ const layerActions: Record = { export const getFeatures: any = (data: any, filter: '1=1') => { return new Promise(async (resolve, reject) => { - const { url } = data; + const { url, serviceToken } = data; let newUrl = decodeURI(url).split("maps/")[0].replace("map-", "data-"); const reg2 = /([^/]+)$/; const decodeUrl: any = decodeURI(url); @@ -113,16 +115,20 @@ export const getFeatures: any = (data: any, filter: '1=1') => { const l = newLayerName?.split("%40"); const datasourceName = `${l?.[1]}:${l?.[0]}`; let queryUrl = `${newUrl}data/featureResults.geojson?returnContent=true`; + let params: any = { + getFeatureMode: 'SQL', + datasetNames: [datasourceName], + maxFeatures: 100000000, + queryParameter: { + attributeFilter: filter + } + }; + if (serviceToken) { + params.k = serviceToken; + } const result = await axios.post( queryUrl, - JSON.stringify({ - getFeatureMode: 'SQL', - datasetNames: [datasourceName], - maxFeatures: 100000000, - queryParameter: { - attributeFilter: filter - } - }), + JSON.stringify(params), { headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' @@ -283,6 +289,7 @@ export function useLayer() { if (!layerType || !(action = layerActions[layerType as string])) return; let layer: any = await action(layerData); if (isNeedCluster === '1' && layerData.nameCn === "水库点") { + let baseUrl = import.meta.env.VITE_BASE_URL; const data = await getFeatures(layerData); if (data?.features?.[0]?.geometry?.type === 'Point') { let layerConfig = {}; @@ -298,7 +305,7 @@ export function useLayer() { { name: "4.0", attr: "image", value: "reservoir_small.png" }, { name: "5.0", attr: "image", value: "reservoir_small.png" }, ], - image: "reservoir_small.png", + image: "map-title-o.png", }; break; } @@ -306,7 +313,7 @@ export function useLayer() { data, symbol: { type: "billboardP", - imageProxy: "/src/assets/map/", // 图片代理 + imageProxy: `${baseUrl}/img/map/`, // 图片代理 style: { clampToGround: false, image: "reservoir_small.png", @@ -359,10 +366,21 @@ export function useLayer() { const { layerType } = data; zoomToLayerActions[layerType as string]?.(data); }; + const viewerClick = throttle((e) => { + console.log(e); + }, 500); + const addViewerMouseClick = () => { + window.viewer?.on(SyCim.MouseEventType.MOUSE_MOVE, viewerClick); + }; + const removeViewerMouseClick = () => { + window.viewer?.off(SyCim.MouseEventType.MOUSE_MOVE, viewerClick); + }; return { addLayer, removeLayer, - zoomToLayer + zoomToLayer, + addViewerMouseClick, + removeViewerMouseClick }; } diff --git a/src/store/modules/chart.ts b/src/store/modules/chart.ts new file mode 100644 index 0000000..e24493b --- /dev/null +++ b/src/store/modules/chart.ts @@ -0,0 +1,42 @@ +import { defineStore } from 'pinia'; +import { store } from '../index'; +import { getlStatisticChart } from '@/api/safety'; +export interface ChartState { + chartObject: any; +} + +export const useChartStore = defineStore('chart', { + state: (): ChartState => ({ + chartObject: { + endTime: '', + startTime: '', + adcd: '', + group: '' + } + }), + getters: { + getChartObject(): object { + return this.chartObject; + } + }, + actions: { + resetChart() { + this.chartObject = {}; + }, + async initStatisticChart(data: any) { + const pramas = { + ...this.chartObject, + ...data + }; + getlStatisticChart(pramas).then(res => { + if (res) return res + }).catch(() => { + return false + }).finally(() => {}) + } + } +}); + +export const useChartStoreWithOut = () => { + return useChartStore(store); +}; diff --git a/src/store/modules/project.ts b/src/store/modules/project.ts index 991d134..27171bb 100644 --- a/src/store/modules/project.ts +++ b/src/store/modules/project.ts @@ -71,6 +71,21 @@ function filterTreeData(data: any[]) { .filter(Boolean) ); } +function getLayerByName(data: any[], name: string) { + let layer = null; + const fn = (data: any[], name: string) => { + for (const item of data) { + if (item.nameCn === name) { + layer = item; + return; + } else if (item.children && item.children.length >= 0) { + fn(item.children, name); + } + } + }; + fn(data, name); + return layer; +} const { addLayer, removeLayer } = useLayer(); export const useProjectStore = defineStore("project", { @@ -185,6 +200,9 @@ export const useProjectStore = defineStore("project", { this.selectedLayers = _nodeTemp.filter((key) => !nodes.includes(key)); } }, + getLayerByName(name: string) { + return getLayerByName(this.layerData, name); + }, async fetchFirstScene() { const rData = await getFirstScene(); if (rData.code === 200) { diff --git a/src/views/BottomPanel/index.vue b/src/views/BottomPanel/index.vue index c88900e..bfa0e10 100644 --- a/src/views/BottomPanel/index.vue +++ b/src/views/BottomPanel/index.vue @@ -1,15 +1,48 @@