|
|
@@ -3,28 +3,12 @@
|
|
|
<q-card class="row col" flat bordered>
|
|
|
<div class="full-height q-pa-md">
|
|
|
<q-list style="width: 220px">
|
|
|
- <q-item clickable @click="logType = 'rt'" :active="logType === 'rt'" active-class="text-primary text-bold">
|
|
|
- <q-item-section>实时日志</q-item-section>
|
|
|
-
|
|
|
- <q-item-section side>
|
|
|
- <q-btn
|
|
|
- flat
|
|
|
- round
|
|
|
- icon="file_download"
|
|
|
- size="sm"
|
|
|
- @click.stop="downloadLog(rtLogLines)"
|
|
|
- title="下载日志"
|
|
|
- ></q-btn>
|
|
|
- </q-item-section>
|
|
|
- </q-item>
|
|
|
-
|
|
|
- <q-separator class="q-my-xs" />
|
|
|
-
|
|
|
<q-item-label header>历史日志</q-item-label>
|
|
|
+ <q-separator />
|
|
|
<q-item
|
|
|
v-for="item in logList"
|
|
|
:key="item.index"
|
|
|
- :active="logType === 'history' && item.index === currentIndex"
|
|
|
+ :active="item.index === currentIndex"
|
|
|
active-class="text-primary text-bold"
|
|
|
@click="handleHistoryItemClick(item)"
|
|
|
clickable
|
|
|
@@ -47,7 +31,7 @@
|
|
|
<log-viewer
|
|
|
class="full-height"
|
|
|
:log-lines="currentLogLines"
|
|
|
- :key="logType + currentItem?.log_lines[0]?.date_time"
|
|
|
+ :key="currentItem?.log_lines[0]?.date_time"
|
|
|
/>
|
|
|
</q-card>
|
|
|
</fix-height-q-page>
|
|
|
@@ -57,20 +41,15 @@
|
|
|
import { useLogList } from 'pages/logs/useLogList';
|
|
|
import FixHeightQPage from 'components/FixHeightQPage';
|
|
|
import { saveText } from 'src/utils/FileDownload';
|
|
|
-import { computed, ref } from 'vue';
|
|
|
-import { useRealTimeLog } from 'src/composables/useRealTimeLog';
|
|
|
+import { computed } from 'vue';
|
|
|
import LogViewer from 'components/LogViewer';
|
|
|
import {getExportSettings, useSettings} from 'pages/settings/useSettings';
|
|
|
|
|
|
const { logList, currentIndex, currentItem } = useLogList();
|
|
|
-const logType = ref('rt'); // rt or history
|
|
|
|
|
|
useSettings();
|
|
|
-const { logLines: rtLogLines } = useRealTimeLog();
|
|
|
-
|
|
|
const handleHistoryItemClick = (item) => {
|
|
|
currentIndex.value = item.index;
|
|
|
- logType.value = 'history';
|
|
|
};
|
|
|
|
|
|
// eslint-disable-next-line camelcase
|
|
|
@@ -81,7 +60,7 @@ const getTextLogLines = (logLines = []) => logLines.map(getTexLogLine);
|
|
|
const getTextLogContent = (logLines = []) => getTextLogLines(logLines).join('\n');
|
|
|
|
|
|
const currentLogLines = computed(() => {
|
|
|
- const lines = logType.value === 'rt' ? rtLogLines.value : currentItem.value?.log_lines;
|
|
|
+ const lines = currentItem.value?.log_lines;
|
|
|
return lines || [];
|
|
|
});
|
|
|
|