远程重启

This commit is contained in:
BOOL\25024
2024-09-10 17:14:59 +08:00
parent ed86d52658
commit 2ed9f687c4

View File

@@ -1,20 +1,27 @@
<template>
<div style="margin-top:10px">
<el-button type="primary" icon="el-icon-upload" round @click="dialogTableVisible = true">远程固件升级</el-button>
<el-button type="primary" icon="el-icon-refresh" round @click="remoteReboot()">远程重启</el-button>
<el-dialog title="配件升级" :visible.sync="dialogTableVisible" :before-close="handleClose">
<el-table
:data="firmwareList"
border
stripe
ref="firmwareList"
>
<div style="margin-top: 10px">
<el-button
type="primary"
icon="el-icon-upload"
round
@click="dialogTableVisible = true"
>远程固件升级</el-button
>
<el-button type="primary" icon="el-icon-refresh" round @click="remoteReboot"
>远程重启</el-button
>
<el-dialog
title="配件升级"
:visible.sync="dialogTableVisible"
:before-close="handleClose"
>
<el-table :data="firmwareList" border stripe ref="firmwareList">
<el-table-column width="80" label="选择" @row-click="singleElection">
<template slot-scope="scope">
<el-radio class="radio" v-model="templateRadioId" :label="scope.$index+1">
<p v-html>&nbsp;</p>
</el-radio>
</template>
<template slot-scope="scope">
<el-radio class="radio" v-model="templateRadioId" :label="scope.$index + 1">
<p v-html>&nbsp;</p>
</el-radio>
</template>
</el-table-column>
<el-table-column prop="name" label="固件名称"></el-table-column>
<el-table-column prop="description" label="固件描述"></el-table-column>
@@ -30,76 +37,74 @@
<script>
import { listFirmware } from "@/api/pile/firmware";
import {remoteReboot, updateFirmware} from "@/api/pile/pileRemote";
import { remoteReboot, updateFirmware } from "@/api/pile/pileRemote";
export default {
props:['pileSn'],
props: ["pileSn"],
data() {
return {
templateSelection: '',
templateSelection: "",
templateRadioId: null,
dialogTableVisible: false,
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
},
multipleSelection: [],
firmwareList:[]
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
},
multipleSelection: [],
firmwareList: [],
};
},
methods: {
submit(){
console.log('this.templateRadioId',this.templateRadioId)
if(this.templateRadioId === null) return this.$modal.msgWarning('请选择文件')
submit() {
console.log("this.templateRadioId", this.templateRadioId);
if (this.templateRadioId === null) return this.$modal.msgWarning("请选择文件");
// console.log('接收传递的 pileSn',this.pileSn,this.templateRadioId);
const data = {
pileSns: [this.pileSn],
firmwareId: this.firmwareList[this.templateRadioId-1].id
firmwareId: this.firmwareList[this.templateRadioId - 1].id,
};
console.log("远程升级固件:", data);
updateFirmware(data).then((response) => {
console.log("updateFirmware结果", response);
if(response.code === 200) {
this.$modal.msgSuccess('升级成功')
this.dialogTableVisible = false
if (response.code === 200) {
this.$modal.msgSuccess("升级成功");
this.dialogTableVisible = false;
}
});
},
getList() {
this.loading = true;
listFirmware(this.queryParams).then(response => {
console.log('查询固件接口 firmwareList',response)
this.firmwareList = response.rows;
this.total = response.total;
this.loading = false;
});
},
remoteReboot() {
const param = {
pileSn: this.pileSn,
}
remoteReboot(param).then(response => {
console.log("远程重启 result:", response)
})
},
// 选择单选框的点击事件
singleElection (row) {
this.templateSelection = this.firmwareList.indexOf(row);
console.log('this.templateSelection',this.templateSelection)
this.templateRadioId = row.id;
console.log(this.templateRadioId,'this.templateRadioId');
},
handleClose(){
this.dialogTableVisible = false
this.templateRadioId = ''
}
getList() {
this.loading = true;
listFirmware(this.queryParams).then((response) => {
console.log("查询固件接口 firmwareList", response);
this.firmwareList = response.rows;
this.total = response.total;
this.loading = false;
});
},
remoteReboot() {
const param = {
pileSn: this.pileSn,
};
remoteReboot(param).then((response) => {
console.log("远程重启 result:", response);
});
},
// 选择单选框的点击事件
singleElection(row) {
this.templateSelection = this.firmwareList.indexOf(row);
console.log("this.templateSelection", this.templateSelection);
this.templateRadioId = row.id;
console.log(this.templateRadioId, "this.templateRadioId");
},
handleClose() {
this.dialogTableVisible = false;
this.templateRadioId = "";
},
},
created() {
// this.getList()
}
}
},
};
</script>
<style>
</style>
<style></style>