Compare commits
2 Commits
98a9c02583
...
0dc0b98fdb
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dc0b98fdb | |||
| a69bccce53 |
@ -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",
|
||||
|
||||
@ -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)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
11
src/renderer/src/api/gdb/index.ts
Normal file
11
src/renderer/src/api/gdb/index.ts
Normal 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,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -40,6 +40,35 @@ 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' //坐标系
|
||||
})
|
||||
)
|
||||
: console.log("没有设置系统设置");
|
||||
|
||||
|
||||
// 注册全局指令
|
||||
(window as any)._winMap = new Map();
|
||||
(window as any)._entityMap = new Map();
|
||||
|
||||
@ -343,7 +343,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'
|
||||
@ -408,6 +408,10 @@ 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())
|
||||
|
||||
const sysChange = async () => {
|
||||
const obj = {
|
||||
compass: systemSetting.value.showCompass, //罗盘
|
||||
@ -416,6 +420,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 +429,9 @@ const sysChange = async () => {
|
||||
YJ.Global.FlwStatusSwitch(window.earth, systemSetting.value.showFangliNet)
|
||||
//地形遮挡
|
||||
YJ.Global.setGroundCover(window.earth, systemSetting.value.occlusion)
|
||||
//系统
|
||||
let coor = systemSetting.value.coordinate ? systemSetting.value.coordinate : 'EPSG:4326'
|
||||
YJ.Global.setCoordinateSystem(window.earth, coor)
|
||||
|
||||
//比例尺
|
||||
await YJ.Global.SheetIndexStatusSwitch(window.earth, systemSetting.value.sheetIndexStatusSwitch)
|
||||
@ -451,7 +460,6 @@ const concurrentWorkloadChange = (val) => {
|
||||
})
|
||||
}
|
||||
const setView = () => {
|
||||
console.log('hhhhh')
|
||||
let msg = '操作成功'
|
||||
let view = YJ.Global.getCurrentView(window.earth)
|
||||
const options = {
|
||||
@ -460,7 +468,6 @@ const setView = () => {
|
||||
}
|
||||
YJ.Global.setDefaultView(window.earth, options)
|
||||
localStorage.setItem('defaultView', JSON.stringify(options))
|
||||
console.log('defaultView')
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
@ -481,6 +488,10 @@ const setData = () => {
|
||||
}
|
||||
const management = () => {}
|
||||
const batteryChange = () => {}
|
||||
onMounted(() => {
|
||||
systemSetting.value = JSON.parse(localStorage.getItem('systemSetting'))
|
||||
// sysChange()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@ -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'
|
||||
@ -815,7 +816,54 @@ 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: {
|
||||
richText: {}
|
||||
},
|
||||
id,
|
||||
sourceName: name,
|
||||
sourceType: 'gdb',
|
||||
// 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])
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
},
|
||||
//圆形统计
|
||||
circleStatistics() {
|
||||
if ((window as any).checkAuthIsValid) {
|
||||
|
||||
@ -526,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) => {
|
||||
@ -561,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()
|
||||
}
|
||||
|
||||
|
||||
@ -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%
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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>
|
||||
@ -371,7 +377,9 @@ const createEarth = async () => {
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
tree.value.initTreeCallBack()
|
||||
sysChange()
|
||||
// @ts-ignore
|
||||
let options = JSON.parse(localStorage.getItem('defaultView'))
|
||||
YJ.Global.setDefaultView(window.earth, options)
|
||||
@ -395,6 +403,39 @@ eventBus.on('defineClickAddLinkCb', (fun) => {
|
||||
clickAddLinkCb = fun
|
||||
})
|
||||
|
||||
const sysChange = async () => {
|
||||
let systemSetting = JSON.parse(localStorage.getItem('systemSetting'))
|
||||
console.log('systemSetting', 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)
|
||||
|
||||
//比例尺
|
||||
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) {
|
||||
@ -429,9 +470,9 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
yarn.lock
10
yarn.lock
@ -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"
|
||||
@ -6154,6 +6159,11 @@ temp-file@^3.4.0:
|
||||
async-exit-hook "^2.0.1"
|
||||
fs-extra "^10.0.0"
|
||||
|
||||
three@^0.180.0:
|
||||
version "0.180.0"
|
||||
resolved "https://registry.npmmirror.com/three/-/three-0.180.0.tgz"
|
||||
integrity sha512-o+qycAMZrh+TsE01GqWUxUIKR1AL0S8pq7zDkYOQw8GqfX8b8VoCKYUoHbhiX5j+7hr8XsuHDVU6+gkQJQKg9w==
|
||||
|
||||
tiny-emitter@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz"
|
||||
|
||||
Reference in New Issue
Block a user