From a8b4e91b9511761738bb50f589e0f6ae935953fc Mon Sep 17 00:00:00 2001
From: TsMask <340112800@qq.com>
Date: Fri, 9 Aug 2024 18:47:45 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E6=9C=AC=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=AE=9E=E6=97=B6=E6=9F=A5=E7=9C=8B=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/TerminalSSHView/index.vue | 227 ++++++++++++++++++
src/i18n/locales/en-US.ts | 5 +
src/i18n/locales/zh-CN.ts | 5 +
.../neFile/components/ViewDrawer.vue | 174 ++++++++++++++
src/views/logManage/neFile/index.vue | 76 ++++--
5 files changed, 472 insertions(+), 15 deletions(-)
create mode 100644 src/components/TerminalSSHView/index.vue
create mode 100644 src/views/logManage/neFile/components/ViewDrawer.vue
diff --git a/src/components/TerminalSSHView/index.vue b/src/components/TerminalSSHView/index.vue
new file mode 100644
index 00000000..33af459b
--- /dev/null
+++ b/src/components/TerminalSSHView/index.vue
@@ -0,0 +1,227 @@
+
+
+
+
+
+
+
diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts
index 1f078acc..7708d546 100644
--- a/src/i18n/locales/en-US.ts
+++ b/src/i18n/locales/en-US.ts
@@ -1258,6 +1258,11 @@ export default {
downTip: "Confirm the download file name is [{fileName}] File?",
downTipErr: "Failed to get file",
dirCd: "Enter Dir",
+ viewAs: 'View Action',
+ reload: "Reload",
+ follow: 'Monitoring Content',
+ tailChar: 'End Characters',
+ tailLines: 'End Lines',
},
},
monitor: {
diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts
index 989051fe..71718b90 100644
--- a/src/i18n/locales/zh-CN.ts
+++ b/src/i18n/locales/zh-CN.ts
@@ -1258,6 +1258,11 @@ export default {
downTip: "确认下载文件名为 【{fileName}】 文件?",
downTipErr: "文件获取失败",
dirCd: "进入目录",
+ viewAs: '查看操作',
+ reload: "重载",
+ follow: '监视内容变化',
+ tailChar: '末尾字数',
+ tailLines: '末尾行数',
},
},
monitor: {
diff --git a/src/views/logManage/neFile/components/ViewDrawer.vue b/src/views/logManage/neFile/components/ViewDrawer.vue
new file mode 100644
index 00000000..1c096b89
--- /dev/null
+++ b/src/views/logManage/neFile/components/ViewDrawer.vue
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('views.logManage.neFile.tailLines') }}
+
+
+ {{ t('views.logManage.neFile.tailChar') }}
+
+
+
+
+ {{ t('views.logManage.neFile.reload') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/logManage/neFile/index.vue b/src/views/logManage/neFile/index.vue
index 62bbdb32..94c50bf4 100644
--- a/src/views/logManage/neFile/index.vue
+++ b/src/views/logManage/neFile/index.vue
@@ -3,12 +3,13 @@ import { reactive, ref, onMounted, toRaw } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { SizeType } from 'ant-design-vue/lib/config-provider';
import { ColumnsType } from 'ant-design-vue/lib/table';
+import { Modal, message } from 'ant-design-vue/lib';
import { parseDateToStr } from '@/utils/date-utils';
import { getNeFile, listNeFiles } from '@/api/tool/neFile';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n';
-import { Modal, message } from 'ant-design-vue/lib';
+import ViewDrawer from './components/ViewDrawer.vue';
import saveAs from 'file-saver';
import { useRoute } from 'vue-router';
const neInfoStore = useNeInfoStore();
@@ -19,11 +20,7 @@ const route = useRoute();
const routeParams = route.query as Record;
/**网元参数 */
-let neType = ref([]);
-/**下载触发等待 */
-let loading = ref(false);
-/**访问路径 */
-let nePathArr = ref([]);
+let neTypeSelect = ref([]);
/**查询参数 */
let queryParams = reactive({
@@ -134,14 +131,17 @@ let tablePagination = reactive({
},
});
+/**下载触发等待 */
+let downLoading = ref(false);
+
/**信息文件下载 */
function fnDownloadFile(row: Record) {
- if (loading.value) return;
+ if (downLoading.value) return;
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.logManage.neFile.downTip', { fileName: row.fileName }),
onOk() {
- loading.value = true;
+ downLoading.value = true;
const hide = message.loading(t('common.loading'), 0);
getNeFile({
neType: queryParams.neType,
@@ -167,12 +167,15 @@ function fnDownloadFile(row: Record) {
})
.finally(() => {
hide();
- loading.value = false;
+ downLoading.value = false;
});
},
});
}
+/**访问路径 */
+let nePathArr = ref([]);
+
/**进入目录 */
function fnDirCD(dir: string, index?: number) {
if (index === undefined) {
@@ -235,15 +238,42 @@ function fnGetList(pageNum?: number) {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
tablePagination.total = res.total;
tableState.data = res.rows;
- if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) {
+ if (
+ tablePagination.total <=
+ (queryParams.pageNum - 1) * tablePagination.pageSize &&
+ queryParams.pageNum !== 1
+ ) {
tableState.loading = false;
fnGetList(queryParams.pageNum - 1);
}
+ } else {
+ message.error(res.msg, 3);
+ tablePagination.total = 0;
+ tableState.data = [];
}
tableState.loading = false;
});
}
+/**抽屉状态 */
+const viewDrawerState = reactive({
+ visible: false,
+ /**文件路径 /var/log/amf.log */
+ filePath: '',
+ /**网元类型 */
+ neType: '',
+ /**网元ID */
+ neId: '',
+});
+
+/**打开抽屉查看 */
+function fnDrawerOpen(row: Record) {
+ viewDrawerState.filePath = [...nePathArr.value, row.fileName].join('/');
+ viewDrawerState.neType = neTypeSelect.value[0];
+ viewDrawerState.neId = neTypeSelect.value[1];
+ viewDrawerState.visible = !viewDrawerState.visible;
+}
+
onMounted(() => {
// 获取网元网元列表
neInfoStore.fnNelist().then(res => {
@@ -253,9 +283,9 @@ onMounted(() => {
content: t('common.noData'),
duration: 2,
});
- } else if (routeParams.neType) {
- neType.value = [routeParams.neType, routeParams.neId]
- fnNeChange(neType.value, undefined);
+ } else if (routeParams.neType) {
+ neTypeSelect.value = [routeParams.neType, routeParams.neId];
+ fnNeChange(neTypeSelect.value, undefined);
}
}
});
@@ -276,12 +306,12 @@ onMounted(() => {
style="margin-bottom: 0"
>
@@ -332,8 +362,15 @@ onMounted(() => {
+
+ {{ t('common.viewText') }}
+
+
+
+
@@ -342,6 +379,7 @@ onMounted(() => {
@@ -353,6 +391,14 @@ onMounted(() => {
+
+
+