pcf动态提示

This commit is contained in:
lai
2024-04-25 14:30:59 +08:00
parent 0ab5141369
commit fe9f458465
2 changed files with 224 additions and 103 deletions

View File

@@ -462,3 +462,144 @@ export async function updateNeConfigReload(neType: string, neId: string) {
}
return result;
}
/**
* 从参数配置PCF中获取对应信息提供给PCC用户策略输入框
* @param neType 网元类型
* @param topTag
* @param neId
* @returns object { wrRule, dataArr }
*/
export async function getPCCRule(neId: any) {
return await Promise.allSettled([
// 获取参数规则
request({
url: `/api/rest/systemManagement/v1/elementType/pcf/objectType/config/pccRules`,
method: 'get',
params: {
ne_id: neId,
},
timeout: 1_000,
}),
// 获取对应信息
request({
url: `/api/rest/systemManagement/v1/elementType/pcf/objectType/config/sessionRules`,
method: 'get',
params: {
ne_id: neId,
},
timeout: 1_000,
}),
request({
url: `/api/rest/systemManagement/v1/elementType/pcf/objectType/config/qosTemplate`,
method: 'get',
params: {
ne_id: neId,
},
timeout: 1_000,
}),
request({
url: `/api/rest/systemManagement/v1/elementType/pcf/objectType/config/headerEnrichTemplate`,
method: 'get',
params: {
ne_id: neId,
},
timeout: 1_000,
}),
request({
url: `/api/rest/systemManagement/v1/elementType/pcf/objectType/config/serviceAreaRestriction`,
method: 'get',
params: {
ne_id: neId,
},
timeout: 1_000,
}),
]).then(resArr => {
let pccJson: any = new Map();
let sessJson: any = new Map();
let qosJson: any = new Map();
let headerJson: any = new Map();
let sarJson: any = new Map();
// 规则数据
if (resArr[0].status === 'fulfilled') {
const itemV = resArr[0].value;
// 解析数据
if (
itemV.code === RESULT_CODE_SUCCESS &&
Array.isArray(itemV.data?.data)
) {
let itemData = itemV.data.data;
itemData.forEach((item: any) => {
pccJson.set(item.ruleId,{ value: item.ruleId, label: item.ruleId });
});
}
}
if (resArr[1].status === 'fulfilled') {
const itemV = resArr[1].value;
// 解析数据
if (
itemV.code === RESULT_CODE_SUCCESS &&
Array.isArray(itemV.data?.data)
) {
let itemData = itemV.data.data;
itemData.forEach((item: any) => {
sessJson.set(item.ruleId,{ value: item.ruleId, label: item.ruleId });
});
}
}
if (resArr[2].status === 'fulfilled') {
const itemV = resArr[2].value;
// 解析数据
if (
itemV.code === RESULT_CODE_SUCCESS &&
Array.isArray(itemV.data?.data)
) {
let itemData = itemV.data.data;
itemData.forEach((item: any) => {
qosJson.set(item.qosId,{ value: item.qosId, label: item.qosId });
});
}
}
if (resArr[3].status === 'fulfilled') {
const itemV = resArr[3].value;
// 解析数据
if (
itemV.code === RESULT_CODE_SUCCESS &&
Array.isArray(itemV.data?.data)
) {
let itemData = itemV.data.data;
itemData.forEach((item: any) => {
headerJson.set(item.templateName,{
value: item.templateName,
label: item.templateName,
});
});
}
}
if (resArr[4].status === 'fulfilled') {
const itemV = resArr[4].value;
// 解析数据
if (
itemV.code === RESULT_CODE_SUCCESS &&
Array.isArray(itemV.data?.data)
) {
let itemData = itemV.data.data;
itemData.forEach((item: any) => {
sarJson.set(item.name,{ value: item.name, label: item.name });
});
}
}
pccJson = Array.from(pccJson.values());
sessJson = Array.from(sessJson.values());
qosJson = Array.from(qosJson.values());
headerJson = Array.from(headerJson.values());
sarJson = Array.from(sarJson.values());
return { pccJson, sessJson, qosJson, headerJson, sarJson };
});
}

View File

