fix: 缓存网元类型获取级联数据判断

This commit is contained in:
TsMask
2023-12-08 18:38:46 +08:00
parent e6a4591fb6
commit 4105f4ef33

View File

@@ -19,7 +19,7 @@ import { SizeType } from 'ant-design-vue/lib/config-provider';
const { t } = useI18n(); const { t } = useI18n();
/**网元参数 */ /**网元参数 */
let neCascaderOtions = ref<Record<string, any>[]>([]); let neCascaderOptions = ref<Record<string, any>[]>([]);
/**网元类型选择 type,id */ /**网元类型选择 type,id */
let neTypeSelect = ref<string[]>(['', '']); let neTypeSelect = ref<string[]>(['', '']);
@@ -989,18 +989,25 @@ 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) {
// 过滤不可用的网元 // 过滤不可用的网元
neCascaderOtions.value = useNeInfoStore().getNeCascaderOptions.filter( neCascaderOptions.value = useNeInfoStore().getNeCascaderOptions.filter(
(item: any) => { (item: any) => {
return !['OMC'].includes(item.value); return !['OMC'].includes(item.value);
} }
); );
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
// 默认选择AMF // 默认选择AMF
const item = neCascaderOtions.value.find(s => s.value === 'AMF'); const item = neCascaderOptions.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]; neTypeSelect.value = [info.neType, info.neId];
} else { } else {
const info = neCascaderOtions.value[0].children[0]; const info = neCascaderOptions.value[0].children[0];
neTypeSelect.value = [info.neType, info.neId]; neTypeSelect.value = [info.neType, info.neId];
} }
fnGetParamConfigTopTab(); fnGetParamConfigTopTab();
@@ -1035,7 +1042,7 @@ onMounted(() => {
> >
<a-cascader <a-cascader
v-model:value="neTypeSelect" v-model:value="neTypeSelect"
:options="neCascaderOtions" :options="neCascaderOptions"
:allow-clear="false" :allow-clear="false"
@change="fnGetParamConfigTopTab" @change="fnGetParamConfigTopTab"
/> />