创建新仓库
This commit is contained in:
234
src/renderer/components/myHeaderAll/setTool/js/setTool.js
Normal file
234
src/renderer/components/myHeaderAll/setTool/js/setTool.js
Normal file
@ -0,0 +1,234 @@
|
||||
// 顶部右侧展示栏功能
|
||||
import { remote } from "electron";
|
||||
import { $sendElectronChanel } from "../../../../utils/communication";
|
||||
import { delDepart, getStatus } from "../../../../api/gisAPI";
|
||||
import { getIP } from "../../../../utils";
|
||||
import { login } from "@/api/air.js";
|
||||
import { login2 } from "@/api/air2.js";
|
||||
import axios from "axios";
|
||||
import { getDockAir } from "../../../../utils/auth";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
LocateCurrent: null,
|
||||
// clicknum: 0,
|
||||
clickTimer: null,
|
||||
isSuccess: true,
|
||||
airShow: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(newV, oldV) {
|
||||
if (newV) {
|
||||
this.$emit("showAirListAndAttr");
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
// tableSet
|
||||
tableSet() {
|
||||
this.$changeComponentShow(".excelSetBox", true);
|
||||
},
|
||||
hhhhhh() {
|
||||
this.airShow = !this.airShow;
|
||||
},
|
||||
// 切换飞机类型
|
||||
handleCommand(command) {
|
||||
console.log("command", command);
|
||||
// return;
|
||||
this.$message.warning("即将跳转无人机");
|
||||
if (command == "dock") {
|
||||
window.airType = "dock";
|
||||
axios
|
||||
.request({
|
||||
// url: process.env.DOCKAIR + "/login",
|
||||
url: getDockAir() + "/login",
|
||||
method: "post",
|
||||
data: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.code == 200) {
|
||||
localStorage.setItem(
|
||||
"airToken",
|
||||
JSON.stringify({
|
||||
access_token: res.data.token,
|
||||
})
|
||||
);
|
||||
setTimeout(() => {
|
||||
this.airLine("flyerDiv");
|
||||
}, 1000);
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error("网络故障,请稍后重试");
|
||||
});
|
||||
} else if (command == "remote") {
|
||||
window.airType = "remote";
|
||||
axios
|
||||
.request({
|
||||
url: getRemoteAir() + "/manage/api/v1/login",
|
||||
method: "post",
|
||||
data: {
|
||||
flag: 1,
|
||||
password: "adminPC",
|
||||
username: "adminPC",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
localStorage.setItem("airToken", JSON.stringify(res.data.data));
|
||||
setTimeout(() => {
|
||||
this.airLine("flyerDiv2");
|
||||
}, 1000);
|
||||
} else {
|
||||
this.$message.error(res.data.message);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error("网络故障,请稍后重试");
|
||||
});
|
||||
}
|
||||
},
|
||||
logout() {
|
||||
this.$confirm("确认是否退出?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
// window.Earth1.destroy()
|
||||
window.Earth1 = null;
|
||||
|
||||
$sendElectronChanel("restart");
|
||||
})
|
||||
.catch(() => {
|
||||
/*this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});*/
|
||||
});
|
||||
|
||||
/*this.$store.dispatch("FedLogOut").then(() => {
|
||||
this.$router.push({path: '/login'})
|
||||
})*/
|
||||
},
|
||||
resetShow(item) {
|
||||
//重置
|
||||
new YJ.Tools(window.Earth1).flyHome();
|
||||
},
|
||||
flyTo() {
|
||||
let gpsCom = localStorage.getItem("gpsCom");
|
||||
if (!gpsCom) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(this.clickTimer);
|
||||
window.clicknum = 0
|
||||
if (this.LocateCurrent) this.LocateCurrent.flyTo();
|
||||
},
|
||||
// 无人机
|
||||
airLine(flyer) {
|
||||
$root_home_index.State = true;
|
||||
$root_home_index.changeState();
|
||||
$root_home_index.$refs.tree.isShow = true;
|
||||
$root_home_index.$refs.tree.isShowTree();
|
||||
if (flyer == "flyerDiv") {
|
||||
$root_home_index.flyerDiv = true;
|
||||
} else {
|
||||
$root_home_index.flyerDiv2 = true;
|
||||
}
|
||||
this.$changeComponentShow(".logo", false);
|
||||
this.$changeComponentShow(".tree", false);
|
||||
this.$changeComponentShow(".header_top", false);
|
||||
YJ.Global.setKeyboardEventActive(window.Earth1, false);
|
||||
},
|
||||
locate(item) {
|
||||
window.clicknum++
|
||||
// 获取 localStorage.setItem("gpsCom", this.gpsVal);
|
||||
let gpsCom = localStorage.getItem("gpsCom");
|
||||
if (!gpsCom) {
|
||||
this.$message.warning("请先设置串口");
|
||||
return;
|
||||
}
|
||||
if (window.clicknum == 1) {
|
||||
this.clickTimer = setTimeout(() => {
|
||||
let host = new URL(getIP()).host;
|
||||
if (this.LocateCurrent) {
|
||||
this.isSuccess = true;
|
||||
this.LocateCurrent.remove();
|
||||
this.LocateCurrent = null;
|
||||
} else {
|
||||
this.isSuccess = false;
|
||||
this.LocateCurrent = new YJ.Obj.LocateCurrent(
|
||||
window.Earth1,
|
||||
{ host },
|
||||
(res) => {
|
||||
if (!res) {
|
||||
this.isSuccess = false;
|
||||
} else {
|
||||
if (res.is_valid) {
|
||||
this.isSuccess = true;
|
||||
} else {
|
||||
this.isSuccess = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
this.LocateCurrent.loaded(() => {
|
||||
this.LocateCurrent.flyTo({
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(0.0),
|
||||
pitch: Cesium.Math.toRadians(-89.0),
|
||||
roll: Cesium.Math.toRadians(0.0),
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
window.clicknum = 0;
|
||||
}, 200);
|
||||
}
|
||||
// console.log(window.);
|
||||
//重置
|
||||
},
|
||||
//新增态势
|
||||
fullScreen(item = null) {
|
||||
let fullScreen = remote.getCurrentWindow().isFullScreen();
|
||||
!item && !fullScreen && (item = this.setList[3]);
|
||||
|
||||
if (item) {
|
||||
//全屏与退出全屏
|
||||
if (!fullScreen) {
|
||||
// 设置退出全屏svg
|
||||
item.icon = "shrink";
|
||||
item.index = 3;
|
||||
remote.getCurrentWindow().setFullScreen(true);
|
||||
} else {
|
||||
// 设置全屏svg
|
||||
item.icon = "fullScreen";
|
||||
item.index = 1;
|
||||
remote.getCurrentWindow().setFullScreen(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
setShow(item) {
|
||||
//设置
|
||||
if (!this.$parent.showSystem) {
|
||||
this.$parent.showSystem = true;
|
||||
this.$nextTick(() => {
|
||||
this.$parent.$refs.systemPopup.getData();
|
||||
});
|
||||
}
|
||||
},
|
||||
shrinkScreen() {
|
||||
//退出全屏
|
||||
},
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user