@@ -17,6 +17,7 @@ import {
batchDelRule,
batchUpdateRule,
} from '@/api/neUser/pcf';
import { getPCCRule } from '@/api/configManage/configParam';
import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
@@ -27,6 +28,15 @@ const { t } = useI18n();
/**网元参数 */
let neOtions = ref<Record<string, any>[]>([]);
/**表单中多选的OPTION */
const pcfRuleOption = reactive({
pccOpt: [],
sessOpt: [],
qosOpt: [],
headerOpt: [],
sarOpt: [],
});
/**查询参数 */
let queryParams = reactive({
/**网元ID */
@@ -214,10 +224,10 @@ let modalState: ModalStateType = reactive({
imsi: '',
msisdn: '',
qosAudio: '',
pccRules: 'internet|ims_sig',
pccRules: undefined,
rfsp: 0,
uePolicy: '',
sessRules: 'internet|ims_sig',
sessRules: undefined,
sar: '',
hdrEnrich: '',
qosVideo: '',
@@ -247,6 +257,16 @@ const modalStateFrom = Form.useForm(
* @param noticeId 网元id, 不传为新增
*/
function fnModalVisibleByEdit(row?: Record<string, any>) {
getPCCRule(queryParams.neId)
.then((res: any) => {
console.log(res);
pcfRuleOption.pccOpt = res.pccJson;
pcfRuleOption.sessOpt = res.sessJson;
pcfRuleOption.qosOpt = res.qosJson;
pcfRuleOption.headerOpt = res.headerJson;
pcfRuleOption.sarOpt = res.sarJson;
})
.finally(() => {
modalState.isBatch = false;
if (!row) {
modalStateFrom.resetFields(); //重置表单
@@ -276,6 +296,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
modalState.confirmLoading = false;
});
}
});
}
/**
@@ -551,6 +572,10 @@ function fnModalUploadImportUpload(file: File) {
});
}
function filterOption(value: any, option: any) {
return option.value.toUpperCase().indexOf(value.toUpperCase()) >= 0;
}
onMounted(() => {
// 获取网元网元列表
useNeInfoStore()
@@ -945,38 +970,26 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="PCC Rules" name="pccRules">
<a-input
<a-select
v-model:value="modalState.from.pccRules"
allow-clear
:maxlength="64"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.pcf.pccRuleTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
mode="tags"
:token-separators="['|']"
:options="pcfRuleOption.pccOpt"
:title="t('views.neUser.pcf.pccRuleTip')"
/>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="SESS Rules" name="sessRules">
<a-input
<a-select
v-model:value="modalState.from.sessRules"
allow-clear
:maxlength="64"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.pcf.sessRuleTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
mode="tags"
:token-separators="['|']"
:options="pcfRuleOption.sessOpt"
:title="t('views.neUser.pcf.sessRuleTip')"
/>
</a-form-item>
</a-col>
</a-row>
@@ -984,38 +997,22 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="QOS Audio" name="qosAudio">
<a-input
<a-auto-complete
v-model:value="modalState.from.qosAudio"
allow-clear
:maxlength="64"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.pcf.qosAudioTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
:options="pcfRuleOption.qosOpt"
:filter-option="filterOption"
/>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="QOS Video" name="qosVideo">
<a-input
<a-auto-complete
v-model:value="modalState.from.qosVideo"
allow-clear
:maxlength="64"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.pcf.qosVideoTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
:options="pcfRuleOption.qosOpt"
:filter-option="filterOption"
/>
</a-form-item>
</a-col>
</a-row>
@@ -1023,20 +1020,12 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="HDR Enrich" name="hdrEnrich">
<a-input
<a-auto-complete
v-model:value="modalState.from.hdrEnrich"
allow-clear
:maxlength="64"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.pcf.hdrTip') }}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
:options="pcfRuleOption.headerOpt"
:filter-option="filterOption"
/>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
@@ -1062,21 +1051,12 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="Sar" name="sar">
<a-input
<a-auto-complete
v-model:value="modalState.from.sar"
allow-clear
:maxlength="64"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
{{ t('views.neUser.pcf.sarTip1') }}<br />
{{ t('views.neUser.pcf.sarTip2') }}<br />
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
</template>
</a-input>
:options="pcfRuleOption.sarOpt"
:filter-option="filterOption"
/>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">