远程重启

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