|
|
@@ -1,16 +1,22 @@
|
|
|
<template>
|
|
|
<a-card>
|
|
|
- <a-row align="middle" justify="space-between" style="width: 100%;height: 68px" class="title">
|
|
|
- <a-col>
|
|
|
- <a-space>
|
|
|
- <span>设备名称:{{state.otaDetail.otaPkgLabel}}</span>
|
|
|
- <span>设备版本:{{state.otaDetail.otaPkgVersion}}</span>
|
|
|
+
|
|
|
+ <a-row align="middle" justify="space-between" style="width: 100%; height: 68px" class="title">
|
|
|
+ <a-col :span="12" >
|
|
|
+ <a-space :size="50" >
|
|
|
+ <span style="font-size: 14px;font-weight: 500;" >OTA包名称: {{state.otaDetail.otaPkgLabel}} </span>
|
|
|
+ <span style="font-size: 14px;font-weight: 500;" >OTA包版本号: {{state.otaDetail.otaPkgVersion}} </span>
|
|
|
</a-space>
|
|
|
</a-col>
|
|
|
- <a-col :span="2" >
|
|
|
+ <a-col :span="4" >
|
|
|
<a-button type="primary" @click="openModal" >下发OTA程序包</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
+
|
|
|
+ <a-row style="margin-top: 20px;">
|
|
|
+ <a-col style="font-size: 20px;font-weight: 600;" >设备升级历史</a-col>
|
|
|
+ </a-row>
|
|
|
+
|
|
|
<a-table
|
|
|
style="margin-top: 20px;"
|
|
|
:columns="columns"
|
|
|
@@ -21,12 +27,13 @@
|
|
|
>
|
|
|
<template #bodyCell="{column, record}">
|
|
|
<template v-if="column.key === 'status'" >
|
|
|
- <a-tag :colo="DeviceContriller.otaStatusMap.get(record.status)?.color">
|
|
|
+ <a-tag :color="DeviceContriller.otaStatusMap.get(record.status)?.color">
|
|
|
{{DeviceContriller.otaStatusMap.get(record.status)?.label}}
|
|
|
</a-tag>
|
|
|
</template>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
+
|
|
|
</a-card>
|
|
|
|
|
|
<modal-pro
|
|
|
@@ -35,25 +42,32 @@
|
|
|
@cancel="state.visible = false"
|
|
|
@ok="ok"
|
|
|
>
|
|
|
- <a-form :labelCol="{span: 6}" :wrapperCol="{span: 14}" >
|
|
|
- <a-form-item label="所属产品" v-bind="validateInfos.deviceId" >
|
|
|
- <!-- 这个写法丑陋的一批 -->
|
|
|
- <select-tsx
|
|
|
- v-model:value="otaState.deviceId"
|
|
|
- :request="async () => {
|
|
|
- const { data } = await DeviceContriller.list()
|
|
|
- return data.map(item => ({name: item.deviceLabel, value: item.id, key: item.id}))
|
|
|
- }"
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="所属产品" v-bind="validateInfos.otaPkgId" >
|
|
|
- </a-form-item>
|
|
|
- </a-form>
|
|
|
+ <a-form :labelCol="{span: 6}" :wrapperCol="{span: 14}" >
|
|
|
+ <a-form-item label="所属产品" v-bind="validateInfos.deviceId" >
|
|
|
+ <!-- 这个写法丑陋的一批 -->
|
|
|
+ <select-tsx
|
|
|
+ v-model:value="otaState.deviceId"
|
|
|
+ :request="async () => {
|
|
|
+ const { data } = await DeviceContriller.list()
|
|
|
+ return data.filter(_ => _.deviceStatus === 'CONNECT').map(item => ({name: item.deviceLabel, value: item.id, key: item.id}))
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="所属OTA包" v-bind="validateInfos.otaPkgId" >
|
|
|
+ <select-tsx
|
|
|
+ v-model:value="otaState.otaPkgId"
|
|
|
+ :request="async () => {
|
|
|
+ const { data } = await OtaController.list()
|
|
|
+ return data.map(item => ({name: item.label, value: item.id, key: item.id}))
|
|
|
+ }"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
</modal-pro>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" >
|
|
|
-import { DeviceContriller } from '@/controller'
|
|
|
+import { DeviceContriller, OtaController } from '@/controller'
|
|
|
import { onMounted, reactive } from 'vue'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import { Form } from 'ant-design-vue'
|
|
|
@@ -73,7 +87,7 @@ const columns = [
|
|
|
dataIndex: 'otaPkgVersion'
|
|
|
},
|
|
|
{
|
|
|
- title: 'OTA升级名称',
|
|
|
+ title: 'OTA升级时间',
|
|
|
dataIndex: 'otaTime'
|
|
|
},
|
|
|
{
|
|
|
@@ -119,6 +133,7 @@ const { resetFields, validate, validateInfos } = useForm(otaState, {
|
|
|
|
|
|
const openModal = () => {
|
|
|
state.visible = true
|
|
|
+ resetFields({})
|
|
|
}
|
|
|
|
|
|
const ok = () => {
|
|
|
@@ -126,17 +141,18 @@ const ok = () => {
|
|
|
await DeviceContriller.upgradationOtaByDeviceId(otaState)
|
|
|
state.visible = false
|
|
|
getOtaPkgByDeviceId()
|
|
|
+ getOtaUpgradationRecordByDeviceId()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
const changePage = ({ current }) => {
|
|
|
queryState.page = current
|
|
|
- getOtaPkgPageByDeviceId()
|
|
|
+ getOtaUpgradationRecordByDeviceId()
|
|
|
}
|
|
|
|
|
|
-const getOtaPkgPageByDeviceId = async () => {
|
|
|
+const getOtaUpgradationRecordByDeviceId = async () => {
|
|
|
state.loading = true
|
|
|
- const { data, sum } = await DeviceContriller.OtaPageByDeviceId(queryState)
|
|
|
+ const { data, sum } = await DeviceContriller.OtaUpgradationRecordByDeviceId(queryState)
|
|
|
state.loading = false
|
|
|
state.dataSource = data
|
|
|
queryState.total = sum
|
|
|
@@ -149,11 +165,11 @@ const getOtaPkgByDeviceId = async () => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
getOtaPkgByDeviceId()
|
|
|
- getOtaPkgPageByDeviceId()
|
|
|
+ getOtaUpgradationRecordByDeviceId()
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less" >
|
|
|
+<style lang="less" scoped >
|
|
|
@import '~@/styles/theme.less';
|
|
|
|
|
|
.title {
|