Compare commits
3 Commits
0dc0b98fdb
...
047cf2d4ef
| Author | SHA1 | Date | |
|---|---|---|---|
| 047cf2d4ef | |||
| 47e2bcfb59 | |||
| 52b753885d |
@ -43,10 +43,10 @@ export default defineConfig({
|
|||||||
})
|
})
|
||||||
]
|
]
|
||||||
// server: {
|
// server: {
|
||||||
// port: 8808,
|
// port: 8848,
|
||||||
// proxy: {
|
// proxy: {
|
||||||
// '/api': {
|
// '/api': {
|
||||||
// target: localStorage.getItem('ip') || 'http://127.0.0.1:8808',
|
// target: localStorage.getItem('ip') || 'http://127.0.0.1:8848',
|
||||||
// changeOrigin: true,
|
// changeOrigin: true,
|
||||||
// rewrite: (path) => path.replace(/^\/api/, '')
|
// rewrite: (path) => path.replace(/^\/api/, '')
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -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 {
|
||||||
@ -10,16 +11,17 @@ import type {
|
|||||||
const pendingRequests = new Map<string, AbortController>()
|
const pendingRequests = new Map<string, AbortController>()
|
||||||
let baseURL: any
|
let baseURL: any
|
||||||
if (window && window.process && window.process.type === 'renderer') {
|
if (window && window.process && window.process.type === 'renderer') {
|
||||||
// baseURL = localStorage.getItem('ip') ||'http://192.168.110.25:8848'|| 'http://127.0.0.1:8808'
|
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)
|
||||||
|
|
||||||
// 检查是否有相同请求正在进行
|
// 检查是否有相同请求正在进行
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { renderVector } from '../views/components/tree/components/hooks/renderVe
|
|||||||
export const initMapData = async (type, data, cd) => {
|
export const initMapData = async (type, data, cd) => {
|
||||||
let entityObject
|
let entityObject
|
||||||
let options
|
let options
|
||||||
let baseURL = localStorage.getItem('service')
|
let baseURL = localStorage.getItem('ip')
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'groundText':
|
case 'groundText':
|
||||||
entityObject = new YJ.Obj.GroundText(window.earth, data)
|
entityObject = new YJ.Obj.GroundText(window.earth, data)
|
||||||
|
|||||||
1
src/renderer/src/global.d.ts
vendored
1
src/renderer/src/global.d.ts
vendored
@ -6,7 +6,6 @@ interface Window {
|
|||||||
sendMessage: (msg: string) => void
|
sendMessage: (msg: string) => void
|
||||||
onReply: (callback: (msg: string) => void) => void
|
onReply: (callback: (msg: string) => void) => void
|
||||||
}
|
}
|
||||||
isStandAlone: any
|
|
||||||
treeObj: any
|
treeObj: any
|
||||||
AllNodes: any
|
AllNodes: any
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ const fs = require('fs')
|
|||||||
const eventBus: any = inject('bus')
|
const eventBus: any = inject('bus')
|
||||||
var clickTreeNode: any = reactive({})
|
var clickTreeNode: any = reactive({})
|
||||||
var leftClickTreeNode: any = reactive({})
|
var leftClickTreeNode: any = reactive({})
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
|
|
||||||
interface TypeNode {
|
interface TypeNode {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@ -159,7 +159,7 @@ const fs = require('fs')
|
|||||||
const eventBus: any = inject('bus')
|
const eventBus: any = inject('bus')
|
||||||
var clickTreeNode: any = reactive({})
|
var clickTreeNode: any = reactive({})
|
||||||
var leftClickTreeNode: any = reactive({})
|
var leftClickTreeNode: any = reactive({})
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
|
|
||||||
interface TypeNode {
|
interface TypeNode {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@ -193,7 +193,7 @@ const fs = require('fs')
|
|||||||
const eventBus: any = inject('bus')
|
const eventBus: any = inject('bus')
|
||||||
const imageRef: any = ref('')
|
const imageRef: any = ref('')
|
||||||
var clickTreeNode: any = reactive({})
|
var clickTreeNode: any = reactive({})
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
|
|
||||||
interface TypeNode {
|
interface TypeNode {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@ -3,11 +3,8 @@
|
|||||||
<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}`)
|
||||||
@ -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)
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,7 +121,7 @@ const isShowPup = ref(false)
|
|||||||
const eventBus: any = inject('bus')
|
const eventBus: any = inject('bus')
|
||||||
const { cusUpdateNode } = useTreeNode()
|
const { cusUpdateNode } = useTreeNode()
|
||||||
var modelName = ref('')
|
var modelName = ref('')
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
|
|
||||||
//tab
|
//tab
|
||||||
interface Model {
|
interface Model {
|
||||||
|
|||||||
@ -45,7 +45,7 @@ const eventBus: any = inject('bus')
|
|||||||
const viewPointHeight: any = ref(1.8)
|
const viewPointHeight: any = ref(1.8)
|
||||||
var rowData: any = reactive([])
|
var rowData: any = reactive([])
|
||||||
var imageData: any = ref(null)
|
var imageData: any = ref(null)
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
// var newData: any = reactive({
|
// var newData: any = reactive({
|
||||||
// name: ''
|
// name: ''
|
||||||
// })
|
// })
|
||||||
|
|||||||
@ -122,7 +122,7 @@ const eventBus: any = inject('bus')
|
|||||||
var modelName = ref('')
|
var modelName = ref('')
|
||||||
var clickTreeNode: any = ref('')
|
var clickTreeNode: any = ref('')
|
||||||
|
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
|
|
||||||
//tab
|
//tab
|
||||||
interface Model {
|
interface Model {
|
||||||
@ -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,
|
||||||
|
|||||||
@ -173,7 +173,7 @@ const { cusUpdateNode } = useTreeNode()
|
|||||||
var modelName = ref('')
|
var modelName = ref('')
|
||||||
|
|
||||||
const availablePort = ref(55110)
|
const availablePort = ref(55110)
|
||||||
const service = ref(localStorage.getItem('service'))
|
const service = ref(localStorage.getItem('ip'))
|
||||||
|
|
||||||
ipcRenderer.invoke('get-available-port').then((port) => {
|
ipcRenderer.invoke('get-available-port').then((port) => {
|
||||||
availablePort.value = port
|
availablePort.value = port
|
||||||
|
|||||||
@ -168,7 +168,7 @@ const init = (obj, selected, hasGEMarker = true, isUrl) => {
|
|||||||
activeName.value = arr[0];
|
activeName.value = arr[0];
|
||||||
}
|
}
|
||||||
hasGEMarker1.value = hasGEMarker;
|
hasGEMarker1.value = hasGEMarker;
|
||||||
url.value = localStorage.getItem('service')
|
url.value = localStorage.getItem('ip')
|
||||||
|
|
||||||
for (const objKey in obj) {
|
for (const objKey in obj) {
|
||||||
let imgList: any = [];
|
let imgList: any = [];
|
||||||
|
|||||||
@ -101,10 +101,11 @@ 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('service')
|
let baseURL = localStorage.getItem('ip')
|
||||||
await addMapSource({
|
await addMapSource({
|
||||||
type: 'geojson',
|
type: 'geojson',
|
||||||
id: id,
|
id: id,
|
||||||
|
|||||||
@ -178,7 +178,7 @@ async function tankuang(id, node, info) {
|
|||||||
let availablePort = await ipcRenderer.invoke('get-available-port');
|
let availablePort = await ipcRenderer.invoke('get-available-port');
|
||||||
window.treeObj.selectNode(node);
|
window.treeObj.selectNode(node);
|
||||||
console.log('BrowserWindow---------------------', electron.BrowserWindow)
|
console.log('BrowserWindow---------------------', electron.BrowserWindow)
|
||||||
let baseURL = localStorage.getItem('service')
|
let baseURL = localStorage.getItem('ip')
|
||||||
// console.log("node.detail.namenode.detail.namenode.detail.name", node.detail);
|
// console.log("node.detail.namenode.detail.namenode.detail.name", node.detail);
|
||||||
let _winMap = await ipcRenderer.invoke('get-_winMap')
|
let _winMap = await ipcRenderer.invoke('get-_winMap')
|
||||||
if (!_winMap.has(id)) {
|
if (!_winMap.has(id)) {
|
||||||
|
|||||||
@ -477,9 +477,9 @@ const getStatus = (time) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let baseURL = localStorage.getItem('service')
|
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>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { validateURL } from '@/utils/validate'
|
import { validateURL } from '@/utils/validate'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { setIP } from '@/utils/index'
|
import { setIP,getIP } from '@/utils/index'
|
||||||
export const useSetUp = () => {
|
export const useSetUp = () => {
|
||||||
const serviceDialog = ref(false) // 服务设置对话框
|
const serviceDialog = ref(false) // 服务设置对话框
|
||||||
const servVal = ref('单机') // 服务类型选择值
|
const servVal = ref('单机') // 服务类型选择值
|
||||||
@ -8,13 +8,32 @@ export const useSetUp = () => {
|
|||||||
const ip = ref('192.168.1.1')
|
const ip = ref('192.168.1.1')
|
||||||
const port = ref('8890')
|
const port = ref('8890')
|
||||||
const localip = ref('127.0.0.1')
|
const localip = ref('127.0.0.1')
|
||||||
const localport = ref('8808')
|
const localport = ref('8848')
|
||||||
const gpsVal = ref('') // 服务类型选择值
|
const gpsVal = ref('') // 服务类型选择值
|
||||||
const gpsOptions: any = ref([])
|
const gpsOptions: any = ref([])
|
||||||
const servOptions: any = ref([{ name: '单机' }, { name: '网络' }])
|
const servOptions: any = ref([{ name: '单机' }, { name: '网络' }])
|
||||||
const selectedService = ref('接口服务')
|
const selectedService = ref('接口服务')
|
||||||
const serviceOptions: any = ref([{ name: '接口服务' }, { name: '北斗串口' }])
|
const serviceOptions: any = ref([{ name: '接口服务' }, { name: '北斗串口' }])
|
||||||
|
|
||||||
|
let serveUrl:any = getIP()
|
||||||
|
let isOk = validateURL(serveUrl)
|
||||||
|
let serverMode = localStorage.getItem('serverMode')
|
||||||
|
if(isOk) {
|
||||||
|
const parsedUrl = new URL(serveUrl);
|
||||||
|
const host = parsedUrl.host;
|
||||||
|
const ipPort = host.split(':');
|
||||||
|
if(serverMode === 'false') {
|
||||||
|
servVal.value = '网络'
|
||||||
|
ip.value = ipPort[0]
|
||||||
|
port.value = ipPort[1]
|
||||||
|
prototype.value = parsedUrl.protocol.slice(0, -1)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localip.value = ipPort[0]
|
||||||
|
localport.value = ipPort[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
switch (selectedService.value) {
|
switch (selectedService.value) {
|
||||||
case '接口服务':
|
case '接口服务':
|
||||||
@ -39,7 +58,7 @@ export const useSetUp = () => {
|
|||||||
// 验证url 合法性
|
// 验证url 合法性
|
||||||
if (isOk) {
|
if (isOk) {
|
||||||
// 网络走这里
|
// 网络走这里
|
||||||
window.isStandAlone = false //判断走哪个服务
|
localStorage.setItem('serverMode', 'false') //判断走哪个服务
|
||||||
setIP(url)
|
setIP(url)
|
||||||
serviceDialog.value = false
|
serviceDialog.value = false
|
||||||
} else {
|
} else {
|
||||||
@ -47,13 +66,15 @@ export const useSetUp = () => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//单机走这里
|
//单机走这里
|
||||||
window.isStandAlone = true
|
localStorage.setItem('serverMode', 'true')
|
||||||
setIP('http://127.0.0.1:' + localport.value)
|
setIP('http://127.0.0.1:' + localport.value)
|
||||||
serviceDialog.value = false
|
serviceDialog.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const initialize = () => {
|
const initialize = () => {
|
||||||
if (!window.isStandAlone) {
|
if(localStorage.getItem('ip')) {}
|
||||||
|
else {
|
||||||
|
if (serverMode==='false') {
|
||||||
setIP('http://127.0.0.1:' + localport.value)
|
setIP('http://127.0.0.1:' + localport.value)
|
||||||
} else {
|
} else {
|
||||||
let url = prototype.value + '://' + ip.value + ':' + port.value
|
let url = prototype.value + '://' + ip.value + ':' + port.value
|
||||||
@ -65,6 +86,7 @@ export const useSetUp = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
serviceDialog,
|
serviceDialog,
|
||||||
servVal,
|
servVal,
|
||||||
|
|||||||
Reference in New Issue
Block a user