Files
4.0/src/renderer/main.js
2025-11-14 09:42:30 +08:00

179 lines
5.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Vue from "vue";
import "normalize.css/normalize.css"; // A modern alternative to CSS resets
import i18n from "./assets/i18n/index.js"; // 第一步引入多语言配置文件index.js
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import { ipcRenderer, remote } from "electron";
import { setConfig } from "@/utils/auth.js";
import obj from "../../config/app_config";
Vue.prototype.$ELEMENT = { locale };
Vue.use(ElementUI);
// Vue.use(Message)
import Avue from "@smallwei/avue";
import "@smallwei/avue/lib/index.css";
import gantNext from "./components/gantt-next";
import locale from "element-ui/lib/locale/lang/zh-CN"; // lang i18n
import App from "./App";
import router from "./router";
import store from "./store";
import VueElectron from "./plugin/VueElectron"; // electron指令
import * as communication from "@/utils/communication";
import directive from "@/utils/drag";
import md5 from "js-md5";
import { selectDictLabel } from "@/utils/index.js";
//新增态势
import "./assets/styles/font.css";
import "./assets/iconfont/font_4587902_y4fhjyq8fxn";
import "./assets/styles/dhtmlxgantt.css";
import "./assets/styles/animate.min.css";
import "./assets/styles/global.css";
import "./plugin/ztree/zTreeStyle/zTreeStyle.css";
import "./plugin/ztree/jquery-1.4.4.min.js";
import "./plugin/ztree/jquery.ztree.core";
import "./plugin/ztree/jquery.ztree.exedit";
import "./plugin/ztree/jquery.ztree.excheck";
import "./plugin/ztree/jquery.ztree.exhide";
import "./plugin/ztree/fuzzysearch";
import "./plugin/ztree/newFuzzySearch";
import { openLoading, zip_file, unzip_file } from "./utils/index";
import "@/icons"; // icon
import "@/permission"; // permission control
import dispatchEventStorage from "./utils/watchLocalStorage";
import Pagination from "@/components/Pagination";
Vue.component("Pagination", Pagination);
//注册推演的甘特图组件
Vue.component("ganttNext", gantNext);
console.log("remote", remote);
Vue.prototype.$remote = remote;
console.log("ipcRenderer", ipcRenderer);
Vue.use(dispatchEventStorage);
Vue.use(VueElectron);
console.log("directive", directive);
Object.keys(directive).forEach((key) => {
Vue.directive(`${key}`, directive[key]);
});
localStorage.setItem("appVersion", obj.appVersion);
Vue.prototype.$zip_file = zip_file;
Vue.prototype.$unzip_file = unzip_file;
Vue.prototype.$openLoading = openLoading;
Vue.prototype.selectDictLabel = selectDictLabel;
Vue.use(Avue, { size: "mini" });
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
for (const communicationKey in communication) {
Vue.prototype[communicationKey] = communication[communicationKey];
}
Vue.prototype.$md5 = md5;
console.log("%cselectedMulti: false", "color:red");
Vue.config.productionTip = false;
document.querySelectorAll("defs").forEach((EL) => {
if (EL.parentElement.id != "icon-rightMenuBg") EL.remove();
});
//创建地球 domid,
Vue.prototype.$createEarth = (domId, params, cb) => {
YJ.on(params).then((res) => {
let earth = new YJ.YJEarth(domId);
// YJ.Global.openRightClick()
// YJ.Global.openLeftClick()
cb(earth);
});
};
const vue = new Vue({
components: { App },
i18n,
router,
store,
template: "<App/>",
}).$mount("#app");
window.$root_home = vue;
//新增态势
window.pauseResumeSet = new Set();
window.gisNotRenderedSet = new Set();
window.ts_Map = new Map();
window.AudioMap = new Map();
window.childNo = true;
window.treeSource = 0;
window.checkAuthIsValid;
if (!localStorage.getItem("UAV_CONFIG")) {
setConfig({
// 机场配置
DOCKAIR: "http://192.168.0.3:8848",
DOCKSOCKETURL: "ws://192.168.0.3:8848/websocket",
AI_URL: "http://192.168.110.23:8000",
// 遥控器配置
REMOTEAIR: "http://192.168.110.26:6789",
REMOTESOCKETURL: "ws://192.168.110.26:6789/websocket",
REMOTEAIR_AI: "http://121.37.119.107:8000",
// 网关端口配置
HOST: "192.168.0.3",
RTMPPORT: 1935,
RTCPORT: 1985,
});
}
if (!localStorage.getItem("searchWay")) {
localStorage.setItem("searchWay", "poi");
}
if (!localStorage.getItem("AMapKey")) {
localStorage.setItem(
"AMapKey",
"d88fcc689d1aa99866b2d0d83fd36677|c3d17927c47eb753b61b26de4f533cbe"
);
}
document.title = vue.$t("title.name");
window.analysisArr = [];
window._entityMap = new Map();
window.right_entityMap = new Map();
window._echartsMap = new Map();
window._winMap = new Map();
window.udp_pointMap = new Map();
window.$AIRLINE_MAP = new Map();
window.$POINT_MAP = new Map();
window.$PATH = null;
window.ELEMENT = ElementUI;
window.airType = "";
window.clicknum = 0;
window.getMovieStatus = (seletor = ".movie") => {
let val = $(`${seletor}`)[0] && $(`${seletor}`)[0].style.display;
// return !["none",''].includes(val) ;
return false;
};
window.onresize = () => {
Array.from(window._echartsMap.values()).forEach((item) => {
item.resize();
});
};
window.addEventListener("click", (event) => {
if (event.target.localName == "canvas") {
vue.$changeComponentShow("#secondMenu", false);
}
if (!event.target.classList.value.split(" ").includes("target"))
vue.$changeComponentShow(".popup", false);
});
!localStorage.getItem("systemSetting")
? localStorage.setItem(
"systemSetting",
JSON.stringify({
showToolBar: false,
showCompass: false,
showDistanceLegend: false,
language: "zh",
skinInfo: "yingguangse",
coordinate: "EPSG:4326",
})
)
: console.log("没有设置系统设置");
window.staticPort = $root_home.$remote.getGlobal("sharedObject").avilablePort;
// if (process.env.NODE_ENV != "development") {
// console.log = function() {};
// }