mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
固件升级完善
This commit is contained in:
@@ -9,6 +9,14 @@ export function listFirmware(query) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询设备最新固件
|
||||||
|
export function getLatestFirmware(deviceId) {
|
||||||
|
return request({
|
||||||
|
url: '/iot/firmware/getLatest/' + deviceId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 查询产品固件详细
|
// 查询产品固件详细
|
||||||
export function getFirmware(firmwareId) {
|
export function getFirmware(firmwareId) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
OTA升级
|
OTA升级
|
||||||
</template>
|
</template>
|
||||||
<el-link :underline="false" style="line-height:28px;font-size:16px;padding-right:10px;">Version {{deviceInfo.firmwareVersion}}</el-link>
|
<el-link :underline="false" style="line-height:28px;font-size:16px;padding-right:10px;">Version {{deviceInfo.firmwareVersion}}</el-link>
|
||||||
<el-link type="success" :underline="false" style="font-size:12px;display:none;">已经是最新版本</el-link>
|
<el-button type="success" size="mini" style="float:right;" @click="getLatestFirmware(deviceInfo.deviceId)" :disabled="deviceInfo.status!=3">检查更新</el-button>
|
||||||
<el-button type="success" size="mini" style="float:right;" @click="otaUpgrade()" :disabled="deviceInfo.status!=3">升级</el-button>
|
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<!-- bool类型-->
|
<!-- bool类型-->
|
||||||
<el-descriptions-item v-for="(item,index) in deviceInfo.boolList" :key="index" :labelStyle="statusColor">
|
<el-descriptions-item v-for="(item,index) in deviceInfo.boolList" :key="index" :labelStyle="statusColor">
|
||||||
@@ -165,6 +164,27 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 添加或修改产品固件对话框 -->
|
||||||
|
<el-dialog title="设备固件升级" :visible.sync="openFirmware" width="600px" append-to-body>
|
||||||
|
<div v-if="firmware==null || deviceInfo.firmwareVersion>=firmware.version" style="text-align:center;font-size:16px;"><i class="el-icon-success" style="color:#67C23A;"></i> 已经是最新版本,不需要升级</div>
|
||||||
|
<el-descriptions :column="1" border size="large" v-if="firmware!=null && deviceInfo.firmwareVersion<firmware.version" :labelStyle='{"width":"100px","font-weight":"bold"}'>
|
||||||
|
<template slot="title">
|
||||||
|
<el-link icon="el-icon-success" type="success" :underline="false"> 可以升级到以下版本</el-link>
|
||||||
|
</template>
|
||||||
|
<el-descriptions-item label="固件名称">{{firmware.firmwareName}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="所属产品">{{firmware.productName}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="固件版本">Version {{firmware.version}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="下载地址">
|
||||||
|
<el-link :href="getDownloadUrl(firmware.filePath)" :underline="false" type="primary">{{getDownloadUrl(firmware.filePath)}}</el-link>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="固件描述">{{firmware.remark}}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="success" @click="otaUpgrade" v-if="firmware!=null && deviceInfo.firmwareVersion<firmware.version">升 级</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -172,6 +192,9 @@
|
|||||||
import {
|
import {
|
||||||
getDeviceRunningStatus
|
getDeviceRunningStatus
|
||||||
} from "@/api/iot/device"
|
} from "@/api/iot/device"
|
||||||
|
import {
|
||||||
|
getLatestFirmware,
|
||||||
|
} from "@/api/iot/firmware";
|
||||||
import {
|
import {
|
||||||
cacheJsonThingsModel
|
cacheJsonThingsModel
|
||||||
} from "@/api/iot/model";
|
} from "@/api/iot/model";
|
||||||
@@ -195,7 +218,6 @@ export default {
|
|||||||
if (newVal && newVal.deviceId != 0) {
|
if (newVal && newVal.deviceId != 0) {
|
||||||
getDeviceRunningStatus(newVal.deviceId).then(response => {
|
getDeviceRunningStatus(newVal.deviceId).then(response => {
|
||||||
this.deviceInfo = response.data;
|
this.deviceInfo = response.data;
|
||||||
console.log(this.deviceInfo);
|
|
||||||
this.updateDeviceStatus(this.deviceInfo);
|
this.updateDeviceStatus(this.deviceInfo);
|
||||||
this.$nextTick(function () {
|
this.$nextTick(function () {
|
||||||
this.MonitorChart();
|
this.MonitorChart();
|
||||||
@@ -221,6 +243,10 @@ export default {
|
|||||||
background: '#67C23A',
|
background: '#67C23A',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
},
|
},
|
||||||
|
// 最新固件信息
|
||||||
|
firmware: {},
|
||||||
|
// 打开固件对话框
|
||||||
|
openFirmware: false,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 设备信息
|
// 设备信息
|
||||||
@@ -295,7 +321,7 @@ export default {
|
|||||||
} else if (type == 3) {
|
} else if (type == 3) {
|
||||||
// OTA升级
|
// OTA升级
|
||||||
topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
|
topic = "/" + device.productId + "/" + device.serialNumber + "/ota/get";
|
||||||
message = '{"version":' + device.firmwareVersion + '}';
|
message = '{"version":' + this.firmware.version + ',"downloadUrl":"' + this.getDownloadUrl(this.firmware.filePath) + '"}';
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -348,10 +374,25 @@ export default {
|
|||||||
let model = {};
|
let model = {};
|
||||||
model.name = "设备升级"
|
model.name = "设备升级"
|
||||||
this.mqttPublish(3, this.deviceInfo, model);
|
this.mqttPublish(3, this.deviceInfo, model);
|
||||||
|
this.openFirmware = false;
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
getLatestFirmware(deviceId) {
|
||||||
|
getLatestFirmware(deviceId).then(response => {
|
||||||
|
this.firmware = response.data;
|
||||||
|
this.openFirmware = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.openFirmware = false;
|
||||||
|
},
|
||||||
|
// 获取下载路径前缀
|
||||||
|
getDownloadUrl(path) {
|
||||||
|
return window.location.origin + process.env.VUE_APP_BASE_API + path;
|
||||||
},
|
},
|
||||||
/**监测图表统计*/
|
/**监测图表统计*/
|
||||||
MonitorChart() {
|
MonitorChart() {
|
||||||
console.log(this.deviceInfo.readOnlyList.length);
|
|
||||||
for (let i = 0; i < this.deviceInfo.readOnlyList.length; i++) {
|
for (let i = 0; i < this.deviceInfo.readOnlyList.length; i++) {
|
||||||
var myChart = echarts.init(this.$refs.map[i]);
|
var myChart = echarts.init(this.$refs.map[i]);
|
||||||
var option;
|
var option;
|
||||||
|
|||||||
@@ -21,28 +21,33 @@
|
|||||||
<el-card style="padding-bottom:100px;">
|
<el-card style="padding-bottom:100px;">
|
||||||
<el-table v-loading="loading" :data="firmwareList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="firmwareList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column label="固件名称" align="center" prop="firmwareName" />
|
<el-table-column label="固件名称" align="center" prop="firmwareName" />
|
||||||
|
<el-table-column label="固件版本" align="center" prop="version" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>Version </span> {{scope.row.version}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="isLatest" width="80">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag type="success" v-if="scope.row.isLatest==1">最新</el-tag>
|
||||||
|
<el-tag type="info" v-else>默认</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="产品名称" align="center" prop="productName">
|
<el-table-column label="产品名称" align="center" prop="productName">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link :underline="false" type="primary" @click="handleViewProduct(scope.row.productId)">{{scope.row.productName}}</el-link>
|
<el-link :underline="false" type="primary" @click="handleViewProduct(scope.row.productId)">{{scope.row.productName}}</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="下载地址" align="center" prop="filePath" min-width="100">
|
||||||
<el-table-column label="下载地址" align="center" prop="filePath" width="400">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link :href="getDownloadUrl(scope.row.filePath)" :underline="false" type="success">{{getDownloadUrl(scope.row.filePath)}}</el-link>
|
<el-link :href="getDownloadUrl(scope.row.filePath)" :underline="false" type="success">{{getDownloadUrl(scope.row.filePath)}}</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="固件版本" align="center" prop="version">
|
<el-table-column label="固件描述" align="center" prop="remark" min-width="200" />
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>Version </span> {{scope.row.version}}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
|
||||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:firmware:edit']">修改</el-button>
|
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:firmware:edit']">修改</el-button>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<el-card :body-style="{ padding: '20px'}" shadow="always" class="card-item">
|
<el-card :body-style="{ padding: '20px'}" shadow="always" class="card-item">
|
||||||
<el-row type="flex" :gutter="10" justify="space-between">
|
<el-row type="flex" :gutter="10" justify="space-between">
|
||||||
<el-col :span="20" style="text-align:left;">
|
<el-col :span="20" style="text-align:left;">
|
||||||
<el-link type="" :underline="false" @click="handleEditProduct(item)" style="font-weight:bold;font-size:16px;line-height:32px;">
|
<el-link type="" :underline="false" @click="handleEditProduct(item)" style="font-weight:bold;font-size:16px;line-height:32px;white-space:nowrap;">
|
||||||
<svg-icon icon-class="product" /> {{item.productName}}
|
<svg-icon icon-class="product" /> {{item.productName}}
|
||||||
<el-tag type="info" size="mini" style="margin-left:5px;font-weight:200" v-if="item.isSys==1">系统</el-tag>
|
<el-tag type="info" size="mini" style="margin-left:5px;font-weight:200" v-if="item.isSys==1">系统</el-tag>
|
||||||
</el-link>
|
</el-link>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="14">
|
<el-col :span="14">
|
||||||
<el-descriptions :column="1" size="small" style="margin-top:10px;">
|
<el-descriptions :column="1" size="small" style="margin-top:10px;white-space:nowrap;">
|
||||||
<el-descriptions-item label="所属分类">
|
<el-descriptions-item label="所属分类">
|
||||||
<el-link type="primary" :underline="false">{{item.categoryName}}</el-link>
|
<el-link type="primary" :underline="false">{{item.categoryName}}</el-link>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-button-group style="margin-top:15px;">
|
<el-button-group style="margin-top:15px;height:28px;">
|
||||||
<el-button size="mini" type="primary" icon="el-icon-edit" @click="handleEditProduct(item)" v-hasPermi="['iot:product:edit']">详情</el-button>
|
<el-button size="mini" type="primary" icon="el-icon-edit" @click="handleEditProduct(item)" v-hasPermi="['iot:product:edit']">详情</el-button>
|
||||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(item)" v-hasPermi="['iot:product:remove']" v-if="item.status==1">删除</el-button>
|
<el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(item)" v-hasPermi="['iot:product:remove']" v-if="item.status==1">删除</el-button>
|
||||||
<el-button size="mini" type="success" icon="el-icon-s-check" @click="handleDeviceAuthorize(item)" v-hasPermi="['iot:product:edit']" v-if="item.status==2" :disabled="item.isAuthorize!=1">设备授权</el-button>
|
<el-button size="mini" type="success" icon="el-icon-s-check" @click="handleDeviceAuthorize(item)" v-hasPermi="['iot:product:edit']" v-if="item.status==2" :disabled="item.isAuthorize!=1">设备授权</el-button>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
|
|
||||||
<!-- 设备详情对话框 -->
|
<!-- 设备详情对话框 -->
|
||||||
<el-dialog title="设备详情" :visible.sync="openDevice" width="600px" append-to-body>
|
<el-dialog title="设备详情" :visible.sync="openDevice" width="600px" append-to-body>
|
||||||
<div v-if="device==null" style="text-align:center;">提示:查找不到设备,可能已经被删除</div>
|
<div v-if="device==null" style="text-align:center;"><i class="el-icon-warning" style="color:#E6A23C;"></i> 提示:查找不到设备,可能已经被删除</div>
|
||||||
<el-descriptions border :column="2" size="medium" v-if="device!=null">
|
<el-descriptions border :column="2" size="medium" v-if="device!=null">
|
||||||
<el-descriptions-item label="设备ID">{{device.deviceId}}</el-descriptions-item>
|
<el-descriptions-item label="设备ID">{{device.deviceId}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="设备名称">{{device.deviceName}}</el-descriptions-item>
|
<el-descriptions-item label="设备名称">{{device.deviceName}}</el-descriptions-item>
|
||||||
|
|||||||
@@ -11,22 +11,28 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" :data="firmwareList" @selection-change="handleSelectionChange" size="small">
|
<el-table v-loading="loading" :data="firmwareList" @selection-change="handleSelectionChange" size="small">
|
||||||
<el-table-column label="固件名称" align="center" prop="firmwareName" />
|
<el-table-column label="固件名称" align="center" prop="firmwareName" />
|
||||||
<el-table-column label="固件版本" align="center" prop="version">
|
<el-table-column label="固件版本" align="center" prop="version" width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>Version </span> {{scope.row.version}}
|
<span>Version </span> {{scope.row.version}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="下载地址" align="center" prop="filePath" width="400">
|
<el-table-column label="状态" align="center" prop="isLatest" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link :href="getDownloadUrl(scope.row.filePath)" :underline="false" type="success">{{getDownloadUrl(scope.row.filePath)}}</el-link>
|
<el-tag type="success" v-if="scope.row.isLatest==1">最新</el-tag>
|
||||||
|
<el-tag type="info" v-else>默认</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="下载地址" align="center" prop="filePath" min-width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link :href="getDownloadUrl(scope.row.filePath)" :underline="false" type="success">{{getDownloadUrl(scope.row.filePath)}}</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="固件描述" align="center" prop="remark" min-width="200" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:firmware:edit']">修改</el-button>
|
<el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iot:firmware:edit']">修改</el-button>
|
||||||
@@ -44,12 +50,16 @@
|
|||||||
<el-form-item label="固件版本" prop="version">
|
<el-form-item label="固件版本" prop="version">
|
||||||
<el-input v-model="form.version" placeholder="请输入固件版本" type="number" step="0.1" />
|
<el-input v-model="form.version" placeholder="请输入固件版本" type="number" step="0.1" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="最新固件" prop="isLatest">
|
||||||
|
<el-switch v-model="form.isLatest" active-text="" inactive-text="" :active-value="1" :inactive-value="0">
|
||||||
|
</el-switch>
|
||||||
|
<el-link type="info" :underline="false" style="font-size:12px;margin-left:15px;">提示:产品中只能有一个最新固件</el-link>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="固件上传" prop="filePath">
|
<el-form-item label="固件上传" prop="filePath">
|
||||||
<fileUpload ref="file-upload" :value="form.filePath" :limit="1" :fileSize="10" :fileType='["bin", "zip", "pdf"]' @input="getFilePath($event)"></fileUpload>
|
<fileUpload ref="file-upload" :value="form.filePath" :limit="1" :fileSize="10" :fileType='["bin", "zip", "pdf"]' @input="getFilePath($event)"></fileUpload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="固件描述" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.remark" type="textarea" rows="4" placeholder="请输入固件信息" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@@ -92,8 +102,8 @@ export default {
|
|||||||
this.productInfo = newVal;
|
this.productInfo = newVal;
|
||||||
if (this.productInfo && this.productInfo.productId != 0) {
|
if (this.productInfo && this.productInfo.productId != 0) {
|
||||||
this.queryParams.productId = this.productInfo.productId;
|
this.queryParams.productId = this.productInfo.productId;
|
||||||
this.form.productId=this.productInfo.productId;
|
this.form.productId = this.productInfo.productId;
|
||||||
this.form.productName=this.productInfo.productName;
|
this.form.productName = this.productInfo.productName;
|
||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,8 +177,7 @@ export default {
|
|||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {},
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
getDownloadUrl(path) {
|
getDownloadUrl(path) {
|
||||||
return window.location.origin + process.env.VUE_APP_BASE_API + path;
|
return window.location.origin + process.env.VUE_APP_BASE_API + path;
|
||||||
@@ -194,9 +203,10 @@ export default {
|
|||||||
firmwareName: null,
|
firmwareName: null,
|
||||||
tenantId: null,
|
tenantId: null,
|
||||||
tenantName: null,
|
tenantName: null,
|
||||||
productId:this.form.productId,
|
productId: this.form.productId,
|
||||||
productName:this.form.productName,
|
productName: this.form.productName,
|
||||||
isSys: null,
|
isSys: null,
|
||||||
|
isLatest: 0,
|
||||||
version: 1.0,
|
version: 1.0,
|
||||||
filePath: null,
|
filePath: null,
|
||||||
delFlag: null,
|
delFlag: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user