Files
jsowell-charger-web/jsowell-ui/src/views/pile/basic/components/remoteUpgrade.vue

87 lines
2.7 KiB
Vue
Raw Normal View History

2023-06-29 16:41:45 +08:00
<template>
<div style="margin-top:10px">
<el-button type="primary" icon="el-icon-s-tools" round @click="dialogTableVisible = true">测试远程固件升级</el-button>
<el-dialog title="配件升级" :visible.sync="dialogTableVisible">
<el-table
2023-06-29 17:14:33 +08:00
:data="firmwareList"
2023-06-29 16:41:45 +08:00
border
stripe
2023-06-29 17:14:33 +08:00
ref="firmwareList"
2023-06-29 16:41:45 +08:00
@row-click="singleElection">
2023-06-29 17:14:33 +08:00
<el-table-column width="65">
2023-06-29 16:41:45 +08:00
<template slot-scope="scope">
2023-06-29 17:14:33 +08:00
<el-radio class="radio" v-model="templateSelection" >&nbsp;</el-radio>
2023-06-29 16:41:45 +08:00
</template>
</el-table-column>
2023-06-29 17:14:33 +08:00
<el-table-column prop="name" label="固件名称"></el-table-column>
<el-table-column prop="description" label="固件描述"></el-table-column>
<el-table-column prop="filePath" label="路径"></el-table-column>
2023-06-29 16:41:45 +08:00
</el-table>
<div style="margin-top: 20px">
2023-06-29 17:14:33 +08:00
<el-button type="primary" @click="submit">提交</el-button>
2023-06-30 09:36:06 +08:00
<!-- <el-button @click="">取消选择</el-button> -->
2023-06-29 16:41:45 +08:00
</div>
</el-dialog>
</div>
</template>
<script>
import { listFirmware } from "@/api/pile/firmware";
2023-06-29 17:14:33 +08:00
import {updateFirmware} from "@/api/pile/pileRemote";
2023-06-29 16:41:45 +08:00
export default {
2023-06-29 17:14:33 +08:00
props:['pileSn'],
2023-06-29 16:41:45 +08:00
data() {
return {
templateSelection: '',
2023-06-29 17:14:33 +08:00
templateRadioId: null,
2023-06-29 16:41:45 +08:00
dialogTableVisible: false,
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
},
multipleSelection: [],
2023-06-29 17:14:33 +08:00
firmwareList:[]
2023-06-29 16:41:45 +08:00
};
},
methods: {
2023-06-29 17:14:33 +08:00
submit(){
2023-06-30 09:36:06 +08:00
if(this.templateRadioId === null) return this.$modal.msgWarning('请选择文件')
2023-06-29 17:14:33 +08:00
// console.log('接收传递的 pileSn',this.pileSn,this.templateRadioId);
const data = {
pileSns: [this.pileSn],
firmwareId: this.templateRadioId
};
console.log("远程升级固件:", data);
updateFirmware(data).then((response) => {
console.log("updateFirmware结果", response);
2023-06-30 09:36:06 +08:00
if(response.code === 200) {
this.$modal.msgError('操作成功')
this.dialogTableVisible = false
}
2023-06-29 17:14:33 +08:00
});
},
2023-06-29 16:41:45 +08:00
getList() {
this.loading = true;
listFirmware(this.queryParams).then(response => {
console.log('查询固件接口 firmwareList',response)
this.firmwareList = response.rows;
this.total = response.total;
this.loading = false;
});
},
singleElection (row) {
2023-06-29 17:14:33 +08:00
this.templateSelection = this.firmwareList.indexOf(row);
this.templateRadioId = row.id;
// console.log('this.templateRadio',this.templateRadioId)
2023-06-29 16:41:45 +08:00
},
},
2023-06-29 17:14:33 +08:00
created() {
// this.getList()
2023-06-29 16:41:45 +08:00
}
}
</script>
<style>
</style>