|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <a-modal :width="800" title="设备异常反馈" :maskClosable="false" :closable="false" okText="提交" v-model:visible="visible"
|
|
|
+ <a-modal :width="950" title="设备异常反馈" :maskClosable="false" :closable="false" okText="提交" v-model:visible="visible"
|
|
|
@ok="handleClickSubmit" @cancel="onClickClose">
|
|
|
<a-form ref="formRef" :model="formModel" :colon="false" :label-col="labelCol" :wrapper-col="wrapperCol">
|
|
|
<a-form-item label='异常描述' name="describe"
|
|
|
@@ -39,11 +39,19 @@
|
|
|
<a-table :columns="airportLogColumns" :scroll="{ x: '100%', y: 600 }"
|
|
|
:data-source="state.airportLogList" :loading="state.listLoading"
|
|
|
:row-selection="airportTableLogState.rowSelection" rowKey="boot_index" :pagination="false">
|
|
|
- <template #log_time="{ record }">
|
|
|
- <!-- <div>{{ getLogTime(record) }}</div> -->
|
|
|
+ <template #log="{ record }">
|
|
|
+ <div style="font-size: 12px;">
|
|
|
+ {{ getDateTime(record.start_time) }}
|
|
|
+ <span style="margin: 0 5px;">
|
|
|
+ -
|
|
|
+ </span>
|
|
|
+ {{ getDateTime(record.end_time) }}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template #size="{ record }">
|
|
|
- <!-- <div>{{ getLogSize(record.size) }}</div> -->
|
|
|
+ <div>
|
|
|
+ {{ getLogSize(record.size) }} G
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
@@ -51,11 +59,19 @@
|
|
|
<a-table :columns="droneLogColumns" :scroll="{ x: '100%', y: 600 }" :data-source="state.droneLogList"
|
|
|
:loading="state.listLoading" :row-selection="droneTableLogState.rowSelection" rowKey="boot_index"
|
|
|
:pagination="false">
|
|
|
- <template #log_time="{ record }">
|
|
|
- <!-- <div>{{ getLogTime(record) }}</div> -->
|
|
|
+ <template #log="{ record }">
|
|
|
+ <div style="font-size: 12px;">
|
|
|
+ {{ getDateTime(record.start_time) }}
|
|
|
+ <span style="margin: 0 5px;">
|
|
|
+ -
|
|
|
+ </span>
|
|
|
+ {{ getDateTime(record.end_time) }}
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<template #size="{ record }">
|
|
|
- <!-- <div>{{ getLogSize(record.size) }}</div> -->
|
|
|
+ <div>
|
|
|
+ {{ getLogSize(record.size) }} G
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
</div>
|
|
|
@@ -67,9 +83,10 @@
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
import { apis, getUploadPath } from '/@/api/custom';
|
|
|
import { getHeaders } from '/@/api/http/request';
|
|
|
-import { message } from 'ant-design-vue';
|
|
|
+import moment from 'moment';
|
|
|
|
|
|
interface Props {
|
|
|
+ sn: string,
|
|
|
visible: boolean,
|
|
|
onClickSubmit: () => Promise<any>
|
|
|
onClickClose: () => void,
|
|
|
@@ -96,8 +113,18 @@ const wrapperCol = { span: 18 };
|
|
|
|
|
|
interface State {
|
|
|
listLoading: boolean,
|
|
|
- airportLogList: any[]
|
|
|
- droneLogList: any[],
|
|
|
+ airportLogList: {
|
|
|
+ boot_index: number,
|
|
|
+ start_time: number,
|
|
|
+ end_time: number,
|
|
|
+ size: number,
|
|
|
+ }[],
|
|
|
+ droneLogList: {
|
|
|
+ boot_index: number,
|
|
|
+ start_time: number,
|
|
|
+ end_time: number,
|
|
|
+ size: number,
|
|
|
+ }[],
|
|
|
};
|
|
|
|
|
|
const state: State = reactive({
|
|
|
@@ -106,8 +133,47 @@ const state: State = reactive({
|
|
|
droneLogList: [],
|
|
|
});
|
|
|
|
|
|
+const fetchAirportLogList = async () => {
|
|
|
+ state.listLoading = true;
|
|
|
+ try {
|
|
|
+ const res = await apis.fetchDeviceLogList(props.sn, { domain_list: 3 });
|
|
|
+ state.airportLogList = res.data.files[0].list;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ } finally {
|
|
|
+ state.listLoading = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const fetchDroneLogList = async () => {
|
|
|
+ state.listLoading = true;
|
|
|
+ try {
|
|
|
+ const res = await apis.fetchDeviceLogList(props.sn, { domain_list: 0 });
|
|
|
+ state.droneLogList = res.data.files[0].list;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ } finally {
|
|
|
+ state.listLoading = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const getDateTime = (timestamp: number) => {
|
|
|
+ const date = moment.unix(timestamp).format('YYYY-MM-DD HH:mm');
|
|
|
+ return date;
|
|
|
+}
|
|
|
+
|
|
|
+const getLogSize = (size: number) => {
|
|
|
+ // 将字节转换为GB
|
|
|
+ const gbSize = size / (1024 * 1024 * 1024);
|
|
|
+ // 保留一位小数
|
|
|
+ return parseFloat(gbSize.toFixed(1));
|
|
|
+};
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
- // await fetchList();
|
|
|
+ await Promise.all([
|
|
|
+ fetchAirportLogList(),
|
|
|
+ fetchDroneLogList(),
|
|
|
+ ]);
|
|
|
})
|
|
|
|
|
|
const handleChangeUpload = (info: any) => {
|
|
|
@@ -131,23 +197,38 @@ const handleChangeUpload = (info: any) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 表格
|
|
|
const airportLogColumns = [
|
|
|
- { title: '机场日志', dataIndex: 'time', width: 100, slots: { customRender: 'log_time' } },
|
|
|
- { title: '文件大小', dataIndex: 'size', width: 25, slots: { customRender: 'size' } },
|
|
|
+ {
|
|
|
+ title: '机场日志',
|
|
|
+ dataIndex: 'log',
|
|
|
+ slots: { customRender: 'log' }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '文件大小',
|
|
|
+ dataIndex: 'size',
|
|
|
+ width: 100,
|
|
|
+ slots: { customRender: 'size' }
|
|
|
+ }
|
|
|
]
|
|
|
|
|
|
const droneLogColumns = [
|
|
|
- { title: '飞行器日志', dataIndex: 'time', width: 100, slots: { customRender: 'log_time' } },
|
|
|
- { title: '文件大小', dataIndex: 'size', width: 25, slots: { customRender: 'size' } },
|
|
|
+ {
|
|
|
+ title: '飞行器日志',
|
|
|
+ dataIndex: 'log',
|
|
|
+ slots: { customRender: 'log' }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '文件大小',
|
|
|
+ dataIndex: 'size',
|
|
|
+ width: 100,
|
|
|
+ slots: { customRender: 'size' }
|
|
|
+ }
|
|
|
]
|
|
|
|
|
|
const airportTableLogState = reactive({
|
|
|
- logList: {} as DeviceLogFileInfo,
|
|
|
- tableLoading: false,
|
|
|
selectRow: [],
|
|
|
rowSelection: {
|
|
|
- columnWidth: 15,
|
|
|
+ columnWidth: 40,
|
|
|
selectedRowKeys: [] as number[],
|
|
|
onChange: (selectedRowKeys: number[], selectedRows: []) => {
|
|
|
airportTableLogState.rowSelection.selectedRowKeys = selectedRowKeys
|
|
|
@@ -158,11 +239,9 @@ const airportTableLogState = reactive({
|
|
|
})
|
|
|
|
|
|
const droneTableLogState = reactive({
|
|
|
- logList: {} as DeviceLogFileInfo,
|
|
|
- tableLoading: false,
|
|
|
selectRow: [],
|
|
|
rowSelection: {
|
|
|
- columnWidth: 15,
|
|
|
+ columnWidth: 40,
|
|
|
selectedRowKeys: [] as number[],
|
|
|
onChange: (selectedRowKeys: number[], selectedRows: []) => {
|
|
|
droneTableLogState.rowSelection.selectedRowKeys = selectedRowKeys
|
|
|
@@ -184,7 +263,7 @@ const handleClickSubmit = () => {
|
|
|
justify-content: space-between;
|
|
|
|
|
|
&-item {
|
|
|
- width: 48%;
|
|
|
+ width: 48.5%;
|
|
|
}
|
|
|
}
|
|
|
</style>
|