feat: PCF用户策略控制导入导出

This commit is contained in:
TsMask
2023-12-01 16:54:27 +08:00
parent 5f89732a61
commit 3a8f6964ae
2 changed files with 16 additions and 14 deletions

View File

@@ -6,15 +6,15 @@ import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils'; import { parseObjLineToHump } from '@/utils/parse-utils';
/** /**
* 签约规则导出 * 规则导出
* @param data 表单数据对象 * @param data 表单数据对象
* @returns bolb * @returns bolb
*/ */
export function exportRule(data: Record<string, any>) { export function exportRule(data: Record<string, any>) {
return request({ return request({
url: '/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/export', url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/export`,
method: 'post', method: 'get',
data: data, params: data,
responseType: 'blob', responseType: 'blob',
timeout: 180_000, timeout: 180_000,
}); });
@@ -22,15 +22,13 @@ export function exportRule(data: Record<string, any>) {
/** /**
* 导入规则数据 * 导入规则数据
* @param neId 网元ID
* @param data 表单数据对象 * @param data 表单数据对象
* @returns object * @returns object
*/ */
export function importRuleData(data: Record<string, any>) { export function importRuleData(data: Record<string, any>) {
return request({ return request({
url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/import`, url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/file/import?neId=${data.neId}&filePath=${data.filePath}&fileType=${data.fileType}`,
method: 'post', method: 'put',
data,
timeout: 60_000, timeout: 60_000,
}); });
} }
@@ -124,7 +122,7 @@ export async function updateRule(data: Record<string, any>) {
*/ */
export async function batchUpdateRule(data: Record<string, any>) { export async function batchUpdateRule(data: Record<string, any>) {
const result = await request({ const result = await request({
url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/${data.num}?neId=${data.neId}`, url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/${data.num}?neId=${data.neId}`,
method: 'put', method: 'put',
data: data, data: data,
}); });
@@ -168,7 +166,7 @@ export async function addRule(data: Record<string, any>) {
*/ */
export async function batchAddRule(data: Record<string, any>) { export async function batchAddRule(data: Record<string, any>) {
const result = await request({ const result = await request({
url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/${data.num}?neId=${data.neId}`, url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/${data.num}?neId=${data.neId}`,
method: 'post', method: 'post',
data: data, data: data,
}); });
@@ -202,7 +200,7 @@ export function delRule(neId: string, data: Record<string, any>) {
*/ */
export async function batchDelRule(data: Record<string, any>) { export async function batchDelRule(data: Record<string, any>) {
return request({ return request({
url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/${data.num}?neId=${data.neId}&imsi=${data.imsi}`, url: `/api/rest/ueManagement/v1/elementType/pcf/objectType/ueInfo/batch/${data.num}?neId=${data.neId}&imsi=${data.imsi}`,
method: 'delete', method: 'delete',
}); });
} }

View File

@@ -382,7 +382,7 @@ function fnExportList(type: string) {
message.loading({ content: t('common.loading'), key }); message.loading({ content: t('common.loading'), key });
exportRule({ exportRule({
neId: neID, neId: neID,
type: type, fileType: type,
}).then(res => { }).then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
@@ -458,15 +458,19 @@ function fnModalUploadImportUpload(file: File) {
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
return importRuleData({ return importRuleData({
type: 'txt',
neId: neID, neId: neID,
filePath: res.data, filePath: res.data,
fileType: 'txt',
}); });
} }
return res; return res;
}) })
.then(res => { .then(res => {
uploadImportState.msg = res.msg; if (res.code === RESULT_CODE_SUCCESS && res.data?.detail) {
uploadImportState.msg = res.data?.detail;
} else {
uploadImportState.msg = res.msg;
}
}) })
.finally(() => { .finally(() => {
hide(); hide();