From 76499d98e071915a0acae5cd9cf3dccc2c512c2f Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 22 Jul 2024 18:16:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=82=E6=95=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8E=E7=A4=BA=E4=BE=8B=E5=AF=B9=E6=AF=94=E5=B7=AE=E5=BC=82?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pt/neConfig.ts | 13 +++ .../configParamTreeTable/index.vue | 94 ++++++++++++++++--- 2 files changed, 96 insertions(+), 11 deletions(-) diff --git a/src/api/pt/neConfig.ts b/src/api/pt/neConfig.ts index a43a8016..35ca904a 100644 --- a/src/api/pt/neConfig.ts +++ b/src/api/pt/neConfig.ts @@ -26,6 +26,19 @@ export function ptResetAsDefault(neType: string) { }); } +/** + * 数据比较示例 + * @param params 查询参数 + * @returns object + */ +export function ptContrastAsDefault(params: Record) { + return request({ + url: `/pt/neConfigData/contrast`, + params, + method: 'get', + }); +} + /** * 网元参数配置信息 * @param params 数据 {neType,paramName} diff --git a/src/views/configManage/configParamTreeTable/index.vue b/src/views/configManage/configParamTreeTable/index.vue index 19349ffa..acf8e98a 100644 --- a/src/views/configManage/configParamTreeTable/index.vue +++ b/src/views/configManage/configParamTreeTable/index.vue @@ -20,7 +20,7 @@ import useConfigList from './hooks/useConfigList'; import useConfigArray from './hooks/useConfigArray'; import useConfigArrayChild from './hooks/useConfigArrayChild'; import { getAllNeConfig } from '@/api/ne/neConfig'; -import { getPtNeConfigData } from '@/api/pt/neConfig'; +import { getPtNeConfigData, ptContrastAsDefault } from '@/api/pt/neConfig'; import { isSystemAdmin, hasRoles } from '@/plugins/auth-user'; const neInfoStore = useNeInfoStore(); const { t } = useI18n(); @@ -397,6 +397,29 @@ function openOpeateDrawer() { operateDrawer.value = !operateDrawer.value; } +// 数据与示例比较 +const dataDiffState = reactive({ + visible: false, + title: '对比示例', + exampleData: '', + data: '', +}); +// 获取当前数据与示例数据 +function fnDataDiff() { + ptContrastAsDefault({ + neType: treeState.neType, + paramName: treeState.selectNode.paramName, + student: classState.student, + }).then(res => { + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + dataDiffState.data = JSON.stringify(res.data, null, 2); + dataDiffState.exampleData = JSON.stringify(res.exampleData, null, 2); + dataDiffState.title = treeState.selectNode.paramDisplay; + dataDiffState.visible = true; + } + }); +} + onMounted(() => { // 获取网元网元列表 neInfoStore.fnNelist().then(res => { @@ -488,7 +511,7 @@ onMounted(() => { " :loading="ptConfigState.applyLoading" > - 应用学生配置 + 应用该学生配置 - 退回学生配置 + 退回该学生配置 @@ -506,14 +529,14 @@ onMounted(() => { @click="ptConfigApply(treeState.neType, '2')" :loading="ptConfigState.applyLoading" > - (管理员/教师) 应用到网元 + 应用配置到网元 - (管理员)载入网元配置为系统示例 + 载入当前网元配置 { :loading="ptConfigState.restLoading" v-roles:has="['teacher']" > - (教师)重置为系统示例 + 重置为示例 - (学生)重置为教师示例 + 重置为示例 - (学生)申请应用到 {{ treeState.neType }} + 申请配置应用到 {{ treeState.neType }} @@ -587,7 +610,11 @@ onMounted(() => { :loading="treeState.selectLoading" >