Merge branch 'main' into multi-tenant

This commit is contained in:
TsMask
2025-01-10 19:39:58 +08:00
6 changed files with 89 additions and 101 deletions

View File

@@ -11,7 +11,7 @@ VITE_APP_NAME = "Core Network OMC"
VITE_APP_CODE = "OMC" VITE_APP_CODE = "OMC"
# 应用版本 # 应用版本
VITE_APP_VERSION = "2.250103" VITE_APP_VERSION = "2.250110"
# 接口基础URL地址-不带/后缀 # 接口基础URL地址-不带/后缀
VITE_API_BASE_URL = "/omc-api" VITE_API_BASE_URL = "/omc-api"

View File

@@ -11,7 +11,7 @@ VITE_APP_NAME = "Core Network OMC"
VITE_APP_CODE = "OMC" VITE_APP_CODE = "OMC"
# 应用版本 # 应用版本
VITE_APP_VERSION = "2.250103" VITE_APP_VERSION = "2.250110"
# 接口基础URL地址-不带/后缀 # 接口基础URL地址-不带/后缀
VITE_API_BASE_URL = "/omc-api" VITE_API_BASE_URL = "/omc-api"

View File

@@ -223,7 +223,7 @@ export default {
serialNum: 'Serial Number', serialNum: 'Serial Number',
expiryDate: 'Expiry Date', expiryDate: 'Expiry Date',
neStatus: 'Status Abnormal', neStatus: 'Status Abnormal',
runStatus:'Status', runStatus: 'Runing Status',
mark:'Information', mark:'Information',
object:'Object', object:'Object',
versionNum:'Version', versionNum:'Version',

View File

@@ -37,17 +37,6 @@ const statusBar = ref<HTMLElement | undefined>(undefined);
/**图实例对象 */ /**图实例对象 */
const statusBarChart = ref<any>(null); const statusBarChart = ref<any>(null);
/**网元状态字典数据 */
let indexColor = ref<DictType[]>([
{ label: 'Normal', value: 'normal', tagType: '', tagClass: '#91cc75' },
{
label: 'Abnormal',
value: 'abnormal',
tagType: '',
tagClass: '#ee6666',
},
]);
/**表格字段列 */ /**表格字段列 */
let tableColumns: ColumnsType = [ let tableColumns: ColumnsType = [
{ {
@@ -127,71 +116,63 @@ let tableState: TabeStateType = reactive({
let serverState: any = ref({}); let serverState: any = ref({});
/**查询网元状态列表 */ /**查询网元状态列表 */
function fnGetList(one: boolean) { async function fnGetList() {
if (tableState.loading) return; try {
if (one) { const res = await listAllNeInfo({ bandStatus: true });
tableState.loading = true; tableState.data = res.data;
// 选择第一个
if (res.data.length > 0) {
const id = res.data[0].id;
fnTableSelectedRowKeys([id]);
} else {
fnTableSelectedRowKeys(tableState.selectedRowKeys);
}
} catch (error) {
console.log(error);
tableState.data = [];
} }
listAllNeInfo({ bandStatus: true })
.then(res => {
tableState.data = res.data;
tableState.loading = false;
if (one && res.data.length > 0) {
const id = res.data[0].id;
fnTableSelectedRowKeys([id]);
} else {
fnTableSelectedRowKeys(tableState.selectedRowKeys);
}
})
.finally(() => {
var rightNum = 0;
var errorNum = 0;
for (const v of tableState.data) {
if (v?.serverState?.online) {
rightNum++;
} else {
errorNum++;
}
}
/// 图表数据
const optionData: any = {
title: {
text: '',
subtext: '',
left: 'center',
},
tooltip: {
trigger: 'item',
},
legend: {
orient: 'vertical',
left: 'left',
},
color: indexColor.value.map(item => item.tagClass),
series: [
{
name: t('views.index.realNeStatus'),
type: 'pie',
radius: '70%',
center: ['50%', '50%'],
data: [
{ value: rightNum, name: t('views.index.normal') },
{ value: errorNum, name: t('views.index.abnormal') },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
},
label: {}, if (tableState.data.length == 0) {
}, return;
}
var rightNum = 0;
var errorNum = 0;
for (const v of tableState.data) {
if (v?.serverState?.online) {
rightNum++;
} else {
errorNum++;
}
}
/// 图表数据
const optionData: any = {
title: {
text: '',
subtext: '',
left: 'center',
},
tooltip: {
trigger: 'item',
},
legend: {
orient: 'vertical',
left: 'left',
},
color: dict.indexStatus.map(item => item.tagClass),
series: [
{
name: t('views.index.runStatus'),
type: 'pie',
radius: '70%',
center: ['50%', '50%'],
data: [
{ value: rightNum, name: t('views.index.normal') },
{ value: errorNum, name: t('views.index.abnormal') },
], ],
}; },
fnDesign(statusBar.value, optionData); ],
}); };
fnDesign(statusBar.value, optionData);
} }
function fnDesign(container: HTMLElement | undefined, option: any) { function fnDesign(container: HTMLElement | undefined, option: any) {
@@ -261,29 +242,50 @@ function fnLocale() {
appStore.setTitle(title); appStore.setTitle(title);
} }
/**字典数据 */
let dict: {
/**网元信息状态 */
neInfoStatus: DictType[];
/**主页状态 */
indexStatus: DictType[];
} = reactive({
neInfoStatus: [],
indexStatus: [],
});
let timer: any; let timer: any;
onMounted(() => { onMounted(() => {
getDict('index_status') // 初始字典数据
.then(res => { Promise.allSettled([getDict('ne_info_status'), getDict('index_status')])
if (res.length > 0) { .then(resArr => {
indexColor.value = res; if (resArr[0].status === 'fulfilled') {
dict.neInfoStatus = resArr[0].value;
}
if (resArr[1].status === 'fulfilled') {
dict.indexStatus = resArr[1].value;
} }
}) })
.finally(() => { .finally(async () => {
fnLocale(); fnLocale();
fnGetList(true); tableState.loading = true;
timer = setInterval(() => fnGetList(false), 10_000); // 每隔10秒执行一次 await fnGetList();
tableState.loading = false;
timer = setInterval(() => {
if (!timer) return;
fnGetList();
}, 10_000); // 每隔10秒执行一次
}); });
}); });
// 在组件卸载之前清除定时器 // 在组件卸载之前清除定时器
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearInterval(timer); clearInterval(timer);
timer = null;
}); });
</script> </script>
<template> <template>
<PageContainer :breadcrumb="{}"> <PageContainer :breadcrumb="{}" :loading="tableState.loading">
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="14" :md="16" :xs="24"> <a-col :lg="14" :md="16" :xs="24">
<!-- 表格列表 --> <!-- 表格列表 -->
@@ -292,7 +294,6 @@ onBeforeUnmount(() => {
row-key="id" row-key="id"
size="small" size="small"
:columns="tableColumns" :columns="tableColumns"
:loading="tableState.loading"
:data-source="tableState.data" :data-source="tableState.data"
:pagination="false" :pagination="false"
:scroll="{ x: true }" :scroll="{ x: true }"
@@ -305,12 +306,7 @@ onBeforeUnmount(() => {
> >
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'"> <template v-if="column.key === 'status'">
<div v-if="record.serverState.online"> <DictTag :options="dict.neInfoStatus" :value="record.status" />
<a-tag color="blue">{{ t('views.index.normal') }}</a-tag>
</div>
<div v-else>
<a-tag color="pink">{{ t('views.index.abnormal') }}</a-tag>
</div>
</template> </template>
</template> </template>
</a-table> </a-table>

View File

@@ -662,15 +662,7 @@ onMounted(() => {
</a-divider> </a-divider>
<div> <div>
<span>{{ t('views.ne.neInfo.serviceState') }}</span> <span>{{ t('views.ne.neInfo.serviceState') }}</span>
<a-tag <DictTag :options="dict.neInfoStatus" :value="record.status" />
:color="record.serverState.online ? 'processing' : 'error'"
>
{{
record.serverState.online
? t('views.ne.common.normalcy')
: t('views.ne.common.exceptions')
}}
</a-tag>
</div> </div>
<div> <div>
<span>{{ t('views.ne.neVersion.version') }}</span> <span>{{ t('views.ne.neVersion.version') }}</span>

View File

@@ -510,7 +510,7 @@ function fnModalCancel() {
*/ */
function fnModalOkResetPwd() { function fnModalOkResetPwd() {
modalStateFrom modalStateFrom
.validate(['userName', 'password']) .validate(['password'])
.then(() => { .then(() => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
const key = 'user'; const key = 'user';