diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index d793c568..d6a7c1a0 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -617,8 +617,8 @@ export default { change: "Change License", reload: "Refresh Info", reloadTip: "Confirmed to refresh license information?", - reloadBatch: "Batch Refresh Info", - reloadBatchTip: "Do you do an information refresh on checked records?", + reloadBatch: "Refresh License Status", + reloadBatchTip: "Do you perform a license status information refresh for the current list of NE?", updateTtile: "Update License", downCodeTop: "Confirmed to save the license activation code to a file?", activationRequestCode: "License Activation Code", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index c3cf5c49..a5850a7c 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -617,8 +617,8 @@ export default { change: "变更许可证", reload: "刷新信息", reloadTip: "确认要刷新许可证信息吗?", - reloadBatch: "批量刷新信息", - reloadBatchTip: "对勾选的记录进行信息刷新吗?", + reloadBatch: "刷新许可证状态", + reloadBatchTip: "对当前列表网元进行许可证状态信息刷新吗?", updateTtile: "更新许可证", downCodeTop: "确认要将许可激活码保存到文件吗?", activationRequestCode: "许可激活码", diff --git a/src/views/ne/neLicense/index.vue b/src/views/ne/neLicense/index.vue index 5383798d..2c7094d3 100644 --- a/src/views/ne/neLicense/index.vue +++ b/src/views/ne/neLicense/index.vue @@ -7,7 +7,6 @@ import { MenuInfo } from 'ant-design-vue/es/menu/src/interface'; import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import useDictStore from '@/store/modules/dict'; -import { NE_TYPE_LIST } from '@/constants/ne-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { listNeLicense, stateNeLicense } from '@/api/ne/neLicense'; import { parseDateToStr } from '@/utils/date-utils'; @@ -20,9 +19,6 @@ const EditModal = defineAsyncComponent( /**字典数据-状态 */ let dictStatus = ref([]); -/**网元参数 */ -let neOtions = ref[]>([]); - /**查询参数 */ let queryParams = reactive({ /**网元类型 */ @@ -57,21 +53,15 @@ type TabeStateType = { loading: boolean; /**紧凑型 */ size: SizeType; - /**搜索栏 */ - seached: boolean; /**记录数据 */ data: any[]; - /**勾选记录 */ - selectedRowKeys: (string | number)[]; }; /**表格状态 */ let tableState: TabeStateType = reactive({ loading: false, size: 'middle', - seached: false, data: [], - selectedRowKeys: [], }); /**表格字段列 */ @@ -113,6 +103,18 @@ let tableColumns = ref([ align: 'left', width: 120, }, + { + title: t('views.ne.common.capability'), + dataIndex: 'capability', + align: 'left', + customRender(opt) { + if (['UDM', 'AMF', 'MME'].includes(opt.record.neType)) { + return opt.value; + } + return '-'; + }, + width: 100, + }, { title: t('common.remark'), dataIndex: 'remark', @@ -173,11 +175,6 @@ function fnTableSize({ key }: MenuInfo) { tableState.size = key as SizeType; } -/**表格多选 */ -function fnTableSelectedRowKeys(keys: (string | number)[]) { - tableState.selectedRowKeys = keys; -} - /**查询列表, pageNum初始页数 */ function fnGetList(pageNum?: number) { if (tableState.loading) return; @@ -186,9 +183,18 @@ function fnGetList(pageNum?: number) { queryParams.pageNum = pageNum; } listNeLicense(toRaw(queryParams)).then(res => { - if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { - tablePagination.total = res.total; - tableState.data = res.rows.filter(s => s.neType !== 'OMC'); + if (res.code === RESULT_CODE_SUCCESS) { + const { total, rows } = res; + let totalV = total; + let rowsV = rows.filter((s: any) => { + if (s.neType !== 'OMC') { + return true; + } + totalV -= 1; + return false; + }); + tableState.data = rowsV; + tablePagination.total = totalV; if ( tablePagination.total <= (queryParams.pageNum - 1) * tablePagination.pageSize && @@ -235,9 +241,25 @@ function fnModalVisibleByEdit(licenseId: string) { * 对话框弹出确认执行函数 * 进行表达规则校验 */ -function fnModalOk() { - // 获取列表数据 - fnGetList(); +function fnModalOk(e: any) { + const next = () => { + // 刷新授权状态 + stateNeLicense(e.neType, e.neId).then(res => { + const row = tableState.data.find( + (item: any) => e.neType === item.neType && e.neId === item.neId + ); + if (res.code === RESULT_CODE_SUCCESS) { + row.status = '1'; + row.serialNum = res.data.sn; + row.expiryDate = res.data.expire; + } else { + row.status = '0'; + } + }); + // 获取列表数据 + fnGetList(); + }; + setTimeout(() => next(), 2_000); } /** @@ -284,8 +306,8 @@ function fnRecordState(row: Record) { }); } -/**刷新网元授权状态 勾选 */ -function fnRecordStateBatch() { +/**刷新网元授权状态 重载 */ +function fnRecordStateReload() { if (modalState.confirmLoading) return; Modal.confirm({ title: t('common.tipTitle'), @@ -293,12 +315,7 @@ function fnRecordStateBatch() { onOk: async () => { modalState.confirmLoading = true; const hide = message.loading(t('common.loading'), 0); - // 勾选的网元数据 - const selectRows = tableState.data.filter(item => - tableState.selectedRowKeys.includes(item.id) - ); - - for (const row of selectRows) { + for (const row of tableState.data) { if (row.neType.toUpperCase() === 'OMC') { continue; } @@ -310,7 +327,6 @@ function fnRecordStateBatch() { } else { row.status = '0'; } - tableState.selectedRowKeys = []; } message.success(t('common.operateOk'), 3); hide(); @@ -321,21 +337,9 @@ function fnRecordStateBatch() { onMounted(() => { // 初始字典数据 - getDict('ne_license_status').then(res => { - dictStatus.value = res; - }); - // 获取网元网元列表 - useNeInfoStore() - .fnNelist() + getDict('ne_license_status') .then(res => { - if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { - neOtions.value = useNeInfoStore().getNeSelectOtions; - } else { - message.warning({ - content: t('common.noData'), - duration: 2, - }); - } + dictStatus.value = res; }) .finally(() => { // 获取列表数据 @@ -347,7 +351,6 @@ onMounted(() => {