Merge branch 'main-v2' into lite

This commit is contained in:
TsMask
2025-07-01 10:29:56 +08:00
20 changed files with 883 additions and 129 deletions

View File

@@ -1779,10 +1779,16 @@ onMounted(() => {
>
<a-select v-model:value="modalState.from.cnType">
<a-select-option value="3">
{{ t('views.neUser.sub.enable') }}
{{ t('views.neUser.sub.cnFlag3') }}
</a-select-option>
<a-select-option value="2">
{{ t('views.neUser.sub.cnFlag2') }}
</a-select-option>
<a-select-option value="1">
{{ t('views.neUser.sub.cnFlag1') }}
</a-select-option>
<a-select-option value="0">
{{ t('views.neUser.sub.disable') }}
{{ t('views.neUser.sub.cnFlag0') }}
</a-select-option>
</a-select>
</a-form-item>

View File

@@ -26,7 +26,8 @@ import useNeListStore from '@/store/modules/ne_list';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { saveAs } from 'file-saver';
import { uploadFileToNE } from '@/api/tool/file';
import { uploadFile } from '@/api/tool/file';
import { getNeViewFile } from '@/api/tool/neFile';
const { t } = useI18n();
const neListStore = useNeListStore();
/**网元参数 */
@@ -489,15 +490,27 @@ function fnModalUploadImportUpload(file: File) {
}
const hide = message.loading(t('common.loading'), 0);
uploadImportState.loading = true;
uploadFileToNE('UDM', neID, file, 5)
// 上传文件
let formData = new FormData();
formData.append('file', file);
formData.append('subPath', 'import');
uploadFile(formData)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
return importUDMVOIP({
neId: neID,
uploadPath: res.data,
});
return res.data.filePath;
} else {
uploadImportState.msg = res.msg;
uploadImportState.loading = false;
return '';
}
return res;
})
.then((filePath: string) => {
if (!filePath) return;
// 文件导入
return importUDMVOIP({
neId: neID,
uploadPath: filePath,
});
})
.then(res => {
if (!res) return;
@@ -517,6 +530,33 @@ function fnModalUploadImportUpload(file: File) {
});
}
/**对话框表格信息导入失败原因 */
function fnModalUploadImportFailReason() {
const neId = queryParams.neId;
if (!neId) return;
const hide = message.loading(t('common.loading'), 0);
getNeViewFile({
neType: 'UDM',
neId: neId,
path: '/tmp',
fileName: 'import_imsuser_err_records.txt',
})
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('common.operateOk'), 3);
const blob = new Blob([res.data], {
type: 'text/plain',
});
saveAs(blob, `import_udmvoip_err_records_${Date.now()}.txt`);
} else {
message.error(`${res.msg}`, 3);
}
})
.finally(() => {
hide();
});
}
/**对话框表格信息导入模板 */
function fnModalDownloadImportTemplate() {
const hide = message.loading(t('common.loading'), 0);
@@ -554,7 +594,7 @@ onMounted(() => {
if (neOtions.value.length > 0) {
queryParams.neId = neOtions.value[0].value;
}
// 获取列表数据
fnGetList();
});
@@ -835,7 +875,7 @@ onMounted(() => {
v-model:value="modalState.from.username"
style="width: 100%"
:min="4"
:maxlangth="16"
:maxlength="16"
:placeholder="t('views.neData.udmVOIP.username')"
>
</a-input-number>
@@ -868,14 +908,13 @@ onMounted(() => {
name="username"
v-bind="modalStateFrom.validateInfos.username"
>
<a-input-number
<a-input
v-model:value="modalState.from.username"
style="width: 100%"
:min="4"
:maxlength="16"
:placeholder="t('views.neData.udmVOIP.username')"
>
</a-input-number>
</a-input>
</a-form-item>
<a-form-item
:label="t('views.neData.udmVOIP.password')"
@@ -917,13 +956,23 @@ onMounted(() => {
</a-button>
</a-col>
</a-row>
<a-textarea
:disabled="true"
:hidden="!uploadImportState.msg"
:value="uploadImportState.msg"
:auto-size="{ minRows: 2, maxRows: 8 }"
style="background-color: transparent; color: rgba(0, 0, 0, 0.85)"
/>
<a-alert
:message="uploadImportState.msg"
:type="uploadImportState.hasFail ? 'warning' : 'info'"
v-show="uploadImportState.msg.length > 0"
>
<template #action>
<a-button
size="small"
type="link"
danger
@click="fnModalUploadImportFailReason"
v-if="uploadImportState.hasFail"
>
{{ t('views.neUser.auth.importFail') }}
</a-button>
</template>
</a-alert>
</template>
</UploadModal>
</PageContainer>

View File

@@ -16,7 +16,8 @@ import useNeListStore from '@/store/modules/ne_list';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { saveAs } from 'file-saver';
import { uploadFileToNE } from '@/api/tool/file';
import { uploadFile } from '@/api/tool/file';
import { getNeViewFile } from '@/api/tool/neFile';
import {
addUDMVolteIMS,
batchAddUDMVolteIMS,
@@ -93,7 +94,7 @@ type TabeStateType = {
data: object[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
selectedRowIMSIs: (string | number)[];
selectedRowIMSIs: Record<string, any>[];
};
/**表格状态 */
@@ -202,7 +203,13 @@ function fnTableSize({ key }: MenuInfo) {
/**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) {
tableState.selectedRowKeys = keys;
tableState.selectedRowIMSIs = rows.map(item => item.imsi);
tableState.selectedRowIMSIs = rows.map(item => {
return {
imsi: item.imsi,
msisdn: item.msisdn,
tag: item.tag,
};
});
}
/**对话框对象信息状态类型 */
@@ -308,7 +315,12 @@ function fnModalOk() {
result = batchAddUDMVolteIMS(from, from.num);
}
if (modalState.type === 'delete') {
result = batchDelUDMVolteIMS(from.neId, from.imsi, from.num);
result = batchDelUDMVolteIMS(
from.neId,
`${from.imsi}_${from.msisdn}`,
from.num,
from.tag
);
}
} else {
if (modalState.type === 'add') {
@@ -374,15 +386,14 @@ function fnModalVisibleByBatch(type: 'delete' | 'add') {
/**
* 记录删除
* @param imsi 网元编号ID
* @param id 记录ID
*/
function fnRecordDelete(imsi: string) {
function fnRecordDelete(id: string) {
const neID = queryParams.neId;
if (!neID) return;
let msg = imsi;
if (imsi === '0') {
msg = `${tableState.selectedRowIMSIs[0]}... ${tableState.selectedRowIMSIs.length}`;
imsi = tableState.selectedRowIMSIs.join(',');
let msg = id;
if (id === '0') {
msg = `${tableState.selectedRowIMSIs[0].imsi}... ${tableState.selectedRowIMSIs.length}`;
}
Modal.confirm({
@@ -390,17 +401,34 @@ function fnRecordDelete(imsi: string) {
content: t('views.neData.udmVolteIMS.delTip', { num: msg }),
onOk() {
const hide = message.loading(t('common.loading'), 0);
delUDMVolteIMS(neID, imsi)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('common.operateOk'), 3);
fnGetList();
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
let reqArr: any[] = [];
if (id === '0') {
const volteArr = tableState.selectedRowIMSIs
.filter(item => item.tag == '1')
.map(item => `${item.imsi}_${item.msisdn}`)
.join(',');
if (volteArr.length > 0) {
reqArr.push(delUDMVolteIMS(neID, volteArr, '1'));
}
const voipArr = tableState.selectedRowIMSIs
.filter(item => item.tag == '0')
.map(item => `${item.imsi}_${item.msisdn}`)
.join(',');
if (voipArr.length > 0) {
reqArr.push(delUDMVolteIMS(neID, voipArr, '0'));
}
} else {
const record: any = tableState.data.find((item: any) => item.id === id);
if (record) {
reqArr = [
delUDMVolteIMS(neID, `${record.imsi}_${record.msisdn}`, record.tag),
];
}
}
Promise.all(reqArr)
.then(() => {
message.success(t('common.operateOk'), 3);
fnGetList();
})
.finally(() => {
hide();
@@ -541,15 +569,27 @@ function fnModalUploadImportUpload(file: File) {
}
const hide = message.loading(t('common.loading'), 0);
uploadImportState.loading = true;
uploadFileToNE('UDM', neID, file, 5)
// 上传文件
let formData = new FormData();
formData.append('file', file);
formData.append('subPath', 'import');
uploadFile(formData)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
return importUDMVolteIMS({
neId: neID,
uploadPath: res.data,
});
return res.data.filePath;
} else {
uploadImportState.msg = res.msg;
uploadImportState.loading = false;
return '';
}
return res;
})
.then((filePath: string) => {
if (!filePath) return;
// 文件导入
return importUDMVolteIMS({
neId: neID,
uploadPath: filePath,
});
})
.then(res => {
if (!res) return;
@@ -569,6 +609,33 @@ function fnModalUploadImportUpload(file: File) {
});
}
/**对话框表格信息导入失败原因 */
function fnModalUploadImportFailReason() {
const neId = queryParams.neId;
if (!neId) return;
const hide = message.loading(t('common.loading'), 0);
getNeViewFile({
neType: 'UDM',
neId: neId,
path: '/tmp',
fileName: 'import_imsuser_err_records.txt',
})
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('common.operateOk'), 3);
const blob = new Blob([res.data], {
type: 'text/plain',
});
saveAs(blob, `import_udmvolte_err_records_${Date.now()}.txt`);
} else {
message.error(`${res.msg}`, 3);
}
})
.finally(() => {
hide();
});
}
/**对话框表格信息导入模板 */
function fnModalDownloadImportTemplate() {
const hide = message.loading(t('common.loading'), 0);
@@ -847,7 +914,7 @@ onMounted(() => {
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.imsi)"
@click.prevent="fnRecordDelete(record.id)"
>
<template #icon>
<DeleteOutlined />
@@ -906,36 +973,73 @@ onMounted(() => {
>
</a-select>
</a-form-item>
<a-form-item
v-if="modalState.from.tag === '1'"
:label="
modalState.isBatch ? t('views.neData.common.startIMSI') : 'IMSI'
"
name="imsi"
v-bind="modalStateFrom.validateInfos.imsi"
>
<a-input
v-model:value="modalState.from.imsi"
allow-clear
:maxlength="15"
<template v-if="modalState.from.tag === '1'">
<a-form-item
:label="
modalState.isBatch ? t('views.neData.common.startIMSI') : 'IMSI'
"
name="imsi"
v-bind="modalStateFrom.validateInfos.imsi"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neData.common.imsiTip') }}<br />
{{ t('views.neData.common.imsiTip1') }}<br />
{{ t('views.neData.common.imsiTip2') }}<br />
{{ t('views.neData.common.imsiTip3') }}
</template>
<InfoCircleOutlined style="opacity: 0.45; color: inherit" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
<a-input
v-model:value="modalState.from.imsi"
allow-clear
:maxlength="15"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neData.common.imsiTip') }}<br />
{{ t('views.neData.common.imsiTip1') }}<br />
{{ t('views.neData.common.imsiTip2') }}<br />
{{ t('views.neData.common.imsiTip3') }}
</template>
<InfoCircleOutlined style="opacity: 0.45; color: inherit" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
<a-form-item
:extra="
modalState.from.tag == '0'
? t('views.neData.udmVolteIMS.voipTip')
: ''
"
:label="
modalState.isBatch
? t('views.neData.udmVolteIMS.startMSISDN')
: 'MSISDN'
"
name="msisdn"
v-bind="modalStateFrom.validateInfos.msisdn"
>
<a-input
v-model:value="modalState.from.msisdn"
allow-clear
:maxlength="32"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neData.common.msisdn') }}
</template>
<InfoCircleOutlined style="opacity: 0.45; color: inherit" />
</a-tooltip>
</template>
</a-input>
</a-form-item>
</template>
<a-form-item
v-else
v-if="modalState.from.tag === '0'"
:extra="
modalState.from.tag == '0'
? t('views.neData.udmVolteIMS.voipTip')
: ''
"
:label="
modalState.isBatch && modalState.from.tag === '0'
modalState.isBatch
? t('views.neData.udmVolteIMS.startMSISDN')
: 'MSISDN'
"
@@ -1021,7 +1125,7 @@ onMounted(() => {
: ''
"
:label="
modalState.isBatch && modalState.from.tag === '0'
modalState.isBatch
? t('views.neData.udmVolteIMS.startMSISDN')
: 'MSISDN'
"
@@ -1089,13 +1193,23 @@ onMounted(() => {
</a-button>
</a-col>
</a-row>
<a-textarea
:disabled="true"
:hidden="!uploadImportState.msg"
:value="uploadImportState.msg"
:auto-size="{ minRows: 2, maxRows: 8 }"
style="background-color: transparent; color: rgba(0, 0, 0, 0.85)"
/>
<a-alert
:message="uploadImportState.msg"
:type="uploadImportState.hasFail ? 'warning' : 'info'"
v-show="uploadImportState.msg.length > 0"
>
<template #action>
<a-button
size="small"
type="link"
danger
@click="fnModalUploadImportFailReason"
v-if="uploadImportState.hasFail"
>
{{ t('views.neUser.auth.importFail') }}
</a-button>
</template>
</a-alert>
</template>
</UploadModal>
</PageContainer>