feat:增加网关批量升级固件进度查询列表
This commit is contained in:
parent
89334e8f83
commit
38dbf95152
|
@ -12,7 +12,7 @@ port= 9988
|
|||
|
||||
# 服务端地址
|
||||
// 陈志荣 本地
|
||||
//target = http://192.168.18.140:8899
|
||||
// target = http://192.168.18.140:8899
|
||||
// 黄明 本地
|
||||
// target = http://192.168.18.134:8899
|
||||
//target = http://192.168.18.139:8899
|
||||
|
|
|
@ -62,7 +62,7 @@ export function upgradeOta(data) {
|
|||
}
|
||||
|
||||
|
||||
// 新增固件版本
|
||||
// 批量升级固件版本
|
||||
export function upgradeBatch(data) {
|
||||
return request({
|
||||
url: '/iot/ota/upgradeBatch',
|
||||
|
@ -70,4 +70,11 @@ export function upgradeBatch(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 查询固件版本列表
|
||||
export function listUpgradeByDeviceKey(deviceKey) {
|
||||
return request({
|
||||
url: '/iot/device/upgradeListByKey/' + deviceKey,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
|
|
@ -87,9 +87,9 @@
|
|||
.pagination-container {
|
||||
position: relative;
|
||||
height: 25px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 15px;
|
||||
padding: 10px 20px !important;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 5px;
|
||||
padding: 15px 20px !important;
|
||||
}
|
||||
|
||||
/* tree border */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="app-container dialog-bit">
|
||||
<div class="dialog-bit">
|
||||
<el-dialog class="eldialog-wrap-t" @close="close" :title="title" :close-on-click-modal="false" append-to-body :visible.sync="visible" :width="width">
|
||||
<slot name="dialog-center"></slot>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
|
|
@ -65,9 +65,7 @@ export default {
|
|||
watch: {
|
||||
sourceData: {
|
||||
handler(val) {
|
||||
if(val && val.length > 0) {
|
||||
this.paramData = this.sourceData;
|
||||
}
|
||||
this.paramData = [...val];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -103,6 +101,7 @@ export default {
|
|||
handleDelete(item) {
|
||||
if (!this.paramData || !item) return;
|
||||
this.paramData = this.paramData.filter(v => v.guid !== item.guid)
|
||||
this.handleChange()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<div class="iot-batch-upgrade-rate">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="getDeviceList"
|
||||
>刷新</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="deviceList" height="540px">
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
align="center"
|
||||
:index="indexFormatter"
|
||||
width="80px"
|
||||
></el-table-column>
|
||||
<el-table-column label="设备key" align="left" width="200" prop="deviceKey" />
|
||||
<el-table-column label="当前版本" align="center" width="120" prop="currentVersion" />
|
||||
<el-table-column label="升级版本" align="center" width="120" prop="upgradeVersion" >
|
||||
<template slot-scope="scope">
|
||||
<span class="lay-table-textarea" :title="scope.row.upgradeVersion">
|
||||
{{ scope.row.upgradeVersion }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="升级进度" align="center" width="350" prop="upgradeStatus" >
|
||||
<template slot-scope="scope">
|
||||
<div style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;"
|
||||
>
|
||||
<el-progress
|
||||
style="width: 220px; margin-right: 10px;"
|
||||
:text-inside="true"
|
||||
:stroke-width="24"
|
||||
:percentage="scope.row.upgradeProgress"
|
||||
:status="upgradeStatusType(scope.row, 'upgradeStatus')"></el-progress>
|
||||
<el-tag :type="upgradeStatusTagType(scope.row, 'upgradeStatus')">{{upgradeStatusTagTiltle(scope.row, 'upgradeStatus')}}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="升级信息" align="left" prop="upgradelnfo" />
|
||||
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
width="160px"
|
||||
|
||||
prop="createTime"
|
||||
/>
|
||||
<!-- <el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
width="200px"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-error"
|
||||
@click="handleDisassociate(scope.row)"
|
||||
>取消关联</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['iot:device:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {listUpgradeByDeviceKey } from '@/api/iot/deviceOta'
|
||||
|
||||
export default {
|
||||
name: 'BatchUpgradeRate',
|
||||
props: {
|
||||
sourceKey: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
queryParams: {
|
||||
pageNum: 1
|
||||
},
|
||||
loading: false,
|
||||
deviceList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeviceList();
|
||||
},
|
||||
methods: {
|
||||
getDeviceList() {
|
||||
this.deviceList = [];
|
||||
if (!this.sourceKey && this.sourceKey !== 0)
|
||||
return;
|
||||
this.loading = true;
|
||||
listUpgradeByDeviceKey(this.sourceKey).then(res => {
|
||||
this.deviceList = [...res.rows];
|
||||
this.loading = false
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
this.loading = false;
|
||||
})
|
||||
|
||||
},
|
||||
upgradeStatusTagTiltle(row, type) {
|
||||
switch(row[type].toString()) {
|
||||
case '0':
|
||||
return '升级中';
|
||||
case '1':
|
||||
return '成功';
|
||||
case '2':
|
||||
return '失败';
|
||||
}
|
||||
},
|
||||
upgradeStatusTagType(row, type) {
|
||||
switch(row[type].toString()) {
|
||||
case '0':
|
||||
return '';
|
||||
case '1':
|
||||
return 'success';
|
||||
case '2':
|
||||
return 'danger';
|
||||
}
|
||||
},
|
||||
upgradeStatusType(row, type) {
|
||||
switch(row[type].toString()) {
|
||||
case '0':
|
||||
return '';
|
||||
case '1':
|
||||
return 'success';
|
||||
case '2':
|
||||
return 'exception';
|
||||
}
|
||||
},
|
||||
indexFormatter(val) {
|
||||
return (
|
||||
val + 1
|
||||
);
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -106,12 +106,19 @@
|
|||
/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="升级进度" name="batchUpgradeRate" v-if="infoData.deviceId === pInfo.deviceId">
|
||||
<div class="tabs-body">
|
||||
<batch-upgrade-rate ref="batchUpgradeRate" v-if="activeName === 'batchUpgradeRate'" :sourceKey="pInfo.deviceKey"></batch-upgrade-rate>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div style="height: 0;">
|
||||
<!-- 添加或修改建筑类型对话框 -->
|
||||
<dialog-template
|
||||
style=""
|
||||
:title="dialogTitle"
|
||||
:visible="dialogOpen"
|
||||
width="880px"
|
||||
|
@ -123,7 +130,6 @@
|
|||
:sourceData="this.form.data"
|
||||
@handleChange="handleFirmwareChange"
|
||||
></e-batch-firmware-upgrade>
|
||||
|
||||
<div slot="dialog-footer" class="dialog-footer">
|
||||
<el-button type="primary" size="mini" @click="submitForm"
|
||||
>确 定</el-button
|
||||
|
@ -148,6 +154,7 @@ import EDeviceScene from '@/views/profile/EDeviceScene/indexView'
|
|||
import DialogTemplate from "@/components/DialogTemplate";
|
||||
import EBatchFirmwareUpgrade from '@/views/profile/BatchFirmwareUpgrade/example'
|
||||
import { upgradeBatch } from '@/api/iot/deviceOta'
|
||||
import BatchUpgradeRate from "./BatchUpgradeRate";
|
||||
export default {
|
||||
name: "DetailsWrap",
|
||||
props: ["sourceId", "isTenant", 'isPersonal'],
|
||||
|
@ -161,7 +168,8 @@ export default {
|
|||
ChildDevice,
|
||||
EDeviceScene,
|
||||
DialogTemplate,
|
||||
EBatchFirmwareUpgrade
|
||||
EBatchFirmwareUpgrade,
|
||||
BatchUpgradeRate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -245,8 +253,7 @@ export default {
|
|||
this.form.data = ev
|
||||
},
|
||||
submitForm() {
|
||||
|
||||
if(!this.form.data || (this.form.data && this.form.data.filter(v => !v.otaId || !v.prodKey).length > 0)) {
|
||||
if((!this.form.data || this.form.data.length <= 0) || (this.form.data && this.form.data.filter(v => !v.otaId || !v.prodKey).length > 0)) {
|
||||
this.$message({
|
||||
message: '未选择型号或固件',
|
||||
type: 'error'
|
||||
|
@ -262,6 +269,10 @@ export default {
|
|||
type: 'success'
|
||||
});
|
||||
this.dialogOpen = false;
|
||||
if (this.activeName === 'batchUpgradeRate'){
|
||||
this.$refs.batchUpgradeRate.getDeviceList();
|
||||
}
|
||||
this.activeName = 'batchUpgradeRate';
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue