|
@@ -1,44 +1,31 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <a-modal
|
|
|
|
|
- title="设备日志上传"
|
|
|
|
|
- v-model:visible="sVisible"
|
|
|
|
|
- width="900px"
|
|
|
|
|
- :footer="null"
|
|
|
|
|
- @update:visible="onVisibleChange">
|
|
|
|
|
|
|
+ <a-modal title="设备日志上传" v-model:visible="sVisible" width="900px" :footer="null" @update:visible="onVisibleChange">
|
|
|
<div class="device-log-upload-wrap">
|
|
<div class="device-log-upload-wrap">
|
|
|
<div class="page-action-row">
|
|
<div class="page-action-row">
|
|
|
<a-button type="primary" :disabled="deviceLogUploadBtnDisabled" @click="uploadDeviceLog">上传日志</a-button>
|
|
<a-button type="primary" :disabled="deviceLogUploadBtnDisabled" @click="uploadDeviceLog">上传日志</a-button>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="device-log-list">
|
|
<div class="device-log-list">
|
|
|
<div class="log-list-item">
|
|
<div class="log-list-item">
|
|
|
- <a-table :columns="airportLogColumns"
|
|
|
|
|
- :scroll="{ x: '100%', y: 600 }"
|
|
|
|
|
- :data-source="airportTableLogState.logList?.list"
|
|
|
|
|
- :loading="airportTableLogState.tableLoading"
|
|
|
|
|
- :row-selection="airportTableLogState.rowSelection"
|
|
|
|
|
- rowKey="boot_index"
|
|
|
|
|
- :pagination = "false">
|
|
|
|
|
- <template #log_time="{record}">
|
|
|
|
|
- <div>{{getLogTime(record)}}</div>
|
|
|
|
|
|
|
+ <a-table :columns="airportLogColumns" :scroll="{ x: '100%', y: 600 }"
|
|
|
|
|
+ :data-source="airportTableLogState.logList?.list" :loading="airportTableLogState.tableLoading"
|
|
|
|
|
+ :row-selection="airportTableLogState.rowSelection" rowKey="boot_index" :pagination="false">
|
|
|
|
|
+ <template #log_time="{ record }">
|
|
|
|
|
+ <div>{{ getLogTime(record) }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #size="{record}">
|
|
|
|
|
- <div>{{getLogSize(record.size)}}</div>
|
|
|
|
|
|
|
+ <template #size="{ record }">
|
|
|
|
|
+ <div>{{ getLogSize(record.size) }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
</a-table>
|
|
</a-table>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="log-list-item">
|
|
<div class="log-list-item">
|
|
|
- <a-table :columns="droneLogColumns"
|
|
|
|
|
- :scroll="{ x: '100%', y: 600 }"
|
|
|
|
|
- :data-source="droneTableLogState.logList?.list"
|
|
|
|
|
- :loading="droneTableLogState.tableLoading"
|
|
|
|
|
- :row-selection="droneTableLogState.rowSelection"
|
|
|
|
|
- rowKey="boot_index"
|
|
|
|
|
- :pagination = "false">
|
|
|
|
|
- <template #log_time="{record}">
|
|
|
|
|
- <div>{{getLogTime(record)}}</div>
|
|
|
|
|
|
|
+ <a-table :columns="droneLogColumns" :scroll="{ x: '100%', y: 600 }"
|
|
|
|
|
+ :data-source="droneTableLogState.logList?.list" :loading="droneTableLogState.tableLoading"
|
|
|
|
|
+ :row-selection="droneTableLogState.rowSelection" rowKey="boot_index" :pagination="false">
|
|
|
|
|
+ <template #log_time="{ record }">
|
|
|
|
|
+ <div>{{ getLogTime(record) }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #size="{record}">
|
|
|
|
|
- <div>{{getLogSize(record.size)}}</div>
|
|
|
|
|
|
|
+ <template #size="{ record }">
|
|
|
|
|
+ <div>{{ getLogSize(record.size) }}</div>
|
|
|
</template>
|
|
</template>
|
|
|
</a-table>
|
|
</a-table>
|
|
|
</div>
|
|
</div>
|
|
@@ -48,11 +35,10 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import { watchEffect, reactive, ref, computed, defineProps, defineEmits } from 'vue'
|
|
|
|
|
-import { ColumnProps, TableState } from 'ant-design-vue/lib/table/interface'
|
|
|
|
|
-import { IPage } from '/@/api/http/type'
|
|
|
|
|
|
|
+import { watchEffect, reactive, ref, computed } from 'vue'
|
|
|
|
|
+import { ColumnProps } from 'ant-design-vue/lib/table/interface'
|
|
|
import { Device, DOMAIN } from '/@/types/device'
|
|
import { Device, DOMAIN } from '/@/types/device'
|
|
|
-import { getDeviceLogList, postDeviceUpgrade, DeviceLogFileInfo, UploadDeviceLogBody, DeviceLogItem } from '/@/api/device-log'
|
|
|
|
|
|
|
+import { getDeviceLogList, postDeviceUpgrade, DeviceLogFileInfo, UploadDeviceLogBody } from '/@/api/device-log'
|
|
|
import { message } from 'ant-design-vue'
|
|
import { message } from 'ant-design-vue'
|
|
|
import { useDeviceLogUploadDetail } from './use-device-log-upload-detail'
|
|
import { useDeviceLogUploadDetail } from './use-device-log-upload-detail'
|
|
|
|
|
|
|
@@ -72,14 +58,14 @@ watchEffect(() => {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-function onVisibleChange (sVisible: boolean) {
|
|
|
|
|
|
|
+function onVisibleChange(sVisible: boolean) {
|
|
|
setVisible(sVisible)
|
|
setVisible(sVisible)
|
|
|
if (!sVisible) {
|
|
if (!sVisible) {
|
|
|
resetTableLogState()
|
|
resetTableLogState()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function setVisible (v: boolean, e?: Event) {
|
|
|
|
|
|
|
+function setVisible(v: boolean, e?: Event) {
|
|
|
sVisible.value = v
|
|
sVisible.value = v
|
|
|
emit('update:visible', v, e)
|
|
emit('update:visible', v, e)
|
|
|
}
|
|
}
|
|
@@ -102,7 +88,7 @@ const airportTableLogState = reactive({
|
|
|
rowSelection: {
|
|
rowSelection: {
|
|
|
columnWidth: 15,
|
|
columnWidth: 15,
|
|
|
selectedRowKeys: [] as number[],
|
|
selectedRowKeys: [] as number[],
|
|
|
- onChange: (selectedRowKeys:number[], selectedRows: []) => {
|
|
|
|
|
|
|
+ onChange: (selectedRowKeys: number[], selectedRows: []) => {
|
|
|
airportTableLogState.rowSelection.selectedRowKeys = selectedRowKeys
|
|
airportTableLogState.rowSelection.selectedRowKeys = selectedRowKeys
|
|
|
airportTableLogState.selectRow = selectedRows
|
|
airportTableLogState.selectRow = selectedRows
|
|
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
|
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
|
|
@@ -110,7 +96,7 @@ const airportTableLogState = reactive({
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-function resetTableLogState () {
|
|
|
|
|
|
|
+function resetTableLogState() {
|
|
|
airportTableLogState.logList = {} as DeviceLogFileInfo
|
|
airportTableLogState.logList = {} as DeviceLogFileInfo
|
|
|
airportTableLogState.selectRow = []
|
|
airportTableLogState.selectRow = []
|
|
|
airportTableLogState.tableLoading = false
|
|
airportTableLogState.tableLoading = false
|
|
@@ -133,11 +119,11 @@ const droneTableLogState = reactive({
|
|
|
|
|
|
|
|
const deviceLogUploadBtnDisabled = computed(() => {
|
|
const deviceLogUploadBtnDisabled = computed(() => {
|
|
|
return (airportTableLogState.rowSelection.selectedRowKeys && airportTableLogState.rowSelection.selectedRowKeys.length <= 0) &&
|
|
return (airportTableLogState.rowSelection.selectedRowKeys && airportTableLogState.rowSelection.selectedRowKeys.length <= 0) &&
|
|
|
- (droneTableLogState.rowSelection.selectedRowKeys && droneTableLogState.rowSelection.selectedRowKeys.length <= 0)
|
|
|
|
|
|
|
+ (droneTableLogState.rowSelection.selectedRowKeys && droneTableLogState.rowSelection.selectedRowKeys.length <= 0)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 获取设备内日志
|
|
// 获取设备内日志
|
|
|
-async function getDeviceLogInfo () {
|
|
|
|
|
|
|
+async function getDeviceLogInfo() {
|
|
|
airportTableLogState.tableLoading = true
|
|
airportTableLogState.tableLoading = true
|
|
|
droneTableLogState.tableLoading = true
|
|
droneTableLogState.tableLoading = true
|
|
|
try {
|
|
try {
|
|
@@ -164,7 +150,7 @@ async function getDeviceLogInfo () {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 日志上传
|
|
// 日志上传
|
|
|
-async function uploadDeviceLog () {
|
|
|
|
|
|
|
+async function uploadDeviceLog() {
|
|
|
const body = {
|
|
const body = {
|
|
|
device_sn: props.device?.device_sn || '',
|
|
device_sn: props.device?.device_sn || '',
|
|
|
files: [] as any
|
|
files: [] as any
|
|
@@ -196,15 +182,16 @@ const { getLogTime, getLogSize } = useDeviceLogUploadDetail()
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
-.device-log-upload-wrap{
|
|
|
|
|
|
|
+.device-log-upload-wrap {
|
|
|
|
|
|
|
|
- .device-log-list{
|
|
|
|
|
|
|
+ .device-log-list {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
padding: 8px 0;
|
|
padding: 8px 0;
|
|
|
- .log-list-item{
|
|
|
|
|
|
|
+
|
|
|
|
|
+ .log-list-item {
|
|
|
width: 420px;
|
|
width: 420px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|