This commit is contained in:
zyl
2025-10-15 14:18:30 +08:00
64 changed files with 2653 additions and 328 deletions

View File

@ -43,10 +43,10 @@ export default defineConfig({
})
]
// server: {
// port: 8808,
// port: 8848,
// proxy: {
// '/api': {
// target: localStorage.getItem('ip') || 'http://127.0.0.1:8808',
// target: localStorage.getItem('ip') || 'http://127.0.0.1:8848',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// }

View File

@ -21,6 +21,7 @@
"build:linux": "npm run build && electron-builder --linux"
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@electron-toolkit/preload": "^3.0.2",
"@electron-toolkit/utils": "^4.0.0",
"@electron/remote": "^2.1.3",
@ -32,6 +33,7 @@
"electron-updater": "^6.3.9",
"element-plus": "^2.10.4",
"express": "^5.1.0",
"file-saver": "^2.0.5",
"mitt": "^3.0.1",
"moment": "^2.30.1",
"pinia": "^3.0.3",
@ -42,7 +44,8 @@
"vue-clipboard3": "^2.0.0",
"vue-i18n": "^9.14.5",
"vue-router": "^4.5.1",
"vuedraggable": "^2.24.3"
"vuedraggable": "^2.24.3",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "3.0.0",

View File

@ -21,6 +21,7 @@ declare module 'vue' {
ElDialog: typeof import('element-plus/es')['ElDialog']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']

File diff suppressed because one or more lines are too long

View File

@ -5,51 +5,50 @@
* typeSonNode:不参与查询的节点的子孙节点是否也不参与匹配默认为false即子节点参与匹配
* */
window.newFuzzySearch = function(
window.newFuzzySearch = function (
treeId,
keyword,
notSearchType = [],
typeSonNode = false,
dispatch = ""
dispatch = ''
) {
//获取所有节点数据
let zTreeObj = $.fn.zTree.getZTreeObj(treeId);
let idKey = zTreeObj.setting.data.simpleData.idKey;
let nodes = zTreeObj.getNodes();
let zTreeObj = $.fn.zTree.getZTreeObj(treeId)
let idKey = zTreeObj.setting.data.simpleData.idKey
let nodes = zTreeObj.getNodes()
//过滤掉不要的
function getCustomNodes(allNodes) {
// let allNode = JSON.parse(JSON.stringify(allNodes))
let notSearchTypeNodesIds = [];
let notSearchTypeNodesIds = []
if (notSearchType.length) {
allNodes.forEach((allNodeItem) => {
if (notSearchType.includes(allNodeItem.sourceType)) {
notSearchTypeNodesIds.push(allNodeItem[idKey]);
notSearchTypeNodesIds.push(allNodeItem[idKey])
}
});
})
//typeSonNode为true时循环notSearchType类型的节点找出其子节点
let res = [];
let res = []
if (typeSonNode) {
notSearchTypeNodesIds.forEach((id, index) => {
let nodes = zTreeObj.transformToArray(
zTreeObj.getNodeByParam(idKey, id, null)
);
let nodes = zTreeObj.transformToArray(zTreeObj.getNodeByParam(idKey, id, null))
nodes.forEach((item) => {
res.push(item[idKey]);
});
});
notSearchTypeNodesIds = res;
res.push(item[idKey])
})
})
notSearchTypeNodesIds = res
}
}
let res = [];
let res = []
allNodes.forEach((item, index) => {
if (!notSearchTypeNodesIds.includes(item[idKey])) {
// console.log(index)
res.push(item);
res.push(item)
}
});
allNodes = res;
return allNodes;
})
allNodes = res
return allNodes
}
/*let allNodes = zTreeObj.transformToArray(nodes);
let nodeChildren = getCustomNodes(allNodes)*/
@ -59,63 +58,60 @@ window.newFuzzySearch = function(
//隐藏所有节点
function hideAllNode(allNodes) {
if (!allNodes || !Array.isArray(allNodes)) {
console.warn("hideAllNode: allNodes 参数无效");
return;
console.warn('hideAllNode: allNodes 参数无效')
return
}
let nodeChildren = getCustomNodes(allNodes);
let nodeChildren = getCustomNodes(allNodes)
if (nodeChildren && nodeChildren.length > 0) {
zTreeObj.hideNodes(nodeChildren);
zTreeObj.hideNodes(nodeChildren)
}
}
//模糊匹配所有符合的节点
function search(contrast, allNodes) {
if (!allNodes || !Array.isArray(allNodes)) {
console.warn("search: allNodes 参数无效");
return;
console.warn('search: allNodes 参数无效')
return
}
let nodeChildren = getCustomNodes(allNodes);
let nodeChildren = getCustomNodes(allNodes)
if (!nodeChildren) {
return;
return
}
hideAllNode(allNodes);
hideAllNode(allNodes)
nodeChildren.forEach((item) => {
if (item.oldname) {
item.sourceName = item.oldname;
zTreeObj.updateNode(item);
item.sourceName = item.oldname
zTreeObj.updateNode(item)
}
if (contrast) {
if ((item.sourceName || "").indexOf(contrast) > -1) {
console.log("sourceName包含关键字");
console.log(item);
console.log(item.sourceName);
if ((item.sourceName || '').indexOf(contrast) > -1) {
console.log('sourceName包含关键字')
console.log(item)
console.log(item.sourceName)
item.oldname = item.sourceName;
item.highlight = true;
let F = new RegExp(contrast, "gi");
item.sourceName = item.oldname.replace(F, function(h) {
let str =
'<span style="color: whitesmoke;background-color: darkred;">' +
h +
"</span>";
return str;
});
item.oldname = item.sourceName
item.highlight = true
let F = new RegExp(contrast, 'gi')
item.sourceName = item.oldname.replace(F, function (h) {
let str = '<span style="color: whitesmoke;background-color: darkred;">' + h + '</span>'
return str
})
// let a = item.name
// a = '<span style="color: whitesmoke;background-color: darkred;">' + a + "</span>"
// item.name = a
zTreeObj.setting.view.nameIsHTML = true;
item.checked = true;
zTreeObj.setting.view.nameIsHTML = true
item.checked = true
// zTreeObj.setting.view.fontCss["color"] = "#8B0000"
zTreeObj.updateNode(item);
zTreeObj.showNode(item);
showNodePath(item);
zTreeObj.updateNode(item)
zTreeObj.showNode(item)
showNodePath(item)
}
/*zTreeObj.updateNode(item);
zTreeObj.showNode(item);
showNodePath(item)*/
}
});
})
/*let searchNodes = zTreeObj.getNodesByParamFuzzy('name', contrast);
console.log('searchNodes', searchNodes)
searchNodes.forEach(function (node) {
@ -123,40 +119,40 @@ window.newFuzzySearch = function(
zTreeObj.showNode(node);
showNodePath(node)
})*/
zTreeObj.expandAll(true);
zTreeObj.expandAll(true)
}
//将查找到的节点父节点按路径设置为显示
function showNodePath(node) {
let parrentNodes = node.getPath();
let parrentNodes = node.getPath()
parrentNodes &&
parrentNodes.forEach(function(node) {
zTreeObj.showNode(node);
});
parrentNodes.forEach(function (node) {
zTreeObj.showNode(node)
})
}
window.treeSearchCb = (value = undefined) => {
let inputValue = value == undefined ? $(keyword).val() : "";
let inputValue = value || ''
// console.log("搜索值", inputValue)
nodes = zTreeObj.getNodes();
let allNodes = zTreeObj.transformToArray(nodes);
let nodeChildren = getCustomNodes(allNodes);
console.log("nodeChildren", nodeChildren);
search(inputValue, allNodes);
nodes = zTreeObj.getNodes()
let allNodes = zTreeObj.transformToArray(nodes)
let nodeChildren = getCustomNodes(allNodes)
console.log('nodeChildren', nodeChildren)
search(inputValue, allNodes)
//当查询条件为空时,显示所有节点
console.log("inputValue", inputValue);
if ((inputValue == null || inputValue === "") && nodeChildren.length >= 0) {
nodeChildren.forEach(function(node) {
console.log('inputValue', inputValue)
if ((inputValue == null || inputValue === '') && nodeChildren.length >= 0) {
nodeChildren.forEach(function (node) {
// node.checked = false
zTreeObj.showNode(node);
});
zTreeObj.showNode(node)
})
// zTreeObj.expandAll(false);
}
};
if (dispatch == "") {
}
if (dispatch == '') {
//input框值改变时
$(keyword).bind("input propertychange", treeSearchCb);
$(keyword).bind('input propertychange', treeSearchCb)
} else {
// $(dispatch).bind('click', treeSearchCb)
}
};
}

View File

@ -0,0 +1,34 @@
//设备管理
import request from '@/axios/request'
import { param } from 'jquery'
export const deviceApi = {
updateDevice: async (data: any) => {
return await request.post({
url: `/device/update`,
data
})
},
addDevice: async (data: any) => {
return await request.post({
url: `/device/add`,
data
})
},
deviceList: async (data) => {
return await request.get({
url: `/device/list`,
params: data,
})
},
deviceById: async () => {
return await request.get({
url: `/device/getById`
})
},
delDevice: async (data) => {
return await request.get({
url: `/device/delete`,
params: data,
})
},
}

View File

