This commit is contained in:
2025-11-21 14:42:30 +08:00
31 changed files with 392 additions and 158 deletions

View File

@ -20,10 +20,12 @@ 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']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSlider: typeof import('element-plus/es')['ElSlider']

View File

@ -513,6 +513,7 @@
overflow-y: auto;
scrollbar-gutter: stable;
width: calc(100% + 1px);
height: 194px;
}
.YJ-custom-base-dialog>.content .table .align-center,

View File

@ -688,6 +688,9 @@
},
nodeTitle: function (setting, node) {
var t = setting.data.key.title === '' ? setting.data.key.name : setting.data.key.title
if(!node[t]) {
t = setting.data.key.name
}
var rawTitle = '' + node[t]
if (typeof setting.data.render.title === 'function') {
return setting.data.render.title.call(this, rawTitle, node)
@ -1489,6 +1492,7 @@
html.push('</a>')
},
makeDOMNodeNameBefore: function (html, setting, node) {
console.log('=================', setting, node)
var title = data.nodeTitle(setting, node),
url = view.makeNodeUrl(setting, node),
fontcss = view.makeNodeFontCss(setting, node),

View File

@ -96,6 +96,10 @@ window.newFuzzySearch = function (
let str = '<span style="color: whitesmoke;background-color: darkred;">' + h + '</span>'
return str
})
item.title = item.oldname.replace(F, function (h) {
let str = h
return str
})
// let a = item.name
// a = '<span style="color: whitesmoke;background-color: darkred;">' + a + "</span>"

View File

@ -85,8 +85,12 @@ service.interceptors.response.use(
if (response.data.code == 401) {
router.push('/')
localStorage.removeItem('Authorization')
ElMessage({
message: "登录过期,请重新登录",
type: 'error'
})
}
if (![0, 200].includes(response.data.code)) {
else if (![0, 200].includes(response.data.code)) {
ElMessage({
message: response.data.msg || response.data.message,
type: 'error'

View File

@ -10,13 +10,22 @@ export const addMapSource = async ({type, id, sourceName = '未命名对象', op
let options: any = await initMapData(type, opt, null)
let selectedNodes = window.treeObj.getSelectedNodes()
let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
function getParentId(nd: any) {
if (nd.sourceType === 'directory') {
return nd.id
} else {
let parentNode = window.treeObj.getNodeByParam("id", nd.parentId, null);
if(parentNode) {
return getParentId(parentNode)
}
else {
return
}
}
}
let parentId
if (node) {
if (node.sourceType === 'directory') {
parentId = node.id
} else {
parentId = node.parentId
}
parentId = getParentId(node)
}
delete options.host
if(options.attribute && options.attribute.rtmp) {

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.25 0L5.25 2.25L4.5 2.25L4.5 3.75L10.5 3.75L10.5 9.75001L4.5 9.75001L4.5 12L3.75 12L3.75 9.75001L1.5 9.75001L1.5 3.75L3.75 3.75L3.75 2.25L3 2.25L3 0L5.25 0ZM3.75 4.5L2.25 4.5L2.25 9.00001L3.75 9.00001L3.75 4.5ZM9.75 4.5L4.5 4.5L4.5 9.00001L9.75 9.00001L9.75 4.5ZM0.75 4.5L0.75 9.00001L0 9.00001L0 4.5L0.75 4.5ZM12 4.5L12 9.00001L11.25 9.00001L11.25 4.5L12 4.5ZM5.625 5.5965L7.125 6.7215L5.625 7.8465L5.625 5.5965ZM4.5 0.75L3.75 0.75L3.75 1.5L4.5 1.5L4.5 0.75Z" fill="#00FFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 641 B

View File

@ -186,7 +186,7 @@ const initTreeCallBack = () => {
});
if ((window as any).earth_ts) {
for (let i = 0; i < layers.length; i++) {
// initMapData(layers[i].sourceType, layers[i].detail, null)
initMapData(layers[i].sourceType, layers[i].detail, null)
}
}
})

View File

@ -0,0 +1,112 @@
<template>
<div class="MouseRight">
<div v-for="item in menus" class="item" @click="item.fun">
<svg-icon :name="item.icon||item.key" :size="14"></svg-icon>
{{ item.name }}
</div>
</div>
</template>
<script lang="ts" setup>
import {ref} from 'vue'
import {TsApi} from "../../../api/ts";
import {ElMessage} from "element-plus";
import {useRightOperate} from './rightOperate'
let {delNode, addEvent} = useRightOperate()
const eventBus = inject("bus");
let setOrReset = ref(1)
let setView = (flag) => {
// let cusView = window['YJ'].Global.getCurrentView(window['earth_ts'])
let node = window['treeObj'].getNodeByParam("id", window['selectedIdTs'], null);
let {
id,
sourceName,
sourceType,
sourcePath,
parentId,
isShow,
detail,
params,
planId,
} = node
let entity = window['_entityMap'].get(id)
if (flag)
entity.setCustomView()
else
entity.resetCustomView()
const detailobj = {...JSON.parse(detail ?? '{}'), customView: flag ? entity.customView : null};
let obj = {
id,
sourceName,
sourceType,
sourcePath,
parentId,
treeIndex: node.getIndex(),
isShow: isShow ? 1 : 0,
detail: JSON.stringify(detailobj),
params,
planId
}
TsApi.updateTsSource(obj).then(res => {
if (res.code == 200) {
ElMessage({type: "success", message: "操作成功"})
}
})
}
let deleteNode = () => {
let node = window['treeObj'].getNodeByParam("id", window['selectedIdTs'], null);
delNode(node, eventBus)
}
let addEventTs = () => {
let node = window['treeObj'].getNodeByParam("id", window['selectedIdTs'], null);
addEvent(node, eventBus)
}
let menus = ref([
{name: "添加态势事件", key: "addEventTs", fun: addEventTs},
{},
{
name: '删除', key: "delModel", fun: deleteNode
}
])
eventBus.on("initMenus", () => {
let customView = null
let entity = window['_entityMap'].get(window['selectedIdTs'])
customView = Boolean(entity.customView && entity.customView.orientation)
setOrReset.value = customView ? 0 : 1
menus.value[1] =
{
name: setOrReset.value ? "视角设定" : "重置视角", key: setOrReset.value ? "setView" : "resetView", fun: () => {
setView(setOrReset.value)
}
}
})
</script>
<style lang="scss" scoped>
.MouseRight {
position: absolute;
z-index: 999;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.6);
//width: 110px;
padding: 5px;
display: none;
.item {
padding: 0 5px;
font-size: 15px;
&:hover {
color: #0ff;
cursor: pointer;
}
}
}
</style>

View File

@ -137,7 +137,10 @@ onMounted(() => {
for (let i = 0; i < doms.length; i++) {
doms[i].style.lineHeight = "19px"
}*/
let panelHeight = window['tsObj']._Store.getDomElement(".chart", 0).getBoundingClientRect().height
let panel = window['tsObj']._Store.getDomElement(".chart", 0)
if (!panel)
return
let panelHeight = panel.getBoundingClientRect().height
// 转为字符串并按 "." 分割
const [whole, decimalStr] = String(panelHeight).split('.');

View File

@ -10,7 +10,7 @@
@click="itemClicks(item)"
>
<div class="itemIcon">
<svg-icon :name="item.key" :size="14"></svg-icon>
<svg-icon :name="item.icon||item.key" :size="14"></svg-icon>
</div>
<div class="itemText">
{{ t(`rightMenu.${item.key}`) }}

View File

@ -128,6 +128,8 @@ export const useRightOperate = () => {
}
let detail = JSON.parse(res.data.detail)
let mapParams = {...detail, ...res.data.params}
if (res.data.sourceType)
sourceType = res.data.sourceType
initMapData(sourceType, mapParams, entity => {
entity.flyTo()
@ -205,11 +207,12 @@ export const useRightOperate = () => {
},
addEvent: {
key: 'addEvent',
icon: 'addEventTs',
callback: addEvent
}
})
return {
rightMenus
rightMenus, delNode, addEvent
}
}

View File

@ -39,6 +39,7 @@
<deduction :TSOBJ="tsOBJ"></deduction>
<newEvent></newEvent>
<addDirectory class="adddirectoryBox absolute zIndex999"></addDirectory>
<mouseRight></mouseRight>
<!-- 方案描述编辑框 -->
<!--<div class="dialogBox">-->
@ -110,13 +111,14 @@
<script setup lang="ts">
//@ts-nocheck
import {ref, reactive, onMounted, nextTick, onUnmounted} from "vue";
import {ref, reactive, onMounted, nextTick, onUnmounted,} from "vue";
import {useRouter, useRoute} from "vue-router";
import Cabin from "./cabin.vue"
import Element from "./element.vue"
import NewEvent from "./newEvent.vue"
import Deduction from "./deduction.vue";
import AddDirectory from './components/tsdirectory.vue'
import MouseRight from './components/MouseRight.vue'
import {TS} from "./sdk";
import * as domain from "domain";
import {TsApi} from "../../api/ts";
@ -246,6 +248,8 @@ onMounted(async () => {
// getAuthInfo()
await YJ.on({host: baseURL})
createEarth()
window.addEventListener('click', handleClick)
// window.addEventListener('contextmenu', handleClick)
})
const createEarth = async () => {
(window as any).earth_ts = await new YJ.YJEarth('earthContainer', {navigationHelpButton: false})
@ -296,10 +300,20 @@ const timer = setInterval(() => {
}).replace(/\//g, '-');
stamp.value = formattedDate
}, 1000)
onUnmounted(() => {
clearInterval(timer)
window.removeEventListener('click', handleClick)
// window.removeEventListener('contextmenu', handleClick)
})
// 定义可复用的回调函数
const handleClick = (e) => {
console.log('点击事件触发', e)
let dom = $('.MouseRight')[0]
if (dom) dom.style.display = "none"
}
</script>
<style lang="scss" scoped>

View File

@ -1,6 +1,6 @@
import {TsApi} from "../../api/ts";
import {useTreeNode} from '@/views/components/tree/hooks/treeNode'
import {rightClick} from "../components/tree/entityClick";
import {bus} from "../../utils/bus"
const {cusAddNodes, getSelectedNode} = useTreeNode()
@ -40,6 +40,11 @@ export function initMapData(type, data, cb: any = null) {
cb && cb(entityObject)
})
break
case 'layer':
data.host = baseURL
entityObject = new YJ.Obj.Layer(window['earth_ts'], data)
cb && cb(entityObject)
break
case "guiji":
entityObject = new YJ.Obj.TrajectoryMotionObject(
@ -69,13 +74,20 @@ export function initMapData(type, data, cb: any = null) {
}
//鼠标右键点击事件
entityObject.onRightClick = () => {
entityObject.onRightClick = (event) => {
// rightClick(getOptions());
console.log("鼠标右键点击事件")
console.log("鼠标右键点击事件", options.id, event)
let id = options.id;
let node = window.treeObj.getNodeByParam("id", id, null);
if (node) window.treeObj.selectNode(node);
YJ.Global.splitScreen.setActiveId([id]);
window['selectedIdTs'] = id
// YJ.Global.splitScreen.setActiveId([id]);
$('.MouseRight')[0].style.display = "block"
$('.MouseRight')[0].style.top = event.position.y + "px"
$('.MouseRight')[0].style.left = event.position.x + "px"
bus.emit("initMenus")
};
return options

View File

@ -150,7 +150,7 @@ let pageSize: any = ref(10)
let pageNum: any = ref(1)
let total: any = ref(0)
const back = () => {
ipcRenderer.send('toggle-fullscreen', false)
// ipcRenderer.send('toggle-fullscreen', false)
router.push({path: '/home'})
}
const handleSizeChange = (val) => {

View File

@ -41,6 +41,7 @@ export const showRightMenuTs = (event: any, treeObj: any, selectedNodes, nodeTyp
try {
arr = [...nodeType[selectedNodes[0].sourceType].rightMenus]
console.log("rightMenus", nodeType[selectedNodes[0].sourceType].rightMenus)
if (!['tileset', 'directory', 'layer', 'terrain',].includes(selectedNodes[0].sourceType))
arr.push('addEvent')
} catch (e) {
console.log('e', e, selectedNodes[0].sourceType)

View File

@ -1,8 +1,8 @@
<template>
<div class="bottomMenuBox zIndex9" ref="bottomMenuBox">
<div class="animate__animated bottomMenu">
<div class="bottom_box" v-for="(item, i) of bottomMenuList" :key="i" :title="t('bottomMenu.' + item.sourceType)">
<div class="bottom_box_content" @click="addMarker(item, $event)">
<div class="bottom_box" v-for="(item, i) of bottomMenuList" :key="i">
<div class="bottom_box_content" @click="addMarker(item, $event)" :title="t('bottomMenu.' + item.sourceType)">
<svg class="bottom_box_bg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="117.030029296875" height="44" viewBox="0 0 117.030029296875 44" fill="none"
preserveAspectRatio="none">
@ -40,7 +40,7 @@
</div>
<div class="bottom_children" v-if="item.children" v-show="item.childrenShow">
<div class="bottom_childre_box" v-for="(item2, m) of item.children" :key="m"
@click="addMarker(item2, $event)">
@click="addMarker(item2, $event)" :title="t('bottomMenu.' + item2.sourceType)">
<svg class="bottom_childre_box_bg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="6vw" height="44.5" viewBox="0 0 119 35.5" fill="none"
preserveAspectRatio="none">
@ -595,6 +595,7 @@ const fold = () => {
const itemDuration = 300
if (isFolded.value) {
// 展开状态
bottomMenuBox.value.style.pointerEvents = 'unset'
items.forEach((item: any, index) => {
setTimeout(() => {
item.style.transition = 'transform 0.3s ease'
@ -606,6 +607,7 @@ const fold = () => {
bottom_left.style.transform = 'rotate(270deg)'
} else {
// 折叠状态
bottomMenuBox.value.style.pointerEvents = 'none'
items.forEach((item: any, index: any) => {
setTimeout(() => {
item.style.transition = 'transform 0.3s ease'
@ -817,6 +819,7 @@ document.addEventListener('click', (e: any) => {
transition: all 0.3s ease;
transform: rotate(270deg);
cursor: pointer;
pointer-events: all;
>svg {
width: 100%;

View File

@ -1,5 +1,5 @@
<template>
<div class="leftBox">
<div class="leftBox" ref="leftBoxRef">
<div class="left animate__animated">
<div class="menus">
<div class="menus_itemBox" v-for="(item, index) in menuList" :title="t(`firstMenu.${item.name}`)">
@ -249,6 +249,7 @@ const menuList: any = ref([
const isFolded: any = ref(false) // 添加折叠状态
const initialPositions: any = ref({}) // 保存初始位置
const isAnimating: any = ref(false) // 添加动画状态
const leftBoxRef = ref()
onMounted(() => {
let menusHeight = menuList.value.length * 65 + 'px'
let height = menuList.value.length * 65 + 30 + 'px'
@ -259,6 +260,8 @@ onMounted(() => {
items.forEach((item: any, index: any) => {
initialPositions.value[index] = item.style.transform || 'translateX(0)'
})
document.addEventListener('click', handleClickOutside, true);
})
const leftSideSecondRef = ref()
const handleClick = (item: any, e) => {
@ -325,6 +328,7 @@ const fold = () => {
const itemDelay = 100
const itemDuration = 300
if (isFolded.value) {
leftBoxRef.value.style.pointerEvents = 'unset'
left_bottom.style.bottom = '6.5vw'
left_bottom.style.left = '72px'
left_bottom.style.transform = 'rotate(0deg)'
@ -337,6 +341,7 @@ const fold = () => {
})
} else {
// 折叠状态
leftBoxRef.value.style.pointerEvents = 'none'
items.forEach((item: any, index: any) => {
setTimeout(() => {
item.style.transition = 'transform 0.3s ease'
@ -364,23 +369,16 @@ const fold = () => {
)
}
const clickMenu = (item: any) => {
console.log(item, 'item')
switch (item.key) {
case 'analysis':
console.log('analysis')
// eventBus.emit('analysisDialog')
eventBus.emit('circleViewShedDialog') //添加高程后测试
// eventBus.emit('submergeDialog')
// eventBus.emit('profileDialog')
// eventBus.emit('viewShedDialog')
// eventBus.emit('cutFillDialog')
// eventBus.emit('contourDialog')
break
default:
break
}
// 外部点击的处理函数
const handleClickOutside = (e) => {
if (leftSideSecondRef.value && leftSideSecondRef.value.leftSideSecondRef && !leftSideSecondRef.value.leftSideSecondRef.contains(e.target)) {
$('.leftSideSecond')[0].style.display = 'none'
}
};
onBeforeUnmount(() => {
document.removeEventListener('click', handleClickOutside, true);
})
</script>
<style scoped lang="scss">
@ -495,6 +493,7 @@ const clickMenu = (item: any) => {
// background-size: 100% 100%;
transition: all 0.3s ease;
cursor: pointer;
pointer-events: all;
>svg {
width: 100%;

View File

@ -1,5 +1,5 @@
<template>
<div class="leftSideSecond">
<div ref="leftSideSecondRef" class="leftSideSecond">
<svg
class="leftSideSecond_bg"
xmlns="http://www.w3.org/2000/svg"
@ -144,7 +144,7 @@ ipcRenderer.invoke('get-available-port').then((port) => {
availablePort.value = port
})
const obj: any = ref(null)
const isclick = ref(false)
const leftSideSecondRef = ref(null)
const eventBus: any = inject('bus')
const initList = (value) => {
obj.value = value
@ -1029,7 +1029,8 @@ const handleClick = (value = 'projectionDistanceMeasure') => {
methodMap[value]()
}
defineExpose({
initList
initList,
leftSideSecondRef
})
</script>
<style>

View File

@ -1,5 +1,6 @@
<template>
<Dialog ref="baseDialog" :title="t('bottomMenu.groundText')" left="calc(50% - 198px)" top="calc(50% - 120px)" :closeCallback="closeCallBack">
<Dialog ref="baseDialog" :title="t('bottomMenu.groundText')" left="calc(50% - 198px)" top="calc(50% - 120px)"
:closeCallback="closeCallBack">
<template #content>
<textarea style="height: 40px; width: 348px;" v-model="text"></textarea>
</template>
@ -31,6 +32,10 @@ const open = () => {
baseDialog.value?.open()
}
const confirm = () => {
if (!text.value) {
return
}
text.value = text.value.trim()
if (!text.value) {
return
}
@ -56,13 +61,22 @@ const confirm = () => {
delete options.positions
let selectedNodes = window.treeObj.getSelectedNodes()
let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
function getParentId(nd: any) {
if (nd.sourceType === 'directory') {
return nd.id
} else {
let parentNode = window.treeObj.getNodeByParam("id", nd.parentId, null);
if (parentNode) {
return getParentId(parentNode)
}
else {
return
}
}
}
let parentId
if (node) {
if (node.sourceType === 'directory') {
parentId = node.id
} else {
parentId = node.parentId
}
parentId = getParentId(node)
}
let params: any = {
id: id,

View File

@ -1,5 +1,6 @@
<template>
<Dialog ref="baseDialog" :title="t('bottomMenu.standText')" left="calc(50% - 198px)" top="calc(50% - 120px)" :closeCallback="closeCallBack">
<Dialog ref="baseDialog" :title="t('bottomMenu.standText')" left="calc(50% - 198px)" top="calc(50% - 120px)"
:closeCallback="closeCallBack">
<template #content>
<textarea style="height: 40px; width: 348px;" v-model="text"></textarea>
</template>
@ -31,6 +32,10 @@ const open = () => {
baseDialog.value?.open()
}
const confirm = () => {
if (!text.value) {
return
}
text.value = text.value.trim()
if (!text.value) {
return
}
@ -52,15 +57,23 @@ const confirm = () => {
delete options.name
let selectedNodes = window.treeObj.getSelectedNodes()
let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
let parentId
if (node) {
if (node.sourceType === 'directory') {
parentId = node.id
function getParentId(nd: any) {
if (nd.sourceType === 'directory') {
return nd.id
} else {
let parentNode = window.treeObj.getNodeByParam("id", nd.parentId, null);
if (parentNode) {
return getParentId(parentNode)
}
else {
parentId = node.parentId
return
}
}
}
let parentId
if (node) {
parentId = getParentId(node)
}
let params: any = {
id: id,

View File

@ -47,9 +47,9 @@ const props = defineProps({
const setInitialStyle = () => {
let style = getdefaultLabelStyle(props.sourceType)
let defaultStyle = JSON.parse(localStorage.getItem('defaultStyle') || '{}')
let defaultStyle = JSON.parse(localStorage.getItem('defaultLabelStyle') || '{}')
defaultStyle[props.sourceType] = style
localStorage.setItem('defaultStyle', JSON.stringify(defaultStyle))
localStorage.setItem('defaultLabelStyle', JSON.stringify(defaultStyle))
ElMessage({
message: `新增${props.type}风格设置成功!`,
type: "success",

View File

@ -7,6 +7,6 @@ let defaultLabelStyle = {
}
}
//@ts-ignore
export const getdefaultLabelStyle = (type) => {
export const getdefaultLabelStyle = (type:any) => {
return (type ? defaultLabelStyle[type] : defaultLabelStyle)
}

View File

@ -48,6 +48,6 @@ let defaultStyle = {
}
}
//@ts-ignore
export const getdefaultStyle = (type) => {
export const getdefaultStyle = (type:any) => {
return (type ? defaultStyle[type] : defaultStyle)
}

View File

@ -126,6 +126,7 @@ const open = async (id: any) => {
})
}
const confirm = () => {
entityOptions.value.text = entityOptions.value.text.trim()
entityOptions.value.text = entityOptions.value.text || t("default.untitled")
originalOptions = structuredClone(that.options)
let params = structuredClone(that.options)

View File

@ -22,7 +22,8 @@
<span class="label">滚动速度</span>
<input type="range" max="100" min="0" step="1" v-model="entityOptions.speed">
<div class="input-number" style="width: 100px;flex: 0 0 100px;margin-left: 10px;">
<input class="input" type="number" title="" min="0" max="100" step="1" v-model="entityOptions.speed" @input="$handleInputLimit">
<input class="input" type="number" title="" min="0" max="100" step="1" v-model="entityOptions.speed"
@input="$handleInputLimit">
<span class="arrow"></span>
</div>
</div>
@ -46,10 +47,13 @@
<script setup lang="ts">
import { ref } from 'vue';
import { inject } from "vue";
import { useI18n } from 'vue-i18n'
import { TreeApi } from '@/api/tree'
import { ElMessage, ElMessageBox } from 'element-plus'
import Dialog from '@/components/dialog/baseDialog.vue'
import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
const { t } = useI18n()
const { cusUpdateNode, getSelectedNodes, cusRemoveNode } = useTreeNode()
const baseDialog: any = ref(null);
@ -83,6 +87,8 @@ const open = async (id: any) => {
})
}
const confirm = () => {
entityOptions.value.text = entityOptions.value.text.trim()
entityOptions.value.text = entityOptions.value.text || t("default.untitled")
originalOptions = structuredClone(that.options)
let params = structuredClone(that.options)
baseDialog.value?.close()

View File

@ -26,7 +26,7 @@ export function renderVector(node, ifFly = true) {
sourceName: it.name,
isShow: true
}
cusAddNodes(window.treeObj, node.id, [childNode])
cusAddNodes(window.treeObj, node.id, [childNode], true)
let zijiNodes: any = [];
if (it.features && it.features.length) {
it.features.forEach((item) => {
@ -45,7 +45,7 @@ export function renderVector(node, ifFly = true) {
});
}
cusAddNodes(window.treeObj, childNode.id, zijiNodes)
cusAddNodes(window.treeObj, childNode.id, zijiNodes, true)
});
}
}

View File

@ -512,6 +512,7 @@ export const useTree = () => {
key: {
//zdatas数据中表示节点name的属性key
name: 'sourceName',
title: 'title',
checked: 'isShow'
},
simpleData: {

View File

@ -532,7 +532,10 @@ export const useTreeNode = () => {
parentNode = treeObj.getNodeByParam('id', parentNodeId, null)
}
let arr = treeObj.addNodes(parentNode, newNodes, isSilent)
if(!isSilent) {
treeObj.selectNode(arr[arr.length - 1])
}
// 确保window.AllNodes存在并为数组
window.AllNodes = (window.AllNodes || []).concat(arr)
return arr

View File

@ -265,7 +265,9 @@ const isShowTree = debounce(() => {
isShow.value = !isShow.value
const box1: any = document.querySelector('.box1')
const arrow: any = document.querySelector('.arrowTree')
const TreeIndex: any = document.querySelector('.TreeIndex')
if (isShow.value) {
TreeIndex.style.pointerEvents = 'none'
// 隐藏box1
box1.style.transform = 'translateX(110%)'
setTimeout(() => {
@ -275,6 +277,7 @@ const isShowTree = debounce(() => {
arrow.style.right = '1em'
}, 100)
} else {
TreeIndex.style.pointerEvents = 'unset'
// 显示box1
arrow.style.transform = 'rotate(180deg)'
arrow.style.bottom = '-5px'
@ -582,6 +585,7 @@ defineExpose({
// background-size: 100% 100%;
transition: transform 0.5s ease;
transform: rotate(180deg);
pointer-events: all;
> svg {
width: 100%;

View File

@ -126,6 +126,8 @@ import addMaterials from '../components/propertyBox/addMaterials.vue'
import { GisApi } from '@/api/gisApi'
import { sysChange as utilsSysChange } from '@/utils/sysChange'
import { getdefaultStyle } from '../components/propertyBox/defaultStyle/style'
import { getdefaultLabelStyle } from '../components/propertyBox/defaultLabelStyle/style'
const { rightMenus } = useRightOperate()
const firstMenuRef = ref(null)
@ -137,6 +139,23 @@ let addStandTextRef = ref()
let tree = ref()
let selectImgRef = ref()
let editdirectoryBox = ref()
// 标注标绘默认样式
if (!localStorage.getItem('defaultStyle')) {
let defaultStyle = getdefaultStyle(null)
localStorage.setItem('defaultStyle', JSON.stringify(defaultStyle))
}
if (!localStorage.getItem('defaultLabelStyle')) {
let defaultLabelStyle = getdefaultLabelStyle(null)
localStorage.setItem('defaultLabelStyle', JSON.stringify(defaultLabelStyle))
}
eventBus.on('openDialog', async (sourceType: any, id: any) => {
if (dynamicComponentRef.value && dynamicComponentRef.value.close) {
dynamicComponentRef.value.close()
@ -455,30 +474,30 @@ const createEarth = async () => {
window.earth = await new YJ.YJEarth('earthContainer')
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) => {
// switch (text) {
// case 'rotateAround':
// YJ.Global.rotateAround(window.earth, object.position)
// break
// case 'textBox':
// let id = new YJ.Tools().randomString()
// let name = '文本框'
// addMapSource({
// type: 'textBox',
// id: id,
// sourceName: name,
// opt: {
// id: id,
// position: object.position
// }
// })
// break
// case 'attribute':
// let node = window.treeObj.getNodeByParam('id', object.id, null)
// rightMenus.edit.callback(eventBus, node)
// break
// }
// })
YJ.Global.MouseRightMenu(window.earth, true, (text, object) => {
switch (text) {
case 'rotateAround':
YJ.Global.rotateAround(window.earth, object.position)
break
case 'textBox':
let id = new YJ.Tools().randomString()
let name = '文本框'
addMapSource({
type: 'textBox',
id: id,
sourceName: name,
opt: {
id: id,
position: object.position
}
})
break
case 'attribute':
let node = window.treeObj.getNodeByParam('id', object.id, null)
rightMenus.edit.callback(eventBus, node)
break
}
})
tree.value.initTreeCallBack()
utilsSysChange(eventBus)