Merge branch 'zyl' of http://xny.yj-3d.com:3000/zhouyulong/electron-4 into zyl
This commit is contained in:
@ -2,8 +2,10 @@ import { app, shell, BrowserWindow, ipcMain, globalShortcut, dialog } from 'elec
|
||||
import path, { join } from 'path'
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import icon from '../../resources/earth.png?asset'
|
||||
import { Recorder } from "../preload/recorder";
|
||||
import fs from 'fs'
|
||||
import { exec } from 'child_process'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
|
||||
// 开发环境路径处理 - 确保添加正确的file协议
|
||||
@ -148,6 +150,50 @@ function createWindow(): void {
|
||||
event.sender.send("selectedItem", arr);
|
||||
});
|
||||
});
|
||||
ipcMain.on("saveFile", (event, { title, filename, filters }) => {
|
||||
dialog
|
||||
.showSaveDialog({
|
||||
title,
|
||||
defaultPath: filename,
|
||||
filters,
|
||||
})
|
||||
.then((files) => {
|
||||
let path = "";
|
||||
if (!files.canceled) {
|
||||
path = files.filePath.replace(/\\/g, "/");
|
||||
}
|
||||
event.sender.send("selectedFileItem", path);
|
||||
});
|
||||
});
|
||||
|
||||
let recorder;
|
||||
ipcMain.on("startRecoder", (event) => {
|
||||
console.log("开始录制");
|
||||
recorder = new Recorder();
|
||||
recorder.start();
|
||||
});
|
||||
ipcMain.on("endRecoder", (event) => {
|
||||
console.log("结束录制");
|
||||
// 判断是否存在recorder,是否有recorder.end方法
|
||||
if (!recorder) {
|
||||
console.log("recorder不存在");
|
||||
return;
|
||||
}
|
||||
recorder.end(() => {
|
||||
let path = dialog.showSaveDialogSync({
|
||||
title: "保存视频文件",
|
||||
defaultPath: dayjs().format("YYYYMMDDHHmmss") + "视频录制.mp4",
|
||||
filters: [{ name: "文件类型", extensions: ["mp4"] }],
|
||||
});
|
||||
if (path != undefined) {
|
||||
recorder.move(path, () => {
|
||||
recorder = null;
|
||||
});
|
||||
} else {
|
||||
recorder = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
// 设置窗口标题和图标
|
||||
mainWindow.webContents.setWindowOpenHandler((details) => {
|
||||
shell.openExternal(details.url)
|
||||
|
||||
22
src/preload/config.ts
Normal file
22
src/preload/config.ts
Normal file
@ -0,0 +1,22 @@
|
||||
//获取项目根目录
|
||||
function GetHomeDir() {
|
||||
let HOME_DIR = process.cwd();
|
||||
console.log("process.env.NODE_ENV", process.env.NODE_ENV);
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
let arr = process.execPath.replaceAll("\\", "/").split("/");
|
||||
arr.pop();
|
||||
HOME_DIR = arr.join("/");
|
||||
}
|
||||
return HOME_DIR;
|
||||
}
|
||||
//获取项目根目录
|
||||
function GetAsar() {
|
||||
let HOME_DIR = process.cwd();
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
let arr = process.execPath.replaceAll("\\", "/").split("/");
|
||||
arr.pop();
|
||||
HOME_DIR = arr.join("/");
|
||||
}
|
||||
return HOME_DIR;
|
||||
}
|
||||
export { GetHomeDir, GetAsar };
|
||||
@ -23,3 +23,4 @@ if (process.contextIsolated) {
|
||||
// @ts-ignore (define in dts)
|
||||
window.YJColorPicker = YJColorPicker
|
||||
}
|
||||
|
||||
|
||||
113
src/preload/recorder.ts
Normal file
113
src/preload/recorder.ts
Normal file
@ -0,0 +1,113 @@
|
||||
import path from "path";
|
||||
import { GetHomeDir } from "./config";
|
||||
const os = require("os");
|
||||
const fs = require("fs");
|
||||
let platform = os.platform();
|
||||
const arch = os.arch();
|
||||
const moment = require("moment");
|
||||
const { spawn } = require("child_process");
|
||||
const EventEmitter = require("events");
|
||||
let ffmpegExePath = path.join(GetHomeDir(), "ffplay");
|
||||
class MyEmitter extends EventEmitter { }
|
||||
|
||||
const myEmitter = new MyEmitter();
|
||||
class Recorder {
|
||||
constructor(option = {}) {
|
||||
this.shell = undefined;
|
||||
this.filename =
|
||||
moment(parseInt(new Date().getTime())).format("YYYYMMDDHHmmss") + ".mp4";
|
||||
this.exe = "ffmpeg.exe";
|
||||
if (platform === "win32") {
|
||||
this.exe = "ffmpeg.exe";
|
||||
this.params = "-f gdigrab -r 30 -y -i desktop -pix_fmt yuv420p";
|
||||
}
|
||||
if (platform === "linux") {
|
||||
switch (arch) {
|
||||
case "x64":
|
||||
this.exe = "ffmpeg_x86";
|
||||
break;
|
||||
case "arm":
|
||||
this.exe = "ffmpeg_arm";
|
||||
break;
|
||||
}
|
||||
this.params =
|
||||
"-v verbose -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 -c:v libx264 -preset ultrafast -crf 18";
|
||||
//-s 1920x1080
|
||||
// ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 -c:v libx264 -preset ultrafast -crf 18 output.mp4
|
||||
}
|
||||
this.commands = path.join(GetHomeDir(), "/ffplay/" + this.exe);
|
||||
}
|
||||
get_path() {
|
||||
return path.join(ffmpegExePath, this.filename);
|
||||
}
|
||||
start() {
|
||||
this.exec(this.commands, this.params);
|
||||
}
|
||||
|
||||
exec(commands, param) {
|
||||
let arr = param.split(" ");
|
||||
arr.push(this.get_path());
|
||||
console.log("commands, arr", commands, arr);
|
||||
this.shell = spawn(commands, arr, {
|
||||
ffmpegExePath,
|
||||
// stdio: "ignore",
|
||||
// shell: true
|
||||
})
|
||||
.on("exit", (err) => {
|
||||
console.log("exit", err);
|
||||
myEmitter.emit("process-exit");
|
||||
})
|
||||
.on("data", function (data) {
|
||||
// console.log(typeof data);
|
||||
})
|
||||
.on("data", function (data) { });
|
||||
this.shell.unref();
|
||||
}
|
||||
end(cb) {
|
||||
if (!this.shell.killed) {
|
||||
console.log(this.shell);
|
||||
this.shell.stdin.write("q");
|
||||
myEmitter.once("process-exit", () => {
|
||||
cb();
|
||||
});
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
}
|
||||
move(dst, cb) {
|
||||
let readStream = fs.createReadStream(this.get_path());
|
||||
let writeStream = fs.createWriteStream(dst);
|
||||
readStream.pipe(writeStream);
|
||||
readStream.on("end", () => {
|
||||
fs.unlinkSync(this.get_path());
|
||||
cb();
|
||||
});
|
||||
}
|
||||
}
|
||||
/*function start() {
|
||||
config.recorder = new Recorder()
|
||||
config.recorder.start()
|
||||
}
|
||||
|
||||
function end(cb) {
|
||||
config.recorder.end(() => {
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
||||
function getRecorder() {
|
||||
return config.recorder
|
||||
}
|
||||
|
||||
function resetRecorder() {
|
||||
config.recorder = null
|
||||
}
|
||||
|
||||
exports.Recorder = {
|
||||
start,
|
||||
end,
|
||||
getRecorder,
|
||||
resetRecorder,
|
||||
}*/
|
||||
|
||||
export { Recorder };
|
||||
16
src/renderer/src/api/setting/auth.ts
Normal file
16
src/renderer/src/api/setting/auth.ts
Normal file
@ -0,0 +1,16 @@
|
||||
//授权
|
||||
import request from '@/axios/request'
|
||||
export const AuthApi = {
|
||||
// 查看授权信息
|
||||
showAuth: async () => {
|
||||
return await request.get({
|
||||
url: `/auth/show`
|
||||
})
|
||||
},
|
||||
//获取系统授权码
|
||||
authInfo: async () => {
|
||||
return await request.get({
|
||||
url: `/auth/info`
|
||||
})
|
||||
},
|
||||
}
|
||||
@ -10,15 +10,14 @@ 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://192.168.110.25:8848' || 'http://127.0.0.1:8808'
|
||||
} else {
|
||||
baseURL = 'http://192.168.110.25:8848'
|
||||
}
|
||||
|
||||
// 创建自定义配置的axios实例
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL:baseURL,
|
||||
baseURL: 'http://192.168.110.25:8848',
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@ -50,10 +49,10 @@ service.interceptors.request.use(
|
||||
|
||||
// 在这里添加认证token
|
||||
const token = localStorage.getItem('Authorization')
|
||||
console.log("localStorage.getItem('Authorization')",token);
|
||||
console.log("localStorage.getItem('Authorization')", token);
|
||||
|
||||
if (token && config.headers) {
|
||||
// Bearer
|
||||
// Bearer
|
||||
config.headers.Authorization = `${token}`
|
||||
}
|
||||
return config
|
||||
@ -68,18 +67,18 @@ service.interceptors.response.use(
|
||||
(response: AxiosResponse) => {
|
||||
const key = getRequestKey(response.config)
|
||||
pendingRequests.delete(key)
|
||||
console.log(response);
|
||||
console.log(response);
|
||||
|
||||
// 统一处理HTTP状态码
|
||||
if (response.status === 200) {
|
||||
if ([0,200].includes(response.data.code)) {
|
||||
if ([0, 200].includes(response.data.code)) {
|
||||
return response
|
||||
}
|
||||
if (response.data.code==401) {
|
||||
if (response.data.code == 401) {
|
||||
router.push('/')
|
||||
localStorage.removeItem('Authorization')
|
||||
}
|
||||
if (![0,200].includes(response.data.code)) {
|
||||
if (![0, 200].includes(response.data.code)) {
|
||||
ElMessage({
|
||||
message: response.data.msg || response.data.message,
|
||||
type: 'error'
|
||||
|
||||
@ -43,13 +43,36 @@ export const initMapData = async (type, data) => {
|
||||
data.host = 'http://192.168.110.25:8848'
|
||||
entityObject = new YJ.Obj.Terrain(window.earth, data)
|
||||
break
|
||||
case 'layer':
|
||||
case 'layer':
|
||||
data.host = 'http://192.168.110.25:8848'
|
||||
entityObject = new YJ.Obj.Layer(window.earth, data)
|
||||
break
|
||||
case 'tileset':
|
||||
case 'tileset':
|
||||
data.host = 'http://192.168.110.25:8848'
|
||||
entityObject = new YJ.Obj.Tileset(window.earth, data)
|
||||
|
||||
entityObject.load((res) => {
|
||||
// 等模型加载完后再加载压平模型
|
||||
Array.from(window.pressModelMap.keys()).forEach((key) => {
|
||||
if (key.indexOf("_" + data.id) > -1) {
|
||||
const nodes = window.pressModelMap.get(key);
|
||||
if (nodes) {
|
||||
if (nodes.isShow == 1) {
|
||||
// nodeType[nodes.source_type].render(nodes);
|
||||
const flatData = JSON.parse(nodes.params)
|
||||
const entity = window.earth.entityMap.get(flatData.modelId).entity
|
||||
let flat = new YJ.Analysis.Flat(window.earth, entity, {
|
||||
positions: flatData.positions,
|
||||
height: flatData.height,
|
||||
name: nodes.sourceName
|
||||
})
|
||||
window.pressModelEntities.set(nodes.id, flat)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
break
|
||||
case 'path':
|
||||
entityObject = new YJ.Obj.TrajectoryMotion(window.earth, data)
|
||||
@ -64,10 +87,10 @@ export const initMapData = async (type, data) => {
|
||||
entityObject = new YJ.Obj.RadarScan(window.earth, data)
|
||||
break
|
||||
default:
|
||||
return
|
||||
break
|
||||
}
|
||||
options = structuredClone(entityObject.options)
|
||||
delete options.host
|
||||
// options = entityObject
|
||||
return options
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-upload
|
||||
:action="action"
|
||||
:action="uploadUrl()"
|
||||
:headers="headers"
|
||||
:data="data"
|
||||
:show-file-list="false"
|
||||
@ -39,12 +39,19 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
const headers = ref({
|
||||
Authorization: 'Bearer ' + localStorage.getItem('access_token')
|
||||
// Authorization: 'Bearer ' + localStorage.getItem('access_token')
|
||||
Authorization: localStorage.getItem('Authorization')
|
||||
})
|
||||
const action = ref('')
|
||||
// const action = ref('')
|
||||
// 上传状态
|
||||
const isUploading = ref(false)
|
||||
|
||||
// 上传地址
|
||||
const uploadUrl = () => {
|
||||
//process.env.BASE_API +
|
||||
console.log(process.env.BASE_API, 'yyyyy')
|
||||
let url = 'http://192.168.110.25:8848' + '/yjearth4.0/api/v1/auth/import'
|
||||
return url
|
||||
}
|
||||
// 上传前处理
|
||||
const handleBeforeUpload = (file: File) => {
|
||||
// 检查文件大小
|
||||
|
||||
1
src/renderer/src/icons/svg/add.svg
Normal file
1
src/renderer/src/icons/svg/add.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 13 KiB |
4
src/renderer/src/icons/svg/turn.svg
Normal file
4
src/renderer/src/icons/svg/turn.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<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="M3.06995 0.0336822C3.30345 -0.0134909 3.72175 0.0203715 4.04432 0.0203715L8.80938 0.0203715C9.40915 0.0203715 10.1307 -0.0457695 10.6647 0.0603036C11.1902 0.1647 11.5443 0.463472 11.7725 0.858946C12.0226 1.29218 11.9994 1.8259 11.9994 2.52278L11.9994 10.1232C11.9994 11.3662 11.3459 12 10.0774 12L3.41699 12C3.05145 12 2.7978 11.9615 2.78966 11.6805C2.77859 11.2992 3.13767 11.3345 3.59051 11.3345L9.62358 11.3345C9.9666 11.3345 10.3532 11.3732 10.5979 11.3078C10.9435 11.2156 11.2516 10.9028 11.3187 10.5225C11.3785 10.1841 11.3321 9.80816 11.3321 9.41772L11.3321 2.70913C11.3321 2.34708 11.3626 1.95707 11.3321 1.59103C11.2915 1.1051 10.9141 0.772719 10.5312 0.699218C10.2419 0.643685 9.88335 0.685907 9.54349 0.685907L3.55046 0.685907C3.25907 0.685907 2.87412 0.72524 2.803 0.446314C2.74999 0.238375 2.86113 0.0758638 3.06995 0.0336822ZM4.9653 7.34125L2.00215 7.34125C1.65943 7.34125 1.32269 7.37425 1.04113 7.31463C0.477442 7.19527 0.00413877 6.69706 2.77496e-05 6.02349C-0.00437695 5.30309 0.516243 4.73537 1.24135 4.67911C1.82735 4.63364 2.47369 4.67911 3.11 4.67911L4.9653 4.67911C5.01246 4.16292 4.79863 2.94146 5.29899 2.94872C5.53703 2.95217 5.7177 3.11918 5.87293 3.24155C6.7027 3.89572 7.45568 4.47287 8.31552 5.11836C8.57959 5.3166 9.11366 5.62915 9.10303 6.05011C9.09247 6.46816 8.55953 6.78468 8.30218 6.98186C7.46283 7.62495 6.69288 8.19646 5.84623 8.83205C5.69609 8.94478 5.46648 9.11088 5.2456 9.05833C4.76802 8.9447 5.0393 7.88096 4.9653 7.34125Z" fill="#FFFFFF" >
|
||||
</path>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
138
src/renderer/src/utils/HighDefinitionScreenshot.ts
Normal file
138
src/renderer/src/utils/HighDefinitionScreenshot.ts
Normal file
@ -0,0 +1,138 @@
|
||||
export function processBase64Images(base64Data1, base64Data2, callback) {
|
||||
if (!base64Data1 || !base64Data2) {
|
||||
alert("请输入两个Base64图像数据");
|
||||
return;
|
||||
}
|
||||
// 创建Image对象并加载第一个Base64图像
|
||||
const img1 = new Image();
|
||||
img1.onload = function () {
|
||||
// 创建Image对象并加载第二个Base64图像
|
||||
const img2 = new Image();
|
||||
img2.onload = function () {
|
||||
// 计算拼接后的Canvas尺寸(这里示例为水平拼接,垂直拼接可调整计算方式)
|
||||
const totalWidth = img1.width + img2.width;
|
||||
const maxHeight = Math.max(img1.height, img2.height);
|
||||
console.log("maxHeight", maxHeight);
|
||||
const resultCanvas = document.createElement("canvas");
|
||||
// 设置结果Canvas的尺寸
|
||||
resultCanvas.width = totalWidth;
|
||||
resultCanvas.height = maxHeight;
|
||||
|
||||
// 获取Canvas绘图上下文
|
||||
const ctx = resultCanvas.getContext("2d");
|
||||
|
||||
// 绘制第一个图像(左上角开始)
|
||||
ctx.drawImage(img1, 0, 0);
|
||||
|
||||
// 绘制第二个图像(第一个图像右侧)
|
||||
ctx.drawImage(img2, img1.width, 0);
|
||||
|
||||
// 获取拼接后的Base64结果(默认为PNG格式,可指定其他格式如JPEG)
|
||||
const resultBase64Data = resultCanvas.toDataURL("image/png");
|
||||
callback(resultBase64Data);
|
||||
console.log("图像拼接完成,Base64结果已生成");
|
||||
};
|
||||
img2.src = base64Data1;
|
||||
};
|
||||
img1.src = base64Data2;
|
||||
}
|
||||
/**
|
||||
* 拼接两个Base64图像并返回新的Base64
|
||||
* @param {string} base641 第一个Base64图像数据
|
||||
* @param {number} width1 第一个图像要截取的宽度
|
||||
* @param {string} base642 第二个Base64图像数据
|
||||
* @param {number} width2 第二个图像要截取的宽度
|
||||
* @param {string} [format='image/png'] 输出图像格式
|
||||
* @param {number} [quality=1.0] 输出图像质量(0-1),仅对支持的格式有效
|
||||
* @returns {Promise<string>} 拼接后的Base64图像数据
|
||||
*/
|
||||
export function combineBase64Images(
|
||||
base641,
|
||||
width1,
|
||||
base642,
|
||||
width2,
|
||||
format = "image/png",
|
||||
quality = 1.0
|
||||
) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 创建canvas元素
|
||||
const canvas = document.createElement("canvas");
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
// 设置canvas宽度和高度
|
||||
canvas.width = width1 + width2;
|
||||
canvas.height = 0; // 高度将在图像加载后确定
|
||||
|
||||
// 创建图像对象
|
||||
const img1 = new Image();
|
||||
const img2 = new Image();
|
||||
|
||||
// 错误处理
|
||||
function handleError(error) {
|
||||
reject(new Error(`图像处理错误: ${error.message}`));
|
||||
}
|
||||
|
||||
// 监听两个图像都加载完成
|
||||
let loadedCount = 0;
|
||||
function checkAllLoaded() {
|
||||
loadedCount++;
|
||||
if (loadedCount === 2) {
|
||||
drawAndResolve();
|
||||
}
|
||||
}
|
||||
|
||||
// 图像1加载事件
|
||||
img1.onload = function () {
|
||||
checkAllLoaded();
|
||||
};
|
||||
|
||||
// 图像2加载事件
|
||||
img2.onload = function () {
|
||||
checkAllLoaded();
|
||||
};
|
||||
|
||||
// 图像加载错误事件
|
||||
img1.onerror = img2.onerror = handleError;
|
||||
|
||||
// 加载图像
|
||||
img1.src = base641;
|
||||
img2.src = base642;
|
||||
|
||||
// 绘制图像并解析为Base64
|
||||
function drawAndResolve() {
|
||||
try {
|
||||
// 确定canvas高度为两个图像高度的最大值
|
||||
const height1 = img1.height;
|
||||
const height2 = img2.height;
|
||||
canvas.height = Math.max(height1, height2);
|
||||
|
||||
// 清除画布
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// 绘制第一个图像的左侧部分 (从左往右截取width1)
|
||||
ctx.drawImage(img1, 0, 0, width1, height1, 0, 0, width1, canvas.height);
|
||||
|
||||
// 绘制第二个图像的右侧部分 (从右往左截取width2)
|
||||
// 计算在原图上的截取起点 (从右侧开始)
|
||||
const sourceX = img2.width - width2;
|
||||
ctx.drawImage(
|
||||
img2,
|
||||
sourceX,
|
||||
0,
|
||||
width2,
|
||||
height2,
|
||||
width1,
|
||||
0,
|
||||
width2,
|
||||
canvas.height
|
||||
);
|
||||
|
||||
// 将canvas内容转换为Base64
|
||||
const resultBase64 = canvas.toDataURL(format, quality);
|
||||
resolve(resultBase64);
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
const { ipcRenderer } = require('electron')
|
||||
export const $changeComponentShow = (selector: any, state: any, styleStr: any = false) => {
|
||||
$(selector).css({ visibility: state ? 'visible' : 'hidden' })
|
||||
if (styleStr) {
|
||||
@ -17,3 +18,14 @@ export const $changeComponentPop = (selector: any, state: any, styleStr: any = f
|
||||
if (str[0] === 'z-index') $(selector).css({ zIndex: str[1] })
|
||||
}
|
||||
}
|
||||
|
||||
export const $sendElectronChanel = (chanel: any, arg: any = null) => {
|
||||
console.log('发送给electron', chanel, arg);
|
||||
ipcRenderer.send(chanel, arg);
|
||||
};
|
||||
export const $recvElectronChanel = (chanel: any, cb: any) => {
|
||||
console.log('接收来自electron', chanel);
|
||||
ipcRenderer.once(chanel, cb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import uploadFiles from '@/components/upload/uploadFiles.vue'
|
||||
import { AuthApi } from '@/api/setting/auth.ts'
|
||||
const { t } = useI18n()
|
||||
const authInfo = ref({
|
||||
license_code: '',
|
||||
@ -53,6 +54,18 @@ const authInfo = ref({
|
||||
auth_type: '无', //授权时间
|
||||
message: '' //
|
||||
})
|
||||
|
||||
const getAuthInfo = async () => {
|
||||
const res = await AuthApi.showAuth()
|
||||
console.log(res, 'resres')
|
||||
}
|
||||
const getAuthCode = async () => {
|
||||
const res = await AuthApi.authInfo()
|
||||
authInfo.value.license_code = res.data
|
||||
console.log(res, 'resres22')
|
||||
}
|
||||
getAuthInfo()
|
||||
getAuthCode()
|
||||
//复制
|
||||
const copy = () => {
|
||||
console.log(1111111)
|
||||
|
||||
@ -128,28 +128,28 @@ const menuList: any = ref([
|
||||
// fun: this.showSecondMenu,
|
||||
key: 'tool',
|
||||
children: [
|
||||
// 'routePlan',
|
||||
// 'clearRoute',
|
||||
// 'graffiti',
|
||||
// // stopGraffiti: "结束涂鸦",
|
||||
// 'clearGraffiti',
|
||||
// 'path',
|
||||
// 'coorLocation',
|
||||
// 'mouseLocation',
|
||||
// 'annotationAggregation',
|
||||
// 'annotation',
|
||||
// 'screenShot',
|
||||
// 'highQuality',
|
||||
// 'videoRecord',
|
||||
// 'pressModel',
|
||||
// 'terrainDig',
|
||||
// 'tilesetClipping',
|
||||
// 'clearTilesetClipping',
|
||||
// 'projConvert',
|
||||
// 'projectionConvert',
|
||||
// 'gdbImport',
|
||||
// 'circleStatistics',
|
||||
// 'polygonStatistics'
|
||||
'routePlan',
|
||||
'clearRoute',
|
||||
'graffiti',
|
||||
// stopGraffiti: "结束涂鸦",
|
||||
'clearGraffiti',
|
||||
'path',
|
||||
'coorLocation',
|
||||
'mouseLocation',
|
||||
'annotationAggregation',
|
||||
'annotation',
|
||||
'screenShot',
|
||||
'highQuality',
|
||||
'videoRecord',
|
||||
'pressModel',
|
||||
'terrainDig',
|
||||
'tilesetClipping',
|
||||
'clearTilesetClipping',
|
||||
'projConvert',
|
||||
'projectionConvert',
|
||||
'gdbImport',
|
||||
'circleStatistics',
|
||||
'polygonStatistics'
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -20,9 +20,18 @@ import { useTreeNode } from '../tree/hooks/treeNode'
|
||||
import { TreeApi } from '@/api/tree'
|
||||
import { renderMethods } from '../tree/hooks/renderTreeNode'
|
||||
import { addMapSource } from '../../../common/addMapSource'
|
||||
import { processBase64Images, combineBase64Images } from '@/utils/HighDefinitionScreenshot'
|
||||
import {
|
||||
$sendElectronChanel,
|
||||
$recvElectronChanel,
|
||||
$changeComponentShow
|
||||
} from '@/utils/communication'
|
||||
import { ElMessage, ElLoading } from 'element-plus'
|
||||
import dayjs from 'dayjs'
|
||||
const { t } = useI18n()
|
||||
const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
|
||||
const obj: any = ref(null)
|
||||
const fs = require('fs')
|
||||
const obj = ref(null)
|
||||
const isclick = ref(false)
|
||||
const eventBus: any = inject('bus')
|
||||
const initList = (value) => {
|
||||
@ -38,6 +47,21 @@ var graffitiObjArr = reactive([])
|
||||
eventBus.on('graffitiObj', (data: never) => {
|
||||
graffitiObjArr.push(data)
|
||||
})
|
||||
|
||||
function openLoading(
|
||||
text = '拼命加载中...',
|
||||
option = {
|
||||
fullscreen: true,
|
||||
background: 'rgba(0,0,0,0.63)',
|
||||
lock: true
|
||||
// spinner: 'el-icon-loading'
|
||||
}
|
||||
) {
|
||||
option.text = text
|
||||
let loadingInstance = ElLoading.service(option)
|
||||
return loadingInstance
|
||||
}
|
||||
|
||||
const methodMap = {
|
||||
// 轨迹运动
|
||||
trajectoryMotion: () => {
|
||||
@ -263,14 +287,66 @@ const methodMap = {
|
||||
//卷帘对比
|
||||
annotation() {
|
||||
clickChange.annotation = !clickChange.annotation
|
||||
// if (clickChange.annotation) {
|
||||
// YJ.Global.splitScreen.on(window.earth)
|
||||
// } else {
|
||||
// YJ.Global.splitScreen.off()
|
||||
// }
|
||||
if (clickChange.annotation) {
|
||||
YJ.Global.splitScreen.on(window.earth)
|
||||
} else {
|
||||
YJ.Global.splitScreen.off()
|
||||
}
|
||||
},
|
||||
//屏幕截图
|
||||
screenShot() { },
|
||||
async screenShot() {
|
||||
function downloadScreen(res) {
|
||||
let base64 = res.replace(/^data:image\/\w+;base64,/, '')
|
||||
let dataBuffer = new Buffer(base64, 'base64')
|
||||
$sendElectronChanel('saveFile', {
|
||||
title: '保存图片',
|
||||
filename: dayjs().format('YYYYMMDDHHmmss') + '截图',
|
||||
filters: [{ name: '保存图片', extensions: ['jpg'] }]
|
||||
})
|
||||
$recvElectronChanel('selectedFileItem', (e, path) => {
|
||||
fs.writeFile(path, dataBuffer, (res) => {})
|
||||
})
|
||||
}
|
||||
|
||||
if (window.splitScreen || window.multiViewportMode) {
|
||||
let res = ''
|
||||
let res2 = ''
|
||||
let sdk
|
||||
if (window.splitScreen) {
|
||||
sdk = YJ.Global.splitScreen.getSdk()
|
||||
} else {
|
||||
sdk = YJ.Global.multiViewportMode.getSdk()
|
||||
}
|
||||
await new YJ.Global.ScreenShot(sdk.sdkD, (data) => {
|
||||
res = data
|
||||
})
|
||||
await new YJ.Global.ScreenShot(sdk.sdkP, (data) => {
|
||||
res2 = data
|
||||
})
|
||||
if (window.multiViewportMode) {
|
||||
processBase64Images(res, res2, (mergedBase64) => {
|
||||
downloadScreen(mergedBase64)
|
||||
// window.multiViewportMode = false;
|
||||
})
|
||||
} else {
|
||||
let doms = document.querySelectorAll('.cesium-widget')
|
||||
let leftWidth = doms[0].offsetWidth
|
||||
let rightWidth = doms[1].offsetWidth
|
||||
combineBase64Images(res2, leftWidth, res, rightWidth)
|
||||
.then((result) => {
|
||||
downloadScreen(result)
|
||||
// window.splitScreen = false;
|
||||
})
|
||||
.catch((err) => console.error('拼接失败:', err))
|
||||
}
|
||||
} else {
|
||||
let res = ''
|
||||
await new YJ.Global.ScreenShot(window.earth, (data) => {
|
||||
res = data
|
||||
})
|
||||
downloadScreen(res)
|
||||
}
|
||||
},
|
||||
//高清出图
|
||||
highQuality() {
|
||||
// eventBus.emit('screenShotDialog')
|
||||
@ -279,27 +355,190 @@ const methodMap = {
|
||||
//视频录制
|
||||
videoRecord() {
|
||||
clickChange.videoRecord = !clickChange.videoRecord
|
||||
|
||||
let time = 3
|
||||
$changeComponentShow('#secondMenu', false)
|
||||
if (clickChange.videoRecord) {
|
||||
// document.addEventListener("keydown", onKeyDown);
|
||||
let loading = openLoading(time, {
|
||||
background: 'rgba(0,0,0,0)',
|
||||
fullscreen: false,
|
||||
customClass: 'timer'
|
||||
})
|
||||
let timer = ''
|
||||
const p = document.createElement('p')
|
||||
p.style.color = '#fff'
|
||||
p.innerHTML = '再次点击录制结束'
|
||||
document.getElementsByClassName('el-loading-spinner')[0].appendChild(p)
|
||||
let func = () => {
|
||||
loading.setText(time--)
|
||||
if (time == -1) {
|
||||
clearInterval(timer)
|
||||
loading.close()
|
||||
p.remove()
|
||||
$sendElectronChanel('startRecoder')
|
||||
}
|
||||
}
|
||||
func()
|
||||
timer = setInterval(func, 1000)
|
||||
} else {
|
||||
$sendElectronChanel('endRecoder')
|
||||
// document.removeEventListener("keydown", onKeyDown);
|
||||
}
|
||||
},
|
||||
//压模
|
||||
pressModel() { },
|
||||
pressModel() {
|
||||
// if (window.checkAuthIsValid) {
|
||||
let selectedNode = window.treeObj.getSelectedNodes()[0]
|
||||
if (selectedNode) {
|
||||
let isTileset = ['bim', 'tileset'].includes(selectedNode.sourceType)
|
||||
if (!isTileset) {
|
||||
ElMessage({
|
||||
message: '请在图层指挥舱选中对应模型进行操作',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
// let source_id = this.$md5(new Date().getTime() + '压平面')
|
||||
|
||||
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
||||
draw.start((err, params) => {
|
||||
if (params.length > 2) {
|
||||
if (err) throw err
|
||||
let alt = params[0].alt
|
||||
params.forEach((item) => {
|
||||
if (item.alt < alt) alt = item.alt
|
||||
})
|
||||
|
||||
//获取节点树对象
|
||||
|
||||
let entity = window.earth.entityMap.get(selectedNode.id).entity
|
||||
|
||||
let flat = new YJ.Analysis.Flat(window.earth, entity, {
|
||||
positions: params
|
||||
})
|
||||
let detailOption = {
|
||||
// modleId: selectedNode.id,
|
||||
modelId: selectedNode.id,
|
||||
positions: params,
|
||||
height: flat.height
|
||||
}
|
||||
let id = new YJ.Tools().randomString()
|
||||
let paramsData = {
|
||||
params: detailOption,
|
||||
id,
|
||||
sourceName: '压平面',
|
||||
sourceType: 'pressModel',
|
||||
// parentId:
|
||||
// selectedNode.sourceType == 'directory' ? selectedNode.id : selectedNode.parentId
|
||||
parentId: selectedNode.id
|
||||
}
|
||||
|
||||
TreeApi.addOtherSource(paramsData)
|
||||
paramsData.isShow = true
|
||||
paramsData.params = JSON.stringify(paramsData.params)
|
||||
pressModelMap.set(id + '_' + selectedNode.id, paramsData)
|
||||
window.pressModelEntities.set(id, flat)
|
||||
cusAddNodes(window.treeObj, paramsData.parentId, [paramsData])
|
||||
// //鼠标右键点击事件
|
||||
flat.onRightClick = () => {}
|
||||
// _entityMap.set(node.source_id, flat)
|
||||
} else {
|
||||
// this.$message.warning('至少三个点')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// this.$message.warning('请在图层指挥舱选中对应模型进行操作!')
|
||||
}
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: '您没有该功能的权限',
|
||||
// type: 'warning'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
//地形开挖
|
||||
terrainDig() {
|
||||
// if (window.checkAuthIsValid) {
|
||||
// new YJ.Analysis.TerrainExcavation(window.Earth1);
|
||||
eventBus.emit('terrainExcavationDialog')
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: '您没有该功能的权限',
|
||||
// type: 'warning'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
//剖切
|
||||
tilesetClipping() { },
|
||||
tilesetClipping() {
|
||||
// if (window.checkAuthIsValid) {
|
||||
let selectedNode = window.treeObj.getSelectedNodes()
|
||||
if (selectedNode.length < 1) {
|
||||
ElMessage({
|
||||
message: '请在图层指挥舱选中对应模型进行操作',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!(selectedNode[0].sourceType === 'tileset' || selectedNode[0].sourceType === 'bim')) {
|
||||
ElMessage({
|
||||
message: '选中的节点不能进行剖切',
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
let tileset = window.earth.entityMap.get(selectedNode[0].id)
|
||||
let draw = new YJ.Draw.DrawPolygon(window.earth)
|
||||
draw.start((err, pos) => {
|
||||
let section = new YJ.Analysis.Section(window.earth, tileset.entity, {
|
||||
positions: pos
|
||||
})
|
||||
// _entityMap.set(selectedNode.source_id + 'pouqie', section)
|
||||
})
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: '您没有该功能的权限',
|
||||
// type: 'warning'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
//删除剖切
|
||||
clearTilesetClipping() { },
|
||||
clearTilesetClipping() {
|
||||
YJ.Analysis.ClearSection()
|
||||
},
|
||||
//度分秒
|
||||
projConvert() { },
|
||||
projConvert() {
|
||||
eventBus.emit('projConvertDialog')
|
||||
},
|
||||
//投影转换
|
||||
projectionConvert() { },
|
||||
projectionConvert() {
|
||||
eventBus.emit('ProjectionConvertDialog')
|
||||
},
|
||||
//GDB导入
|
||||
gdbImport() { },
|
||||
//圆形统计
|
||||
circleStatistics() { },
|
||||
circleStatistics() {
|
||||
// if (window.checkAuthIsValid) {
|
||||
eventBus.emit('goodsSearchCircleDialog')
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: '您没有该功能的权限',
|
||||
// type: 'warning'
|
||||
// })
|
||||
// }
|
||||
},
|
||||
//多边形统计
|
||||
polygonStatistics() { }
|
||||
polygonStatistics() {
|
||||
// if (window.checkAuthIsValid) {
|
||||
eventBus.emit('goodsSearchPolgonDialog')
|
||||
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: "您没有该功能的权限",
|
||||
// type: "warning",
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
const handleClick = (value = 'projectionDistanceMeasure') => {
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<div class="row" style="align-items: flex-start">
|
||||
<div class="col" style="flex: 0 0 120px">
|
||||
<span class="label">等高线</span>
|
||||
<input class="btn-switch show" type="checkbox" />
|
||||
<input class="btn-switch show" type="checkbox" v-model="show" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -145,6 +145,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="sure">确定</button>
|
||||
<button @click="close">取消</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
@ -158,16 +159,24 @@ import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
const baseDialog: any = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
|
||||
var show: any = ref(true)
|
||||
eventBus.on('contourDialog', () => {
|
||||
baseDialog.value?.open()
|
||||
setTimeout(() => {
|
||||
YJ.Global.Contour(window.earth)
|
||||
})
|
||||
})
|
||||
const closeCallBack = (e) => {}
|
||||
const closeCallBack = (e) => {
|
||||
YJ.Global.ContourReset()
|
||||
show.value = true
|
||||
}
|
||||
const close = (e) => {
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
const sure = (e) => {
|
||||
YJ.Global.ContourStartDraw(window.earth, show.value)
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
title="坐标定位"
|
||||
left="180px"
|
||||
top="100px"
|
||||
width="418px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content>
|
||||
@ -15,14 +16,24 @@
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 0 0 58%">
|
||||
<span class="label">经度</span>
|
||||
<input class="input" type="number" v-model="longitude" />
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
placeholder="请输入坐标点经度数值"
|
||||
v-model="longitude"
|
||||
/>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 0 0 58%">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input" type="number" v-model="latitude" />
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
placeholder="请输入坐标点纬度数值"
|
||||
v-model="latitude"
|
||||
/>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
@ -41,9 +52,9 @@
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 0 0 78%">
|
||||
<span class="label">经度</span>
|
||||
<input class="input" type="number" v-model="longitude" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="longitude" />
|
||||
<span class="label2">度</span>
|
||||
<input class="input" type="number" v-model="lngMin" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="lngMin" />
|
||||
<span class="label2">分</span>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
@ -51,9 +62,9 @@
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 0 0 78%">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input" type="number" v-model="latitude" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="latitude" />
|
||||
<span class="label2">度</span>
|
||||
<input class="input" type="number" v-model="latMin" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="latMin" />
|
||||
<span class="label2">分</span>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
@ -73,11 +84,11 @@
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 0 0 90%">
|
||||
<span class="label">经度</span>
|
||||
<input class="input" type="number" v-model="longitude" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="longitude" />
|
||||
<span class="label2">度</span>
|
||||
<input class="input" type="number" v-model="lngMin" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="lngMin" />
|
||||
<span class="label2">分</span>
|
||||
<input class="input" type="number" v-model="lngSec" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="lngSec" />
|
||||
<span class="label2">秒</span>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
@ -85,11 +96,11 @@
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 0 0 90%">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input" type="number" v-model="latitude" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="latitude" />
|
||||
<span class="label2">度</span>
|
||||
<input class="input" type="number" v-model="latMin" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="latMin" />
|
||||
<span class="label2">分</span>
|
||||
<input class="input" type="number" v-model="latSec" />
|
||||
<input class="input" type="number" placeholder="请输入内容" v-model="latSec" />
|
||||
<span class="label2">秒</span>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
@ -106,8 +117,8 @@
|
||||
</el-tabs>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="draw">确定</button>
|
||||
<button @click="close">取消</button>
|
||||
<!-- <button @click="draw">确定</button> -->
|
||||
<button @click="close">关闭</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
@ -177,13 +188,13 @@ const flyto = (e) => {
|
||||
break
|
||||
case 'third':
|
||||
var lng =
|
||||
// @ts-ignore (define in dts)
|
||||
// @ts-ignore (define in dts)
|
||||
Math.abs(longitude.value) + Math.abs(lngMin.value) / 60 + Math.abs(lngSec.value) / 3600
|
||||
var lat =
|
||||
// @ts-ignore (define in dts)
|
||||
// @ts-ignore (define in dts)
|
||||
Math.abs(latitude.value) + Math.abs(latMin.value) / 60 + Math.abs(latSec.value) / 3600
|
||||
|
||||
// @ts-ignore (define in dts)
|
||||
// @ts-ignore (define in dts)
|
||||
lng = longitude.value < 0 ? -lng : lng
|
||||
// @ts-ignore (define in dts)
|
||||
lat = latitude.value < 0 ? -lat : lat
|
||||
|
||||
@ -0,0 +1,340 @@
|
||||
<template>
|
||||
<Dialog
|
||||
v-if="show"
|
||||
ref="baseDialog"
|
||||
title="物质统计"
|
||||
left="180px"
|
||||
top="100px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content>
|
||||
<div id="goodSearchEchart" style="width: 100%; height: 100%"></div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button>绘制</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { inject } from 'vue'
|
||||
import { nextTick } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
|
||||
const baseDialog: any = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
const shpTotalDict: any = reactive({
|
||||
shlwz_jzzp: '救灾帐篷',
|
||||
mb: '棉被',
|
||||
mymdy: '棉衣、棉大衣',
|
||||
mjb: '毛巾被',
|
||||
mt: '毛毯',
|
||||
dgnsd: '睡袋',
|
||||
zdc: '折叠床',
|
||||
jycs: '简易厕所',
|
||||
xpct: '橡皮船(艇)',
|
||||
cfz: '冲锋舟',
|
||||
jsc: '救生船',
|
||||
jsy: '救生衣',
|
||||
jsq: '救生圈',
|
||||
bzd: '编织袋',
|
||||
md: '麻袋',
|
||||
csb: '抽水泵',
|
||||
fdj: '发电机',
|
||||
yjd: '应急灯',
|
||||
jzzp: '救灾帐篷',
|
||||
jzyb: '救灾衣被',
|
||||
jygj: '救援工具'
|
||||
})
|
||||
|
||||
var draw: any = reactive([])
|
||||
|
||||
var show: any = ref(false)
|
||||
eventBus.on('goodsSearchCircleDialog', () => {
|
||||
console.log('kkkkkk')
|
||||
// baseDialog.value?.open()
|
||||
draw = new YJ.Draw.DrawCircle(window.earth)
|
||||
draw.start((err, positions) => {
|
||||
console.log('err, positions', err, positions)
|
||||
if (!err && positions.center.lng) {
|
||||
show.value = true
|
||||
let nodes = booleanOverlaps(positions)
|
||||
console.log('goodsSearchCircle', nodes)
|
||||
renderCanvas(nodes)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function booleanOverlaps(positions1, flag = 'circle') {
|
||||
let cross = undefined
|
||||
function set3Array(positions) {
|
||||
let arr = []
|
||||
positions.forEach((item) => {
|
||||
arr.push([item.lng, item.lat])
|
||||
})
|
||||
arr.push(arr[0])
|
||||
return arr
|
||||
}
|
||||
|
||||
let getNode = (types) => {
|
||||
let treeObj = window.treeObj
|
||||
let res = []
|
||||
types.forEach((type) => {
|
||||
let nodes = treeObj.getNodesByParam('sourceType', type, null)
|
||||
// console.log("nodes",nodes)
|
||||
res = res.concat(nodes)
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
//绘制的区域
|
||||
// console.log("[set3Array(positions1)]", [set3Array(positions1)])
|
||||
// 获取物资处(特定的标注类型)
|
||||
let allNodes = getNode(['point', 'vr', 'picture', 'Feature'])
|
||||
console.log('allNodes', allNodes)
|
||||
let itemInArea = [] //区域内的类型符合的标注
|
||||
|
||||
for (let i = 0; i < allNodes.length; i++) {
|
||||
let item = allNodes[i]
|
||||
let getAllItemInArea = (lng, lat) => {
|
||||
if (flag == 'circle') {
|
||||
let { center, radius } = positions1
|
||||
let distance = new YJ.Tools().randomString(center, { lng, lat })
|
||||
distance < radius && itemInArea.push(item)
|
||||
} else {
|
||||
let polygon1 = turf.polygon([set3Array(positions1)])
|
||||
let pt = turf.point([lng, lat])
|
||||
turf.booleanPointInPolygon(pt, polygon1) && itemInArea.push(item)
|
||||
}
|
||||
}
|
||||
console.log(item, item.sourceType, 'ooooo')
|
||||
switch (item.sourceType) {
|
||||
case 'point':
|
||||
case 'vr':
|
||||
case 'picture':
|
||||
let params = JSON.parse(item.params)
|
||||
console.log('params', params)
|
||||
let lng = params.position.lng
|
||||
let lat = params.position.lat
|
||||
getAllItemInArea(lng, lat)
|
||||
break
|
||||
case 'Feature':
|
||||
if (item.detail.geometry.type == 'Point') {
|
||||
lng = item.detail.geometry.coordinates[0]
|
||||
lat = item.detail.geometry.coordinates[1]
|
||||
getAllItemInArea(lng, lat)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return itemInArea
|
||||
}
|
||||
function renderCanvas(nodes) {
|
||||
console.log('nodes', nodes)
|
||||
|
||||
let x: any = []
|
||||
let y: any = []
|
||||
nodes.forEach((item) => {
|
||||
// shp物资统计
|
||||
if (item.sourceType == 'Feature') {
|
||||
let obj = JSON.parse(JSON.stringify(item.detail.properties))
|
||||
for (const key in obj) {
|
||||
let name = key
|
||||
if (shpTotalDict[key]) {
|
||||
name = shpTotalDict[key]
|
||||
// 把相同名称的物资数量相加,名称相同时,累加数据
|
||||
let index = x.findIndex((item) => item === name)
|
||||
if (index !== -1) {
|
||||
y[index] = y[index] + Number(obj[key])
|
||||
} else {
|
||||
x.push(name)
|
||||
y.push(Number(obj[key]))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let params = JSON.parse(item.params)
|
||||
if (params.attribute && params.attribute.goods) {
|
||||
let goods = params.attribute.goods.content
|
||||
console.log('goods', goods)
|
||||
if (goods.length) {
|
||||
// $root_home_index.goodSearchDialog = false;
|
||||
goods.forEach((good) => {
|
||||
// 把相同名称的物资数量相加,名称相同时,累加数据
|
||||
let index = x.findIndex((item) => item === good.name)
|
||||
if (index !== -1) {
|
||||
y[index] = y[index] + Number(good.cnt)
|
||||
} else {
|
||||
x.push(good.name)
|
||||
y.push(Number(good.cnt))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('x,y')
|
||||
console.log(x)
|
||||
console.log(y)
|
||||
let notZeroX = []
|
||||
let notZeroY = []
|
||||
for (let i = 0; i < y.length; i++) {
|
||||
if (y[i] != 0) {
|
||||
notZeroX.push(x[i])
|
||||
notZeroY.push(y[i])
|
||||
}
|
||||
}
|
||||
console.log(notZeroX)
|
||||
console.log(notZeroY)
|
||||
x = notZeroX
|
||||
y = notZeroY
|
||||
if (!x.length) show.value = false
|
||||
if (show.value) {
|
||||
nextTick(() => {
|
||||
let option = {
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '8%',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
label: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
formatter(params) {
|
||||
var data = ''
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if (params[i].seriesName == '随访率') {
|
||||
data += params[i].seriesName + ': ' + params[i].value + '%'
|
||||
} else {
|
||||
data += params[i].seriesName + ': ' + params[i].value + '<br/>'
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['总量'],
|
||||
top: '5%',
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '5%',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
// type: "category",
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
width: 40, //将内容的宽度固定
|
||||
overflow: 'truncate', //超出的部分截断
|
||||
truncate: '...', //截断的部分用...代替
|
||||
rotate: 30,
|
||||
interval: 0,
|
||||
textStyle: {
|
||||
color: '#fff' //X轴文字颜色
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: '(数量)',
|
||||
nameTextStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#eeeeee'
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
gridIndex: 0,
|
||||
min: 50,
|
||||
max: 100,
|
||||
splitNumber: 8,
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: false
|
||||
},
|
||||
splitArea: {
|
||||
show: false,
|
||||
areaStyle: {
|
||||
color: ['rgba(250,250,250,0.0)', 'rgba(250,250,250,0.05)']
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '数量',
|
||||
type: 'bar',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
},
|
||||
barWidth: 15,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#fdcb6c'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
var dom = document.getElementById('goodSearchEchart')
|
||||
var myChart = (window as any).echarts.init(dom)
|
||||
option.xAxis.data = x
|
||||
option.series[0].data = y
|
||||
myChart.setOption(option)
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: '该区域没有物资',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const closeCallBack = (e) => {}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<Dialog
|
||||
v-if="show"
|
||||
ref="baseDialog"
|
||||
title="物质统计"
|
||||
left="180px"
|
||||
top="100px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content>
|
||||
<div id="goodSearchEchart2" style="width: 100%; height: 100%"></div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button>绘制</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { inject } from 'vue'
|
||||
import { nextTick } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
|
||||
const baseDialog: any = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
const shpTotalDict: any = reactive({
|
||||
shlwz_jzzp: '救灾帐篷',
|
||||
mb: '棉被',
|
||||
mymdy: '棉衣、棉大衣',
|
||||
mjb: '毛巾被',
|
||||
mt: '毛毯',
|
||||
dgnsd: '睡袋',
|
||||
zdc: '折叠床',
|
||||
jycs: '简易厕所',
|
||||
xpct: '橡皮船(艇)',
|
||||
cfz: '冲锋舟',
|
||||
jsc: '救生船',
|
||||
jsy: '救生衣',
|
||||
jsq: '救生圈',
|
||||
bzd: '编织袋',
|
||||
md: '麻袋',
|
||||
csb: '抽水泵',
|
||||
fdj: '发电机',
|
||||
yjd: '应急灯',
|
||||
jzzp: '救灾帐篷',
|
||||
jzyb: '救灾衣被',
|
||||
jygj: '救援工具'
|
||||
})
|
||||
|
||||
var draw: any = reactive([])
|
||||
|
||||
var show: any = ref(false)
|
||||
eventBus.on('goodsSearchPolgonDialog', () => {
|
||||
draw = new YJ.Draw.DrawPolygon(window.earth)
|
||||
draw.start((err, params) => {
|
||||
if (!err && params.length > 2) {
|
||||
show.value = true
|
||||
let nodes = booleanOverlaps(params, 'polygon')
|
||||
renderCanvas(nodes)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function booleanOverlaps(positions1, flag = 'circle') {
|
||||
let cross = undefined
|
||||
function set3Array(positions) {
|
||||
let arr = []
|
||||
positions.forEach((item) => {
|
||||
arr.push([item.lng, item.lat])
|
||||
})
|
||||
arr.push(arr[0])
|
||||
return arr
|
||||
}
|
||||
|
||||
let getNode = (types) => {
|
||||
let treeObj = window.treeObj
|
||||
let res = []
|
||||
types.forEach((type) => {
|
||||
let nodes = treeObj.getNodesByParam('sourceType', type, null)
|
||||
res = res.concat(nodes)
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
//绘制的区域
|
||||
// 获取物资处(特定的标注类型)
|
||||
let allNodes = getNode(['point', 'vr', 'picture', 'Feature'])
|
||||
let itemInArea = [] //区域内的类型符合的标注
|
||||
|
||||
for (let i = 0; i < allNodes.length; i++) {
|
||||
let item = allNodes[i]
|
||||
let getAllItemInArea = (lng, lat) => {
|
||||
if (flag == 'circle') {
|
||||
let { center, radius } = positions1
|
||||
let distance = new YJ.Tools().randomString(center, { lng, lat })
|
||||
distance < radius && itemInArea.push(item)
|
||||
} else {
|
||||
let polygon1 = turf.polygon([set3Array(positions1)])
|
||||
let pt = turf.point([lng, lat])
|
||||
turf.booleanPointInPolygon(pt, polygon1) && itemInArea.push(item)
|
||||
}
|
||||
}
|
||||
switch (item.sourceType) {
|
||||
case 'point':
|
||||
case 'vr':
|
||||
case 'picture':
|
||||
let params = JSON.parse(item.params)
|
||||
let lng = params.position.lng
|
||||
let lat = params.position.lat
|
||||
getAllItemInArea(lng, lat)
|
||||
break
|
||||
case 'Feature':
|
||||
if (item.detail.geometry.type == 'Point') {
|
||||
lng = item.detail.geometry.coordinates[0]
|
||||
lat = item.detail.geometry.coordinates[1]
|
||||
getAllItemInArea(lng, lat)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return itemInArea
|
||||
}
|
||||
function renderCanvas(nodes) {
|
||||
let x: any = []
|
||||
let y: any = []
|
||||
nodes.forEach((item) => {
|
||||
// shp物资统计
|
||||
if (item.sourceType == 'Feature') {
|
||||
let obj = JSON.parse(JSON.stringify(item.detail.properties))
|
||||
for (const key in obj) {
|
||||
let name = key
|
||||
if (shpTotalDict[key]) {
|
||||
name = shpTotalDict[key]
|
||||
// 把相同名称的物资数量相加,名称相同时,累加数据
|
||||
let index = x.findIndex((item) => item === name)
|
||||
if (index !== -1) {
|
||||
y[index] = y[index] + Number(obj[key])
|
||||
} else {
|
||||
x.push(name)
|
||||
y.push(Number(obj[key]))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let params = JSON.parse(item.params)
|
||||
if (params.attribute && params.attribute.goods) {
|
||||
let goods = params.attribute.goods.content
|
||||
if (goods.length) {
|
||||
// $root_home_index.goodSearchDialog = false;
|
||||
goods.forEach((good) => {
|
||||
// 把相同名称的物资数量相加,名称相同时,累加数据
|
||||
let index = x.findIndex((item) => item === good.name)
|
||||
if (index !== -1) {
|
||||
y[index] = y[index] + Number(good.cnt)
|
||||
} else {
|
||||
x.push(good.name)
|
||||
y.push(Number(good.cnt))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('x,y')
|
||||
console.log(x)
|
||||
console.log(y)
|
||||
let notZeroX = []
|
||||
let notZeroY = []
|
||||
for (let i = 0; i < y.length; i++) {
|
||||
if (y[i] != 0) {
|
||||
notZeroX.push(x[i])
|
||||
notZeroY.push(y[i])
|
||||
}
|
||||
}
|
||||
console.log(notZeroX)
|
||||
console.log(notZeroY)
|
||||
x = notZeroX
|
||||
y = notZeroY
|
||||
if (!x.length) show.value = false
|
||||
if (show.value) {
|
||||
nextTick(() => {
|
||||
let option = {
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '8%',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
label: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
formatter(params) {
|
||||
var data = ''
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if (params[i].seriesName == '随访率') {
|
||||
data += params[i].seriesName + ': ' + params[i].value + '%'
|
||||
} else {
|
||||
data += params[i].seriesName + ': ' + params[i].value + '<br/>'
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['总量'],
|
||||
top: '5%',
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '5%',
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
// type: "category",
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
width: 40, //将内容的宽度固定
|
||||
overflow: 'truncate', //超出的部分截断
|
||||
truncate: '...', //截断的部分用...代替
|
||||
rotate: 30,
|
||||
interval: 0,
|
||||
textStyle: {
|
||||
color: '#fff' //X轴文字颜色
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: '(数量)',
|
||||
nameTextStyle: {
|
||||
color: '#fff'
|
||||
},
|
||||
splitLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#eeeeee'
|
||||
}
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: '#fff'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
gridIndex: 0,
|
||||
min: 50,
|
||||
max: 100,
|
||||
splitNumber: 8,
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: false
|
||||
},
|
||||
splitArea: {
|
||||
show: false,
|
||||
areaStyle: {
|
||||
color: ['rgba(250,250,250,0.0)', 'rgba(250,250,250,0.05)']
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '数量',
|
||||
type: 'bar',
|
||||
label: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
},
|
||||
barWidth: 15,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#fdcb6c'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
var dom = document.getElementById('goodSearchEchart2')
|
||||
var myChart = (window as any).echarts.init(dom)
|
||||
option.xAxis.data = x
|
||||
option.series[0].data = y
|
||||
myChart.setOption(option)
|
||||
})
|
||||
} else {
|
||||
ElMessage({
|
||||
message: '该区域没有物资',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const closeCallBack = (e) => {}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@ -59,7 +59,7 @@ eventBus.on('graffitiDialog', () => {
|
||||
graffiti = new YJ.Obj.Graffiti(window.earth, {
|
||||
width: width.value
|
||||
})
|
||||
}, 0)
|
||||
}, 10)
|
||||
})
|
||||
|
||||
const closeCallBack = (e) => {}
|
||||
|
||||
285
src/renderer/src/views/components/propertyBox/ProjConvert.vue
Normal file
285
src/renderer/src/views/components/propertyBox/ProjConvert.vue
Normal file
@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<Dialog
|
||||
ref="baseDialog"
|
||||
class="proj-convert"
|
||||
title="度分秒格式转换"
|
||||
left="180px"
|
||||
top="100px"
|
||||
width="515px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content v-if="status1">
|
||||
<span class="custom-divider"></span>
|
||||
<div class="div-item">
|
||||
<div class="row">
|
||||
<div class="col input-select-box">
|
||||
<span class="label" style="flex: 0 0 60px">输入格式</span>
|
||||
<div class="input-select"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="0" v-show="isShowing">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px; padding-bottom: 6px; margin-top: 10px; margin-bottom: 5px">
|
||||
<span style="margin-right: 10px">度</span>
|
||||
<span style="font-size: 12px; margin-bottom: 5px; color: #f16c55">例如116.6°, 39.9°</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="label" style="flex: auto">经度</span>
|
||||
<input class="input lng" type="number" min="-180" max="180" value="0" title="" />
|
||||
</div>
|
||||
<div class="col" style="margin: 0">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat" type="number" min="-90" max="90" value="0" title="" />
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px">
|
||||
<i
|
||||
class="icon-copy-box"
|
||||
title="复制"
|
||||
data-clipboard-action="copy"
|
||||
data-clipboard-target=".input"
|
||||
style="cursor: pointer"
|
||||
>
|
||||
<svg class="icon-copy" style="margin: 4px; margin-bottom: 0px">
|
||||
<use xlink:href="#yj-icon-copy"></use>
|
||||
</svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="1" v-show="isShowing">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px; padding-bottom: 6px; margin-top: 10px; margin-bottom: 5px">
|
||||
<span style="margin-right: 10px">度分</span>
|
||||
<span style="font-size: 12px; margin-bottom: 5px; color: #f16c55"
|
||||
>例如95°10.1702', 49°12.4015'</span
|
||||
>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col" style="flex-direction: column">
|
||||
<div class="row" style="margin-bottom: 15px">
|
||||
<span class="label">经度</span>
|
||||
<input
|
||||
class="input lng-dm-d"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="-180"
|
||||
max="180"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">度</span>
|
||||
<input
|
||||
class="input lng-dm-m"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="0"
|
||||
max="60"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">分</span>
|
||||
<span class="top-line"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">纬度</span>
|
||||
<input
|
||||
class="input lat-dm-d"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="-90"
|
||||
max="90"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">度</span>
|
||||
<input
|
||||
class="input lat-dm-m"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="0"
|
||||
max="60"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">分</span>
|
||||
<span class="bottom-line"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px; margin: 0">
|
||||
<i
|
||||
class="icon-copy-box"
|
||||
title="复制"
|
||||
data-clipboard-action="copy"
|
||||
data-clipboard-target=".input"
|
||||
style="cursor: pointer; position: relative; left: -30px"
|
||||
>
|
||||
<svg class="icon-copy" style="margin: 4px; margin-bottom: 0px">
|
||||
<use xlink:href="#yj-icon-copy"></use>
|
||||
</svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="2" v-show="isShowing">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px; padding-bottom: 6px; margin-top: 10px; margin-bottom: 5px">
|
||||
<span style="margin-right: 10px">度分秒</span>
|
||||
<span style="font-size: 12px; margin-bottom: 5px; color: #f16c55"
|
||||
>例如11°18'54.37", 39°13'46.57"</span
|
||||
>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col" style="flex-direction: column">
|
||||
<div class="row" style="margin-bottom: 15px">
|
||||
<span class="label">经度</span>
|
||||
<input
|
||||
class="input lng-dms-d"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="-180"
|
||||
max="180"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">度</span>
|
||||
<input
|
||||
class="input lng-dms-m"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="0"
|
||||
max="60"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">分</span>
|
||||
<input
|
||||
class="input lng-dms-s"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="0"
|
||||
max="60"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">秒</span>
|
||||
<span class="top-line"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">纬度</span>
|
||||
<input
|
||||
class="input lat-dms-d"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="-90"
|
||||
max="90"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">度</span>
|
||||
<input
|
||||
class="input lat-dms-m"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="0"
|
||||
max="60"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">分</span>
|
||||
<input
|
||||
class="input lat-dms-s"
|
||||
style="flex: 1"
|
||||
type="number"
|
||||
min="0"
|
||||
max="60"
|
||||
value="0"
|
||||
title=""
|
||||
/>
|
||||
<span class="label" style="flex: 0 0 14px; margin: 0 10px">秒</span>
|
||||
<span class="bottom-line"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px; margin: 0">
|
||||
<i
|
||||
class="icon-copy-box"
|
||||
title="复制"
|
||||
data-clipboard-action="copy"
|
||||
data-clipboard-target=".input"
|
||||
style="cursor: pointer; position: relative; left: -30px"
|
||||
>
|
||||
<svg class="icon-copy" style="margin: 4px; margin-bottom: 0px">
|
||||
<use xlink:href="#yj-icon-copy"></use>
|
||||
</svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="custom-divider" style="order: 10; margin-top: 12px"></span>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="close">关闭</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { inject } from 'vue'
|
||||
import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
import Clipboard from 'clipboard'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const baseDialog: any = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
|
||||
var status1: any = ref(false)
|
||||
var isShowing: any = ref(false)
|
||||
var tools: any = reactive([])
|
||||
eventBus.on('projConvertDialog', () => {
|
||||
baseDialog.value?.open()
|
||||
if (status1.value) {
|
||||
reset()
|
||||
status1.value = false
|
||||
}
|
||||
status1.value = !status1.value
|
||||
setTimeout(() => {
|
||||
tools = new YJ.Tools(window.earth)
|
||||
tools.projConvert(status1.value, () => {
|
||||
status1.value = false
|
||||
isShowing.value = true
|
||||
})
|
||||
}, 10)
|
||||
})
|
||||
|
||||
const closeCallBack = (e) => {
|
||||
status1.value = false
|
||||
}
|
||||
const reset = () => {
|
||||
let contentElm = document
|
||||
.getElementsByClassName('proj-convert')[0]
|
||||
.getElementsByClassName('content')[0]
|
||||
contentElm.getElementsByClassName('lng-dms-d')[0].value = null
|
||||
contentElm.getElementsByClassName('lng-dms-m')[0].value = null
|
||||
contentElm.getElementsByClassName('lng-dms-s')[0].value = null
|
||||
contentElm.getElementsByClassName('lat-dms-d')[0].value = null
|
||||
contentElm.getElementsByClassName('lat-dms-m')[0].value = null
|
||||
contentElm.getElementsByClassName('lat-dms-s')[0].value = null
|
||||
contentElm.getElementsByClassName('lng')[0].value = null
|
||||
contentElm.getElementsByClassName('lat')[0].value = null
|
||||
}
|
||||
const close = (e) => {
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .content > div {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<Dialog
|
||||
ref="baseDialog"
|
||||
class="projection-convert"
|
||||
title="投影转换"
|
||||
left="180px"
|
||||
top="100px"
|
||||
width="634px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content v-if="status1">
|
||||
<span class="custom-divider"></span>
|
||||
<div style="width: 585px; display: flex">
|
||||
<div class="row left" style="flex: 1; margin-bottom: 0">
|
||||
<div
|
||||
style="
|
||||
margin: 10px 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<span class="lable-left-line">源坐标</span>
|
||||
<button class="btn pick" style="margin-left: 15px">
|
||||
<svg class="icon-edit"><use xlink:href="#yj-icon-edit"></use></svg>坐标拾取
|
||||
</button>
|
||||
<button
|
||||
class="btn sourceCopy"
|
||||
data-clipboard-action="copy"
|
||||
data-clipboard-target=".input"
|
||||
style="margin-left: 5px"
|
||||
>
|
||||
<svg class="icon-copy"><use xlink:href="#yj-icon-copy"></use></svg>复制
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: flex; margin-bottom: 12px; align-items: center">
|
||||
<span class="label" style="flex: 0 0 60px">椭圆基准</span>
|
||||
<div class="datalist_left"></div>
|
||||
</div>
|
||||
<div style="display: flex; margin-bottom: 12px; align-items: center">
|
||||
<span class="label" style="flex: 0 0 60px">经度(x)</span>
|
||||
<input class="input left-x" type="number" title="" />
|
||||
</div>
|
||||
<div style="display: flex; margin-bottom: 10px; align-items: center">
|
||||
<span class="label" style="flex: 0 0 60px">纬度(y)</span>
|
||||
<input class="input left-y" type="number" title="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
margin: 28px 15px 0 15px;
|
||||
"
|
||||
>
|
||||
<button class="btn convert">
|
||||
<svg-icon name="turn" :size="11" color="rgba(255, 255, 255, 1)"></svg-icon>
|
||||
转换
|
||||
</button>
|
||||
</div>
|
||||
<div class="row right" style="flex: 1; margin-bottom: 0">
|
||||
<div
|
||||
style="
|
||||
margin: 10px 0;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<span class="lable-left-line">目标坐标</span>
|
||||
<button
|
||||
class="btn copy"
|
||||
data-clipboard-action="copy"
|
||||
data-clipboard-target=".input"
|
||||
style="margin-left: 20px"
|
||||
>
|
||||
<svg class="icon-copy"><use xlink:href="#yj-icon-copy"></use></svg>复制
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: flex; margin-bottom: 12px; align-items: center">
|
||||
<span class="label" style="flex: 0 0 60px">椭圆基准</span>
|
||||
<div class="datalist_right"></div>
|
||||
</div>
|
||||
<div style="display: flex; margin-bottom: 12px; align-items: center">
|
||||
<span class="label" style="flex: 0 0 60px">经度(x)</span>
|
||||
<input class="input right-x" readonly="readonly" />
|
||||
</div>
|
||||
<div style="display: flex; margin-bottom: 10px; align-items: center">
|
||||
<span class="label" style="flex: 0 0 60px">纬度(y)</span>
|
||||
<input class="input right-y" readonly="readonly" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="custom-divider"></span>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="close">关闭</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { inject } from 'vue'
|
||||
import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
import Clipboard from 'clipboard'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const baseDialog: any = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
|
||||
var status1: any = ref(false)
|
||||
var tools: any = reactive([])
|
||||
eventBus.on('ProjectionConvertDialog', () => {
|
||||
baseDialog.value?.open()
|
||||
if (status1.value) {
|
||||
reset()
|
||||
status1.value = false
|
||||
tools && tools.projectionConvert(status1.value, () => {})
|
||||
}
|
||||
status1.value = !status1.value
|
||||
setTimeout(() => {
|
||||
tools = new YJ.Tools(window.earth)
|
||||
tools.projectionConvert(status1.value, () => {
|
||||
status1.value = false
|
||||
})
|
||||
}, 100)
|
||||
})
|
||||
|
||||
const closeCallBack = (e) => {
|
||||
status1.value = false
|
||||
tools && tools.projectionConvert(status1.value, () => {})
|
||||
}
|
||||
const reset = () => {
|
||||
let contentElm = document
|
||||
.getElementsByClassName('projection-convert')[0]
|
||||
.getElementsByClassName('content')[0]
|
||||
contentElm.getElementsByClassName('left-x')[0].value = null
|
||||
contentElm.getElementsByClassName('left-y')[0].value = null
|
||||
contentElm.getElementsByClassName('right-x')[0].value = null
|
||||
contentElm.getElementsByClassName('right-y')[0].value = null
|
||||
}
|
||||
const close = (e) => {
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .content > div {
|
||||
display: flex !important;
|
||||
flex-direction: column !important;
|
||||
}
|
||||
::v-deep .content .cy_datalist input {
|
||||
background: rgba(var(--color-sdk-base-rgb), 0.2) !important;
|
||||
border: unset;
|
||||
}
|
||||
::v-deep .content input[type='number'] {
|
||||
font-size: 16px !important;
|
||||
// font-weight: 700 !important;
|
||||
color: var(--color-sdk-auxiliary-public) !important;
|
||||
}
|
||||
</style>
|
||||
@ -1,12 +1,21 @@
|
||||
<template>
|
||||
<Dialog ref="baseDialog" title="路径规划" left="180px" top="100px" :closeCallback="closeCallBack">
|
||||
<Dialog
|
||||
ref="baseDialog"
|
||||
class="RoutePlanning"
|
||||
title="路径规划"
|
||||
left="180px"
|
||||
top="100px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content>
|
||||
<div class="row" style="align-items: flex-start">
|
||||
<div class="col start-col">
|
||||
<span class="label">起点</span>
|
||||
<input class="input" type="number" title="" min="-180" max="180" @model="startLng" />
|
||||
<input class="input" type="number" title="" min="-90" max="90" @model="startLat" />
|
||||
<button @click="pickStartPos" style="margin-left: 10px">拾取</button>
|
||||
<button class="crossPoint">
|
||||
<svg-icon name="add" :size="16" color="rgba(255, 255, 255, 1)"></svg-icon> 途径点
|
||||
</button>
|
||||
<button style="margin-left: 10px">
|
||||
<svg-icon name="add" :size="16" color="rgba(255, 255, 255, 1)"></svg-icon>避让点
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="align-items: flex-start">
|
||||
@ -41,7 +50,6 @@ var endLat: any = ref(null)
|
||||
var routePlanning: any = reactive([])
|
||||
eventBus.on('routePlanningDialog', () => {
|
||||
baseDialog.value?.open()
|
||||
routePlanning = new YJ.Obj.RoutePlanning(window.earth, { gps: true })
|
||||
})
|
||||
const closeCallBack = (e) => {}
|
||||
|
||||
@ -52,13 +60,19 @@ const draw = (e) => {}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.YJ-custom-base-dialog > .content {
|
||||
::v-deep .RoutePlanning > .content {
|
||||
width: 460px;
|
||||
}
|
||||
.YJ-custom-base-dialog > .content > div > .row .col {
|
||||
::v-deep .RoutePlanning > .content > div > .row .col {
|
||||
margin: 0 10px;
|
||||
}
|
||||
.YJ-custom-base-dialog > .content .row .label {
|
||||
::v-deep .RoutePlanning > .content .row .label {
|
||||
flex: auto;
|
||||
}
|
||||
.crossPoint:hover {
|
||||
color: rgba(var(--color-sdk-base-rgb), 1);
|
||||
}
|
||||
.crossPoint:hover {
|
||||
color: rgba(var(--color-sdk-base-rgb), 1);
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<!-- <template>
|
||||
<template>
|
||||
<Dialog ref="baseDialog" title="地形开挖" left="180px" top="100px" :closeCallback="closeCallBack">
|
||||
<template #content>
|
||||
<span class="custom-divider"></span>
|
||||
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="close">取消</button>
|
||||
<button @click="close">关闭</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
@ -62,7 +62,7 @@ var excavation: any = reactive([])
|
||||
eventBus.on('terrainExcavationDialog', () => {
|
||||
baseDialog.value?.open()
|
||||
|
||||
excavation = new (window as any).YJ.Analysis.TerrainExcavation(this.sdk, { height: 10 })
|
||||
excavation = new (window as any).YJ.Analysis.TerrainExcavation(window.earth, { height: 10 })
|
||||
})
|
||||
|
||||
const changeHeight = () => {
|
||||
@ -76,7 +76,9 @@ const heightInput = () => {
|
||||
height.value = dom.max * 1
|
||||
}
|
||||
}
|
||||
const closeCallBack = (e) => {}
|
||||
const closeCallBack = (e) => {
|
||||
height.value = 10
|
||||
}
|
||||
const close = (e) => {
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
@ -88,4 +90,4 @@ const clear = (e) => {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style> -->
|
||||
<style scoped lang="scss"></style>
|
||||
|
||||
@ -113,7 +113,7 @@ eventBus.on('viewShedDialog', () => {
|
||||
e_horizontalViewAngle.removeEventListener('change', changeFun)
|
||||
e_horizontalViewAngle.addEventListener('input', inputFun)
|
||||
e_horizontalViewAngle.addEventListener('change', changeFun)
|
||||
})
|
||||
}, 10)
|
||||
})
|
||||
function inputFun() {
|
||||
let contentElm = document.getElementsByClassName('view-shed')[0]
|
||||
|
||||
99
src/renderer/src/views/components/propertyBox/flat.vue
Normal file
99
src/renderer/src/views/components/propertyBox/flat.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<Dialog
|
||||
ref="baseDialog"
|
||||
title="压平面属性"
|
||||
class="flatPlane"
|
||||
left="180px"
|
||||
top="100px"
|
||||
:closeCallback="closeCallBack"
|
||||
>
|
||||
<template #content>
|
||||
<span class="custom-divider"></span>
|
||||
<div class="div-item">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="label" style="width: 56px; flex: 0 0 56px">名称</span>
|
||||
<input class="input input-name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="label" style="width: 56px; flex: 0 0 56px">压平高度</span>
|
||||
<div class="input-number input-number-unit-1">
|
||||
<input
|
||||
class="input flat-height"
|
||||
type="number"
|
||||
title=""
|
||||
min="-9999999"
|
||||
max="999999999"
|
||||
/>
|
||||
<span class="unit">m</span>
|
||||
<span class="arrow"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button @click="sure">确认</button>
|
||||
<button @click="close">关闭</button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { inject } from 'vue'
|
||||
import Dialog from '@/components/dialog/baseDialog.vue'
|
||||
import { TreeApi } from '@/api/tree'
|
||||
import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
|
||||
|
||||
const { cusUpdateNode } = useTreeNode()
|
||||
|
||||
const baseDialog: any = ref(null)
|
||||
const eventBus: any = inject('bus')
|
||||
|
||||
var flat: any = reactive([])
|
||||
var flatMsg: any = reactive([])
|
||||
eventBus.on('flatDialog', (id) => {
|
||||
baseDialog.value?.open()
|
||||
})
|
||||
const open = (data) => {
|
||||
baseDialog.value?.open()
|
||||
flat = window.pressModelEntities.get(data.id)
|
||||
|
||||
let params = JSON.parse(data.params)
|
||||
flatMsg = pressModelMap.get(data.id + '_' + params.modelId)
|
||||
setTimeout(() => {
|
||||
flat.edit(true)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
const closeCallBack = (e) => {}
|
||||
const sure = (e) => {
|
||||
let paramsData = JSON.parse(flatMsg.params)
|
||||
paramsData.height = flat.height
|
||||
let params = {
|
||||
id: flatMsg.id,
|
||||
sourceName: flat.name,
|
||||
params: paramsData,
|
||||
isShow: flatMsg.isShow ? 1 : 0
|
||||
}
|
||||
TreeApi.updateDirectoryInfo(params)
|
||||
cusUpdateNode({
|
||||
id: params.id,
|
||||
sourceName: params.sourceName,
|
||||
params: JSON.stringify(paramsData)
|
||||
})
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
const close = (e) => {
|
||||
flat.reset()
|
||||
baseDialog.value?.close()
|
||||
}
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@ -179,6 +179,11 @@ export const useRightOperate = () => {
|
||||
if (selectNodes && selectNodes[selectNodes.length - 1]) {
|
||||
let node = selectNodes[selectNodes.length - 1]
|
||||
eventBus.emit("openDialog", node.sourceType, node.id);
|
||||
if (node.sourceType == 'pressModel') {
|
||||
eventBus.emit("openDialog", node.sourceType, node);
|
||||
} else {
|
||||
eventBus.emit("openDialog", node.sourceType, node.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除
|
||||
|
||||
@ -69,7 +69,13 @@ export const useTree = () => {
|
||||
* @param treeNode 鼠标右键点击时所在节点的 JSON 数据对象
|
||||
*/
|
||||
const onDblClick = (event: MouseEvent, treeId: string, treeNode: any) => {
|
||||
let entityObject = window.earth.entityMap.get(treeNode.id)
|
||||
let entityObject
|
||||
if (treeNode.sourceType == 'pressModel') {
|
||||
entityObject = window.pressModelEntities.get(treeNode.id)
|
||||
} else {
|
||||
entityObject = window.earth.entityMap.get(treeNode.id)
|
||||
}
|
||||
console.log('entityObject', entityObject)
|
||||
entityObject.flyTo()
|
||||
}
|
||||
/**
|
||||
@ -215,10 +221,31 @@ export const useTree = () => {
|
||||
* @param treeNode
|
||||
*/
|
||||
const onCheck = async (event: any, treeId: any, treeNode: any) => {
|
||||
console.log(treeNode, 'treeNode')
|
||||
let params = JSON.parse(treeNode.params)
|
||||
let entityObject = window.earth.entityMap.get(params.id)
|
||||
entityObject.show = treeNode.isShow
|
||||
params.show = treeNode.isShow
|
||||
let entityObject
|
||||
if (treeNode.sourceType == 'pressModel') {
|
||||
let params = JSON.parse(treeNode.params)
|
||||
let id = treeNode.id + '_' + params.modelId
|
||||
let data = window.pressModelMap.get(id)
|
||||
data.isShow = treeNode.isShow
|
||||
entityObject = window.pressModelEntities.get(treeNode.id)
|
||||
|
||||
if (!entityObject && treeNode.isShow) {
|
||||
const entity = window.earth.entityMap.get(params.modelId).entity
|
||||
entityObject = new YJ.Analysis.Flat(window.earth, entity, {
|
||||
positions: params.positions,
|
||||
height: params.height,
|
||||
name: treeNode.sourceName
|
||||
})
|
||||
window.pressModelEntities.set(treeNode.id, entityObject)
|
||||
}
|
||||
|
||||
} else {
|
||||
entityObject = window.earth.entityMap.get(params.id)
|
||||
}
|
||||
entityObject.show = treeNode.isShow;
|
||||
(treeNode.sourceType != 'pressModel') && (params.show = treeNode.isShow)
|
||||
let params2 = {
|
||||
"id": treeNode.id,
|
||||
"params": params,
|
||||
@ -402,7 +429,6 @@ export const useTree = () => {
|
||||
// 初始化树的方法
|
||||
const initTree = async (selector: string = '#treeDemo') => {
|
||||
let res = await TreeApi.getTreeList()
|
||||
console.log('res', res)
|
||||
if ([0, 200].includes(res.code)) {
|
||||
res.data.sort((a: any, b: any) => {
|
||||
if (a.treeIndex && b.treeIndex) {
|
||||
@ -416,15 +442,21 @@ export const useTree = () => {
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
//将模型压平
|
||||
window.pressModelMap = new Map();
|
||||
window.pressModelEntities = new Map();
|
||||
for (let i = res.data.length - 1; i >= 0; i--) {
|
||||
if (!res.data[i].id) {
|
||||
// res.data.splice(i, 1);
|
||||
res.data[i].id = generateRandomString(20, false)
|
||||
}
|
||||
if (res.data[i].sourceType == "pressModel") {
|
||||
const obj = JSON.parse(res.data[i].params);
|
||||
pressModelMap.set(res.data[i].id + "_" + obj.modelId, res.data[i]);
|
||||
}
|
||||
}
|
||||
zNodes.value = res.data
|
||||
treeObj.value = $.fn.zTree.init($(selector), setting, zNodes.value)
|
||||
console.log(res.data)
|
||||
window.treeObj = treeObj.value
|
||||
window.AllNodes = treeObj.value.getNodes()
|
||||
initTreeCallBack()
|
||||
@ -463,6 +495,7 @@ export const useTree = () => {
|
||||
params.id = zNodes.value[i].id
|
||||
}
|
||||
initMapData(zNodes.value[i].sourceType, params)
|
||||
|
||||
}
|
||||
else {
|
||||
//@ts-ignore
|
||||
|
||||
@ -510,7 +510,6 @@ export const useTreeNode = () => {
|
||||
let showRightMenu = (event: any, treeObj: any) => {
|
||||
// 获取选中的节点
|
||||
let selectedNodes = getSelectedNodes(treeObj)
|
||||
console.log('selectedNodes', selectedNodes)
|
||||
let arr: any = []
|
||||
let rightMenuHeight = window.getComputedStyle($('#rMenu')[0]).getPropertyValue('height')
|
||||
let rightMenuWidth = window.getComputedStyle($('#rMenu')[0]).getPropertyValue('width')
|
||||
|
||||
@ -26,7 +26,11 @@
|
||||
<!-- <FlyRoam ref="FlyRoam"></FlyRoam> -->
|
||||
<CoorLocation ref="CoorLocation"></CoorLocation>
|
||||
<ScreenShot ref="ScreenShot"></ScreenShot>
|
||||
<!-- <TerrainExcavation ref="TerrainExcavation"></TerrainExcavation> -->
|
||||
<TerrainExcavation ref="TerrainExcavation"></TerrainExcavation>
|
||||
<ProjConvert ref="ProjConvert"></ProjConvert>
|
||||
<ProjectionConvert ref="ProjectionConvert"></ProjectionConvert>
|
||||
<GoodsSearchCircle ref="GoodsSearchCircle"></GoodsSearchCircle>
|
||||
<GoodsSearchPolgon ref="GoodsSearchPolgon"></GoodsSearchPolgon>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -59,13 +63,18 @@ import Graffiti from '../components/propertyBox/Graffiti.vue'
|
||||
import FlyRoam from '../components/propertyBox/FlyRoam.vue'
|
||||
import CoorLocation from '../components/propertyBox/CoorLocation.vue'
|
||||
import ScreenShot from '../components/propertyBox/ScreenShot.vue'
|
||||
import terrainExcavation from '../components/propertyBox/terrainExcavation.vue'
|
||||
import tileset from '../components/propertyBox/tileset.vue'
|
||||
import layer from '../components/propertyBox/layer.vue'
|
||||
import trajectoryMotion from '../components/propertyBox/trajectoryMotion.vue'
|
||||
import wallStereoscopic from '../components/propertyBox/wallStereoscopic.vue'
|
||||
import circleDiffuse from '../components/propertyBox/circleDiffuse.vue'
|
||||
import radarScan from '../components/propertyBox/radarScan.vue'
|
||||
import TerrainExcavation from '../components/propertyBox/TerrainExcavation.vue'
|
||||
import ProjConvert from '../components/propertyBox/ProjConvert.vue'
|
||||
import ProjectionConvert from '../components/propertyBox/ProjectionConvert.vue'
|
||||
import GoodsSearchCircle from '../components/propertyBox/GoodsSearchCircle.vue'
|
||||
import GoodsSearchPolgon from '../components/propertyBox/GoodsSearchPolgon.vue'
|
||||
import flat from '../components/propertyBox/flat.vue'
|
||||
|
||||
import { GisApi } from '@/api/gisApi'
|
||||
|
||||
@ -126,7 +135,7 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
|
||||
currentComponent.value = circleObject
|
||||
await nextTick()
|
||||
dynamicComponentRef.value?.open(id, 'circle')
|
||||
break;
|
||||
break
|
||||
case 'rectangle':
|
||||
currentComponent.value = polygonObject
|
||||
await nextTick()
|
||||
@ -176,6 +185,11 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
|
||||
currentComponent.value = radarScan
|
||||
await nextTick()
|
||||
dynamicComponentRef.value?.open(id)
|
||||
case 'pressModel':
|
||||
currentComponent.value = flat
|
||||
await nextTick()
|
||||
console.log('cccc', id)
|
||||
dynamicComponentRef.value?.open(id, 'pressModel')
|
||||
break
|
||||
default:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user