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" >