@ -0,0 +1,11 @@
//gdb
import request from '@/axios/request'
export const gdbApi = {
// gdb导入
importGdb: async (data: any) => {
return await request.post({
url: `/gdal/import`,
data,
})
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

View File

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

View File

@ -1,8 +1,9 @@
import { leftClick, rightClick } from '../../src/views/components/tree/entityClick'
import { renderVector } from '../views/components/tree/components/hooks/renderVector'
export const initMapData = async (type, data, cd) => {
let entityObject
let options
let baseURL = localStorage.getItem('service')
let baseURL = localStorage.getItem('ip')
switch (type) {
case 'groundText':
entityObject = new YJ.Obj.GroundText(window.earth, data)
@ -42,6 +43,7 @@ export const initMapData = async (type, data, cd) => {
entityObject = new YJ.Obj.EllipseObject(window.earth, data)
break
case 'model':
console.log('model', data)
entityObject = new YJ.Obj.Model(window.earth, data)
break
case 'military':
@ -132,6 +134,14 @@ export const initMapData = async (type, data, cd) => {
case 'explosion':
entityObject = new YJ.Obj.Explosion(window.earth, data)
break
case 'geojson':
entityObject = new YJ.Obj.GeoJson(window.earth, data)
entityObject.on()
break
case 'vector':
let node = window.treeObj.getNodeByParam("id", data.id, null);
entityObject = renderVector(node, false)
break
default:
break
}
@ -167,6 +177,9 @@ export const initMapData = async (type, data, cd) => {
rightClick(getOptions());
};
if (entityObject.options.id) {
(window as any)._entityMap.set(entityObject.options.id, entityObject)
}
}
// options = entityObject

View File

@ -1,15 +1,9 @@
<template>
<div
class="YJ-custom-base-dialog"
:class="className"
ref="baseDialog"
:id="id"
v-if="dialogVisible"
v-show="dialogVisible"
>
<div class="YJ-custom-base-dialog" :class="className" ref="baseDialog" :id="id" v-if="dialogVisible"
v-show="dialogVisible">
<div class="title-box" ref="titleBox">
<span class="title">{{ title }}</span
><span class="close-box" @click="close"><span class="close"></span><i></i></span>
<span class="title">{{ title }}</span><span class="close-box" @click="close"><span
class="close"></span><i></i></span>
</div>
<div class="content" style="padding: 0 24px 0 24px">
<div>
@ -83,7 +77,7 @@ const props = defineProps({
},
closeCallback: {
type: Function,
default: () => {}
default: () => { }
}
})
@ -116,16 +110,16 @@ const open = (data) => {
if (!first.value) {
first.value = true
dialogVisible.value = true
nextTick(() => {
moveDiv()
})
}
dialogVisible.value = true
nextTick(() => {
moveDiv()
})
nextTick(() => {
// setTimeout(() => {
// openPosition()
// }, 0)
if(baseDialog.value) {
if (baseDialog.value) {
baseDialog.value.style.width = props.width
baseDialog.value.style.height = props.height
baseDialog.value.style.top = props.top
@ -271,20 +265,25 @@ defineExpose({
.YJ-custom-base-dialog {
::v-deep .el-tabs {
width: 100%;
.el-tabs__item {
padding: 0 8px;
color: #fff;
}
.el-tabs__item:nth-child(2) {
padding-left: 0;
}
.el-tabs__item.is-active,
.el-tabs__item:hover {
color: #fff;
}
.el-tabs__active-bar {
background-color: rgb(0, 255, 255);
}
.el-tabs__nav-wrap:after {
background-color: rgba(204, 204, 204, 0.2);
}

View File

@ -6,7 +6,6 @@ interface Window {
sendMessage: (msg: string) => void
onReply: (callback: (msg: string) => void) => void
}
isStandAlone: any
treeObj: any
AllNodes: any
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="9.066558837890625" height="5.0849609375" viewBox="0 0 9.066558837890625 5.0849609375" fill="none"><path d="M4.53328 5.08491C4.40728 5.08491 4.28655 5.03419 4.19834 4.94419L0.134036 0.797225C-0.0472612 0.612256 -0.0442613 0.315334 0.140723 0.134053C0.325677 -0.0472122 0.622614 -0.0442433 0.803895 0.140741L4.53328 3.94595L8.26267 0.140741C8.44394 -0.0442591 8.74084 -0.0472745 8.92583 0.134053C9.11083 0.31535 9.11381 0.612256 8.93252 0.797225L4.8682 4.94417C4.78 5.03419 4.65928 5.08491 4.53328 5.08491Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 627 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="9.06658935546875" height="5.0849609375" viewBox="0 0 9.06658935546875 5.0849609375" fill="none"><path d="M4.53328 5.48363e-05C4.40728 5.48363e-05 4.28655 0.0507736 4.19834 0.140773L0.134036 4.28774C-0.0472612 4.4727 -0.0442613 4.76963 0.140723 4.95091C0.325677 5.13217 0.622614 5.1292 0.803895 4.94422L4.53328 1.13901L8.26267 4.94422C8.44394 5.12922 8.74084 5.13224 8.92583 4.95091C9.11083 4.76961 9.11381 4.4727 8.93252 4.28774L4.8682 0.140789C4.78 0.0507736 4.65928 5.48363e-05 4.53328 5.48363e-05Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 623 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20.1923828125" height="20" viewBox="0 0 20.1923828125 20" fill="none"><path d="M19.7403 8.99939C19.4488 8.32318 19.033 7.71639 18.5042 7.19692C17.9755 6.67745 17.3608 6.26993 16.6762 5.98556C15.996 5.70344 15.2752 5.55342 14.5318 5.54222C14.4572 5.26681 14.3646 4.99364 14.2493 4.72943C13.9443 4.01964 13.5082 3.38373 12.9523 2.83739C12.3987 2.29329 11.7524 1.86562 11.0316 1.56559C10.2859 1.25659 9.49729 1.09985 8.68381 1.09985C7.87034 1.09985 7.08173 1.25659 6.33604 1.56559C5.61748 1.86339 4.97122 2.29329 4.41535 2.83739C3.85947 3.38373 3.42336 4.01964 3.11831 4.72943C2.80196 5.46609 2.64152 6.24754 2.64152 7.05138C2.64152 7.20363 2.6483 7.35365 2.6596 7.50367C2.15344 7.7746 1.69248 8.13062 1.2993 8.56277C0.460967 9.4808 0 10.663 0 11.8923C0 12.5663 0.135579 13.2223 0.402217 13.8403C0.659816 14.4337 1.02588 14.9666 1.49137 15.4256C1.95685 15.8824 2.49691 16.2406 3.09797 16.4914C3.27422 16.5653 3.45274 16.628 3.63577 16.6817L3.65836 14.877C2.51498 14.3531 1.71507 13.2089 1.71507 11.8923C1.71507 10.2152 3.01211 8.8225 4.66843 8.6277C4.46958 8.13958 4.35885 7.60891 4.35885 7.05361C4.35885 4.70704 6.29537 2.80605 8.68381 2.80605C11.0723 2.80605 13.0088 4.70928 13.0088 7.05361C13.0088 7.21035 12.9997 7.36485 12.9817 7.51711C13.4336 7.3447 13.9239 7.24618 14.4369 7.24618C16.6671 7.24618 18.4771 9.02402 18.4771 11.2161C18.4771 12.8215 17.5055 14.2053 16.109 14.83L16.0842 16.6504C17.0761 16.3593 17.9755 15.8085 18.685 15.0427C19.6566 13.9948 20.1922 12.6379 20.1922 11.2161C20.1967 10.4458 20.043 9.70023 19.7403 8.99939Z" fill="#FFFFFF" ></path><path d="M6.20972 12.4857L15.2212 12.4857L15.2212 14.1874L6.20972 14.1874L6.20972 12.4857ZM4.98047 14.7919L13.9919 14.7919L13.9919 16.4936L4.98047 16.4936L4.98047 14.7919ZM5.79846 17.0982L14.8099 17.0982L14.8099 18.7999L5.79846 18.7999L5.79846 17.0982ZM12.2023 8.19108C11.9583 8.19108 11.7142 8.08808 11.5447 7.8888C11.2397 7.53054 11.2849 6.99316 11.6464 6.69088C12.5119 5.96765 13.6146 5.56909 14.7489 5.56909C15.2234 5.56909 15.6076 5.94974 15.6076 6.41995C15.6076 6.89016 15.2234 7.27081 14.7489 7.27081C14.019 7.27081 13.3095 7.52606 12.7536 7.9918C12.5955 8.1239 12.3989 8.19108 12.2023 8.19108Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M19.3625 8.55754L17.5011 8.55754C17.1483 8.55754 16.8636 8.84771 16.8636 9.1923C16.8636 9.54552 17.1483 9.83094 17.5011 9.83094L19.3625 9.83094C19.7151 9.83094 20 9.54552 20 9.1923C20 8.84771 19.7151 8.55754 19.3625 8.55754ZM7.1869 5.54873C7.43068 5.80263 7.83768 5.80263 8.08146 5.54873C8.33471 5.29957 8.33471 4.89627 8.08146 4.64712L6.76614 3.32405C6.51761 3.07491 6.11536 3.07491 5.86686 3.32405C5.62308 3.57322 5.62308 3.97652 5.86686 4.22611L7.1869 5.54873ZM16.262 5.54873L17.5812 4.22611C17.8258 3.97652 17.8258 3.57322 17.5812 3.32405C17.3288 3.07491 16.9304 3.07491 16.6776 3.32405L15.3579 4.64712C15.1094 4.89627 15.1094 5.29957 15.3579 5.54873C15.6116 5.80263 16.0091 5.80263 16.262 5.54873ZM11.7242 4.04475C12.0727 4.04475 12.3569 3.75458 12.3569 3.40093L12.3569 1.53466C12.3569 1.18101 12.0727 0.899902 11.7242 0.899902C11.3719 0.899902 11.0825 1.18058 11.0825 1.53466L11.0825 3.40093C11.0825 3.75458 11.3719 4.04475 11.7242 4.04475ZM1.65427 14.431C1.41052 13.8415 1.27484 13.1982 1.27484 12.5185C1.27484 11.8341 1.41052 11.1864 1.64567 10.597C1.89892 9.98985 2.26974 9.44146 2.73918 8.97942C3.19571 8.51265 3.74742 8.14129 4.35728 7.8917C4.9357 7.65119 5.58216 7.5156 6.26481 7.5156C6.76226 7.5156 7.25022 7.58339 7.70202 7.71509C8.16758 7.86018 8.60604 8.06832 9.00355 8.33602L9.03931 8.35416C9.41917 8.61282 9.76286 8.91164 10.0609 9.27391L10.07 9.28298C10.3727 9.6362 10.6212 10.0352 10.8202 10.4704C10.9374 10.7235 11.1996 10.869 11.471 10.8375L11.5886 10.8241L11.7152 10.815L11.7423 10.8107L11.8328 10.8055L11.9413 10.8055C12.3935 10.8055 12.8272 10.8966 13.2157 11.0594L13.2428 11.0728C13.6408 11.2408 14.0026 11.4852 14.301 11.7888L14.3097 11.7888L14.3187 11.8026C14.6167 12.1109 14.8614 12.4732 15.0285 12.8765L15.0285 12.8808C15.1951 13.2707 15.286 13.7055 15.286 14.1676C15.286 14.2699 15.28 14.3718 15.2709 14.472L16.5406 14.472C16.5475 14.3709 16.5561 14.2699 16.5561 14.1676C16.5561 13.5376 16.4291 12.9352 16.2038 12.3916C16.0725 12.0832 15.9092 11.7844 15.7202 11.5077C15.8782 11.2309 16.0139 10.9368 16.1134 10.6285C16.2624 10.1755 16.3391 9.69967 16.3391 9.19663C16.3391 7.91935 15.8278 6.76339 14.9871 5.9257L14.9871 5.92094L14.9781 5.91187C14.1378 5.08238 12.9904 4.56118 11.7242 4.56118C10.8745 4.56118 10.0794 4.79694 9.39678 5.19593L9.35586 5.23265C8.81794 5.54051 8.35235 5.97535 7.98669 6.4784C7.4393 6.31993 6.86088 6.23789 6.26437 6.23789C5.41463 6.23789 4.60535 6.40154 3.86932 6.71416C3.09622 7.03111 2.40454 7.49789 1.83516 8.07781C1.25675 8.64909 0.791175 9.33783 0.475049 10.1172C0.167537 10.8561 0 11.6674 0 12.5194C0 13.1964 0.11241 13.8545 0.314402 14.4729L1.67323 14.4729C1.66806 14.4582 1.66031 14.4448 1.65427 14.431ZM9.99802 6.3195L10.0385 6.30137C10.5312 6.0112 11.1053 5.84364 11.7242 5.84364C12.6463 5.84364 13.4823 6.21931 14.0922 6.82255C14.6934 7.43441 15.069 8.26781 15.069 9.19663C15.069 9.55501 15.0061 9.9173 14.9062 10.2347C14.879 10.334 14.8342 10.4247 14.7929 10.5249C14.4768 10.2757 14.1197 10.0628 13.7355 9.89917L13.7041 9.88103C13.1567 9.65476 12.5649 9.52781 11.9413 9.52781L11.9413 9.53257L11.9232 9.53257L11.8151 9.53732L11.7742 9.53732C11.5662 9.14783 11.3168 8.78511 11.0373 8.45435L11.0373 8.44528C10.6574 8.00527 10.2237 7.62529 9.73531 7.29884L9.7086 7.27164C9.5458 7.16282 9.383 7.0635 9.21158 6.98146C9.43769 6.71805 9.70385 6.49611 9.99802 6.3195ZM16.6647 17.8211L3.19658 17.8211C2.9696 17.8211 2.79087 18.0931 2.79087 18.4148C2.79087 18.7352 2.9696 18.9999 3.19658 18.9999L16.6647 18.9999C16.8916 18.9999 17.0803 18.7352 17.0803 18.4148C17.0803 18.0931 16.8916 17.8211 16.6647 17.8211ZM14.9738 16.628C14.9738 16.3413 14.7955 16.1202 14.5724 16.1202L1.09998 16.1202C0.877746 16.1202 0.694272 16.3413 0.694272 16.628C0.694272 16.9031 0.877746 17.1298 1.09998 17.1298L14.5724 17.1298C14.7955 17.1298 14.9738 16.9026 14.9738 16.628Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12" fill="none"><g clip-path="url(#clip-path-2256_179)"><path d="M1.19473 4.35725L1.19473 1.80615C1.19473 1.46881 1.46881 1.19473 1.80615 1.19473L10.1939 1.19473C10.5312 1.19473 10.8053 1.46881 10.8053 1.80615L10.8053 10.1939C10.8053 10.5312 10.5312 10.8053 10.1939 10.8053L7.64275 10.8053C7.31245 10.8053 7.04539 11.0723 7.04539 11.4026C7.04539 11.7329 7.31245 12 7.64275 12L10.7859 12C11.4571 12 12 11.4554 12 10.786L12 1.21406C12 0.542899 11.4553 0 10.7859 0L1.21406 0C0.542899 0 0 0.544656 0 1.21406L0 4.35725C0 4.68756 0.267057 4.95461 0.597365 4.95461C0.927672 4.95461 1.19473 4.68756 1.19473 4.35725Z" fill="#FFFFFF" ></path><path d="M6.20029 8.62311L6.19854 8.62135L3.84949 6.2723C3.61581 6.03863 3.23807 6.03863 3.00439 6.2723C2.77072 6.50598 2.77072 6.88372 3.00439 7.1174L4.33792 8.45093L0.597365 8.45093C0.267057 8.45093 0 8.71799 0 9.04829C0 9.3786 0.267057 9.64566 0.597365 9.64566L4.33441 9.64566L3.00439 10.9757C2.77072 11.2093 2.77072 11.5871 3.00439 11.8208C3.23807 12.0544 3.61581 12.0544 3.84949 11.8208L6.16164 9.50861C6.29341 9.39968 6.37775 9.23453 6.37775 9.05005C6.37775 8.88138 6.30923 8.73204 6.20029 8.62311Z" fill="#FFFFFF" ></path></g><defs><clipPath id="clip-path-2256_179"><path d="M0 12L12 12L12 0L0 0L0 12Z" fill="white"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M11.2506 2.25446L2.99221 2.25446C2.58012 2.25446 2.24268 2.59194 2.24268 3.00411L2.24268 11.2504C2.24268 11.6625 2.58012 12 2.99221 12L11.2506 12C11.6627 12 12.0001 11.6625 12.0001 11.2504L12.0001 3.0041C12.0001 2.59193 11.6627 2.25446 11.2506 2.25446ZM11.247 11.2468L2.99702 11.2468L2.99702 3.0041L11.247 3.0041L11.247 11.2468Z" fill="#FFFFFF" ></path><path d="M2.99209 9.00349L0.749541 9.00349L0.749541 0.757263L8.99838 0.757263L8.99838 2.26282L9.75747 2.26282L9.75747 0.757263C9.75747 0.345095 9.42002 0 9.00793 0L0.749541 0C0.337437 0 0 0.345095 0 0.757263L0 9.00349C0 9.41565 0.337437 9.75313 0.749541 9.75313L2.99209 9.75313L2.99209 9.00349Z" fill="#FFFFFF" ></path><path d="M9.74439 6.75013L7.49499 6.75013L7.49499 4.49957L6.73931 4.49957L6.73931 6.75013L4.49512 6.75013L4.49512 7.50113L6.7441 7.50113L6.7441 9.74953L7.49619 9.74953L7.49619 7.50113L9.74439 7.50113L9.74439 6.75013Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20.1923828125" height="20" viewBox="0 0 20.1923828125 20" fill="none"><path d="M16.5969 12.9364L3.6107 12.9364C1.61975 12.9364 0 11.3264 0 9.34752C0 7.71959 1.11346 6.30497 2.65593 5.88535C2.65412 5.84661 2.65319 5.80781 2.65319 5.76905C2.65319 4.39379 3.77777 3.27493 5.16008 3.27493C5.66977 3.27493 6.15753 3.42682 6.56787 3.70432C7.49091 1.82306 9.42227 0.600098 11.5668 0.600098C14.5264 0.600098 16.9536 2.91035 17.1203 5.81269C17.8948 5.92765 18.6087 6.28852 19.1646 6.85306C19.8273 7.52608 20.1923 8.41502 20.1923 9.35607C20.1923 10.311 19.8138 11.2111 19.1266 11.8903C18.4441 12.5649 17.5457 12.9364 16.5969 12.9364ZM5.1601 4.1995C4.29024 4.1995 3.58255 4.90362 3.58255 5.76905C3.58255 5.89399 3.59767 6.01924 3.62747 6.14132C3.65856 6.26839 3.63402 6.40267 3.56 6.51077C3.48597 6.61885 3.36931 6.69073 3.23908 6.70848C1.92233 6.88806 0.929364 8.02258 0.929364 9.34752C0.929364 10.8166 2.13223 12.0118 3.6107 12.0118L16.5969 12.0118C17.2986 12.0118 17.9643 11.7358 18.4716 11.2345C18.9819 10.7301 19.2629 10.063 19.2629 9.35612C19.2629 8.65845 18.9923 7.99929 18.5007 7.50011C18.0101 7.00194 17.3542 6.71725 16.6537 6.69847C16.3983 6.69168 16.1964 6.48102 16.2016 6.22692C16.2019 6.21407 16.2014 6.20151 16.2011 6.18891C16.2006 6.17008 16.2001 6.15119 16.2001 6.13178C16.2001 3.59141 14.1216 1.52469 11.5668 1.52469C9.58744 1.52469 7.82616 2.77533 7.18399 4.63675C7.1292 4.79556 6.99221 4.91231 6.82609 4.94176C6.65988 4.97131 6.49079 4.90877 6.38419 4.77863C6.08287 4.41058 5.63672 4.1995 5.1601 4.1995Z" fill="#00FFFF" ></path><path d="M5.46419 19.5001C5.20757 19.5001 4.99951 19.2931 4.99951 19.0378L4.99951 14.2079C4.99951 13.9526 5.20757 13.7456 5.46419 13.7456C5.72079 13.7456 5.92885 13.9526 5.92885 14.2079L5.92885 19.0378C5.92885 19.2931 5.72079 19.5001 5.46419 19.5001Z" fill="#00FFFF" ></path><path d="M8.68634 17.6509C8.42974 17.6509 8.22168 17.4439 8.22168 17.1886L8.22168 14.2079C8.22168 13.9526 8.42974 13.7456 8.68634 13.7456C8.94296 13.7456 9.15102 13.9526 9.15102 14.2079L9.15102 17.1886C9.15102 17.4439 8.94296 17.6509 8.68634 17.6509Z" fill="#00FFFF" ></path><path d="M11.9076 19.5001C11.6509 19.5001 11.4429 19.2931 11.4429 19.0378L11.4429 14.2079C11.4429 13.9526 11.6509 13.7456 11.9076 13.7456C12.1642 13.7456 12.3722 13.9526 12.3722 14.2079L12.3722 19.0378C12.3723 19.2931 12.1642 19.5001 11.9076 19.5001Z" fill="#00FFFF" ></path><path d="M15.1297 17.6509C14.8731 17.6509 14.665 17.4439 14.665 17.1886L14.665 14.2079C14.665 13.9526 14.8731 13.7456 15.1297 13.7456C15.3863 13.7456 15.5944 13.9526 15.5944 14.2079L15.5944 17.1886C15.5944 17.4439 15.3863 17.6509 15.1297 17.6509Z" fill="#00FFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M5.99995 0C2.68626 0 0 2.6863 0 6.00001C0 9.31371 2.68628 12 5.99995 12C9.31363 12 11.9999 9.31371 11.9999 6.00001C11.9999 2.6863 9.31363 0 5.99995 0ZM5.99995 10.8988C3.29444 10.8988 1.10121 8.70557 1.10121 6.00002C1.10121 3.29447 3.29443 1.10124 5.99995 1.10124C8.70548 1.10124 10.8987 3.29447 10.8987 6.00002C10.8987 8.70557 8.70548 10.8988 5.99995 10.8988Z" fill="#FFFFFF" ></path><path d="M5.72705 3.17093C5.72705 3.56116 6.04337 3.8775 6.43361 3.8775C6.82384 3.8775 7.14017 3.56116 7.14017 3.17093C7.14017 2.78069 6.82384 2.46436 6.43361 2.46436C6.04337 2.46444 5.72705 2.78075 5.72705 3.17093ZM6.2303 9.67696C5.70904 9.80738 4.98747 9.7957 4.62688 9.6509C4.26623 9.50617 4.13495 8.97968 4.33516 8.48104L5.23442 6.24068C5.43461 5.742 5.17471 5.21648 4.65696 5.07279L4.48511 5.02508C3.96734 4.8814 3.97761 4.69316 4.50797 4.60682L5.02267 4.523C5.55304 4.4366 6.28202 4.48439 6.64266 4.62917C7.00331 4.7739 7.13372 5.30002 6.93249 5.79829L6.09405 7.87443C5.89281 8.3727 6.14467 8.90614 6.6536 9.0599C7.16253 9.21366 7.15254 9.44619 6.63128 9.57661L6.23033 9.67696L6.2303 9.67696Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20.1923828125" height="13.800048828125" viewBox="0 0 20.1923828125 13.800048828125" fill="none"><path d="M10.0962 2.55556C11.52 2.55556 12.6849 1.40556 12.6849 0L7.5074 0C7.5074 1.40556 8.67234 2.55556 10.0962 2.55556ZM14.8854 0L13.7204 0C13.7204 0.383333 13.7204 0.638889 13.591 1.02222L14.7559 1.27778C14.8854 0.894445 14.8854 0.383333 14.8854 0ZM9.19009 3.45C8.5429 3.32222 8.02515 3.06667 7.5074 2.55556L6.73077 3.45C7.37796 4.08889 8.02515 4.47222 8.93121 4.6L9.19009 3.45ZM12.6849 2.55556C12.1672 3.06667 11.6494 3.32222 11.0022 3.45L11.3905 4.6C12.1672 4.34445 12.9438 3.96111 13.591 3.45L12.6849 2.55556ZM6.60133 1.02222C6.47189 0.638889 6.47189 0.383333 6.47189 0L5.30695 0C5.30695 0.383333 5.30695 0.894445 5.43639 1.27778L6.60133 1.02222ZM17.4741 0L16.3092 0C16.3092 0.383333 16.3092 0.766667 16.1797 1.02222L17.3447 1.27778C17.4741 0.766667 17.4741 0.383333 17.4741 0ZM4.91864 5.23889L5.69527 4.47222C5.30695 3.96111 4.91864 3.45 4.53033 2.81111L3.49482 3.45C3.88314 4.08889 4.40089 4.72778 4.91864 5.23889ZM6.73077 6.51667C7.5074 6.9 8.15459 7.15556 8.93121 7.28334L9.06065 6.13334C8.5429 6.00556 7.89571 5.75 7.24852 5.49445L6.73077 6.51667ZM11.2611 7.28334C12.0377 7.15556 12.8144 6.9 13.4615 6.64445L12.9438 5.62222C12.2966 5.75 11.7788 6.00556 11.1317 6.13334L11.2611 7.28334ZM15.2737 5.23889C15.7914 4.72778 16.3092 4.08889 16.6975 3.45L15.662 2.93889C15.4031 3.45 15.0148 3.96111 14.497 4.47222L15.2737 5.23889ZM3.88314 1.02222C3.88314 0.638889 3.7537 0.383333 3.7537 0L2.7182 0C2.7182 0.383333 2.7182 0.894445 2.84763 1.27778L3.88314 1.02222ZM10.0962 11.1167C4.53033 11.1167 0 11.6278 0 12.2667L0 13.8L20.1923 13.8L20.1923 12.2667C20.1923 11.6278 15.662 11.1167 10.0962 11.1167Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15.7001953125" height="16" viewBox="0 0 15.7001953125 16" fill="none"><path d="M6.97754 0.874993C6.97754 0.392098 7.37037 0 7.85407 0C8.33778 0 8.73206 0.39208 8.73206 0.874993L8.73206 6.38264C8.73206 6.86553 8.33778 7.25762 7.85407 7.25762C7.37037 7.25762 6.97754 6.86555 6.97754 6.38264L6.97754 0.874993Z" fill="#CCCCCC" ></path><path d="M13.403 13.7081C10.3413 16.764 5.35891 16.764 2.29627 13.7072C-0.765426 10.6513 -0.765426 5.67832 2.29627 2.62245C2.63137 2.28796 3.17512 2.28796 3.51022 2.62245C3.84534 2.95691 3.84534 3.49963 3.51022 3.83411C1.11791 6.22203 1.11791 10.1076 3.51022 12.4955C5.90256 14.8833 9.79664 14.8843 12.189 12.4965C14.5814 10.1086 14.5814 6.22091 12.189 3.83312C11.8539 3.49866 11.8539 2.95595 12.189 2.62145C12.5242 2.28699 13.0678 2.28699 13.4031 2.62145C16.4656 5.67833 16.4656 10.6513 13.403 13.7081Z" fill="#CCCCCC" ></path></svg>

After

Width:  |  Height:  |  Size: 959 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -42,8 +42,39 @@ const i18n = createI18n({
if (!localStorage.getItem("searchWay")) {
localStorage.setItem("searchWay", "poi");
}
if (!localStorage.getItem("AMapKey")) {
localStorage.setItem(
"AMapKey",
"d88fcc689d1aa99866b2d0d83fd36677|c3d17927c47eb753b61b26de4f533cbe"
);
}
!localStorage.getItem("systemSetting")
? localStorage.setItem(
"systemSetting",
JSON.stringify({
showFangliNet: false, // 方里网
showLatitudeLongitudeNetwork: false, //经纬网
showToolBar: false, //信息栏
showCompass: true, //罗盘
showMapX: false, //鹰眼图
occlusion: true, //点遮挡
showDistanceLegend: true, //比例尺
showFps: false, //比例尺
administrativeArea: false, //行政区划
sheetIndexStatusSwitch: false, //标准图幅
skinInfo: 'yingguangse', //主题色
language: 'zh', //语言
coordinate: 'EPSG:4326', //坐标系
positionType: '度'
})
)
: console.log("没有设置系统设置");
// 注册全局指令
(window as any)._winMap = new Map();
(window as any)._entityMap = new Map();
const setApp = createApp(App)
// 定义全局方法

View File

@ -42,3 +42,26 @@ export const setIP = (url: string) => {
export const getIP = () => {
return localStorage.getItem('ip') || undefined
}
/**
* 切割路径返回名称
* @param path
* @returns {*}
*/
export function getNamefromPath(path) {
let index = 1;
if (path.endsWith(".json")) {
index = 2;
}
let arr = path.split("/");
let str = arr[arr.length - index];
let name = str;
if (!path.endsWith(".json")) {
let arr1 = str.split(".");
arr1.pop();
name = arr1.join(".");
}
return name;
}

View File

@ -1,7 +1,11 @@
<template>
<div class="equipment">
<div class="equipment_title">
<el-button color="#004b4b" style="border: 1px solid rgba(0, 255, 255, 0.5)">
<el-button
color="#004b4b"
style="border: 1px solid rgba(0, 255, 255, 0.5)"
@click="edit('添加设备')"
>
<template #icon>
<svg-icon name="leading_in" />
</template>
@ -9,40 +13,47 @@
</el-button>
<el-button color="#004b4b" style="border: 1px solid rgba(0, 255, 255, 0.5)">
<template #icon>
<svg-icon name="leading_in" />
<svg-icon name="loadTemp" />
</template>
<span>批量导入</span>
<span>下载模板</span>
</el-button>
<el-button color="#004b4b" style="border: 1px solid rgba(0, 255, 255, 0.5)">
<template #icon>
<svg-icon name="leading_in" />
<svg-icon name="pitchImport" />
</template>
<span>批量模版</span>
<span>批量导入</span>
</el-button>
<el-input
v-model="input3"
style="max-width: 250px"
placeholder="Please input"
placeholder="请输入设备名称进行搜索"
class="input-with-select"
:suffix-icon="Search"
>
<template #append>
<el-button :icon="Search" color="#004b4b" />
</template>
</el-input>
</div>
<div class="nav_table">
<el-table :data="tableData" style="width: 100%">
<el-table-column fixed prop="date" label="Date" width="150" />
<el-table-column prop="name" label="Name" width="120" />
<el-table-column prop="state" label="State" width="120" />
<el-table-column prop="city" label="City" width="120" />
<el-table-column prop="address" label="Address" width="600" />
<el-table-column prop="zip" label="Zip" width="120" />
<el-table-column fixed="right" label="Operations" min-width="120">
<template #default>
<el-button link type="primary" size="small"> Detail </el-button>
<el-button link type="primary" size="small">Edit</el-button>
<el-table :data="tableData" height="40vh" style="width: 100%">
<el-table-column fixed prop="cameraName" label="设备名称" width="150" />
<el-table-column prop="deviceType" label="设备类型" width="120">
<template #default="scope">
<span class="deviceType"></span>
{{ statusTrans(scope.row.type) }}
</template>
</el-table-column>
<el-table-column prop="ip" label="设备IP" width="120" />
<el-table-column prop="port" label="设备端口" width="120" />
<el-table-column prop="userName" label="用户名" width="120" />
<el-table-column prop="password" label="密码" width="120" />
<el-table-column prop="channel" label="通道号" width="120" />
<el-table-column prop="flvUrl" label="flv地址" width="300" />
<el-table-column fixed="right" label="操作" min-width="120">
<template #default="scope">
<el-button link type="primary" size="small" @click="edit('编辑设备', scope.row)">
编辑
</el-button>
<el-button link type="primary" size="small" @click="delFun(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -50,7 +61,7 @@
<div>
<Pagination
:total="total"
v-model:page="pages.pageNo"
v-model:page="pages.pageNum"
v-model:limit="pages.pageSize"
@pagination="getTableList"
/>
@ -60,33 +71,164 @@
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
import { deviceApi } from '@/api/deviceManage/index'
import Dialog from '@/components/dialog/baseDialog.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
const eventBus: any = inject('bus')
const input3 = ref('')
const tableData: any = ref([])
const total = ref(100)
// 页码
let pages: any = reactive({
pageNo: 1,
pageNum: 1,
pageSize: 10
})
// 使用循环生成10条数据
for (let i = 0; i < 10; i++) {
tableData.value.push({
date: `2023-05-${i < 9 ? '0' + (i + 1) : i + 1}`,
name: `用户${i + 1}`,
state: ['California', 'New York', 'Texas'][i % 3],
city: ['Los Angeles', 'New York', 'Houston'][i % 3],
address: `No. ${i + 1}00, Main St`,
zip: ['CA 90036', 'NY 10001', 'TX 77002'][i % 3],
tag: ['Home', 'Work', 'Other'][i % 3]
// for (let i = 0; i < 10; i++) {
// tableData.value.push({
// cameraName: '123',
// type: (i % 3) + '',
// state: ['California', 'New York', 'Texas'][i % 3],
// city: ['Los Angeles', 'New York', 'Houston'][i % 3],
// address: `No. ${i + 1}00, Main St`,
// zip: ['CA 90036', 'NY 10001', 'TX 77002'][i % 3],
// tag: ['Home', 'Work', 'Other'][i % 3]
// })
// }
var statusTrans = (id) => {
switch (id) {
case '1':
return '海康'
case '2':
return '大华'
case '3':
return '手动录入'
}
}
const getTableList = async () => {
const res = await deviceApi.deviceList(pages)
// if (res.code === 50) {
// ElMessage.warning(res.message)
// return
// }
if (res.code === 200) {
tableData.value = res.data.records
total.value = res.data.total
}
}
getTableList()
eventBus.on('addOptionResuit', () => {
getTableList()
})
//------------------添加--------------------
const baseDialog: any = ref(null)
var peopleFormRef: any = ref('')
const peopleRules: any = reactive({
cameraName: [{ required: true, message: '请输入名称', trigger: 'blur' }],
ip: [{ required: true, message: '请输入ip', trigger: 'blur' }],
port: [{ required: true, message: '请输入设备端口号', trigger: 'blur' }],
userName: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
type: [{ required: true, message: '请选择设备类型', trigger: 'blur' }]
})
var close = () => {
baseDialog.value?.close()
// baseDialog.value = false
}
var edit = (type, row) => {
let addForm
if (row) {
addForm = JSON.parse(JSON.stringify(row))
addForm.areaId = +row.areaId
}
eventBus.emit('openAddDevice', { title: type, data: addForm })
}
var submitProtal = () => {
peopleFormRef.value.validate(async (valid) => {
if (valid) {
if (
addForm.value.channel === undefined ||
addForm.value.channel === '' ||
addForm.value.channel === null
) {
addForm.value.channel = 1
}
// const res = await cameraDataAdd(this.addForm)
// if (res.code === 50) {
// ElMessage.warning(res.message)
// return
// }
// if (res.code === 0) {
// ElMessage.success('添加成功')
// pDialogVisible.value = false
// // this.getList()
// }
} else {
console.log('error submit!!')
return false
}
})
}
const getTableList = () => {
console.log(1111111)
var delFun = (row) => {
ElMessageBox.confirm(
`删除该设备将在系统中永久消失,且及其所有关联数据将从系统中永久移除,您确定要执行该操作吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
.then(() => {
// let formData = new FormData()
// formData.append('id', row.id)
deviceApi.delDevice({ id: row.id }).then((res) => {
if (res.code === 200) {
ElMessage.success('删除成功')
getTableList()
}
})
})
.catch(() => {})
}
</script>
<style lang="scss">
::v-deep .addDevice {
background:
linear-gradient(180deg, rgba(0, 255, 255, 0.2) 0%, rgba(0, 255, 255, 0) 100%), rgba(0, 0, 0, 1) !important;
.el-dialog__title {
color: #fff !important;
}
}
</style>
<style scoped lang="scss">
::v-deep .el-form-item--label-right .el-form-item__label {
color: #fff !important;
}
::v-deep .el-form-item .el-input__wrapper {
background-color: transparent !important;
box-shadow: 0 0 0 0.5px #00ffff inset !important; /* 新增此行 */
}
::v-deep .el-form-item .el-select__wrapper {
background-color: transparent !important;
box-shadow: 0 0 0 0.5px #00ffff inset !important; /* 新增此行 */
}
::v-deep .el-form-item .el-input__inner {
color: #fff !important;
}
::v-deep .el-form-item .el-select__placeholder {
color: #fff !important;
}
.equipment {
width: 100%;
height: 100%;
@ -126,7 +268,7 @@ const getTableList = () => {
}
.nav_table {
width: 100%;
height: 40vh;
// height: 40vh;
// box-sizing: border-box;
overflow-y: auto; /* 垂直方向超出时显示滚动条 */
:deep(.el-table, .el-table__expanded-cell) {
@ -209,5 +351,37 @@ const getTableList = () => {
.nav_table::-webkit-scrollbar-track {
background-color: rgba(0, 255, 255, 0.2);
}
.deviceType {
display: inline-block;
width: 8px;
height: 8px;
border-radius: 4px;
background: red;
margin-right: 10px;
}
::v-deep .el-select__wrapper {
background-color: unset !important;
}
::v-deep .el-select__placeholder {
color: #fff !important;
}
::v-deep .el-select__wrapper.is-focused {
box-shadow: 0 0 0 1px #fff inset !important;
}
::v-deep .el-input__wrapper {
background-color: unset !important;
}
::v-deep .el-input__inner {
color: #fff !important;
}
::v-deep .el-input__wrapper.is-focus {
box-shadow: 0 0 0 1px #fff inset !important;
}
::v-deep .el-pager li * {
color: rgba(0, 255, 255, 1) !important;
}
::v-deep .el-pager li.is-active {
color: rgba(0, 255, 255, 1) !important;
}
}
</style>

View File

@ -151,7 +151,7 @@ const fs = require('fs')
const eventBus: any = inject('bus')
var clickTreeNode: any = reactive({})
var leftClickTreeNode: any = reactive({})
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
interface TypeNode {
id: string

View File

@ -159,7 +159,7 @@ const fs = require('fs')
const eventBus: any = inject('bus')
var clickTreeNode: any = reactive({})
var leftClickTreeNode: any = reactive({})
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
interface TypeNode {
id: string

View File

@ -193,7 +193,7 @@ const fs = require('fs')
const eventBus: any = inject('bus')
const imageRef: any = ref('')
var clickTreeNode: any = reactive({})
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
interface TypeNode {
id: string

View File

@ -48,7 +48,7 @@
<!-- 坐标系 -->
<div class="detailSkin">
<span>{{ t('systemSetting.coordinateSystem') }}</span>
<el-select
<!-- <el-select
style="width: 175px"
v-model="systemSetting.coordinate"
@change="sysChange"
@ -61,21 +61,81 @@
:value="item.epsg"
>
</el-option>
</el-select> -->
<el-select v-model="systemSetting.coordinate" @change="sysChange">
<div
class="group-header"
:class="isHotGroupOpen ? 'arrowActive' : ''"
@click="toggleGroup('hot')"
>
地理坐标系
<svg-icon
v-if="isHotGroupOpen"
name="arrow1"
:size="10"
color="rgba(0, 255, 255, 1)"
style="margin-left: 10px"
></svg-icon>
<svg-icon
v-else
name="arrow2"
:size="10"
color="rgba(255, 255, 255, 1)"
style="margin-left: 10px"
></svg-icon>
</div>
<div v-show="isHotGroupOpen">
<el-option
v-for="item in name_map1"
:key="item.epsg"
:label="item.name"
:value="item.epsg"
></el-option>
</div>
<div
class="group-header"
:class="isHotGroupOpen2 ? 'arrowActive' : ''"
@click="toggleGroup('ty')"
>
投影坐标系
<svg-icon
v-if="isHotGroupOpen2"
name="arrow1"
:size="10"
color="rgba(0, 255, 255, 1)"
style="margin-left: 10px"
></svg-icon>
<svg-icon
v-else
name="arrow2"
:size="10"
color="rgba(255, 255, 255, 1)"
style="margin-left: 10px"
></svg-icon>
</div>
<div v-show="isHotGroupOpen2">
<el-option
v-for="item in name_map"
:key="item.epsg"
:label="item.name"
:value="item.epsg"
></el-option>
</div>
</el-select>
</div>
<div class="detailSkin">
<div class="detailSkin" v-show="showPosiType">
<span>{{ t('systemSetting.latitude') }}</span>
<el-select
style="width: 175px"
v-model="systemSetting.coordinate"
v-model="systemSetting.positionType"
@change="sysChange"
placeholder="请选择"
>
<el-option
v-for="item in name_map"
:key="item.epsg"
v-for="item in position_map"
:key="item.value"
:label="item.name"
:value="item.epsg"
:value="item.value"
>
</el-option>
</el-select>
@ -343,7 +403,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import { inject } from 'vue'
import { inject, onMounted } from 'vue'
import { TreeApi } from '@/api/tree'
import { useTreeNode } from '../../../../tree/hooks/treeNode'
import { $sendElectronChanel } from '@/utils/communication'
@ -353,6 +413,10 @@ const { cusUpdateNode } = useTreeNode()
const { t } = useI18n()
const isHotGroupOpen: any = ref(false)
const isHotGroupOpen2: any = ref(false)
const showPosiType: any = ref(false)
const systemSetting = ref({
showFangliNet: false, // 方里网
showLatitudeLongitudeNetwork: false, //经纬网
@ -366,7 +430,8 @@ const systemSetting = ref({
sheetIndexStatusSwitch: false, //标准图幅
skinInfo: 'yingguangse', //主题色
language: '', //语言
coordinate: 'EPSG:4326' //坐标系
coordinate: 'EPSG:4326', //坐标系
positionType: '度'
})
const options = ref([
{ id: 'zh', label: '中文简体' },
@ -403,11 +468,31 @@ const concurrentWorkloadList = ref([
}
])
const name_map: any = ref([])
const name_map1: any = ref([])
const position_map: any = ref([
{
name: '度',
value: '度'
},
{
name: '度分',
value: '度分'
},
{
name: '度分秒',
value: '度分秒'
}
])
const searchWay = ref()
const concurrentcode = ref()
const showBattery = ref()
searchWay.value = localStorage.getItem('searchWay') || 'net'
concurrentcode.value = localStorage.getItem('concurrentcode') || 10
//系统坐标系
let tool = new YJ.Tools(window.earth)
name_map.value = Array.from(tool.name_map.values())
name_map1.value = name_map.value.splice(0, 2)
const sysChange = async () => {
const obj = {
compass: systemSetting.value.showCompass, //罗盘
@ -416,6 +501,8 @@ const sysChange = async () => {
// system.showFps
frame: systemSetting.value.showFps //刷新率
}
localStorage.setItem('systemSetting', JSON.stringify(systemSetting.value))
YJ.Global.CesiumContainer(window.earth, obj)
//经纬网
YJ.Global.JwwStatusSwitch(window.earth, systemSetting.value.showLatitudeLongitudeNetwork)
@ -423,6 +510,16 @@ const sysChange = async () => {
YJ.Global.FlwStatusSwitch(window.earth, systemSetting.value.showFangliNet)
//地形遮挡
YJ.Global.setGroundCover(window.earth, systemSetting.value.occlusion)
//系统
if (systemSetting.value.coordinate) {
let data = name_map1.value.filter((item) => item.epsg === systemSetting.value.coordinate)
showPosiType.value = data.length
}
let coor = systemSetting.value.coordinate ? systemSetting.value.coordinate : 'EPSG:4326'
YJ.Global.setCoordinateSystem(window.earth, coor)
//设置坐标格式
YJ.Global.setDMS(window.earth, systemSetting.value.positionType)
//比例尺
await YJ.Global.SheetIndexStatusSwitch(window.earth, systemSetting.value.sheetIndexStatusSwitch)
@ -451,7 +548,6 @@ const concurrentWorkloadChange = (val) => {
})
}
const setView = () => {
console.log('hhhhh')
let msg = '操作成功'
let view = YJ.Global.getCurrentView(window.earth)
const options = {
@ -460,7 +556,6 @@ const setView = () => {
}
YJ.Global.setDefaultView(window.earth, options)
localStorage.setItem('defaultView', JSON.stringify(options))
console.log('defaultView')
ElMessage({
message: msg,
type: 'success'
@ -479,8 +574,25 @@ const setData = () => {
}
})
}
const toggleGroup = (type: string) => {
if (type === 'hot') isHotGroupOpen.value = !isHotGroupOpen.value
if (type === 'ty') isHotGroupOpen2.value = !isHotGroupOpen2.value
}
const management = () => {}
const batteryChange = () => {}
onMounted(() => {
systemSetting.value = JSON.parse(localStorage.getItem('systemSetting'))
if (systemSetting.value.coordinate) {
let data = name_map1.value.filter((item) => item.epsg === systemSetting.value.coordinate)
showPosiType.value = data.length
if (data.length) {
isHotGroupOpen.value = true
} else {
isHotGroupOpen2.value = true
}
}
// sysChange()
})
</script>
<style lang="scss">
@ -575,4 +687,17 @@ const batteryChange = () => {}
margin-left: 5px;
font-size: 0.8rem;
}
.group-header {
width: 100%;
height: 30px;
padding: 8px 20px;
cursor: pointer;
font-weight: bold;
color: rgba(255, 255, 255, 1);
font-size: 12px;
font-weight: 400;
}
.arrowActive {
color: rgba(0, 255, 255, 1);
}
</style>

View File

@ -0,0 +1,592 @@
<template>
<div class="my_weather" id="my_weather">
<!-- <div class="move_pop" id="move_pop">
<span></span>
<span class="close" @click.capture="onClose"></span>
</div> -->
<div class="weather_content">
<div class="weather_content_hear">
<span class="xian"></span>
<span class="text">光照效果</span>
<svg-icon
class="switchClass"
name="switch"
:size="16"
:title="switchStatus ? '关闭光照' : '开启光照'"
:color="!switchStatus ? 'rgba(255, 255, 255, 1)' : 'rgba(0, 255, 255, 1)'"
@click="switchFunc"
></svg-icon>
</div>
<div class="weather_content_body1">
<span class="lightTip">模拟设定时间范围内的太阳光照效果</span>
<div class="div-item">
<div class="row">
<div class="col">
<span class="label">实时天气</span>
<el-switch
v-model="weatherData.currWeather"
style="--el-switch-on-color: #00ffff; --el-switch-off-color: #003333"
@change="weatherChange"
>
</el-switch>
</div>
</div>
<div class="row">
<div class="col">
<div class="timeline-container">
<div class="timeline" id="timeline">
<div class="progress" id="progress">
<div class="handle" id="handle"></div>
<div class="current-time" id="currentTime">00:00:00</div>
</div>
</div>
<div class="time-marks"></div>
<!-- <button id="timePause">暂停</button> -->
</div>
</div>
</div>
<div class="iconCon">
<div class="item_icon" v-for="(item, index) in timelist" :key="index">
<svg-icon
:name="item.svg"
:size="20"
:color="!item.status ? 'rgba(255, 255, 255, 1)' : 'rgba(0, 255, 255, 1)'"
@click="clickIcon(item)"
></svg-icon>
<div>
<span :class="['icon_text', !item.status ? '' : 'active']">{{ item.name }}</span>
</div>
</div>
</div>
<div class="row">
<div class="col">
<span class="label">阴影优化</span>
<el-switch
v-model="weatherData.softShadow"
style="--el-switch-on-color: #00ffff; --el-switch-off-color: #003333"
@change="shadowChange"
>
</el-switch>
</div>
</div>
<div class="row">
<div class="col">
<span class="label">阴影柔和度</span>
<el-input
class="input height"
type="number"
step="0.1"
min="0"
max="1"
v-model="weatherData.darkness"
@change="changDarkness"
/>
</div>
</div>
<div class="row">
<div class="col">
<span class="label">倍数</span>
<el-input
class="input height"
type="number"
min="-9999999"
max="999999999"
v-model="weatherData.speed"
@change="changSpeed"
size="small"
>
<template #suffix>
<span>X</span>
</template>
</el-input>
</div>
</div>
<div class="row">
<div class="col">
<span class="label">日期选择</span>
<el-date-picker
v-model="weatherData.time"
type="date"
value-format="YYYY-MM-DD"
placeholder="Pick a day"
size="small"
@change="weatherTimeChange"
/>
</div>
</div>
<div class="row">
<div class="col">
<span class="label">自动播放</span>
<!-- <button id="timePause">暂停</button> -->
<button id="timePause">播放</button>
</div>
</div>
</div>
</div>
<div class="weather_content_hear">
<span class="xian"></span>
<span class="text">天气效果</span>
<span class="text_two">可叠加以下天气类型</span>
</div>
<div class="weather_content_body">
<div class="item_icon" v-for="(item, index) in list" :key="index">
<svg-icon
:name="item.svg"
:size="20"
:color="!item.status ? 'rgba(255, 255, 255, 1)' : 'rgba(0, 255, 255, 1)'"
@click="clickIcon(item)"
></svg-icon>
<div>
<span :class="['icon_text', !item.status ? '' : 'active']">{{ item.name }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { reactive, onMounted, onBeforeUnmount } from 'vue'
import { ElMessage } from 'element-plus'
import TimeLine from './timeLIne'
import { before } from 'node:test'
var sunshine
var timeline
var list = reactive([
// 雨
{
// fun: this.toDo,
name: '雨',
svg: 'rain',
status: false
},
// 雪
{
// fun: this.toDo,
name: '雪',
svg: 'snow',
status: false
},
//雾
{
// fun: this.toDo,
name: '雾',
svg: 'fog',
status: false
},
//星空
{
// fun: this.toDo,
name: '星空',
svg: 'skystarry',
status: false
}
])
var timelist = reactive([
// 雨
{
name: '清晨',
svg: 'qc',
status: false
},
// 雪
{
name: '正午',
svg: 'zw',
status: false
},
//雾
{
name: '黄昏',
svg: 'hh',
status: false
},
//星空
{
name: '夜晚',
svg: 'pw',
status: false
}
])
var switchStatus = ref(false)
const now = new Date()
const formattedDate = now.toISOString().slice(0, 10)
var weatherData: any = reactive({
currWeather: true,
softShadow: true,
darkness: 0.4,
speed: 1,
time: formattedDate
})
onMounted(() => {
timeline = new TimeLine(window.earth, weatherData.speed)
// sunshine = new YJ.Global.efflect.Sunshine(window.earth, { id: 123 })
timeline.moveComplay((item) => {
weatherData.currWeather = false
sunshine.timeBar = item
})
// timeline.updateTime()
// timeline.setCurrBar()
})
onBeforeUnmount(() => {
sunshine && sunshine.remove()
timeline && timeline.clear()
})
var weatherChange = () => {
if (weatherData.currWeather) {
let ss = getCurrentTime()
sunshine.timeBar = ss
weatherData.speed = 1
sunshine && (sunshine.speed = weatherData.speed)
timeline.setSpeed(weatherData.speed)
}
}
var getCurrentTime = () => {
const now = new Date()
const hours = String(now.getHours()).padStart(2, '0')
const minutes = String(now.getMinutes()).padStart(2, '0')
const seconds = String(now.getSeconds()).padStart(2, '0')
return `${hours}:${minutes}:${seconds}`
}
var switchFunc = () => {
switchStatus.value = !switchStatus.value
if (switchStatus.value) {
//开启
sunshine = new YJ.Global.efflect.Sunshine(window.earth, {
id: 123,
speed: weatherData.speed,
time: weatherData.time,
hour: document.getElementById('currentTime').textContent
})
timeline.setSunShine(true)
} else {
//关闭
sunshine && sunshine.remove()
sunshine = null
let timeData = now.setHours(0, 0, 0, 0) // 设置为当天0点
timeline.updateTime(timeData)
timeline.setSunShine(false)
}
}
//雨特效
var func = {
rain: (item) => {
YJ.Global.efflect.rain(window.earth, item.status)
},
//雪
snow: (item) => {
YJ.Global.efflect.snow(window.earth, item.status)
},
//雾
fog: (item) => {
YJ.Global.efflect.fog(window.earth, item.status)
},
// 星空
skystarry: (item) => {
YJ.Global.efflect.skyStarry(window.earth, item.status)
}
}
var clickIcon = (item: any) => {
if ((window as any).checkAuthIsValid) {
item.status = !item.status
func[item.svg](item)
} else {
ElMessage({
message: '您没有该功能的权限',
type: 'warning'
})
}
}
var changDarkness = () => {
sunshine && (sunshine.darkness = weatherData.darkness)
}
var changSpeed = () => {
weatherData.currWeather = false
sunshine && (sunshine.speed = weatherData.speed)
timeline.setSpeed(weatherData.speed)
}
var weatherTimeChange = () => {
const now = new Date()
let timeData = now.setHours(0, 0, 0, 0) // 设置为当天0点
timeline.updateTime(timeData)
sunshine && (sunshine.time = weatherData.time)
}
var onClose = () => {}
var shadowChange = () => {
sunshine && (sunshine.softShadow = weatherData.softShadow)
}
</script>
<style lang="scss">
.my_weather {
// display: none;
position: fixed;
top: 85px;
left: 260px;
width: 250px;
height: auto;
z-index: 30;
background:
linear-gradient(180deg, rgba(0, 255, 255, 0) 0%, rgba(0, 255, 255, 0.2) 100%),
rgba(0, 0, 0, 0.6);
padding: 10px;
border: 1.5px solid aqua;
.move_pop {
position: relative;
color: #fff;
text-align: center;
height: 30px;
line-height: 30px;
.close {
position: absolute;
top: 0;
right: 10px;
cursor: pointer;
}
}
.weather_content_hear {
display: flex;
align-items: center;
height: 30px;
position: relative;
// margin-bottom: 20px;
.switchClass {
position: absolute;
top: 6px;
right: 10px;
cursor: pointer;
}
span {
// margin-right: 10px;
}
.xian {
display: inline-block;
height: 15px;
width: 2px;
background-color: aqua;
}
.text {
color: #fff;
font-size: 14px;
font-weight: 700;
// font-family: 'alimamashuheiti';
}
.text_two {
font-size: 12px;
font-weight: 400;
color: rgba(173, 241, 255, 1);
}
}
.weather_content_body1 {
.lightTip {
font-size: 12px;
font-weight: 400;
color: rgba(204, 204, 204, 1);
position: relative;
display: block;
left: 10px;
}
.label {
margin-right: 10px;
white-space: nowrap;
}
.timeline-container {
width: 100%;
padding: 20px 15px;
position: relative;
}
.timeline {
height: 2px;
background: rgba(0, 255, 255, 0.8);
border-radius: 15px;
position: relative;
cursor: pointer;
}
.progress {
height: 100%;
width: 0;
background: rgba(var(--color-sdk-base-rgb), 1);
border-radius: 15px;
position: relative;
}
.handle {
width: 16px;
height: 16px;
background: white;
/* border: 3px solid #4285f4; */
background: unset;
border-radius: 50%;
position: absolute;
right: -8px;
top: 50%;
transform: translateY(-50%);
cursor: grab;
background-image: url('@/assets/img/sun.png');
background-size: cover;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
z-index: 2;
}
.time-marks {
display: flex;
justify-content: space-between;
margin-top: 5px;
}
.time-mark {
font-size: 12px;
color: #fff;
}
.time-Point {
width: 8px;
height: 8px;
background: rgba(0, 255, 255, 0.8);
border-radius: 4px;
position: absolute;
top: 17px;
z-index: 1;
}
.time-Point:nth-child(10) {
left: 11px;
}
.time-Point:nth-child(2) {
left: 60.5px;
}
.time-Point:nth-child(4) {
left: 110px;
}
.time-Point:nth-child(6) {
left: 155.5px;
}
.time-Point:nth-child(8) {
left: 209px;
}
.controls {
margin: 15px 0;
}
.current-time {
font-size: 12px;
position: absolute;
width: 50px;
text-align: center;
right: -25px;
top: -200%;
transform: translateY(-100%);
color: rgba(255, 223, 83, 1);
}
#timePause {
// margin-top: 10px;
background: rgba(0, 255, 255, 0.2) !important;
border: 1px solid rgba(0, 255, 255, 0.5) !important;
color: #fff !important;
width: 48px !important;
height: 24px !important;
margin-top: 4px;
font-size: 12px !important;
font-weight: 400 !important;
line-height: 24px !important;
cursor: pointer;
}
.iconCon {
display: flex;
color: #fff;
justify-content: space-between;
text-align: center;
.item_icon {
width: 32px;
height: 45px;
cursor: pointer;
font-size: 12px;
font-weight: 400;
}
.item_icon:hover {
color: rgba(var(--color-sdk-base-rgb), 1) !important;
.svg-icon {
color: rgba(var(--color-sdk-base-rgb), 1) !important;
}
}
.active {
color: rgba(var(--color-sdk-base-rgb), 1) !important;
}
}
.row .col {
display: flex;
padding: 5px 0px 5px 0px;
.label {
line-height: 32px;
}
.el-input {
height: 32px !important;
}
.el-input__wrapper {
background-color: rgba(0, 0, 0, 0.5) !important;
border: 1px solid rgba(0, 255, 255, 0.5) !important;
box-shadow: unset !important;
}
.el-input__inner {
color: #fff !important;
}
.el-switch.is-checked .el-switch__core .el-switch__action {
left: calc(100% - 11px) !important;
}
.el-switch__core {
min-width: 30px !important;
height: 13px;
}
.el-switch__core .el-switch__action {
width: 11px !important;
height: 11px !important;
}
}
}
.weather_content_body {
display: flex;
color: #fff;
justify-content: space-around;
text-align: center;
.item_icon {
width: 32px;
height: 45px;
cursor: pointer;
font-size: 12px;
font-weight: 400;
margin-top: 10px;
}
.item_icon:hover {
color: rgba(var(--color-sdk-base-rgb), 1) !important;
.svg-icon {
color: rgba(var(--color-sdk-base-rgb), 1) !important;
}
}
.active {
color: rgba(var(--color-sdk-base-rgb), 1) !important;
}
}
}
</style>

View File

@ -0,0 +1,236 @@
import { ElMessage } from 'element-plus'
export default class TimeLine {
constructor(sdk, speed) {
this.sdk = { ...sdk };
this.progress = document.getElementById('progress');
this.handle = document.getElementById('handle');
// this.timeline = document.getElementById('timeline');
this.timeline = document.getElementsByClassName('timeline-container')[0];
this.currentTime = document.getElementById('currentTime');
this.timelineCon = document.getElementsByClassName('timeline-container')[0];
this.speed = speed;
this.animationId;
this.startTime = performance.now();
this.manualPosition = null;
// this.manualPosition = this.calculateTimePercentage();
this.isDragging = false;
this.pauseed = true;
this.time = '';
this.sunShine = false;
if (this.pauseed) {
this.pausedTime = this.startTime
}
this.update = this.update.bind(this);
TimeLine.init(this)
}
static init(that) {
for (let i = 0; i <= 24; i++) {
if (i % 6 === 0) {
const label = document.createElement('div');
label.className = 'time-mark';
label.textContent = `${i}:00`;
label.style.left = `${(i / 24) * 100}%`;
document.getElementsByClassName('time-marks')[0].appendChild(label)
const point = document.createElement('div');
point.className = 'time-Point';
document.getElementsByClassName('time-marks')[0].appendChild(point)
}
}
that.setCurrBar()//设置当前时间
that.startTime = performance.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed);
that.timeline.addEventListener('mousedown', (e) => {
if (e.srcElement.className === 'handle') {
if (!that.sunShine) {
ElMessage({
message: '请开启光照功能',
type: 'warning'
})
} else {
that.isDragging = true;
}
}
e.preventDefault();
});
that.timeline.addEventListener('mousemove', (e) => {
if (!that.isDragging) return;
const rect = that.timeline.getBoundingClientRect();
let pos = (e.clientX - rect.left) / rect.width;
pos = Math.max(0, Math.min(1, pos));
that.manualPosition = pos;
that.progress.style.width = `${pos * 100}%`;
const seconds = pos * 86400;
that.currentTime.textContent = that.formatTime(seconds);
});
that.update();
document.getElementById('timePause').addEventListener('click', function () {
if (!that.sunShine) {
ElMessage({
message: '请开启光照功能',
type: 'warning'
})
} else {
that.pauseed = !that.pauseed;
if (that.pauseed) {//暂停
that.pausedTime = performance.now(); // 记录暂停时刻
document.getElementById('timePause').textContent = '播放';
that.animationId && cancelAnimationFrame(that.animationId);
that.sdk.viewer.clock.shouldAnimate = false
} else {//播放
let now = performance.now()
const pausedDuration = now - that.pausedTime;
document.getElementById('timePause').textContent = '暂停';
that.manualPosition = null
that.startTime += pausedDuration; // 补偿暂停期间的时间差
if (that.changeDate) {//切换日期后让时间从0开始
if (that.changeDateGrag) {
that.changeDateGrag = undefined
} else {
that.startTime = now
}
that.changeDate = undefined
}
that.sdk.viewer.clock.shouldAnimate = true
that.update(); // 重启动画循环
}
}
});
}
setSunShine(v) {
this.sunShine = v
if (this.sunShine) {
document.getElementById('timePause')?.click()
} else {
this.pauseed = true
this.pausedTime = performance.now(); // 记录暂停时刻
document.getElementById('timePause').textContent = '播放';
this.animationId && cancelAnimationFrame(this.animationId);
this.sdk.viewer.clock.shouldAnimate = false
// document.getElementById('timePause')?.click()
}
}
calculateTimePercentage() {
// 获取当前时间
const now = new Date();
const hours = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
// 计算当前时间总秒数
const totalSeconds = (hours * 3600) + (minutes * 60) + seconds;
// 24小时总秒数
const totalSecondsInDay = 24 * 3600;
// 计算百分比并保留两位小数
const percentage = (totalSeconds / totalSecondsInDay);
return percentage;
}
moveComplay(func) {
let that = this
// that.timeline.addEventListener('mouseup', () => {
document.addEventListener('mouseup', () => {
if (that.isDragging) {
that.isDragging = false;
if (that.manualPosition !== null) {
// that.sdk.viewer.clock.shouldAnimate = true
that.startTime = performance.now() - (that.manualPosition * 86400 * 1000 / that.speed);
that.manualPosition = null;
that.changeDate && (that.changeDateGrag = true)
if (!that.pauseed) {
that.update()
func(that.time)
} else {
that.pausedTime = performance.now(); // 记录暂停时刻
func(that.currentTime.textContent)
}
}
}
});
}
setCurrBar() {
let pos = this.calculateTimePercentage()
this.manualPosition = pos;
this.progress.style.width = `${pos * 100}%`;
const seconds = pos * 86400;
this.currentTime.textContent = this.formatTime(seconds);
}
formatTime(seconds) {
const hrs = Math.floor(seconds / 3600).toString().padStart(2, '0');
const mins = Math.floor((seconds % 3600) / 60).toString().padStart(2, '0');
const secs = Math.floor(seconds % 60).toString().padStart(2, '0');
return `${hrs}:${mins}:${secs}`;
}
update() {
if (this.manualPosition !== null) return;
if (this.changeDate) {//切换日期后让时间从0开始
this.startTime = performance.now()
}
let elapsed = (performance.now() - this.startTime) * this.speed;
// if (this.elapsed) {
// elapsed = elapsed + this.elapsed
// this.elapsed = undefined
// }
const totalSeconds = elapsed / 1000;//秒
const daySeconds = totalSeconds % 86400;//天
const percentage = daySeconds / 86400;
this.progress.style.width = `${percentage * 100}%`;
this.time = this.formatTime(daySeconds)
this.currentTime.textContent = this.time;
if (!this.pauseed) {
this.animationId && cancelAnimationFrame(this.animationId);
this.animationId = requestAnimationFrame(this.update);
}
}
setSpeed(v) {
let now = performance.now()
if (!this.pauseed) {
const currentProgress = this.manualPosition ??
(performance.now() - this.startTime) * this.speed / (86400 * 1000);
this.speed = v;
this.startTime = performance.now() - (currentProgress * 86400 * 1000 / this.speed);
} else {
let pausedDuration = now - this.pausedTime;
this.startTime += pausedDuration; // 补偿暂停期间的时间差
const currentProgress = this.manualPosition ??
(now - this.startTime) * this.speed / (86400 * 1000);
this.speed = v;
this.startTime = now - (currentProgress * 86400 * 1000 / this.speed);
this.pausedTime = now; // 记录切换speed暂停时刻
// this.speed = v;
}
this.manualPosition = null;
// this.update();
}
updateTime() {
this.manualPosition = null;
this.startTime = performance.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed);
this.pauseed && (this.changeDate = true)
this.changeDateGrag = undefined
this.update();
}
clear() {
this.animationId && cancelAnimationFrame(this.animationId);
this.progress.style.width = '0%';
this.currentTime.textContent = '00:00:00';
}
}

View File

@ -11,10 +11,11 @@
<span>{{ t(`week.${date.week}`) }}</span>
</div>
<div class="weather">
<svg-icon name="weather" :size="40"></svg-icon>
<svg-icon name="weather" :size="40" @click="clickFun"></svg-icon>
</div>
</div>
<setTool ref="setToolRef"></setTool>
<weather ref="weatherRef" v-if="weatherClick"></weather>
<!-- <headButton class="headButton"></headButton> -->
</div>
@ -23,6 +24,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import setTool from './components/setTool/setTool.vue'
import weather from './components/weather/index.vue'
const { t } = useI18n()
const date = ref({
@ -30,6 +32,7 @@ const date = ref({
hms: '',
week: 0
})
var weatherClick = ref(false)
const setTime = () => {
let date1 = new Date()
let year: any = date1.getFullYear()
@ -58,6 +61,11 @@ onUnmounted(() => {
clearInterval(timer)
})
var clickFun = () => {
weatherClick.value = !weatherClick.value
console.log('点击天气', weatherClick.value)
}
// onMounted(() => {
// console.log($t('headerTitles.week'))
// })

View File

@ -23,6 +23,7 @@ import { ref, reactive, getCurrentInstance } from 'vue'
import { initMapData } from '../../../common/initMapData'
import { useTreeNode } from '../tree/hooks/treeNode'
import { TreeApi } from '@/api/tree'
import { gdbApi } from '@/api/gdb'
import { renderMethods } from '../tree/hooks/renderTreeNode'
import { addMapSource } from '../../../common/addMapSource'
import { processBase64Images, combineBase64Images } from '@/utils/HighDefinitionScreenshot'
@ -33,6 +34,7 @@ import {
} from '@/utils/communication'
import { ElMessage, ElLoading } from 'element-plus'
import dayjs from 'dayjs'
import { renderVector } from '../tree/components/hooks/renderVector'
const { ipcRenderer } = require('electron')
const { t } = useI18n()
const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
@ -87,8 +89,6 @@ const handleKeyDown = (e) => {
if (clickChange.videoRecord) {
methodMap['videoRecord']()
}
console.log('全局ESC监听')
}
}
window.addEventListener('keydown', handleKeyDown)
@ -177,7 +177,6 @@ const methodMap = {
diffuseScan: () => {
let draw = new YJ.Draw.DrawCircle(window.earth)
draw.start((err, options) => {
console.log('options', options)
if (options) {
let id = new YJ.Tools().randomString()
let name = '扩散光波'
@ -205,7 +204,6 @@ const methodMap = {
radarScan: () => {
let draw = new YJ.Draw.DrawCircle(window.earth)
draw.start((err, options) => {
console.log('options', options)
if (options) {
let id = new YJ.Tools().randomString()
let name = '雷达光波'
@ -688,7 +686,6 @@ const methodMap = {
if (selectedNode) {
let isTileset = ['bim', 'tileset'].includes(selectedNode.sourceType)
if (!isTileset) {
console.log('aaaaaa')
ElMessage({
message: '请在图层指挥舱选中对应模型进行操作',
type: 'warning'
@ -744,7 +741,6 @@ const methodMap = {
}
})
} else {
console.log('bbbbb')
ElMessage({
message: '请在图层指挥舱选中对应模型进行操作',
type: 'warning'
@ -815,7 +811,63 @@ const methodMap = {
eventBus.emit('ProjectionConvertDialog')
},
//GDB导入
gdbImport() {},
gdbImport() {
let option = {
properties: ['openDirectory'],
filters: []
}
$sendElectronChanel('open-directory-dialog', option)
$recvElectronChanel('selectedItem', (e, path) => {
if (path.length) {
// let formData = new FormData()
// formData.append('path', path[0])
// gdbApi.importGdb(formData).then((res) => {
// console.log(res, 'resresres')
// if (res.status === 200) {
// ElMessage({
// message: '导入成功',
// type: 'success'
// })
// let path = path[0]
let arr = path[0].split('/')
let name = arr[arr.length - 1]
let id = new YJ.Tools().randomString()
let selectedNode = window.treeObj.getSelectedNodes()[0]
let DbOption: any = {
params: {
id: id,
path: path[0],
field: 'id',
name: name,
headTables: [],
opacity: 1,
color: 'rgba(0,255,184,0.5)',
show: true
},
id,
sourceName: name,
sourceType: 'vector',
// isShow: true,
// sourcePath: path[0],
parentId: selectedNode
? selectedNode.sourceType == 'directory'
? selectedNode.id
: selectedNode.parentId
: undefined
}
TreeApi.addOtherSource(DbOption)
DbOption.isShow = true
DbOption.params = JSON.stringify(DbOption.params)
cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
let entityObject = renderVector(DbOption, true)
;(window as any)._entityMap.set(id, entityObject)
// }
// })
}
})
},
//圆形统计
circleStatistics() {
if ((window as any).checkAuthIsValid) {
@ -841,7 +893,6 @@ const methodMap = {
}
const handleClick = (value = 'projectionDistanceMeasure') => {
console.log('点击了', value)
methodMap[value]()
}
defineExpose({

View File

@ -0,0 +1,196 @@
<template>
<Dialog
ref="baseDialog"
class="addDevice"
:title="addTitle"
left="calc(50% - 160px)"
top="calc(50% - 120px)"
>
<template #content>
<el-form label-width="100px" :model="addForm" :rules="peopleRules" ref="peopleFormRef">
<el-form-item label="名称" prop="cameraName">
<el-input v-model="addForm.cameraName" clearable />
</el-form-item>
<el-form-item label="设备IP" prop="ip">
<el-input v-model="addForm.ip" clearable></el-input>
</el-form-item>
<el-form-item label="设备端口" prop="port">
<el-input v-model="addForm.port" clearable></el-input>
</el-form-item>
<el-form-item label="用户名" prop="userName">
<el-input v-model="addForm.userName" clearable></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="addForm.password" clearable></el-input>
</el-form-item>
<el-form-item label="设备类型" prop="type">
<el-select v-model="addForm.type" filterable placeholder="请选择">
<el-option label="海康" value="1"> </el-option>
<el-option label="大华" value="2"> </el-option>
<!-- <el-option label="手动录入" value="3"> </el-option> -->
</el-select>
</el-form-item>
<el-form-item v-if="addForm.type === '3'" label="视频流地址" prop="flvUrl">
<el-input v-model="addForm.flvUrl" clearable></el-input>
</el-form-item>
<el-form-item label="通道号" prop="channel">
<el-input v-model="addForm.channel" clearable></el-input>
</el-form-item>
</el-form>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="submitProtal"> 确定 </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { inject } from 'vue'
import { TreeApi } from '@/api/tree'
import Dialog from '@/components/dialog/baseDialog.vue'
import { initMapData } from '../../../common/initMapData'
import { useTreeNode } from '../tree/hooks/treeNode'
import { deviceApi } from '@/api/deviceManage/index'
import { ElMessage, ElMessageBox } from 'element-plus'
const { cusAddNodes } = useTreeNode()
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
var addTitle = ref('')
var peopleFormRef: any = ref('')
var addForm: any = reactive({
cameraName: '',
ip: '',
port: '',
userName: '',
password: '',
type: '',
channel: '',
flvUrl: ''
})
const peopleRules: any = reactive({
cameraName: [{ required: true, message: '请输入名称', trigger: 'blur' }],
ip: [{ required: true, message: '请输入ip', trigger: 'blur' }],
port: [{ required: true, message: '请输入设备端口号', trigger: 'blur' }],
userName: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
type: [{ required: true, message: '请选择设备类型', trigger: 'blur' }]
})
var cancel = () => {
// pDialogVisible.value = false
baseDialog.value?.close()
addForm = {
cameraName: '',
ip: '',
port: '',
userName: '',
password: '',
type: '',
channel: '',
flvUrl: ''
}
}
var submitProtal = () => {
peopleFormRef.value.validate(async (valid) => {
if (valid) {
if (addForm.channel === undefined || addForm.channel === '' || addForm.channel === null) {
addForm.channel = 1
}
if (addTitle.value == '添加设备') {
const res = await deviceApi.addDevice(addForm)
if (res.code === 200) {
ElMessage.success('操作成功')
eventBus.emit('addOptionResuit')
}
} else {
delete addForm.updatedAt
delete addForm.areaId
delete addForm.createdAt
const res = await deviceApi.updateDevice(addForm)
if (res.code === 200) {
ElMessage.success('操作成功')
eventBus.emit('addOptionResuit')
}
}
baseDialog.value?.close()
} else {
console.log('error submit!!')
return false
}
})
}
eventBus.on('openAddDevice', (params) => {
addTitle.value = params.title
if (addTitle.value != '添加设备') {
addForm = params.data
} else {
addForm = {
cameraName: '',
ip: '',
port: '',
userName: '',
password: '',
type: '',
channel: '',
flvUrl: ''
}
}
baseDialog.value?.open()
})
const open = () => {
baseDialog.value?.open()
}
const confirm = () => {
baseDialog.value?.close()
}
defineExpose({
open
})
</script>
<style lang="scss">
.YJ-custom-base-dialog.addDevice > .content input,
.YJ-custom-base-dialog.addDevice > .content textarea {
background-color: transparent !important;
border: unset !important;
}
</style>
<style scoped lang="scss">
::v-deep .el-form-item--label-right .el-form-item__label {
color: #fff !important;
}
::v-deep .el-form-item .el-input__wrapper {
background-color: rgba(0, 0, 0, 0.5) !important;
box-shadow: 0 0 0 0.5px #00ffff inset !important; /* 新增此行 */
}
::v-deep .el-form-item .el-select__wrapper {
background-color: rgba(0, 0, 0, 0.5) !important;
box-shadow: 0 0 0 0.5px #00ffff inset !important; /* 新增此行 */
:deep(input) {
background-color: transparent !important;
border: unset !important;
}
}
::v-deep .el-form-item .el-input__inner {
color: #fff !important;
}
::v-deep .el-form-item .el-select__placeholder {
color: #fff !important;
}
::v-deep .el-input__wrapper {
padding: 0px !important;
}
::v-deep .el-button:hover {
background-color: rgba(0, 255, 255, 0.2) !important;
color: rgba(0, 255, 255, 1) !important;
}
</style>

View File

@ -29,6 +29,7 @@ const open = () => {
baseDialog.value?.open()
}
const confirm = () => {
console.log('121212121', baseDialog.value)
baseDialog.value?.close()
let name = text.value
text.value = ''
@ -38,11 +39,15 @@ const confirm = () => {
return
}
let id = new YJ.Tools().randomString()
let options: any = await initMapData('groundText', {
id: id,
text: name,
positions: positions
}, null)
let options: any = await initMapData(
'groundText',
{
id: id,
text: name,
positions: positions
},
null
)
delete options.host
delete options.positions
let selectedNodes = window.treeObj.getSelectedNodes()
@ -51,8 +56,7 @@ const confirm = () => {
if (node) {
if (node.sourceType === 'directory') {
parentId = node.id
}
else {
} else {
parentId = node.parentId
}
}

View File

@ -121,7 +121,7 @@ const isShowPup = ref(false)
const eventBus: any = inject('bus')
const { cusUpdateNode } = useTreeNode()
var modelName = ref('')
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
//tab
interface Model {

View File

@ -45,7 +45,7 @@ const eventBus: any = inject('bus')
const viewPointHeight: any = ref(1.8)
var rowData: any = reactive([])
var imageData: any = ref(null)
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
// var newData: any = reactive({
// name: ''
// })

View File

@ -122,7 +122,7 @@ const eventBus: any = inject('bus')
var modelName = ref('')
var clickTreeNode: any = ref('')
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
//tab
interface Model {
@ -358,7 +358,8 @@ const renderModel = async (data, model) => {
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 = {
params: option,

View File

@ -173,7 +173,7 @@ const { cusUpdateNode } = useTreeNode()
var modelName = ref('')
const availablePort = ref(55110)
const service = ref(localStorage.getItem('service'))
const service = ref(localStorage.getItem('ip'))
ipcRenderer.invoke('get-available-port').then((port) => {
availablePort.value = port

View File

@ -13,7 +13,7 @@
<div class="col">
<span class="label">名称字段选择</span>
<el-select v-model="entityOptions.field">
<el-option v-for="item in keyData" :label="item.name" :value="item.key"></el-option>
<el-option v-for="item in keyData" :label="item.label" :value="item.key"></el-option>
</el-select>
</div>
</div>
@ -57,8 +57,7 @@ const getKeys = () => {
}
}
keyData.value.push({
name: label,
value: label,
label: label,
key: key
})
}
@ -80,6 +79,11 @@ const confirm = () => {
name: entityOptions.value.name,
show: entityOptions.value.show,
id: entityOptions.value.options.id,
path: entityOptions.value.options.path,
field: entityOptions.value.field,
headTables: entityOptions.value.options.headTables,
opacity: entityOptions.value.opacity,
color: entityOptions.value.color,
}
let params2 = {
"id": params.id,

View File

@ -0,0 +1,266 @@
<template>
<Dialog ref="baseDialog" :title="title" width="900px" left="calc(50% - 450px)" top="calc(50% - 360px)"
:closeCallback="closeCallback">
<template #content>
<span class="custom-divider"></span>
<div class="div-item">
<div class="row">
<div class="col">
<input type="text" placeholder="输入关键字搜索" v-model="keyword" @input="search">
<button class="btn" style="margin-left: 10px;" @click="exportExcel">导出</button>
</div>
<div class="col">
<span class="label">名称字段选择</span>
<el-select v-model="entityOptions.field" @change="changeFieId">
<el-option v-for="item in keyData" :label="item.label" :value="item.key"></el-option>
</el-select>
</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col table-box">
<div class="table">
<div class="table-head">
<div class="tr">
<div class="th" v-for="field in keyData" :title="field.label">
<p>{{ field.label }}</p>
</div>
</div>
</div>
<div class="table-body">
<div class="tr" v-for="item in tableData">
<div class="td" v-for="td in keyData" :title="item.properties[td.key]">
<p>{{ item.properties[td.key] }}</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<Pagination :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" />
</div>
</div>
</template>
<template #footer>
<button @click="close">关闭</button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { inject } from 'vue'
import { TreeApi } from '@/api/tree'
import { ElMessage, ElMessageBox } from 'element-plus'
import Dialog from '@/components/dialog/baseDialog.vue'
import { useTreeNode } from '../tree/hooks/treeNode'
const FileSaver = require('file-saver')
const XLSX = require('xlsx')
const { cusUpdateNode, getSelectedNodes, cusRemoveNode } = useTreeNode()
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
const keyData: any = ref([])
const keyword: any = ref('')
const entityOptions: any = ref({});
let originalOptions: any
let that: any
const tableData: any = ref([])
const total: any = ref(0)
const pageSize: any = ref(20)
const pageNum: any = ref(1)
const maxPageNum: any = ref(0)
const filterData: any = ref([])
const title = ref('')
const closeCallback = () => {
entityOptions.value.originalOptions = structuredClone(originalOptions)
entityOptions.value.reset()
eventBus.emit("destroyComponent")
}
const getKeys = () => {
for (let key in that.geojson.features[0].properties) {
let label = key
for (let index = 0; index < that.options.headTables.length; index++) {
if (that.options.headTables[index].key === key) {
label = that.options.headTables[index].label
break
}
}
keyData.value.push({
label: label,
key: key
})
}
}
let node
let parentNode
let features
const open = async (id: any) => {
// that = window.earth.entityMap.get(id)
node = window.treeObj.getNodeByParam("id", id, null);
that = getThat(node)
if (that.options.id === id) {
features = that.geojson.features
}
else {
features = [node.params]
}
console.log(features, that, id)
let arr = JSON.parse(JSON.stringify(features))
filterData.value = JSON.parse(JSON.stringify(arr))
total.value = filterData.value.length
let spliceData = arrSplice(arr, pageSize.value)
maxPageNum.value = spliceData.length
tableData.value = spliceData[pageNum.value - 1]
title.value = node.sourceName
getKeys()
originalOptions = structuredClone(that.options)
entityOptions.value = that
baseDialog.value?.open()
await nextTick()
}
const getThat = (n) => {
if (n) {
let t = window.earth.entityMap.get(n.id)
if (t) {
parentNode = n
return t
}
else {
if (n.parentId) {
return getThat(window.treeObj.getNodeByParam("id", n.parentId, null))
}
}
}
}
const search = () => {
let val = keyword.value
let fuzzySearch = (list, keyWord, attribute: any = []) => {
const reg = new RegExp(keyWord) // 创建正则表达式
const arr: any = []
for (let i = 0; i < list.length; i++) {
let isFind = false
for (let j = 0; j < attribute.length; j++) {
if (list[i].properties[attribute[j].key]) {
isFind = reg.test(list[i].properties[attribute[j].key])
if (isFind) {
arr.push(list[i])
break
}
}
}
}
console.log(arr)
return arr
}
let arr = fuzzySearch(features, val, keyData.value)
filterData.value = JSON.parse(JSON.stringify(arr))
total.value = filterData.value.length
let spliceData = arrSplice(arr, pageSize.value)
maxPageNum.value = spliceData.length
tableData.value = spliceData[pageNum.value - 1]
}
const arrSplice = (arr, chunkSize) => {
//定义一个空数组来接收返回值
const resSplice: any = []
while (arr.length > 0) {
//注意splice方法的返回值为删除的值在这边即为原数组中切割掉的index为0-chunkSize的值
const chunk = arr.splice(0, chunkSize)
//将返回值添加到resSplice数组
resSplice.push(chunk)
}
//return出去
return resSplice
}
const getTableList = ({ page, limit }) => {
pageNum.value = page
pageSize.value = limit
let arr = JSON.parse(JSON.stringify(filterData.value))
let spliceData = arrSplice(arr, pageSize.value)
maxPageNum.value = spliceData.length
tableData.value = spliceData[pageNum.value - 1]
}
const changeFieId = () => {
updateNode(parentNode.children, entityOptions.value.field)
}
const updateNode = (children, field) => {
for (let i = 0; i < children.length; i++) {
if (children[i].children) {
updateNode(children[i].children, field)
}
else {
if (children[i].params) {
cusUpdateNode({ "id": children[i].id, "sourceName": children[i].params.properties[field], "params": children[i].params })
}
}
}
}
const exportExcel = () => {
let prepareData: any = [[]]
for (let m = 0; m < keyData.value.length; m++) {
prepareData[0].push(keyData.value[m].label)
}
for (let i = 0; i < tableData.value.length; i++) {
let array: any = []
for (let m = 0; m < keyData.value.length; m++) {
array.push(tableData.value[i].properties[keyData.value[m].key])
}
prepareData.push(array)
}
const worksheet = XLSX.utils.aoa_to_sheet(prepareData)
const workbook = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
const data = new Blob([excelBuffer], { type: 'application/octet-stream' })
FileSaver.saveAs(data, title.value + '.xlsx')
}
const close = () => {
baseDialog.value?.close()
}
defineExpose({
open,
close
})
</script>
<style scoped lang="scss">
.table-box {
width: 100%;
overflow: auto;
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5);
.table {
flex: 0 0 auto;
min-width: 100%;
.table-body {
height: 420px;
}
.tr {
display: inline-flex;
}
.tr:last-child {
border-bottom: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
.th,
.td {
white-space: nowrap;
flex: 1;
min-width: 0px;
p {
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
</style>

View File

@ -0,0 +1,110 @@
<template>
<Dialog
ref="baseDialog"
title=""
left="calc(50% - 160px)"
top="calc(50% - 120px)"
:closeCallback="closeCallback"
>
<template #content>
<div class="my_weather" id="my_weather">
<div class="move_pop" id="move_pop">
<!-- <span>{{ $t("headerTitles.weather") }}</span> -->
<span></span>
<span class="close" @click.capture="onClose"></span>
</div>
<div class="weather_content">
<div class="weather_content_hear">
<span class="xian"></span>
<span class="text">天气效果</span>
<span class="text_two">可叠加以下天气类型</span>
</div>
<div class="weather_content_body">
<div class="item_icon" v-for="item in list">
<template v-if="item.hasOwnProperty('svg')">
<svg-icon
:name="item.svg"
:size="16"
:color="!item.status ? 'rgba(255, 255, 255, 1)' : 'rgba(0, 255, 255, 1)'"
></svg-icon>
</template>
<div>
<span :class="['icon_text', !item.status ? '' : 'active']">{{ item.name }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { inject } from 'vue'
import Dialog from '@/components/dialog/baseDialog.vue'
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
const text = ref('')
eventBus.on('openWeather', () => {
baseDialog.value?.open()
})
const entityOptions: any = ref({})
let originalOptions: any
let that: any
var list = reactive([
// 雨
{
// fun: this.toDo,
name: '雨',
svg: 'rain',
status: false
},
// 雪
{
// fun: this.toDo,
name: '雪',
svg: 'snow',
status: false
},
//雾
{
// fun: this.toDo,
name: '雾',
svg: 'fog',
status: false
},
//星空
{
// fun: this.toDo,
name: '星空',
svg: 'skystarry',
status: false
}
])
const closeCallback = () => {
entityOptions.value.oldData = structuredClone(originalOptions)
that.positionEditing = false
entityOptions.value.reset()
eventBus.emit('destroyComponent')
}
const open = async (id: any) => {
that = window.earth.entityMap.get(id)
originalOptions = structuredClone(that.newData)
entityOptions.value = that
baseDialog.value?.open()
await nextTick()
}
const close = () => {
baseDialog.value?.close()
}
defineExpose({
open,
close
})
</script>
<style scoped lang="scss"></style>

View File

@ -168,7 +168,7 @@ const init = (obj, selected, hasGEMarker = true, isUrl) => {
activeName.value = arr[0];
}
hasGEMarker1.value = hasGEMarker;
url.value = localStorage.getItem('service')
url.value = localStorage.getItem('ip')
for (const objKey in obj) {
let imgList: any = [];

View File

@ -0,0 +1,65 @@
import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
const { cusAddNodes } = useTreeNode()
export function renderVector(node, ifFly = true) {
// if (node.detail != "") node.detail.field = node.detail.fieldName || "id";
let params = JSON.parse(node.params)
let vectorParams = {
id: node.id,
path: params.path,
fileName: node.sourceName,
...params,
};
console.log("node", node);
console.log("vectorParams", vectorParams);
let Vector = new YJ.Obj.Vector(window.earth, vectorParams);
console.log("Vector", Vector);
Vector.on().then((res) => {
Vector.load(() => {
let newnodes = Vector.getAllNode();
console.log("newnodes1111", newnodes);
if (newnodes) {
if (newnodes.list.length) {
newnodes.list.forEach((it) => {
let childNode = {
id: new YJ.Tools().randomString(),
sourceType: 'FeatureCollection',
sourceName: it.name,
isShow: true
}
cusAddNodes(window.treeObj, node.id, [childNode])
let zijiNodes: any = [];
if (it.features && it.features.length) {
it.features.forEach((item) => {
let ziNode = {
id: item.id,
sourceType: item.type,
sourcePath: params.path,
sourceName:
item.properties[Vector.field] || Object.keys(item.properties)[0] || '未知',
params: {
...item,
},
isShow: true
};
zijiNodes.push(ziNode);
});
}
cusAddNodes(window.treeObj, childNode.id, zijiNodes)
});
}
}
if (ifFly) Vector.flyTo();
// Vector.onClick = shpTotal;
Vector.onClick = () => {
alert('left')
};
//鼠标右键点击事件
// Vector.onRightClick = shpSelect;
Vector.onRightClick = () => {
alert('right')
};
});
});
return Vector
}

View File

@ -5,6 +5,8 @@ import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
import { initMapData } from '@/common/initMapData'
import { GisApi } from '@/api/gisApi'
import { addMapSource } from '@/common/addMapSource'
import { getNamefromPath } from '@/utils/index'
import { renderVector } from './renderVector'
const { cusAddNodes } = useTreeNode()
export const useRightOperate = () => {
@ -83,19 +85,40 @@ export const useRightOperate = () => {
parentId: parentId,
sourceName: name,
sourceType: 'vector',
sourcePath: filePaths[0],
// sourcePath: filePaths[0],
params: {
id: id,
path: filePaths[0],
field: 'id',
name: name,
headTables: [],
opacity: 1,
color: 'rgba(0,255,184,0.5)',
show: true
},
}
TreeApi.addOtherSource(params)
params.isShow = true
params.params = JSON.stringify(params.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)) {
let baseURL = localStorage.getItem('ip')
await addMapSource({
type: 'geojson',
id: id,
sourceName: name,
opt: {
host: baseURL,
id: id,
url: filePaths[0],
show: true,
width: 1,
color: "rgb(239, 6, 6, 1)",
}
})
}
else {
// 获取最后一个点的位置
@ -246,11 +269,54 @@ export const useRightOperate = () => {
}
}
//属性
const showAttr = (eventBus, node) => {
console.log(eventBus, node)
const showAttr = (eventBus) => {
let node
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
node = selectNodes[selectNodes.length - 1]
}
if (node && (node.sourceType == 'Feature' || node.sourceType == 'vector')) {
eventBus.emit("openDialog", 'vectorAttr', node.id);
}
}
//导入表头
const importHeader = () => {
let node
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
node = selectNodes[selectNodes.length - 1]
}
const dialogParams = {
properties: ["openFile", "multiSelections"],
filters: [
{
name: "excel",
extensions: ["csv"],
},
],
};
openDirectoryDialog(dialogParams, (paths) => {
if (!paths.length) {
return;
}
let name = getNamefromPath(paths[0]);
let formData = new FormData();
formData.append("file", paths[0]);
formData.append("id", node.id);
console.log(paths[0], node.id)
// importTablehead(formData).then((res) => {
// if (res.code == 0) {
// this.rightClickTreeNode.head_tables = JSON.stringify(
// res.data.list
// );
// this.$message.success("导入成功");
// } else {
// this.$message.error("导入失败");
// }
// });
});
}
//导入模型
const importHeader = () => { }
//导入模型
const addXlsxs = () => { }
//导入模型
@ -288,7 +354,7 @@ export const useRightOperate = () => {
type: 'success'
})
source_ids.forEach(item => {
let entity = window.earth.entityMap.get(item)
let entity = (window as any)._entityMap.get(item)
entity?.remove?.();
// let node = window.treeObj.getNodeByParam("id", item, null);
eventBus.emit("destroyComponent", item);
@ -325,7 +391,7 @@ export const useRightOperate = () => {
id: node.id,
}
}
let entityObject = window.earth.entityMap.get(params.id)
let entityObject = (window as any)._entityMap.get(params.id)
entityObject.setCustomView()
params.customView = entityObject.customView
let params2 = {
@ -346,7 +412,7 @@ export const useRightOperate = () => {
if (selectNodes && selectNodes[selectNodes.length - 1]) {
let node = selectNodes[selectNodes.length - 1]
let params = JSON.parse(node.params)
let entityObject = window.earth.entityMap.get(params.id)
let entityObject = (window as any)._entityMap.get(params.id)
entityObject.resetCustomView()
params.customView = entityObject.customView
let params2 = {
@ -475,7 +541,7 @@ export const useRightOperate = () => {
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
let node = selectNodes[selectNodes.length - 1]
let layer = window.earth.entityMap.get(node.id);
let layer = (window as any)._entityMap.get(node.id);
layer[key]();
_updateLayerIndex();
}
@ -497,7 +563,7 @@ export const useRightOperate = () => {
];
nodes.forEach((item) => {
if (arr.includes(item.sourceType) && item.isShow) {
let entityOptions = window.earth.entityMap.get(item.id)
let entityOptions = (window as any)._entityMap.get(item.id)
let layerIndex = entityOptions.layerIndex;
layers.push({ id: item.id, layerIndex });
// let params = {
@ -601,71 +667,7 @@ export const useRightOperate = () => {
}
}
function renderVector(node, ifFly = true) {
// if (node.detail != "") node.detail.field = node.detail.fieldName || "id";
let headTables;
if (node.headTables) {
headTables == "" ? node.headTables : JSON.parse(node.headTables);
}
let vectorParams = {
id: node.id,
path: node.sourcePath,
fileName: node.sourceName,
headTables,
...node.params,
};
console.log("node", node);
console.log("vectorParams", vectorParams);
let Vector = new YJ.Obj.Vector(window.earth, vectorParams);
console.log("Vector", Vector);
Vector.on().then((res) => {
Vector.load(() => {
let childNode = {
id: new YJ.Tools().randomString(),
sourceType: 'FeatureCollection',
sourceName: node.sourceName,
isShow: true
}
cusAddNodes(window.treeObj, node.id, [childNode])
let newnodes = Vector.getAllNode();
console.log("newnodes1111", newnodes);
if (newnodes) {
if (newnodes.list.length) {
newnodes.list.forEach((it) => {
let zijiNodes: any = [];
if (it.features && it.features.length) {
it.features.forEach((item) => {
let ziNode = {
id: item.id,
sourceType: item.type,
sourceName:
item.properties[Vector.field] || Object.keys(item.properties)[0] || '未知',
params: {
...item,
},
isShow: true
};
zijiNodes.push(ziNode);
});
}
cusAddNodes(window.treeObj, childNode.id, zijiNodes)
});
}
}
if (ifFly) Vector.flyTo();
// Vector.onClick = shpTotal;
Vector.onClick = () => {
alert('left')
};
//鼠标右键点击事件
// Vector.onRightClick = shpSelect;
Vector.onRightClick = () => {
alert('right')
};
});
});
}
function getLastPathComponent(path, extensionsToRemove = []) {
// 处理路径分隔符
@ -677,6 +679,7 @@ export const useRightOperate = () => {
// 检查是否匹配任何需要移除的后缀
for (const ext of extensionsToRemove) {
//@ts-ignore
const extWithDot = ext.startsWith('.') ? ext : `.${ext}`;
if (lastComponent.endsWith(extWithDot)) {
return lastComponent.slice(0, -extWithDot.length);
@ -686,6 +689,14 @@ export const useRightOperate = () => {
return lastComponent;
}
function openDirectoryDialog(option, cb) {
const { ipcRenderer } = require('electron')
ipcRenderer.send("open-directory-dialog", option);
ipcRenderer.once("selectedItem", (e, paths) => {
cb(paths);
});
}
return {
rightMenus
}

View File

@ -178,7 +178,7 @@ async function tankuang(id, node, info) {
let availablePort = await ipcRenderer.invoke('get-available-port');
window.treeObj.selectNode(node);
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);
let _winMap = await ipcRenderer.invoke('get-_winMap')
if (!_winMap.has(id)) {

View File

@ -56,7 +56,7 @@ export const useTree = () => {
const menus = showRightMenu(event, treeObj.value)
console.log('menus', menus)
if (menus.length == 0) {
$changeComponentShow('.rightMenu', false)
// $changeComponentShow('.rightMenu', false)
return
}
nextTick(() => {
@ -71,13 +71,34 @@ export const useTree = () => {
*/
const onDblClick = (event: MouseEvent, treeId: string, treeNode: any) => {
let entityObject
if (treeNode.sourceType == 'pressModel') {
entityObject = (window as any).pressModelEntities.get(treeNode.id)
} else {
entityObject = window.earth.entityMap.get(treeNode.id)
if(treeNode.sourceType == 'Feature') {
const getEntityObject = (n) => {
if (n) {
let t = window.earth.entityMap.get(n.id)
if (t) {
return t
}
else {
if (n.parentId) {
return getEntityObject(window.treeObj.getNodeByParam("id", n.parentId, null))
}
}
}
}
entityObject = getEntityObject(treeNode)
entityObject.flyTo(treeNode.id)
}
else {
if (treeNode.sourceType == 'pressModel') {
entityObject = (window as any).pressModelEntities.get(treeNode.id)
} else {
entityObject = (window as any)._entityMap.get(treeNode.id)
}
entityObject.flyTo()
}
console.log('entityObject', entityObject)
entityObject.flyTo()
}
/**
* 用于捕获节点拖拽操作结束的事件回调函数
@ -235,7 +256,7 @@ export const useTree = () => {
entityObject = (window as any).pressModelEntities.get(treeNode.id)
if (!entityObject && treeNode.isShow) {
const entity = window.earth.entityMap.get(params.modelId).entity
const entity = (window as any)._entityMap.get(params.modelId).entity
entityObject = new YJ.Analysis.Flat(window.earth, entity, {
positions: params.positions,
height: params.height,
@ -245,7 +266,7 @@ export const useTree = () => {
}
} else if (treeNode.sourceType != 'directory') {
entityObject = window.earth.entityMap.get(params.id)
entityObject = (window as any)._entityMap.get(params.id)
}
if (entityObject) {
entityObject.show = treeNode.isShow;
@ -505,6 +526,24 @@ export const useTree = () => {
// 初始化树的方法
const initTree = async (selector: string = '#treeDemo') => {
let keycode = localStorage.getItem("AMapKey");
window._AMapSecurityConfig = {
securityJsCode:
(keycode && keycode.split("|")[1]) ||
"c3d17927c47eb753b61b26de4f533cbe",
};
// console.log("获取图层指挥舱数据");
//初始化高德地图
let arr = [
"ArcgisWXImagery",
"ArcgisBLUEImagery",
"ArcgisLWImagery",
"GDLWImagery",
"GDWXImagery",
"GDSLImagery",
"layer",
];
let res = await TreeApi.getTreeList()
if ([0, 200].includes(res.code)) {
res.data.sort((a: any, b: any) => {
@ -540,6 +579,16 @@ export const useTree = () => {
treeObj.value = $.fn.zTree.init($(selector), setting, zNodes.value)
window.treeObj = treeObj.value
window.AllNodes = treeObj.value.getNodes()
window.newFuzzySearch(
`treeDemo`,
"#keyword",
["bim", "sonShp", "gdbShp"],
true,
"#queryButton"
); /**/
initTreeCallBack()
}

View File

@ -446,17 +446,16 @@ export const useTreeNode = () => {
const cusNodeIcon = async (node) => {
let availablePort = await ipcRenderer.invoke('get-available-port');
let type
if(node.sourcePath) {
if(node.sourcePath || node.sourceType === 'vector') {
let path = node.sourcePath ? node.sourcePath : JSON.parse(node.params).path
// 获取最后一个点的位置
const lastDotIndex = node.sourcePath.lastIndexOf('.');
const lastDotIndex = path.lastIndexOf('.');
// 如果没有点或者点是最后一个字符,则不是有效的文件后缀
if (lastDotIndex === -1 || lastDotIndex === node.sourcePath.length - 1) {
if (lastDotIndex === -1 || lastDotIndex === path.length - 1) {
return false;
}
// 提取后缀并转换为小写进行比较
const extension = node.sourcePath.slice(lastDotIndex + 1).toLowerCase();
const extension = path.slice(lastDotIndex + 1).toLowerCase();
type = extension
}
else {
@ -534,7 +533,9 @@ export const useTreeNode = () => {
allNodes = allNodes.concat(treeObj.transformToArray(node))
})
allNodes.forEach((node: any) => {
_idSet.add(node.id)
if(node.sourceType !== 'FeatureCollection' && node.sourceType !== 'Feature') {
_idSet.add(node.id)
}
treeObj.removeNode(node)
})
YJ.Global.splitScreen.setActiveId();

View File

@ -19,17 +19,40 @@
<el-option value="tree" :label="t('tree.layer')"></el-option>
<el-option value="poi" :label="t('tree.location')"></el-option>
</el-select>
<input v-bind="searchKey" style="width: 50px" id="keyword" type="text" :placeholder="t('btn.treePlaceholder')"
@input="clearResult" @change="searchPlace" />
<el-button type="primary" plain id="queryButton" size="small" @click="searchPlace" :loading="loading">{{
t('btn.search') }}
<input
v-model="searchKey"
style="width: 50px"
id="keyword"
type="text"
:placeholder="t('btn.treePlaceholder')"
@input="clearResult"
@change="searchPlace"
/>
<el-button
type="primary"
plain
id="queryButton"
size="small"
@click="searchPlace"
:loading="loading"
>{{ t('btn.search') }}
</el-button>
</div>
<div id="selectorBox">
<el-select ref="select1" @change="locationChange" v-model="value" size="small"
:placeholder="t('btn.selectPlaceholder')" :no-data-text="t('btn.selectNoText')">
<el-option v-for="(item, index) in poiOptions" :key="item.search_key + index" :label="item.search_key"
:value="item.address">
<el-select
ref="select1"
@change="locationChange"
v-model="value"
size="small"
:placeholder="t('btn.selectPlaceholder')"
:no-data-text="t('btn.selectNoText')"
>
<el-option
v-for="(item, index) in poiOptions"
:key="item.search_key + index"
:label="item.search_key"
:value="item.address"
>
</el-option>
</el-select>
</div>
@ -55,8 +78,11 @@
import { debounce } from '@/utils'
import { useI18n } from 'vue-i18n'
import { useTree } from './hooks/tree'
import AMapLoader from '@amap/amap-jsapi-loader'
import rightMenu from './components/rightMenu.vue'
import { $changeComponentShow } from '@/utils/communication'
import { ref, nextTick } from 'vue'
import { ElMessage } from 'element-plus'
import { bus } from '@/utils/bus'
const { initTree, rightMenuRef, initTreeCallBack } = useTree()
@ -98,46 +124,246 @@ const treeMouseOver = () => {
const selectChange = (val) => {
let input = document.getElementById('keyword')
// treeSearchCb("");
// if (val == 'poi') {
// this.searchKey = ''
// input.value = ''
// } else {
// this.searchKey = ''
// this.poiOptions = []
// this.value = ''
// input.value = ''
// }
// if (window.searchPlaceEntity) {
// window.searchPlaceEntity.remove();
// }
treeSearchCb('')
if (val == 'poi') {
searchKey.value = ''
// input.value = ''
} else {
searchKey.value = ''
poiOptions.value = []
value.value = ''
// input.value = ''
}
if (window.searchPlaceEntity) {
window.searchPlaceEntity.remove()
}
}
const clearResult = () => {
// if (this.select == "tree") {
// let string = $("#keyword")
// .val()
// .trim();
// if (string == "") {
// let arr = [];
// if (select.value == 'tree') {
// let string = searchKey.value.trim()
// if (string == '') {
// let arr = []
// if (window.searchPlaceMap) {
// arr = Array.from(window.searchPlaceMap);
// arr = Array.from(window.searchPlaceMap)
// }
// if (arr.length) {
// window.searchPlaceMap.get(arr[0][0]).remove();
// window.searchPlaceMap.clear();
// window.searchPlaceMap.get(arr[0][0]).remove()
// window.searchPlaceMap.clear()
// }
// this.poiOptions = [];
// this.value = "";
// window.treeSearchCb();
// poiOptions.value = []
// value.value = ''
// window.treeSearchCb('')
// }
// }
let string = searchKey.value.trim()
if (string == '') {
let arr = []
if (window.searchPlaceMap) {
arr = Array.from(window.searchPlaceMap)
}
if (arr.length) {
window.searchPlaceMap.get(arr[0][0]).remove()
window.searchPlaceMap.clear()
}
poiOptions.value = []
value.value = ''
window.treeSearchCb('')
}
}
const cancel = () => {
YJ.Global.splitScreen.setActiveId([]);
YJ.Global.splitScreen.setActiveId([])
}
const searchPlace = () => { }
const locationChange = () => { }
var mapModule
var key =
(localStorage.getItem('AMapKey') && localStorage.getItem('AMapKey').split('|')[0]) ||
'd88fcc689d1aa99866b2d0d83fd36677'
var isOnline = false
var loadAmp = (cb = () => {}) => {
AMapLoader.reset()
AMapLoader.load({
key: key, // 申请好的Web端开发者Key首次调用 load 时必填
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: []
})
.then((AMap) => {
mapModule = AMap
isOnline = true
cb()
})
.catch((err) => {
loading.value = false
isOnline = false
cb(err ? 'err' : '')
})
}
var select1: any = ref('')
const searchPlace = debounce(function () {
if (!searchKey.value) {
return
}
if (select.value == 'poi') {
poiOptions.value = []
value.value = ''
let way = localStorage.getItem('searchWay')
if (way == 'net') {
treeSearchCb()
loading.value = true
const doSearch = () => {
mapModule.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => {
var placeSearch = new AMap.PlaceSearch()
try {
placeSearch.search(searchKey.value.trim(), (status, result) => {
if (result.info && result.info === 'OK') {
let arr = []
result.poiList.pois.forEach((item) => {
const location = YJ.CoordTransform.GCJ02ToWGS84(
item.location.lng,
item.location.lat
)
arr.push({
address: item.name,
search_key: item.name,
search_type: item.id,
lat: location[1],
lng: location[0]
})
})
poiOptions.value = arr
if (poiOptions.value.length) {
loading.value = false
select1.value.toggleMenu()
}
} else if (status == 'error' || result === 'INVALID_PARAMS') {
ElMessage({
message: '请填写正确的搜索关键字',
type: 'error'
})
loading.value = false
} else if (status == 'error') {
ElMessage({
message: '网络异常',
type: 'error'
})
loading.value = false
} else {
ElMessage({
message: '没有搜索结果',
type: 'error'
})
loading.value = false
}
})
} catch (e) {
loading.value = false
}
})
}
if (!mapModule) {
loadAmp((err) => {
if (err) {
ElMessage({
message: '无网络连接,请检查网络',
type: 'error'
})
loading.value = false
} else {
doSearch()
}
})
} else {
doSearch()
}
} else if (way == 'poi') {
let string = searchKey.value.trim()
// if (string)
// queryPOI({ key: string }, (res) => {
// poiOptions.value = res.list
// if (poiOptions.value.length) {
// select1.value.toggleMenu()
// }
// loading.value = false
// })
// else
// ElMessage({
// message: '请输入搜索关键字',
// type: 'warning'
// })
}
} else {
poiOptions.value = []
value.value = ''
treeSearchCb(searchKey.value)
}
}, 500)
const availablePort = ref(55110)
const locationChange = () => {
let item = poiOptions.value.find((item) => item.address == value.value)
let id = new YJ.Tools().randomString()
nextTick(() => {
select1.value.blur()
})
if (window.searchPlaceMap === undefined) {
window.searchPlaceMap = new Map()
}
if (window.searchPlaceMap.size) {
window.searchPlaceMap.forEach((item) => {
item.remove()
})
window.searchPlaceMap.clear()
}
let textLenght = item.search_key.length
if (textLenght > 17) {
item.search_key = item.search_key.match(/.{1,17}/g).join('\n')
}
// let sg84 = YJ.Global.CoordTransform.GCJ02ToWGS84(item.lng, item.lat);
let params = {
id,
position: { lng: item.lng, lat: item.lat, alt: item.alt ? item.alt : 0 },
billboard: {
show: true,
image: 'http://localhost:' + availablePort.value + '/' + 'GEMarker1/A-ablu-blank.png',
width: 320,
height: 360
},
show: true,
label: {
show: true,
text: item.search_key,
fontSize: 80,
color: '#FFF200FF',
scale: 3
}
}
let entity = new YJ.Obj.BillboardObject(window.earth, params)
entity.labelFontSize = 75
entity.billboardScale = 9
entity.far = 42000000
entity.entity.billboard.heightReference = 1
entity.entity.label.heightReference = 1
window.searchPlaceEntity = entity
entity.picking = false
// 获取entity
// entity.entity.label.eyeOffset = new Cesium.Cartesian3(0, 0, -1000);
// entity.entity.billboard.eyeOffset = new Cesium.Cartesian3(0, 0, -1000)
window.earth.viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(
Number(params.position.lng),
Number(params.position.lat),
14000
),
duration: 3,
orientation: {
heading: 0,
pitch: (-85 * Math.PI) / 180,
roll: 0
}
})
window.searchPlaceMap.set(id, entity)
}
onMounted(() => {
initTree()
// ipcRenderer.on('renderNode-reply', (event: any, data: any) => {
@ -208,10 +434,12 @@ defineExpose({
font-size: 1.2em;
text-shadow: 0px 0px 9px rgba(20, 118, 255, 1);
font-weight: 700;
background: linear-gradient(90deg,
rgba(0, 255, 255, 0) 0%,
rgba(0, 255, 255, 0.5) 55.55%,
rgba(0, 255, 255, 0) 100%);
background: linear-gradient(
90deg,
rgba(0, 255, 255, 0) 0%,
rgba(0, 255, 255, 0.5) 55.55%,
rgba(0, 255, 255, 0) 100%
);
}
}

View File

@ -11,8 +11,14 @@
<firstMenu class="absolute zIndex9" ref="firstMenuRef"></firstMenu>
<!--底部菜单-->
<bottomMenu class="absolute zIndex9" ref="bottomMenuRef"></bottomMenu>
<input type="file" id="fileInputlink" style="display: none" multiple accept=".jpeg,.png,.jpg,.mp4,.pdf"
@input="uploadFile" />
<input
type="file"
id="fileInputlink"
style="display: none"
multiple
accept=".jpeg,.png,.jpg,.mp4,.pdf"
@input="uploadFile"
/>
<!-- 多点视线分析 -->
<Visibility ref="visibility"></Visibility>
@ -44,6 +50,7 @@
<modelSetting ref="modelsetting"></modelSetting>
<modelObject ref="modelobject"></modelObject>
<graphObject ref="graphobject"></graphObject>
<addDevice ref="adddevice"></addDevice>
</template>
<script setup lang="ts">
@ -113,11 +120,13 @@ import particleEffects from '../components/propertyBox/particleEffects.vue'
import flyLine from '../components/propertyBox/flyLine.vue'
import explosion from '../components/propertyBox/explosion.vue'
import vector from '../components/propertyBox/vector.vue'
import vectorAttr from '../components/propertyBox/vectorAttr.vue'
import graphObject from '../components/propertyBox/graphObject.vue'
import graph from '../components/propertyBox/graph.vue'
import graphSetting from '../components/propertyBox/graphSetting.vue'
import photo from '../components/propertyBox/photo.vue'
import addDevice from '../components/propertyBox/addDevice.vue'
import { GisApi } from '@/api/gisApi'
@ -132,7 +141,6 @@ let tree = ref()
let selectImgRef = ref()
let editdirectoryBox = ref()
eventBus.on('openDialog', async (sourceType: any, id: any) => {
console.log(sourceType, id)
if (dynamicComponentRef.value && dynamicComponentRef.value.close) {
dynamicComponentRef.value.close()
}
@ -300,11 +308,15 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
await nextTick()
dynamicComponentRef.value?.open(id)
break
case 'vectorAttr':
currentComponent.value = vectorAttr
await nextTick()
dynamicComponentRef.value?.open(id)
break
default:
break
}
dynamicComponentRef.value.id = id
console.log(dynamicComponentRef.value)
})
eventBus.on('openSelectImg', (selected, entity) => {
// $sendElectronChanel("requireGEMarkerName", {
@ -341,7 +353,6 @@ const createEarth = async () => {
let openLeftClick = await new YJ.Global.openLeftClick(window.earth)
let openRightClick = await new YJ.Global.openRightClick(window.earth)
YJ.Global.MouseRightMenu(window.earth, true, (text, object) => {
console.log(text)
switch (text) {
case 'rotateAround':
YJ.Global.rotateAround(window.earth, object.position)
@ -365,7 +376,9 @@ const createEarth = async () => {
break
}
})
tree.value.initTreeCallBack()
sysChange()
// @ts-ignore
let options = JSON.parse(localStorage.getItem('defaultView'))
YJ.Global.setDefaultView(window.earth, options)
@ -389,6 +402,39 @@ eventBus.on('defineClickAddLinkCb', (fun) => {
clickAddLinkCb = fun
})
const sysChange = async () => {
let systemSetting = JSON.parse(localStorage.getItem('systemSetting'))
const obj = {
compass: systemSetting.showCompass, //罗盘
legend: systemSetting.showDistanceLegend, //比例尺
info: systemSetting.showToolBar, //信息栏
// system.showFps
frame: systemSetting.showFps //刷新率
}
YJ.Global.CesiumContainer(window.earth, obj)
//经纬网
YJ.Global.JwwStatusSwitch(window.earth, systemSetting.showLatitudeLongitudeNetwork)
//方里网
YJ.Global.FlwStatusSwitch(window.earth, systemSetting.showFangliNet)
//地形遮挡
YJ.Global.setGroundCover(window.earth, systemSetting.occlusion)
//系统
let coor = systemSetting.coordinate ? systemSetting.coordinate : 'EPSG:4326'
YJ.Global.setCoordinateSystem(window.earth, coor)
YJ.Global.setDMS(window.earth, systemSetting.positionType)
//比例尺
await YJ.Global.SheetIndexStatusSwitch(window.earth, systemSetting.sheetIndexStatusSwitch)
eventBus.emit('tufuInput', systemSetting.sheetIndexStatusSwitch)
//鹰眼图
if (systemSetting.showMapX) {
YJ.Global.MapX.open(window.earth)
} else {
YJ.Global.MapX.close(window.earth)
}
}
const uploadFile = (event) => {
let files = event.target.files
if (files.length > 0) {
@ -423,16 +469,16 @@ const getStatus = (time) => {
const currentTimestamp = Date.now()
if (timestamp > currentTimestamp) {
; (window as any).checkAuthIsValid = true
;(window as any).checkAuthIsValid = true
} else {
; (window as any).checkAuthIsValid = false
;(window as any).checkAuthIsValid = false
}
}
onMounted(async () => {
let baseURL = localStorage.getItem('service')
let baseURL = localStorage.getItem('ip')
getAuthInfo()
await YJ.on({ host: baseURL })
await YJ.on({ host: baseURL, token: localStorage.getItem('Authorization') })
createEarth()
})
</script>

View File

@ -1,6 +1,6 @@
import { validateURL } from '@/utils/validate'
import { ElMessage } from 'element-plus'
import { setIP } from '@/utils/index'
import { setIP,getIP } from '@/utils/index'
export const useSetUp = () => {
const serviceDialog = ref(false) // 服务设置对话框
const servVal = ref('单机') // 服务类型选择值
@ -8,13 +8,32 @@ export const useSetUp = () => {
const ip = ref('192.168.1.1')
const port = ref('8890')
const localip = ref('127.0.0.1')
const localport = ref('8808')
const localport = ref('8848')
const gpsVal = ref('') // 服务类型选择值
const gpsOptions: any = ref([])
const servOptions: any = ref([{ name: '单机' }, { name: '网络' }])
const selectedService = ref('接口服务')
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 = () => {
switch (selectedService.value) {
case '接口服务':
@ -39,7 +58,7 @@ export const useSetUp = () => {
// 验证url 合法性
if (isOk) {
// 网络走这里
window.isStandAlone = false //判断走哪个服务
localStorage.setItem('serverMode', 'false') //判断走哪个服务
setIP(url)
serviceDialog.value = false
} else {
@ -47,21 +66,24 @@ export const useSetUp = () => {
}
} else {
//单机走这里
window.isStandAlone = true
localStorage.setItem('serverMode', 'true')
setIP('http://127.0.0.1:' + localport.value)
serviceDialog.value = false
}
}
const initialize = () => {
if (!window.isStandAlone) {
setIP('http://127.0.0.1:' + localport.value)
} else {
let url = prototype.value + '://' + ip.value + ':' + port.value
let isOk = validateURL(url)
if (isOk) {
setIP(url)
if(localStorage.getItem('ip')) {}
else {
if (serverMode==='false') {
setIP('http://127.0.0.1:' + localport.value)
} else {
ElMessage.error('url不合法')
let url = prototype.value + '://' + ip.value + ':' + port.value
let isOk = validateURL(url)
if (isOk) {
setIP(url)
} else {
ElMessage.error('url不合法')
}
}
}
}

View File

@ -2,6 +2,11 @@
# yarn lockfile v1
"@amap/amap-jsapi-loader@^1.0.1":
version "1.0.1"
resolved "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz"
integrity sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==
"@ampproject/remapping@^2.2.0":
version "2.3.0"
resolved "https://registry.npmmirror.com/@ampproject/remapping/-/remapping-2.3.0.tgz"