大屏添加cesium
This commit is contained in:
@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<Dialog ref="baseDialog" title="立体文字" left="calc(50% - 160px)" top="calc(50% - 120px)">
|
||||
<template #content>
|
||||
<textarea style="height: 76px; width: 270px" v-model="text"></textarea>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="confirm">确定</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, inject } from 'vue';
|
||||
import { addOtherSource } from '@/views/largeScreen/components/api';
|
||||
import Dialog from './baseDialog.vue';
|
||||
import { initMapData } from '../initMapData';
|
||||
import { useTreeNode } from '../treeNode';
|
||||
|
||||
const { cusAddNodes } = useTreeNode();
|
||||
const eventBus: any = inject('bus');
|
||||
|
||||
const baseDialog: any = ref(null);
|
||||
const text = ref('');
|
||||
|
||||
const open = () => {
|
||||
baseDialog.value?.open();
|
||||
};
|
||||
const confirm = () => {
|
||||
baseDialog.value?.close();
|
||||
let name = text.value;
|
||||
text.value = '';
|
||||
let Draw = new window['YJ'].Draw.DrawPolyline(window['Earth1']);
|
||||
Draw.start(async (a, positions) => {
|
||||
if (!positions || positions.length < 2) {
|
||||
return;
|
||||
}
|
||||
let id = new window['YJ'].Tools().randomString();
|
||||
let options: any = await initMapData(
|
||||
'standText',
|
||||
{
|
||||
id: id,
|
||||
name: name,
|
||||
text: name,
|
||||
positions: positions
|
||||
},
|
||||
null
|
||||
);
|
||||
delete options.host;
|
||||
console.log('options', options);
|
||||
let selectedNodes = window['treeObj'].getSelectedNodes();
|
||||
let node = selectedNodes && selectedNodes[selectedNodes.length - 1];
|
||||
let parentId;
|
||||
if (node) {
|
||||
if (node.sourceType === 'directory') {
|
||||
parentId = node.id;
|
||||
} else {
|
||||
parentId = node.parentId;
|
||||
}
|
||||
}
|
||||
|
||||
let params: any = {
|
||||
id: id,
|
||||
sourceName: name,
|
||||
sourceType: 'standText',
|
||||
parentId: parentId,
|
||||
// "treeIndex": 0,
|
||||
params: options
|
||||
};
|
||||
addOtherSource(params);
|
||||
params.params = JSON.stringify(params.params);
|
||||
params.isShow = true;
|
||||
cusAddNodes(window['treeObj'], params.parentId, [params]);
|
||||
});
|
||||
};
|
||||
defineExpose({
|
||||
open
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
Reference in New Issue
Block a user