From 20007f4732f11a8a15fcd4137f643951d130afe1 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Sat, 8 Mar 2025 10:31:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=AD=A6=E7=94=9F=E9=85=8D=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- practical_training/api/pt/neConfig.ts | 15 +- practical_training/i18n/locales/en-US.ts | 6 +- practical_training/i18n/locales/zh-CN.ts | 6 +- .../hooks/usePtOptions.ts | 163 +-- .../configParamTreeTable/index.vue | 109 +- .../monitor/topologyArchitecture/index.vue | 1146 +++++++---------- src/api/pt/neConfig.ts | 15 +- src/i18n/locales/en-US.ts | 6 +- src/i18n/locales/zh-CN.ts | 6 +- .../hooks/usePtOptions.ts | 163 +-- .../configParamTreeTable/index.vue | 109 +- src/views/configManage/neOverview/index.vue | 423 +++--- src/views/monitor/topology/index.vue | 1 + .../monitor/topologyArchitecture/index.vue | 6 +- 14 files changed, 1067 insertions(+), 1107 deletions(-) diff --git a/practical_training/api/pt/neConfig.ts b/practical_training/api/pt/neConfig.ts index 6e45d4d9..733ad021 100644 --- a/practical_training/api/pt/neConfig.ts +++ b/practical_training/api/pt/neConfig.ts @@ -44,7 +44,7 @@ export function ptContrastAsDefault(params: Record) { * @param student 仅教师 student * @returns object */ -export function ptExport(student: string|undefined) { +export function ptExport(student: string | undefined) { return request({ url: `/pt/neConfigData/export`, method: 'get', @@ -54,6 +54,19 @@ export function ptExport(student: string|undefined) { }); } +/** + * 配置数据导出Excel (仅教师全量) + * @returns object + */ +export function ptExportAll() { + return request({ + url: `/pt/neConfigData/export-all`, + method: 'get', + responseType: 'blob', + timeout: 180_000, + }); +} + /** * 网元参数配置信息 * @param params 数据 {neType,paramName} diff --git a/practical_training/i18n/locales/en-US.ts b/practical_training/i18n/locales/en-US.ts index 3cf352c9..44021817 100644 --- a/practical_training/i18n/locales/en-US.ts +++ b/practical_training/i18n/locales/en-US.ts @@ -514,13 +514,17 @@ export default { ptDiffRest: 'Restore this version', ptHistory: 'History', ptReset: 'Reset To Example', + ptResetTip: 'Confirmed to reset to the sample configuration?', ptLoad: 'Load Current Configuration', + ptLoadTip: 'Confirm that you want to load the current network element configuration?', ptExport: "Export Excel", - ptExportTip: "Exporting NE Configuration Data to an Excel file", + ptExportTip: "Confirm that you want to export the network element configuration data to an Excel file?", + ptExportAll: "导出所有学生配置", ptApplyShow: 'View Student', ptApply: 'request', ptApplyNE: 'Application To NE', ptApplyStu: 'Application To {ne}', + ptApplyStuTip: 'Confirm that you want to initiate a Configure Application to {ne} request to the teacher?', ptApplyStuRack: 'Return Request', ptApplyStuNE: 'Application Request', }, diff --git a/practical_training/i18n/locales/zh-CN.ts b/practical_training/i18n/locales/zh-CN.ts index 0a3a3561..289cfecc 100644 --- a/practical_training/i18n/locales/zh-CN.ts +++ b/practical_training/i18n/locales/zh-CN.ts @@ -514,13 +514,17 @@ export default { ptDiffRest: '还原此版本', ptHistory: '历史记录', ptReset: '重置为示例', + ptResetTip: '确认要重置为示例配置吗?', ptLoad: '载入当前网元配置', + ptLoadTip: '确认要载入当前网元配置吗?', ptExport: "导出Excel", - ptExportTip: "导出网元配置数据到Excel文件中", + ptExportTip: "确认要导出网元配置数据到Excel文件中吗?", + ptExportAll: "导出所有学生配置", ptApplyShow: '查看学生', ptApply: '申请', ptApplyNE: '应用配置到网元', ptApplyStu: '申请配置应用到 {ne}', + ptApplyStuTip: '确认要向教师发起配置应用到 {ne} 的申请吗?', ptApplyStuRack: '退回该学生配置', ptApplyStuNE: '应用该学生配置', }, diff --git a/practical_training/views/configManage/configParamTreeTable/hooks/usePtOptions.ts b/practical_training/views/configManage/configParamTreeTable/hooks/usePtOptions.ts index c2d7d464..f10a98dc 100644 --- a/practical_training/views/configManage/configParamTreeTable/hooks/usePtOptions.ts +++ b/practical_training/views/configManage/configParamTreeTable/hooks/usePtOptions.ts @@ -5,9 +5,9 @@ import { updatePtNeConfigApply, } from '@/api/pt/neConfigApply'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; -import { hasRoles } from '@/plugins/auth-user'; +import { Modal } from 'ant-design-vue/es'; import { message } from 'ant-design-vue/lib'; -import { computed, onMounted, reactive } from 'vue'; +import { computed, reactive } from 'vue'; /** * 实训教学函数 @@ -22,48 +22,60 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { }); /**(管理员)保存网元下所有配置为示例配置 */ function ptConfigSave(neType: string) { - ptConfigState.saveLoading = true; - ptSaveAsDefault(neType, '001') - .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.operateOk'), - duration: 3, + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.configParamForm.ptLoadTip'), + onOk() { + ptConfigState.saveLoading = true; + ptSaveAsDefault(neType, '001') + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + ptConfigState.saveLoading = false; + fnActiveConfigNode('#'); }); - } else { - message.error({ - content: `${res.msg}`, - duration: 3, - }); - } - }) - .finally(() => { - ptConfigState.saveLoading = false; - fnActiveConfigNode('#'); - }); + }, + }); } /**重置网元下所有配置 */ function ptConfigReset(neType: string) { - ptConfigState.restLoading = true; - ptResetAsDefault(neType) - .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.operateOk'), - duration: 3, + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.configParamForm.ptResetTip'), + onOk() { + ptConfigState.restLoading = true; + ptResetAsDefault(neType) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + ptConfigState.restLoading = false; + fnActiveConfigNode('#'); }); - } else { - message.error({ - content: `${res.msg}`, - duration: 3, - }); - } - }) - .finally(() => { - ptConfigState.restLoading = false; - fnActiveConfigNode('#'); - }); + }, + }); } /**配置下方应用(学生)申请撤回和(管理/教师)应用退回 */ @@ -97,33 +109,42 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { result = stuPtNeConfigApply({ neType, status }); } if (!result) return; - ptConfigState.applyLoading = true; - result - .then((res: any) => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.operateOk'), - duration: 3, - }); - // 教师修改学生时改变状态 - if (student) { - const item = classState.studentOptionsDef.find( - s => s.value === classState.student - ); - if (item) { - item.applyStatus = status; + + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.configParamForm.ptApplyStuTip', { + ne: neType, + }), + onOk() { + ptConfigState.applyLoading = true; + result + .then((res: any) => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + // 教师修改学生时改变状态 + if (student) { + const item = classState.studentOptionsDef.find( + s => s.value === classState.student + ); + if (item) { + item.applyStatus = status; + } + } + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); } - } - } else { - message.error({ - content: `${res.msg}`, - duration: 3, + }) + .finally(() => { + ptConfigState.applyLoading = false; }); - } - }) - .finally(() => { - ptConfigState.applyLoading = false; - }); + }, + }); } const classState = reactive<{ @@ -148,13 +169,6 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { studentOptionsDef: [], }); - // 仅教师加载 - if (hasRoles(['teacher'])) { - onMounted(() => { - classStudents(); // 初始学生列表 - }); - } - /**学生选择搜索 */ function studentChange(v: any) { if (!v) { @@ -166,7 +180,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { let timeout: any; /**学生选择搜索 */ - function studentSearch(val: string) { + function studentSearch(neType: string, val: string) { if (timeout) { clearTimeout(timeout); timeout = null; @@ -175,12 +189,12 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { Object.assign(classState.studentOptions, classState.studentOptionsDef); return; } - timeout = setTimeout(() => classStudents(val), 500); + timeout = setTimeout(() => classStudents(neType, val), 500); } /**班级学生列表 */ - function classStudents(val?: string) { - getPtClassStudents({ userName: val }).then(res => { + function classStudents(neType: string, val?: string) { + getPtClassStudents({ neType, userName: val }).then(res => { classState.studentOptions = []; if (!Array.isArray(res.data) || res.data.length <= 0) { return; @@ -221,6 +235,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { ptConfigReset, ptConfigApply, classState, + classStudents, studentStatus, studentSearch, studentChange, diff --git a/practical_training/views/configManage/configParamTreeTable/index.vue b/practical_training/views/configManage/configParamTreeTable/index.vue index 5f96c062..5e7714c3 100644 --- a/practical_training/views/configManage/configParamTreeTable/index.vue +++ b/practical_training/views/configManage/configParamTreeTable/index.vue @@ -1,5 +1,12 @@ diff --git a/src/api/pt/neConfig.ts b/src/api/pt/neConfig.ts index 6e45d4d9..733ad021 100644 --- a/src/api/pt/neConfig.ts +++ b/src/api/pt/neConfig.ts @@ -44,7 +44,7 @@ export function ptContrastAsDefault(params: Record) { * @param student 仅教师 student * @returns object */ -export function ptExport(student: string|undefined) { +export function ptExport(student: string | undefined) { return request({ url: `/pt/neConfigData/export`, method: 'get', @@ -54,6 +54,19 @@ export function ptExport(student: string|undefined) { }); } +/** + * 配置数据导出Excel (仅教师全量) + * @returns object + */ +export function ptExportAll() { + return request({ + url: `/pt/neConfigData/export-all`, + method: 'get', + responseType: 'blob', + timeout: 180_000, + }); +} + /** * 网元参数配置信息 * @param params 数据 {neType,paramName} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 3cf352c9..44021817 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -514,13 +514,17 @@ export default { ptDiffRest: 'Restore this version', ptHistory: 'History', ptReset: 'Reset To Example', + ptResetTip: 'Confirmed to reset to the sample configuration?', ptLoad: 'Load Current Configuration', + ptLoadTip: 'Confirm that you want to load the current network element configuration?', ptExport: "Export Excel", - ptExportTip: "Exporting NE Configuration Data to an Excel file", + ptExportTip: "Confirm that you want to export the network element configuration data to an Excel file?", + ptExportAll: "导出所有学生配置", ptApplyShow: 'View Student', ptApply: 'request', ptApplyNE: 'Application To NE', ptApplyStu: 'Application To {ne}', + ptApplyStuTip: 'Confirm that you want to initiate a Configure Application to {ne} request to the teacher?', ptApplyStuRack: 'Return Request', ptApplyStuNE: 'Application Request', }, diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 0a3a3561..289cfecc 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -514,13 +514,17 @@ export default { ptDiffRest: '还原此版本', ptHistory: '历史记录', ptReset: '重置为示例', + ptResetTip: '确认要重置为示例配置吗?', ptLoad: '载入当前网元配置', + ptLoadTip: '确认要载入当前网元配置吗?', ptExport: "导出Excel", - ptExportTip: "导出网元配置数据到Excel文件中", + ptExportTip: "确认要导出网元配置数据到Excel文件中吗?", + ptExportAll: "导出所有学生配置", ptApplyShow: '查看学生', ptApply: '申请', ptApplyNE: '应用配置到网元', ptApplyStu: '申请配置应用到 {ne}', + ptApplyStuTip: '确认要向教师发起配置应用到 {ne} 的申请吗?', ptApplyStuRack: '退回该学生配置', ptApplyStuNE: '应用该学生配置', }, diff --git a/src/views/configManage/configParamTreeTable/hooks/usePtOptions.ts b/src/views/configManage/configParamTreeTable/hooks/usePtOptions.ts index c2d7d464..f10a98dc 100644 --- a/src/views/configManage/configParamTreeTable/hooks/usePtOptions.ts +++ b/src/views/configManage/configParamTreeTable/hooks/usePtOptions.ts @@ -5,9 +5,9 @@ import { updatePtNeConfigApply, } from '@/api/pt/neConfigApply'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; -import { hasRoles } from '@/plugins/auth-user'; +import { Modal } from 'ant-design-vue/es'; import { message } from 'ant-design-vue/lib'; -import { computed, onMounted, reactive } from 'vue'; +import { computed, reactive } from 'vue'; /** * 实训教学函数 @@ -22,48 +22,60 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { }); /**(管理员)保存网元下所有配置为示例配置 */ function ptConfigSave(neType: string) { - ptConfigState.saveLoading = true; - ptSaveAsDefault(neType, '001') - .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.operateOk'), - duration: 3, + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.configParamForm.ptLoadTip'), + onOk() { + ptConfigState.saveLoading = true; + ptSaveAsDefault(neType, '001') + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + ptConfigState.saveLoading = false; + fnActiveConfigNode('#'); }); - } else { - message.error({ - content: `${res.msg}`, - duration: 3, - }); - } - }) - .finally(() => { - ptConfigState.saveLoading = false; - fnActiveConfigNode('#'); - }); + }, + }); } /**重置网元下所有配置 */ function ptConfigReset(neType: string) { - ptConfigState.restLoading = true; - ptResetAsDefault(neType) - .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.operateOk'), - duration: 3, + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.configParamForm.ptResetTip'), + onOk() { + ptConfigState.restLoading = true; + ptResetAsDefault(neType) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + ptConfigState.restLoading = false; + fnActiveConfigNode('#'); }); - } else { - message.error({ - content: `${res.msg}`, - duration: 3, - }); - } - }) - .finally(() => { - ptConfigState.restLoading = false; - fnActiveConfigNode('#'); - }); + }, + }); } /**配置下方应用(学生)申请撤回和(管理/教师)应用退回 */ @@ -97,33 +109,42 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { result = stuPtNeConfigApply({ neType, status }); } if (!result) return; - ptConfigState.applyLoading = true; - result - .then((res: any) => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success({ - content: t('common.operateOk'), - duration: 3, - }); - // 教师修改学生时改变状态 - if (student) { - const item = classState.studentOptionsDef.find( - s => s.value === classState.student - ); - if (item) { - item.applyStatus = status; + + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.configParamForm.ptApplyStuTip', { + ne: neType, + }), + onOk() { + ptConfigState.applyLoading = true; + result + .then((res: any) => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + // 教师修改学生时改变状态 + if (student) { + const item = classState.studentOptionsDef.find( + s => s.value === classState.student + ); + if (item) { + item.applyStatus = status; + } + } + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); } - } - } else { - message.error({ - content: `${res.msg}`, - duration: 3, + }) + .finally(() => { + ptConfigState.applyLoading = false; }); - } - }) - .finally(() => { - ptConfigState.applyLoading = false; - }); + }, + }); } const classState = reactive<{ @@ -148,13 +169,6 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { studentOptionsDef: [], }); - // 仅教师加载 - if (hasRoles(['teacher'])) { - onMounted(() => { - classStudents(); // 初始学生列表 - }); - } - /**学生选择搜索 */ function studentChange(v: any) { if (!v) { @@ -166,7 +180,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { let timeout: any; /**学生选择搜索 */ - function studentSearch(val: string) { + function studentSearch(neType: string, val: string) { if (timeout) { clearTimeout(timeout); timeout = null; @@ -175,12 +189,12 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { Object.assign(classState.studentOptions, classState.studentOptionsDef); return; } - timeout = setTimeout(() => classStudents(val), 500); + timeout = setTimeout(() => classStudents(neType, val), 500); } /**班级学生列表 */ - function classStudents(val?: string) { - getPtClassStudents({ userName: val }).then(res => { + function classStudents(neType: string, val?: string) { + getPtClassStudents({ neType, userName: val }).then(res => { classState.studentOptions = []; if (!Array.isArray(res.data) || res.data.length <= 0) { return; @@ -221,6 +235,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) { ptConfigReset, ptConfigApply, classState, + classStudents, studentStatus, studentSearch, studentChange, diff --git a/src/views/configManage/configParamTreeTable/index.vue b/src/views/configManage/configParamTreeTable/index.vue index 5f96c062..5e7714c3 100644 --- a/src/views/configManage/configParamTreeTable/index.vue +++ b/src/views/configManage/configParamTreeTable/index.vue @@ -1,5 +1,12 @@