From 027803f3e7464ef8e305a92804d353c6dcb61b72 Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Thu, 9 Oct 2025 17:49:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/public/icon/clt.png | Bin 0 -> 346 bytes src/renderer/public/icon/geojson.png | Bin 2925 -> 348 bytes src/renderer/public/icon/jct.png | Bin 0 -> 361 bytes src/renderer/public/icon/json.png | Bin 0 -> 321 bytes src/renderer/public/icon/kml.png | Bin 995 -> 282 bytes src/renderer/public/icon/kmz.png | Bin 0 -> 353 bytes src/renderer/public/icon/mbtiles.png | Bin 0 -> 340 bytes src/renderer/public/icon/pak.png | Bin 0 -> 349 bytes src/renderer/public/icon/shp.png | Bin 297 -> 362 bytes src/renderer/src/icons/svg/importPanorama.svg | 4 - .../src/icons/svg/pictureLocation.svg | 4 - .../views/components/propertyBox/vector.vue | 116 ++++++ .../components/propertyBox/vectorAttr.vue | 0 .../tree/components/hooks/rightOperate.ts | 353 ++++++++++-------- .../src/views/components/tree/hooks/tree.ts | 1 + .../views/components/tree/hooks/treeNode.ts | 26 +- src/renderer/src/views/home/index.vue | 9 +- 17 files changed, 334 insertions(+), 179 deletions(-) create mode 100644 src/renderer/public/icon/clt.png create mode 100644 src/renderer/public/icon/jct.png create mode 100644 src/renderer/public/icon/json.png create mode 100644 src/renderer/public/icon/kmz.png create mode 100644 src/renderer/public/icon/mbtiles.png create mode 100644 src/renderer/public/icon/pak.png create mode 100644 src/renderer/src/views/components/propertyBox/vector.vue create mode 100644 src/renderer/src/views/components/propertyBox/vectorAttr.vue diff --git a/src/renderer/public/icon/clt.png b/src/renderer/public/icon/clt.png new file mode 100644 index 0000000000000000000000000000000000000000..ec2105a83c0185d043832e62d204cc6b3df04a05 GIT binary patch literal 346 zcmV-g0j2(lP)Px#1am@3R0s$N2z&@+hyVZq1W80eR5*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X;jfzW!S2($<>xD~p&WEB5(i2+3Rwi Z`|#+yrMPx#1am@3R0s$N2z&@+hyVZq6G=otR5*==l3{JbFc5`5PX!PNX0Vlki(qBYKxh$E zMX)g_glY&}1{;HzK~e;7KYVGO)z(h3ocQj(d$J$2LJCOVNCT2@)>Rriqz@z&0NGjh zUvsdA5ouqX9}O}f^{wW)C{`s)-f}A8FGWeP-2-ox5#AQSdkp|^1t#EvbhfGaP9Orw zYG?rx&aHuiDT=@V^uPhmQO3C+1} zGymtk=VyzBD=UVQE(>$y#@T(N?XxRGQ5TT5*mLPg`a{iF$?fmpiu7`dU&zfju2q<#l8uoq!$SAAluj$I{Zt8ozMvTGV#G?;G#Ns>Zz500000NkvXX Hu0mjfim{Sh literal 0 HcmV?d00001 diff --git a/src/renderer/public/icon/json.png b/src/renderer/public/icon/json.png new file mode 100644 index 0000000000000000000000000000000000000000..2b2160beddd1d7ac56dbbf0be2b37d071c8e3a27 GIT binary patch literal 321 zcmV-H0lxl;P)Px#1am@3R0s$N2z&@+hyVZp>q$gGR5*>Lli?A9Fbsu1JO^NeZh#wzo9G5^pd+{e zZUQSfLES(%c>W;JQi_~s?l^kM%S-awfTZa2teNEFoUOUfzyo-%62Qs+6>!6t>P)2) z>4MZCxlFu9($G?!NqkvsXn9H`?dBs-6OWPqm=Klo$s`wvlU8%)8{%VZlM(3()PT37 z2JnC*2$-?ZflJyB8l@Ouo1yBhDDFsmJ9kU4+z3Bej^MI*@6aq06vY!b(2M0wJO?jRrN z(9=pGSO`v`9|bExb8~@fga_App^OpU;Xsw|~~iC`zV2<8&(1AE?K zt+HgIdoH*MHnEZqWqWdp=gg-88@*?P1ZtW1@C)u`u~oI3#Dvth45bDP46hOx7_4S6Fo+k-*%fF5lweEp zc6R~NK=9LfcRi5eEbxdd2GSm2>~=ESj)8%x$?smC$G8g@-NDr znj)6rk(<|K)zDa~6GHYdT|FmQc)c|wCTpZl3P-VZGQTzRPx zEweCk_g~><3wYLsz1+WRgTqd>3oATT0@Wt(;rPO+A>#M+UQx>D&l77*ULBC>{P?lq zv^itty|;dO&M`4D^$*%y%$TQF{p~!I5GlDQ{-;vRvmGA0?mXU?zPeac^v$s@)spfY z9{$ar|4dx7#y4CjcT?rve>ryRHVOSow2#se>oh9~*bx%)#i0K7n(6Xt?lV#mwx)hsU>Uk*fT4u?|ybB zYnIFZ{DcLYd-L-wKbU( zerxr`oLO(Ggzb(tpJ9nxJ1xb8YyR7B8NyuBA6GDKjq_(s5?@kur!ClL?}b*YcIN*L zTn>8f4x$cDPHPyhoqD^h@&!}JLwVuczpM)wIc^!4?K%NWmZ~ML5hW>!C8<`)MX5lF z!N|bKP}jgj*U&t~(Adh@(#q6A+rYxgz@V6GN+pVh-29Zxv`X9>n8J0A0yTJnY$z^E zw@OMZPSq_f%4A5(%t^J<*VoU;&rQ`&Ov%m6)6Y!K&(lrI&nwX{$t?i$;)|2=GIK2o jQcRO9^wTqogTe~DWM4fu^N#Q diff --git a/src/renderer/public/icon/kmz.png b/src/renderer/public/icon/kmz.png new file mode 100644 index 0000000000000000000000000000000000000000..1755c310a41d60d4fdcb13214f9e67eaf1230a45 GIT binary patch literal 353 zcmV-n0iOPeP)Px#1am@3R0s$N2z&@+hyVZq3rR#lR5*>bl3{JbKn#UHPXiDL$DkR5ltIT}Wso5_ z6+y-zWiSmv#vl+<1}THrAMs_EES>hJmQLrh?C1AZ0Sctg1=9uniEfY7Wbtv8mt=)4 zkPfLtYLOa0-9}#Rjlvc{a9`P}Hb8=dbV!G14;QnXr6t{$EOuoY@E&Lq>X6N2%orS2 z-P15fzuPrH>%$834ou&i^bbgJmI9bRM&JVom>si@Z@`XeAFjYVX1N^9S2g0zmr2==Hq4x$|9PU22~&s4#1fuU zhIUyWCS38HkbEpqc#3B^SHc380#PgO2YU4kI~Hn)?Tin)9lJ>2_XO*Eb7Q@2yEjeD z5Bx3~&?U_LfOCO+;GWd$zbTr@A2MU^ge^`RPG7Y?6J_2wBht`z;_t)^ zFNN4+3nWEZnN~7MJ=i*-=8%rji=xc|ndj6_{nIvhJt6ABQilNLx2IS-m#EC&$(!rO z(Ep`-Nu)os46otc|BYAT-ES3Vatl^4GYL%0Yb#;jR}m8toue4ZFt5>8;Fn}hqq^Mk sT`3bwI`_S={xNs<)RYN_K3M-}G;V8Eb$q6+4h$j&Pgg&ebxsLQ0L(6kb^rhX literal 0 HcmV?d00001 diff --git a/src/renderer/public/icon/shp.png b/src/renderer/public/icon/shp.png index 6be284a3d1728a487cf03818a79a5b74dd9fbc54..8846948ddea6e095145566fc865ee9f62883dafc 100644 GIT binary patch delta 322 zcmV-I0logI0_p;gF@FSeLP=Bz2nYy#2xN!=009(9L_t(Ijir*&S;H_4gn#wR02#p> z&=JZ8*??|9Hz?fzCJ0Ob8t1|K9t(MOq`hB5jfS zs^h7_EFwimKDYEf0t03{2OYiJ$3>MoKW_pLmHz^~W449)aQtpa2C2z!F06 zpi!)a8{jaUW69sNNq0rN%Osmk)BZOze_BJ4=R@EGbc%I6HkfVw5p#eCa0FfnaSJ#X z$sEK3a-f?^?eBost30j92+MlH;Oeg#uo<0c-2rm2E{WfDmbRJz9KTUjf~Uc@5}aCqBR&v+M^r diff --git a/src/renderer/src/icons/svg/pictureLocation.svg b/src/renderer/src/icons/svg/pictureLocation.svg index 367685a..032f566 100644 --- a/src/renderer/src/icons/svg/pictureLocation.svg +++ b/src/renderer/src/icons/svg/pictureLocation.svg @@ -1,10 +1,6 @@ diff --git a/src/renderer/src/views/components/propertyBox/vector.vue b/src/renderer/src/views/components/propertyBox/vector.vue new file mode 100644 index 0000000..3eee1a0 --- /dev/null +++ b/src/renderer/src/views/components/propertyBox/vector.vue @@ -0,0 +1,116 @@ + +
+
+
+ 文件名称 + +
+
+
+
+ 名称字段选择 + + + +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/renderer/src/views/components/propertyBox/vectorAttr.vue b/src/renderer/src/views/components/propertyBox/vectorAttr.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/renderer/src/views/components/tree/components/hooks/rightOperate.ts b/src/renderer/src/views/components/tree/components/hooks/rightOperate.ts index 960152f..b956156 100644 --- a/src/renderer/src/views/components/tree/components/hooks/rightOperate.ts +++ b/src/renderer/src/views/components/tree/components/hooks/rightOperate.ts @@ -48,62 +48,111 @@ export const useRightOperate = () => { return false; } - // 获取最后一个点的位置 - const lastDotIndex = filePaths[0].lastIndexOf('.'); - - // 如果没有点或者点是最后一个字符,则不是有效的文件后缀 - if (lastDotIndex === -1 || lastDotIndex === filePaths[0].length - 1) { - return false; - } - - // 提取后缀并转换为小写进行比较 - const extension = filePaths[0].slice(lastDotIndex + 1).toLowerCase(); - - let params2: any = { - id: id, - show: true, - } - if (extension === 'mbtiles') { - params2.alpha = 1 - params2.brightness = 1 - params2.layerIndex = 99999 - } - if (extension === 'apk') { - // params2.exaggeration = 1 - } - let params: any = { - id: id, - sourcePath: filePaths[0], - parentId: parentId, - params: params2, + + let item = filePaths[0] + + //@ts-ignore + let name = getLastPathComponent(item, ['clt', 'json', 'pak', 'kml', 'kmz', 'shp', 'geojson', 'geoJson', 'czml', 'jct', 'mif', 'tab', 'csv']); + let sourceType = "layer"; + if (item.endsWith(".clt") || item.endsWith(".json")) { + sourceType = "tileset"; + } else if (item.endsWith(".pak")) { + sourceType = "Terrain"; + } else if (item.endsWith(".kml") || item.endsWith(".kmz")) { + sourceType = "kml"; + } else if (item.endsWith(".shp")) { + sourceType = "shp"; + } else if (item.endsWith(".geojson") || item.endsWith(".geoJson")) { + sourceType = "geojson"; + } else if (item.endsWith(".czml")) { + sourceType = "czml"; + } else if (item.endsWith(".jct")) { + sourceType = "bim"; + } else if (item.endsWith(".mif")) { + sourceType = "shp"; + } else if (item.endsWith(".tab")) { + sourceType = "shp"; + } else if (item.endsWith(".csv")) { + sourceType = "csv"; } - // filePaths[0].split('\\').pop() - let res = await TreeApi.addModelSource(params) - console.log('res', res) - if (res.code === 0 || res.code === 200) { - ElMessage({ - message: '添加成功', - type: 'success' - }) - res.data.params = JSON.parse(res.data.params) - if (!res.data.params.name) { - res.data.params.name = res.data.sourceName + if (["shp", "tab", "mif", "kml", "kmz"].includes(sourceType)) { + let params: any = { + id: id, + parentId: parentId, + sourceName: name, + sourceType: 'vector', + sourcePath: filePaths[0], + params: { + id: id, + path: filePaths[0], + field: 'id', + name: name, + }, } - if (!res.data.params.id) { - res.data.params.id = res.data.id - } - let detail = JSON.parse(res.data.detail) - let mapParams = { ...detail, ...res.data.params } + TreeApi.addOtherSource(params) + params.isShow = true + params.params = JSON.stringify(params.params) + cusAddNodes(window.treeObj, params.parentId, [params]) + renderVector(params, true) + } + else { + // 获取最后一个点的位置 + const lastDotIndex = filePaths[0].lastIndexOf('.'); - await initMapData(res.data.sourceType, mapParams, (entity) => { - entity.flyTo() - }) - if (res.data.sourceType) { } - res.data.params = JSON.stringify(res.data.params) - res.data.detail = JSON.stringify(res.data.detail) - cusAddNodes(window.treeObj, params.parentId, [res.data]) + // 如果没有点或者点是最后一个字符,则不是有效的文件后缀 + if (lastDotIndex === -1 || lastDotIndex === filePaths[0].length - 1) { + return false; + } + + let params2: any = { + id: id, + show: true, + } + if (item.endsWith(".mbtiles")) { + params2.alpha = 1 + params2.brightness = 1 + params2.layerIndex = 99999 + } + if (item.endsWith(".apk")) { + // params2.exaggeration = 1 + } + + + let params: any = { + id: id, + sourcePath: filePaths[0], + parentId: parentId, + params: params2, + } + // filePaths[0].split('\\').pop() + let res = await TreeApi.addModelSource(params) + console.log('res', res) + if (res.code === 0 || res.code === 200) { + ElMessage({ + message: '添加成功', + type: 'success' + }) + res.data.params = JSON.parse(res.data.params) + if (!res.data.params.name) { + res.data.params.name = res.data.sourceName + } + if (!res.data.params.id) { + res.data.params.id = res.data.id + } + let detail = JSON.parse(res.data.detail) + let mapParams = { ...detail, ...res.data.params } + + await initMapData(res.data.sourceType, mapParams, (entity) => { + entity.flyTo() + }) + if (res.data.sourceType) { } + + res.data.params = JSON.stringify(res.data.params) + res.data.detail = JSON.stringify(res.data.detail) + cusAddNodes(window.treeObj, params.parentId, [res.data]) + } } } }); @@ -197,7 +246,9 @@ export const useRightOperate = () => { } } //属性 - const showAttr = () => { } + const showAttr = (eventBus, node) => { + console.log(eventBus, node) + } //导入模型 const importHeader = () => { } //导入模型 @@ -213,7 +264,6 @@ export const useRightOperate = () => { } } if (node) { - eventBus.emit("openDialog", node.sourceType, node.id); if (node.sourceType == 'pressModel') { eventBus.emit("openDialog", node.sourceType, node); } else { @@ -435,7 +485,7 @@ export const useRightOperate = () => { let nodes = window.treeObj.transformToArray( window.treeObj.getNodes() ); - let layers:any = []; + let layers: any = []; let arr = [ "ArcgisWXImagery", "ArcgisBLUEImagery", @@ -551,117 +601,90 @@ export const useRightOperate = () => { } } - // function renderVector(node, ifFly = true) { - // // if (node.detail != "") node.detail.field = node.detail.fieldName || "id"; - // let head_tables; - // if (node.head_tables) { - // head_tables == "" ? node.head_tables : JSON.parse(node.head_tables); - // } - // let vectorParams = { - // id: node.source_id, - // path: node.source_path, - // fileName: node.source_name, - // head_tables, - // ...node.detail, - // }; - // console.log("node", node); - // console.log("vectorParams", vectorParams); - // let Vector = new YJ.Obj.Vector((window as any).Earth1, vectorParams); - // console.log("Vector", Vector); - // Vector.on().then((res) => { - // (window as any)._entityMap.set(node.source_id, Vector); - // let treeObj = $.fn.zTree.getZTreeObj("treeDemo"); - // Vector.load(() => { - // let newnodes = Vector.getAllNode(); - // console.log("newnodes1111", newnodes); - // if (newnodes) { - // if (newnodes.list.length) { - // newnodes.list.forEach((it) => { - // let arrt = node.detail.hasOwnProperty("fieldName") - // ? node.detail.fieldName - // : Vector.field; - // let zijiNodes:any = []; - // if (it.features && it.features.length) { - // it.features.forEach((item) => { - // let ziNode = { - // source_id: item.id, - // source_type: item.type, - // source_name: - // item.properties[arrt] || Object.keys(item.properties)[0] || '未知', - // detail: { - // ...item, - // info: { type: "richText" }, - // }, - // is_show: 1, - // fid: node.source_id, - // }; - // zijiNodes.push(ziNode); - // }); - // } - // let fuNode = { - // source_id: - // it.id || md5(new Date().getTime().toString() + Math.random()), - // source_type: it.type, - // source_name: it.name || '未知', - // detail: { - // defaultfieldName: Vector.field, - // ...node.detail, - // }, - // is_show: 1, - // fid: node.source_id, - // children: zijiNodes.length > 0 ? zijiNodes : [], // 关键:把子节点挂到父节点 - // }; - // let parentNode = treeObj.getNodeByParam( - // "source_id", - // node.source_id, - // null - // ); - // if (parentNode) { - // treeObj.addNodes(parentNode, [fuNode], true); - // } - // }); - // } else { - // let arrt = node.detail.hasOwnProperty("fieldName") - // ? node.detail.fieldName - // : Vector.field; - // newnodes.list.forEach((it) => { - // let zijiNodes = []; - // let childNode = treeObj.getNodeByParam( - // "source_id", - // node.source_id, - // null - // ); - // console.log("1111111111111111111111111111", it); - // if (it.features && it.features.length) { - // it.features.forEach((item) => { - // let ziNode = { - // source_id: item.id, - // source_type: item.type, - // source_name: item.properties[arrt] || "", - // detail: { - // ...item, - // info: { type: "richText" }, - // }, - // is_show: 1, - // fid: node.source_id, - // }; - // zijiNodes.push(ziNode); - // }); - // } - // console.log("zijiNodes", "childNode", childNode, zijiNodes); - // if (childNode) { - // treeObj.addNodes(childNode, zijiNodes, true); - // } - // }); - // } - // } - // if (ifFly) Vector.flyTo(); - // Vector.onClick = shpTotal; - // //鼠标右键点击事件 - // Vector.onRightClick = shpSelect; - // }); - // }); - // } + 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 = []) { + // 处理路径分隔符 + const normalizedPath = path.replace(/\\/g, '/'); + const lastComponent = normalizedPath.split('/').pop(); + + // 如果没有提供需要移除的后缀列表,直接返回原始名称 + if (extensionsToRemove.length === 0) return lastComponent; + + // 检查是否匹配任何需要移除的后缀 + for (const ext of extensionsToRemove) { + const extWithDot = ext.startsWith('.') ? ext : `.${ext}`; + if (lastComponent.endsWith(extWithDot)) { + return lastComponent.slice(0, -extWithDot.length); + } + } + + return lastComponent; + } return { rightMenus diff --git a/src/renderer/src/views/components/tree/hooks/tree.ts b/src/renderer/src/views/components/tree/hooks/tree.ts index cfe97b1..643e20d 100644 --- a/src/renderer/src/views/components/tree/hooks/tree.ts +++ b/src/renderer/src/views/components/tree/hooks/tree.ts @@ -56,6 +56,7 @@ export const useTree = () => { const menus = showRightMenu(event, treeObj.value) console.log('menus', menus) if (menus.length == 0) { + $changeComponentShow('.rightMenu', false) return } nextTick(() => { diff --git a/src/renderer/src/views/components/tree/hooks/treeNode.ts b/src/renderer/src/views/components/tree/hooks/treeNode.ts index 651a45b..336f5f6 100644 --- a/src/renderer/src/views/components/tree/hooks/treeNode.ts +++ b/src/renderer/src/views/components/tree/hooks/treeNode.ts @@ -330,7 +330,7 @@ export const useTreeNode = () => { // detailFun: get_detail_fountain, allowChildren: false }, - shp: { + vector: { rightMenus: ['edit', 'del', 'setView', 'resetView', 'showAttr', 'importHeader'] // render: renderShp, // detailFun: get_detail_shp, @@ -361,7 +361,7 @@ export const useTreeNode = () => { // allowChildren: false }, Feature: { - rightMenus: ['setView', 'resetView', 'showAttr'] + rightMenus: ['showAttr'] // render: renderShp, // detailFun: get_detail_shp, // allowChildren: false, @@ -445,7 +445,23 @@ export const useTreeNode = () => { const cusNodeIcon = async (node) => { let availablePort = await ipcRenderer.invoke('get-available-port'); - let type = node.sourceType || node.type; + let type + if(node.sourcePath) { + // 获取最后一个点的位置 + const lastDotIndex = node.sourcePath.lastIndexOf('.'); + + // 如果没有点或者点是最后一个字符,则不是有效的文件后缀 + if (lastDotIndex === -1 || lastDotIndex === node.sourcePath.length - 1) { + return false; + } + + // 提取后缀并转换为小写进行比较 + const extension = node.sourcePath.slice(lastDotIndex + 1).toLowerCase(); + type = extension + } + else { + type = node.sourceType || node.type; + } console.log("----------", type); let name = [ "GDSLImagery", @@ -458,7 +474,7 @@ export const useTreeNode = () => { if (type == "Terrain") name = "terrain"; if (type == "road" && node.detail.imageType == "arrowRoad") name = "lineDrawing"; - return type === 'directory' ? undefined : `http://localhost:${availablePort}/icon/${name}.png`; + return (type === 'directory' || type === 'FeatureCollection') ? undefined : `http://localhost:${availablePort}/icon/${name}.png`; }; /** * 获取选中节点 @@ -608,7 +624,7 @@ export const useTreeNode = () => { try { arr = nodeType[selectedNodes[0].sourceType].rightMenus } catch (e) { - console.log('e', e) + console.log('e', e, selectedNodes[0].sourceType) arr = [] } } diff --git a/src/renderer/src/views/home/index.vue b/src/renderer/src/views/home/index.vue index c740cfa..d5bd244 100644 --- a/src/renderer/src/views/home/index.vue +++ b/src/renderer/src/views/home/index.vue @@ -112,6 +112,7 @@ import modelObject from '../components/propertyBox/modelObject.vue' 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 graphObject from '../components/propertyBox/graphObject.vue' import graph from '../components/propertyBox/graph.vue' @@ -294,6 +295,11 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => { await nextTick() dynamicComponentRef.value?.open(id) break + case 'vector': + currentComponent.value = vector + await nextTick() + dynamicComponentRef.value?.open(id) + break default: break } @@ -424,8 +430,9 @@ const getStatus = (time) => { } onMounted(async () => { + let baseURL = localStorage.getItem('service') getAuthInfo() - await YJ.on() + await YJ.on({ host: baseURL }) createEarth() })