first
This commit is contained in:
172
src/apphymain.js
Normal file
172
src/apphymain.js
Normal file
@ -0,0 +1,172 @@
|
||||
|
||||
import {invoke} from "@tauri-apps/api/tauri";
|
||||
import {ref} from "vue";
|
||||
|
||||
import {appWindow, LogicalSize, WebviewWindow} from "@tauri-apps/api/window";
|
||||
import setWavelenth from "./components/menubox/SetWavelenth.vue";
|
||||
import SetName from "./components/menubox/SetName.vue";
|
||||
import SetWorkmode from "./components/menubox/SetWorkmode.vue";
|
||||
import setCalibrate from "./components/menubox/SetCalibrate.vue";
|
||||
import Greet from "./components/Greet.vue";
|
||||
import {$ref} from "vue3-json-editor/dist/vue3-json-editor.cjs.js";
|
||||
//引入
|
||||
|
||||
export default {
|
||||
async onmenuclicked(command){
|
||||
|
||||
console.log("menuclicked main "+command.name)
|
||||
if (command.type=="Set")
|
||||
{
|
||||
if (!this.isDevOpen())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (command.type=="File"){
|
||||
if (command.name=="Advance"){
|
||||
this.modaltitle="高级测试模式";
|
||||
this.modalcomponent=Greet;
|
||||
this.showModal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if (command.name=="setting"){
|
||||
//
|
||||
// this.modaltitle="设置波长";
|
||||
// this.modalcomponent=setWavelenth
|
||||
// this.showModal();
|
||||
// }
|
||||
if (command.name=="DevInfo"){
|
||||
|
||||
let iscommenopen=this.$refs.SiderComponend.SerialInfo.isopen;
|
||||
if (!iscommenopen)
|
||||
{
|
||||
alert("请先打开设备");
|
||||
return
|
||||
}
|
||||
this.modaltitle="设置设备信息";
|
||||
this.modalcomponent=SetName
|
||||
await this.$nextTick();
|
||||
|
||||
this.$refs.Commancompent.name=this.$refs.SiderComponend.Devinfo.name;
|
||||
this.$refs.Commancompent.version=this.$refs.SiderComponend.Devinfo.Version;
|
||||
this.$refs.Commancompent.upother=this.$refs.SiderComponend.GetSenSorInfo
|
||||
|
||||
this.showModal();
|
||||
|
||||
}
|
||||
if (command.name=="Workmode"){
|
||||
this.modaltitle="设置工作模式";
|
||||
|
||||
this.modalcomponent=SetWorkmode
|
||||
await this.$nextTick();
|
||||
this.$refs.Commancompent.GetSenSorInfo();
|
||||
this.showModal();
|
||||
}
|
||||
if(command.name=="Weavelenth")
|
||||
{
|
||||
if (!this.isinAdvanceMode()) return;
|
||||
this.modaltitle="设置波长";
|
||||
this.modalcomponent=setWavelenth
|
||||
await this.$nextTick();
|
||||
// this.$refs.Commancompent.GetSenSorInfo();
|
||||
this.showModal();
|
||||
}
|
||||
if (command.name=="Calibrate")
|
||||
{
|
||||
if (!this.isinAdvanceMode()) return;
|
||||
this.modaltitle="能量定标";
|
||||
this.modalcomponent=setCalibrate
|
||||
await this.$nextTick();
|
||||
// this.$refs.Commancompent.GetSenSorInfo();
|
||||
this.showModal();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
async newwindow() {
|
||||
const webview = new WebviewWindow("element", {
|
||||
url: "/element",
|
||||
// 可自行添加属性配置 窗口配置
|
||||
width: 2000,
|
||||
height: 900,
|
||||
//center:true,
|
||||
//decorations:false
|
||||
});
|
||||
|
||||
await webview.once("tauri://created", function () {
|
||||
|
||||
// webview window successfully created
|
||||
// 窗口创建成功 打印1
|
||||
console.log(1);
|
||||
});
|
||||
await webview.once("tauri://error", function (e) {
|
||||
// an error happened creating the webview window
|
||||
// 窗口创建失败 打印2
|
||||
console.log(2);
|
||||
});
|
||||
|
||||
|
||||
// testWindow.open();
|
||||
},
|
||||
showModal() {
|
||||
this.modal=!this.modal;
|
||||
|
||||
// alert("showModal")
|
||||
},
|
||||
isDevOpen(){
|
||||
let iscommenopen=this.$refs.SiderComponend.SerialInfo.isopen;
|
||||
if (!iscommenopen)
|
||||
{
|
||||
alert("请先打开设备");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
isinAdvanceMode(){
|
||||
let isadvance=this.$refs.SiderComponend.Devinfo.work_mode;
|
||||
if(isadvance!="advanced_mode")
|
||||
{
|
||||
alert("请先切换到高级模式");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
},
|
||||
inittour(){
|
||||
var steps=[
|
||||
{
|
||||
title: 'Save',
|
||||
description: 'Save your changes.',
|
||||
target:()=>this.$refs.SiderComponend.value&& this.$refs.SiderComponend.value.$el,
|
||||
}
|
||||
]
|
||||
this.tourdata.steps=steps;
|
||||
|
||||
|
||||
},
|
||||
siderresize(){
|
||||
this.$refs.HyperSpectralMainView.echartresize();
|
||||
},
|
||||
async testinmpt(){
|
||||
let x=[0.0,0.5, 0.569, 1.138, 1.707, 2.276, 2.845];
|
||||
let y=[0.0, 0.4,0.5, 1.0, 0.5, 0.0, -0.5];
|
||||
let cc=await invoke("interpolate_spline",{x:x,y,step:0.1});
|
||||
console.log(cc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user