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