This commit is contained in:
zh
2025-10-13 11:38:27 +08:00
parent 47e2bcfb59
commit 047cf2d4ef
5 changed files with 34 additions and 19 deletions

View File

@ -1,3 +1,4 @@
//@ts-nocheck
import router from '@renderer/router' import router from '@renderer/router'
import axios from 'axios' import axios from 'axios'
import type { import type {
@ -13,13 +14,14 @@ if (window && window.process && window.process.type === 'renderer') {
baseURL = localStorage.getItem('ip') || 'http://127.0.0.1:8848' baseURL = localStorage.getItem('ip') || 'http://127.0.0.1:8848'
// baseURL = 'http://127.0.0.1:8848' // baseURL = 'http://127.0.0.1:8848'
} else { } else {
localStorage.setItem('ip', 'http://192.168.110.25:8848')
baseURL = 'http://192.168.110.25:8848' baseURL = 'http://192.168.110.25:8848'
} }
// localStorage.setItem('service', baseURL) // localStorage.setItem('service', baseURL)
// 创建自定义配置的axios实例 // 创建自定义配置的axios实例
const service: AxiosInstance = axios.create({ const service: AxiosInstance = axios.create({
baseURL: baseURL, // baseURL: baseURL,
timeout: 300000, timeout: 300000,
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -35,6 +37,10 @@ function getRequestKey(config: AxiosRequestConfig): string {
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => { (config: InternalAxiosRequestConfig) => {
if (!config.url.startsWith("http://"))
config.url = new URL(config.url,
localStorage.getItem('ip')
).href;
const key = getRequestKey(config) const key = getRequestKey(config)
// 检查是否有相同请求正在进行 // 检查是否有相同请求正在进行

View File

@ -3,15 +3,12 @@
<div class="leftSideSecondBox"> <div class="leftSideSecondBox">
<template v-if="obj"> <template v-if="obj">
<div class="menuItem" v-for="value in obj.children" @click="handleClick(value)"> <div class="menuItem" v-for="value in obj.children" @click="handleClick(value)">
<img <img :src="'http://localhost:' + `${availablePort}` + '/icon/' + `${value}` + '.png'"
:src="'http://localhost:' + `${availablePort}` + '/icon/' + `${value}` + '.png'" style="color: rgb(255, 0, 0)" alt="" />
style="color: rgb(255, 0, 0)"
alt=""
/>
<!-- <svg-icon :name="value" :size="20" color="rgba(0, 255, 255, 1)"></svg-icon> --> <!-- <svg-icon :name="value" :size="20" color="rgba(0, 255, 255, 1)"></svg-icon> -->
<span :style="{ color: !clickChange[value] ? 'var(--color-text)' : 'rgb(255,0,0)' }">{{ <span :style="{ color: !clickChange[value] ? 'var(--color-text)' : 'rgb(255,0,0)' }">{{
t(`${obj.key}.${value}`) t(`${obj.key}.${value}`)
}}</span> }}</span>
</div> </div>
</template> </template>
</div> </div>
@ -34,6 +31,7 @@ import {
} from '@/utils/communication' } from '@/utils/communication'
import { ElMessage, ElLoading } from 'element-plus' import { ElMessage, ElLoading } from 'element-plus'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { renderVector } from '../tree/components/hooks/renderVector'
const { ipcRenderer } = require('electron') const { ipcRenderer } = require('electron')
const { t } = useI18n() const { t } = useI18n()
const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode() const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
@ -600,7 +598,7 @@ const methodMap = {
filters: [{ name: '保存图片', extensions: ['jpg'] }] filters: [{ name: '保存图片', extensions: ['jpg'] }]
}) })
$recvElectronChanel('selectedFileItem', (e, path) => { $recvElectronChanel('selectedFileItem', (e, path) => {
fs.writeFile(path, dataBuffer, (res) => {}) fs.writeFile(path, dataBuffer, (res) => { })
}) })
} }
@ -734,11 +732,11 @@ const methodMap = {
TreeApi.addOtherSource(paramsData) TreeApi.addOtherSource(paramsData)
paramsData.isShow = true paramsData.isShow = true
paramsData.params = JSON.stringify(paramsData.params) paramsData.params = JSON.stringify(paramsData.params)
;(window as any).pressModelMap.set(id + '_' + selectedNode.id, paramsData) ; (window as any).pressModelMap.set(id + '_' + selectedNode.id, paramsData)
;(window as any).pressModelEntities.set(id, flat) ; (window as any).pressModelEntities.set(id, flat)
cusAddNodes(window.treeObj, paramsData.parentId, [paramsData]) cusAddNodes(window.treeObj, paramsData.parentId, [paramsData])
// //鼠标右键点击事件 // //鼠标右键点击事件
flat.onRightClick = () => {} flat.onRightClick = () => { }
// _entityMap.set(node.source_id, flat) // _entityMap.set(node.source_id, flat)
} else { } else {
// this.$message.warning('至少三个点') // this.$message.warning('至少三个点')
@ -842,13 +840,20 @@ const methodMap = {
let selectedNode = window.treeObj.getSelectedNodes()[0] let selectedNode = window.treeObj.getSelectedNodes()[0]
let DbOption: any = { let DbOption: any = {
params: { params: {
richText: {} id: id,
path: path[0],
field: 'id',
name: name,
headTables: [],
opacity: 1,
color: 'rgba(0,255,184,0.5)',
show: true
}, },
id, id,
sourceName: name, sourceName: name,
sourceType: 'gdb', sourceType: 'vector',
// isShow: true, // isShow: true,
sourcePath: path[0], // sourcePath: path[0],
parentId: selectedNode parentId: selectedNode
? selectedNode.sourceType == 'directory' ? selectedNode.sourceType == 'directory'
? selectedNode.id ? selectedNode.id
@ -858,7 +863,9 @@ const methodMap = {
TreeApi.addOtherSource(DbOption) TreeApi.addOtherSource(DbOption)
DbOption.isShow = true DbOption.isShow = true
DbOption.params = JSON.stringify(DbOption.params) DbOption.params = JSON.stringify(DbOption.params)
// cusAddNodes(window.treeObj, DbOption.parentId, [DbOption]) cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
let entityObject = renderVector(DbOption, true);
(window as any)._entityMap.set(id, entityObject)
// } // }
// }) // })
} }

View File

@ -358,7 +358,8 @@ const renderModel = async (data, model) => {
z z
} }
} }
let Model = await new YJ.Obj.Model(window.earth, option) let Model = await new YJ.Obj.Model(window.earth, option);
(window as any)._entityMap.set(id, Model)
let DbOption: any = { let DbOption: any = {
params: option, params: option,

View File

@ -101,7 +101,8 @@ export const useRightOperate = () => {
params.isShow = true params.isShow = true
params.params = JSON.stringify(params.params) params.params = JSON.stringify(params.params)
cusAddNodes(window.treeObj, params.parentId, [params]) cusAddNodes(window.treeObj, params.parentId, [params])
renderVector(params, true) let entityObject = renderVector(params, true);
(window as any)._entityMap.set(id, entityObject)
} }
else if (["geojson"].includes(sourceType)) { else if (["geojson"].includes(sourceType)) {
let baseURL = localStorage.getItem('ip') let baseURL = localStorage.getItem('ip')

View File

@ -479,7 +479,7 @@ const getStatus = (time) => {
onMounted(async () => { onMounted(async () => {
let baseURL = localStorage.getItem('ip') let baseURL = localStorage.getItem('ip')
getAuthInfo() getAuthInfo()
await YJ.on({ host: baseURL }) await YJ.on({ host: baseURL, token: localStorage.getItem('Authorization') })
createEarth() createEarth()
}) })
</script> </script>