fix: 参数配置接入实训调整网元类型选择,权限按钮

This commit is contained in:
TsMask
2024-07-11 10:24:27 +08:00
parent 99140f0641
commit ecaa0ce077

View File

@@ -5,35 +5,25 @@ import { Modal, message } from 'ant-design-vue/lib';
import useI18n from '@/hooks/useI18n';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import {
getParamConfigTopTab,
getParamConfigInfoForm,
updateParamConfigInfo,
delParamConfigInfo,
addParamConfigInfo,
} from '@/api/configManage/configParam';
import useNeInfoStore from '@/store/modules/neinfo';
import useOptions from './hooks/useOptions';
import useSMFOptions from './hooks/useSMFOptions';
import { SizeType } from 'ant-design-vue/lib/config-provider';
import { DataNode } from 'ant-design-vue/lib/tree';
import { getAllNeConfig } from '@/api/ne/neConfig';
import {
addNeConfigData,
delNeConfigData,
editNeConfigData,
getAllNeConfig,
getNeConfigData,
} from '@/api/ne/neConfig';
addPtNeConfigData,
delPtNeConfigData,
editPtNeConfigData,
getPtNeConfigData,
} from '@/api/pt/neConfig';
const neInfoStore = useNeInfoStore();
const { t } = useI18n();
const { ruleVerification } = useOptions();
const { ruleVerification, ptSaveConfig, ptResetConfig, ptConfigApply } = useOptions();
const { initUPFIds, optionsUPFIds } = useSMFOptions();
/**网元参数 */
let neCascaderOptions = ref<Record<string, any>[]>([]);
/**网元类型选择 type,id */
let neTypeSelect = ref<string[]>(['', '']);
let neSelectOptions = ref<Record<string, any>[]>([]);
/**左侧导航是否可收起 */
let collapsible = ref<boolean>(true);
@@ -47,6 +37,8 @@ function changeCollapsible() {
type TreeStateType = {
/**网元 loading */
loading: boolean;
/**网元类型,教学固定neId:001 */
neType: string;
/**网元配置 tree */
data: DataNode[];
/**选择对应Node一级 tree */
@@ -66,6 +58,7 @@ type TreeStateType = {
let treeState: TreeStateType = reactive({
loading: true,
neType: '',
data: [],
selectNode: {
paramName: '',
@@ -89,7 +82,7 @@ function fnSelectConfigNode(_: any, info: any) {
fnActiveConfigNode(key);
}
/**tab标签栏标签点击监听 */
/**标签点击监听 */
function fnActiveConfigNode(key: string | number) {
listState.data = [];
arrayState.data = [];
@@ -111,9 +104,8 @@ function fnActiveConfigNode(key: string | number) {
treeState.selectNode = JSON.parse(JSON.stringify(param));
// 获取网元端的配置数据
getNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
getPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
}).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
@@ -213,7 +205,7 @@ function fnActiveConfigNode(key: string | number) {
/**查询配置可选属性值列表 */
function fnGetNeConfig() {
const neType = neTypeSelect.value[0];
const neType = treeState.neType;
if (!neType) {
message.warning({
content: t('views.configManage.configParamForm.neTypePleace'),
@@ -313,9 +305,8 @@ function listEditOk() {
// 发送
const hide = message.loading(t('common.loading'), 0);
editNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
editPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
paramData: {
[from['name']]: from['value'],
@@ -458,12 +449,11 @@ function arrayEditOk(from: Record<string, any>) {
// 发送
const hide = message.loading(t('common.loading'), 0);
editNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
editPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
paramData: data,
loc: from['index']['value'],
loc: `${from['index']['value']}`,
})
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
@@ -489,7 +479,7 @@ function arrayEditOk(from: Record<string, any>) {
/**多列表删除单行 */
function arrayDelete(rowIndex: Record<string, any>) {
const loc = rowIndex.value;
const loc = `${rowIndex.value}`;
const title = `${treeState.selectNode.paramDisplay} Index-${loc}`;
Modal.confirm({
@@ -498,9 +488,8 @@ function arrayDelete(rowIndex: Record<string, any>) {
num: title,
}),
onOk() {
delNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
delPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
loc: loc,
}).then(res => {
@@ -568,12 +557,11 @@ function arrayAddOk(from: Record<string, any>) {
// 发送
const hide = message.loading(t('common.loading'), 0);
addNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
addPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
paramData: data,
loc: from['index']['value'],
loc: `${from['index']['value']}`,
})
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
@@ -776,9 +764,8 @@ function arrayChildEditOk(from: Record<string, any>) {
// 发送
const hide = message.loading(t('common.loading'), 0);
editNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
editPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
paramData: data,
loc,
@@ -817,9 +804,8 @@ function arrayChildDelete(rowIndex: Record<string, any>) {
num: title,
}),
onOk() {
delNeConfigData({
neType: neTypeSelect.value[0],
neId: neTypeSelect.value[1],
delPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
loc,
}).then(res => {
@@ -866,7 +852,6 @@ function arrayChildAdd() {
/**多列表新增单行确认 */
function arrayChildAddOk(from: Record<string, any>) {
const loc = `${arrayChildState.loc}/${from['index']['value']}`;
const neType = neTypeSelect.value[0];
let data: Record<string, any> = {};
for (const key in from) {
@@ -888,9 +873,8 @@ function arrayChildAddOk(from: Record<string, any>) {
// 发送
const hide = message.loading(t('common.loading'), 0);
addNeConfigData({
neType: neType,
neId: neTypeSelect.value[1],
addPtNeConfigData({
neType: treeState.neType,
paramName: treeState.selectNode.paramName,
paramData: data,
loc,
@@ -1065,7 +1049,7 @@ watch(
() => modalState.visible,
val => {
// SMF需要选择配置的UPF id
if (val && neTypeSelect.value[0] === 'SMF') {
if (val && treeState.neType === 'SMF') {
initUPFIds();
}
}
@@ -1077,12 +1061,12 @@ onMounted(() => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
// 过滤不可用的网元
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
neSelectOptions.value = neInfoStore.getNeSelectOtions.filter(
(item: any) => {
return !['OMC'].includes(item.value);
return !['OMC','LMF','NEF'].includes(item.value);
}
);
if (neCascaderOptions.value.length === 0) {
if (neSelectOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
@@ -1090,13 +1074,13 @@ onMounted(() => {
return;
}
// 默认选择AMF
const item = neCascaderOptions.value.find(s => s.value === 'AMF');
const item = neSelectOptions.value.find(s => s.value === 'AMF');
if (item && item.children) {
const info = item.children[0];
neTypeSelect.value = [info.neType, info.neId];
treeState.neType = info.neType;
} else {
const info = neCascaderOptions.value[0].children[0];
neTypeSelect.value = [info.neType, info.neId];
const info = neSelectOptions.value[0].children[0];
treeState.neType = info.neType;
}
fnGetNeConfig();
}
@@ -1118,7 +1102,7 @@ onMounted(() => {
>
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="管理员/教师)查看学生" name="neType ">
<a-form-item label="(教师)查看学生" name="neType ">
<a-auto-complete
:options="neInfoStore.getNeSelectOtions"
allow-clear
@@ -1129,9 +1113,15 @@ onMounted(() => {
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button>(管理员/教师)保存当前网元为示例配置</a-button>
<a-button>(学生/教师)重置当前网元为示例配置</a-button>
<a-button>(学生)申请应用当前网元配置</a-button>
<a-button @click="ptSaveConfig(treeState.neType)">
(管理员)载入网元配置为示例配置
</a-button>
<a-button @click="ptResetConfig(treeState.neType)">
(学生)重置为班级示例/(教师)重置为系统示例
</a-button>
<a-button @click="ptConfigApply(treeState.neType, '0')">
(学生)申请应用当前网元配置
</a-button>
</a-space>
</a-form-item>
</a-col>
@@ -1155,9 +1145,9 @@ onMounted(() => {
>
<a-form layout="vertical" autocomplete="off">
<a-form-item name="neId ">
<a-cascader
v-model:value="neTypeSelect"
:options="neCascaderOptions"
<a-select
v-model:value="treeState.neType"
:options="neSelectOptions"
:allow-clear="false"
@change="fnGetNeConfig"
/>
@@ -1576,7 +1566,7 @@ onMounted(() => {
<!-- 特殊SMF-upfid选择 -->
<a-select
v-if="
neTypeSelect[0] === 'SMF' &&
treeState.neType === 'SMF' &&
modalState.from[item.name]['name'] === 'upfId'
"
v-model:value="modalState.from[item.name]['value']"