Merge branch 'lichang' into lite

This commit is contained in:
TsMask
2025-05-23 16:09:38 +08:00
15 changed files with 78 additions and 86 deletions

View File

@@ -142,14 +142,14 @@ function fnModalOk() {
const validateArr = ['title', 'addr', 'port', 'user'];
if (form.authMode === '0') {
validateArr.push('password');
} else {
} else if (form.authMode === '1') {
validateArr.push('privateKey');
}
modalStateFrom
.validate(validateArr)
.then(() => {
modalState.confirmLoading = true;
const neHost = form.id > 0 ? updateNeHost(form) : addNeHost(form);
const neHost = form.id ? updateNeHost(form) : addNeHost(form);
const hide = message.loading(t('common.loading'), 0);
neHost
.then(res => {

View File

@@ -54,21 +54,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: [],
});
/**表格字段列 */
@@ -114,6 +108,12 @@ let tableColumns = ref<TableColumnsType>([
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,
},
{
@@ -176,11 +176,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;
@@ -191,8 +186,16 @@ function fnGetList(pageNum?: number) {
listNeLicense(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
const { total, rows } = res.data;
tablePagination.total = total;
tableState.data = rows.filter((s: any) => s.neType !== 'OMC');
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 &&
@@ -304,8 +307,8 @@ function fnRecordState(row: Record<string, any>) {
});
}
/**刷新网元授权状态 勾选 */
function fnRecordStateBatch() {
/**刷新网元授权状态 重载 */
function fnRecordStateReload() {
if (modalState.confirmLoading) return;
Modal.confirm({
title: t('common.tipTitle'),
@@ -313,12 +316,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;
}
@@ -330,7 +328,6 @@ function fnRecordStateBatch() {
} else {
row.status = '0';
}
tableState.selectedRowKeys = [];
}
message.success(t('common.operateOk'), 3);
hide();
@@ -355,7 +352,6 @@ onMounted(() => {
<template>
<PageContainer>
<a-card
v-show="tableState.seached"
:bordered="false"
:body-style="{ marginBottom: '24px', paddingBottom: 0 }"
>
@@ -417,9 +413,8 @@ onMounted(() => {
<a-space :size="8" align="center">
<a-button
type="default"
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordStateBatch()"
@click.prevent="fnRecordStateReload()"
>
<template #icon><SyncOutlined /></template>
{{ t('views.ne.neLicense.reloadBatch') }}
@@ -430,21 +425,6 @@ onMounted(() => {
<!-- 插槽-卡片右侧 -->
<template #extra>
<a-space :size="8" align="center">
<a-tooltip>
<template #title>{{ t('common.searchBarText') }}</template>
<a-switch
v-model:checked="tableState.seached"
:checked-children="t('common.switch.show')"
:un-checked-children="t('common.switch.hide')"
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList()">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip placement="topRight">
<template #title>{{ t('common.sizeText') }}</template>
<a-dropdown placement="bottomRight" trigger="click">
@@ -483,12 +463,6 @@ onMounted(() => {
:pagination="tablePagination"
:scroll="{ x: tableColumns.length * 140 }"
@resizeColumn="(w:number, col:any) => (col.width = w)"
:row-selection="{
type: 'checkbox',
columnWidth: '48px',
selectedRowKeys: tableState.selectedRowKeys,
onChange: fnTableSelectedRowKeys,
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">