6.95
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {invoke} from "@tauri-apps/api/tauri";
|
||||
import { dialog, fs } from "@tauri-apps/api";
|
||||
import * as echarts from "echarts";
|
||||
import SerialportMethod from "../SerialPort/SerialportMethod.js";
|
||||
|
||||
@ -24,11 +25,11 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
let that=this;
|
||||
//await
|
||||
//await
|
||||
await setTimeout(function() {
|
||||
that.GetSenSorInfo();
|
||||
// 这里是你要在100毫秒后执行的代码
|
||||
|
||||
|
||||
}, 100);
|
||||
await setTimeout(function() {
|
||||
that.GetSenSorInfo();
|
||||
@ -89,7 +90,7 @@ export default {
|
||||
//min:0,
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
left: 60,
|
||||
right: '5%',
|
||||
bottom: '5%',
|
||||
top: '5%'
|
||||
@ -156,6 +157,7 @@ export default {
|
||||
|
||||
|
||||
|
||||
|
||||
let chartpeak=
|
||||
{
|
||||
data:peaksforshow, // 使用二维数组表示数据点的坐标
|
||||
@ -164,7 +166,7 @@ export default {
|
||||
show: true,
|
||||
position: 'top',
|
||||
formatter: function (params) {
|
||||
return params.value[2]
|
||||
return params.value[2]
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,7 +207,38 @@ export default {
|
||||
chart_up.setOption(this.option);
|
||||
|
||||
// console.log(dataforshow);
|
||||
|
||||
|
||||
},
|
||||
async Set_Weave_Coeff() {
|
||||
await SerialportMethod.Set_Weave_Coeff(0, this.Devinfo.bochangxishu.a0, this.Devinfo.bochangxishu.a1, this.Devinfo.bochangxishu.a2, this.Devinfo.bochangxishu.a3);
|
||||
await this.saveCoeffToFile();
|
||||
},
|
||||
async saveCoeffToFile() {
|
||||
const now = new Date();
|
||||
const pad = n => String(n).padStart(2, '0');
|
||||
const dateStr = `${now.getFullYear()}${pad(now.getMonth()+1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
||||
const serial = this.Devinfo?.serialnumber || this.Devinfo?.SerilNumber || "Unknown";
|
||||
const defaultName = `${serial}_${dateStr}.json`;
|
||||
|
||||
const savePath = await dialog.save({
|
||||
defaultPath: defaultName,
|
||||
filters: [{ name: "JSON文件", extensions: ["json"] }]
|
||||
});
|
||||
if (!savePath) return;
|
||||
|
||||
const data = {
|
||||
serialnumber: serial,
|
||||
saveTime: now.toISOString(),
|
||||
sensor_type: this.Devinfo?.sensor_type || "",
|
||||
bochangxishu: {
|
||||
a0: this.Devinfo.bochangxishu.a0,
|
||||
a1: this.Devinfo.bochangxishu.a1,
|
||||
a2: this.Devinfo.bochangxishu.a2,
|
||||
a3: this.Devinfo.bochangxishu.a3,
|
||||
}
|
||||
};
|
||||
|
||||
await fs.writeTextFile(savePath, JSON.stringify(data, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +294,7 @@ export default {
|
||||
</b-input-group>
|
||||
<b-button @click="GetOneData" style="position:absolute;left: 25% ">获取数据</b-button>
|
||||
<b-button @click="updataName" style="position:absolute; right: 50% ">计算</b-button>
|
||||
<b-button @click="updataName" style="position:absolute;right: 20px ">设置</b-button>
|
||||
<b-button @click="Set_Weave_Coeff" style="position:absolute;right: 20px ">设置</b-button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user