feat: 优化PCF参数可选请求数据处理
This commit is contained in:
@@ -1,55 +0,0 @@
|
|||||||
import {
|
|
||||||
RESULT_CODE_ERROR,
|
|
||||||
RESULT_CODE_SUCCESS,
|
|
||||||
RESULT_MSG_ERROR,
|
|
||||||
} from '@/constants/result-constants';
|
|
||||||
import { language, request } from '@/plugins/http-fetch';
|
|
||||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询配置详细
|
|
||||||
* @param tag 配置ID
|
|
||||||
* @returns object
|
|
||||||
*/
|
|
||||||
export async function getConfigInfo(tag: string) {
|
|
||||||
// 发起请求
|
|
||||||
const result = await request({
|
|
||||||
url: `/api/rest/databaseManagement/v1/omc_db/config`,
|
|
||||||
method: 'get',
|
|
||||||
params: {
|
|
||||||
SQL: `SELECT * FROM config WHERE config_tag = '${tag}'`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
// 解析数据
|
|
||||||
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
|
|
||||||
let data = result.data.data[0];
|
|
||||||
return Object.assign(result, {
|
|
||||||
data: parseObjLineToHump(data['config'][0]),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改配置
|
|
||||||
* @param data 配置对象
|
|
||||||
* @returns object
|
|
||||||
*/
|
|
||||||
export async function updateConfig(tag: string, data: Record<string, any>) {
|
|
||||||
const result = await request({
|
|
||||||
url: `/api/rest/databaseManagement/v1/omc_db/config?WHERE=config_tag='${tag}'`,
|
|
||||||
method: 'put',
|
|
||||||
data: { data },
|
|
||||||
});
|
|
||||||
// 解析数据
|
|
||||||
if (result.code === RESULT_CODE_SUCCESS && result.data.data) {
|
|
||||||
let rows = result.data.data.affectedRows;
|
|
||||||
if (rows) {
|
|
||||||
delete result.data;
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR[language] };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@@ -29,12 +29,12 @@ const { t } = useI18n();
|
|||||||
let neOtions = ref<Record<string, any>[]>([]);
|
let neOtions = ref<Record<string, any>[]>([]);
|
||||||
|
|
||||||
/**表单中多选的OPTION */
|
/**表单中多选的OPTION */
|
||||||
const pcfRuleOption = reactive({
|
const pcfRuleOption = ref<Record<string, any[]>>({
|
||||||
pccOpt: [],
|
pccRules: [],
|
||||||
sessOpt: [],
|
sessionRules: [],
|
||||||
qosOpt: [],
|
qosTemplate: [],
|
||||||
headerOpt: [],
|
headerEnrichTemplate: [],
|
||||||
sarOpt: [],
|
serviceAreaRestriction: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
/**查询参数 */
|
/**查询参数 */
|
||||||
@@ -258,12 +258,8 @@ const modalStateFrom = Form.useForm(
|
|||||||
*/
|
*/
|
||||||
function fnModalVisibleByEdit(row?: Record<string, any>) {
|
function fnModalVisibleByEdit(row?: Record<string, any>) {
|
||||||
getPCCRule(queryParams.neId)
|
getPCCRule(queryParams.neId)
|
||||||
.then((res: any) => {
|
.then((data: any) => {
|
||||||
pcfRuleOption.pccOpt = res.pccJson;
|
pcfRuleOption.value = data;
|
||||||
pcfRuleOption.sessOpt = res.sessJson;
|
|
||||||
pcfRuleOption.qosOpt = res.qosJson;
|
|
||||||
pcfRuleOption.headerOpt = res.headerJson;
|
|
||||||
pcfRuleOption.sarOpt = res.sarJson;
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
modalState.isBatch = false;
|
modalState.isBatch = false;
|
||||||
@@ -438,12 +434,9 @@ function fnModalCancel() {
|
|||||||
*/
|
*/
|
||||||
function fnModalVisibleByBatch(type: 'delete' | 'add' | 'update') {
|
function fnModalVisibleByBatch(type: 'delete' | 'add' | 'update') {
|
||||||
getPCCRule(queryParams.neId)
|
getPCCRule(queryParams.neId)
|
||||||
.then((res: any) => {
|
.then((data: any) => {
|
||||||
pcfRuleOption.pccOpt = res.pccJson;
|
pcfRuleOption.value = data;
|
||||||
pcfRuleOption.sessOpt = res.sessJson;
|
console.log(data);
|
||||||
pcfRuleOption.qosOpt = res.qosJson;
|
|
||||||
pcfRuleOption.headerOpt = res.headerJson;
|
|
||||||
pcfRuleOption.sarOpt = res.sarJson;
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
modalStateFrom.resetFields(); //重置表单
|
modalStateFrom.resetFields(); //重置表单
|
||||||
@@ -1021,7 +1014,7 @@ onMounted(() => {
|
|||||||
v-model:value="modalState.from.pccRules"
|
v-model:value="modalState.from.pccRules"
|
||||||
allow-clear
|
allow-clear
|
||||||
mode="tags"
|
mode="tags"
|
||||||
:options="pcfRuleOption.pccOpt"
|
:options="pcfRuleOption.pccRules"
|
||||||
:title="t('views.neUser.pcf.pccRuleTip')"
|
:title="t('views.neUser.pcf.pccRuleTip')"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -1032,7 +1025,7 @@ onMounted(() => {
|
|||||||
v-model:value="modalState.from.sessRules"
|
v-model:value="modalState.from.sessRules"
|
||||||
allow-clear
|
allow-clear
|
||||||
mode="tags"
|
mode="tags"
|
||||||
:options="pcfRuleOption.sessOpt"
|
:options="pcfRuleOption.sessionRules"
|
||||||
:title="t('views.neUser.pcf.sessRuleTip')"
|
:title="t('views.neUser.pcf.sessRuleTip')"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -1045,7 +1038,7 @@ onMounted(() => {
|
|||||||
<a-auto-complete
|
<a-auto-complete
|
||||||
v-model:value="modalState.from.qosAudio"
|
v-model:value="modalState.from.qosAudio"
|
||||||
allow-clear
|
allow-clear
|
||||||
:options="pcfRuleOption.qosOpt"
|
:options="pcfRuleOption.qosTemplate"
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -1055,7 +1048,7 @@ onMounted(() => {
|
|||||||
<a-auto-complete
|
<a-auto-complete
|
||||||
v-model:value="modalState.from.qosVideo"
|
v-model:value="modalState.from.qosVideo"
|
||||||
allow-clear
|
allow-clear
|
||||||
:options="pcfRuleOption.qosOpt"
|
:options="pcfRuleOption.qosTemplate"
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -1068,7 +1061,7 @@ onMounted(() => {
|
|||||||
<a-auto-complete
|
<a-auto-complete
|
||||||
v-model:value="modalState.from.hdrEnrich"
|
v-model:value="modalState.from.hdrEnrich"
|
||||||
allow-clear
|
allow-clear
|
||||||
:options="pcfRuleOption.headerOpt"
|
:options="pcfRuleOption.headerEnrichTemplate"
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -1099,7 +1092,7 @@ onMounted(() => {
|
|||||||
<a-auto-complete
|
<a-auto-complete
|
||||||
v-model:value="modalState.from.sar"
|
v-model:value="modalState.from.sar"
|
||||||
allow-clear
|
allow-clear
|
||||||
:options="pcfRuleOption.sarOpt"
|
:options="pcfRuleOption.serviceAreaRestriction"
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user