feat: 锁屏添加OMC升级等待

This commit is contained in:
TsMask
2024-01-17 17:29:31 +08:00
parent ce076ef7f8
commit e3a01b8998
5 changed files with 100 additions and 43 deletions

View File

@@ -98,8 +98,8 @@ onUnmounted(() => {
background: 'rgba(0, 0, 0, 0.85)',
}"
>
<!-- 锁屏 -->
<div class="lock-screen_login">
<!-- 锁屏-登录 -->
<div class="lock-screen_login" v-if="lockedStore.lockType === 'lock'">
<div class="lock-screen_login-user">
<a-avatar
shape="circle"
@@ -130,6 +130,13 @@ onUnmounted(() => {
</a-button>
</div>
</div>
<!-- 锁屏-OMC重启升级 -->
<div class="lock-screen_reload" v-if="lockedStore.lockType === 'reload'">
<LoadingOutlined style="font-size: 56px" />
<div class="text">正在重启请稍等...</div>
<div class="desc">当准备就绪的时候你的浏览器会自动刷新</div>
</div>
</a-modal>
</template>
@@ -173,6 +180,27 @@ onUnmounted(() => {
}
}
}
.lock-screen_reload {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: transparent;
color: #fff;
& .text {
font-size: 24px;
font-weight: bold;
letter-spacing: 4px;
margin-top: 24px;
}
& .desc {
margin-top: 8px;
font-size: 16px;
}
}
</style>
<style lang="less">

View File

@@ -138,19 +138,6 @@ const logoUrl = computed(() => {
return url.replace('{language}', lang);
});
// 系统使用手册地址
const helpDocUrl = computed(() => {
let url = parseUrlPath(appStore.helpDoc);
if (url.indexOf('{language}') === -1) {
return url;
}
// 语言参数替换
const local = currentLocale.value;
const lang = local.split('_')[0];
return url.replace('{language}', lang);
});
/**系统使用手册跳转 */
function fnClickHelpDoc(language?: string) {
const routeData = router.resolve({ name: 'HelpDoc' });
@@ -315,7 +302,7 @@ document.addEventListener('visibilitychange', function () {
<template #footerRender="{ width }">
<footer class="footer">
<div class="footer-fixed" :style="{ width }">
<div style="flex: 1;">
<div style="flex: 1">
<span>{{ appStore.copyright }}</span>
</div>
<a-space direction="horizontal" :size="8">
@@ -367,7 +354,7 @@ document.addEventListener('visibilitychange', function () {
.footer {
z-index: 16;
margin: 0px;
width: auto;
width: auto;
margin-top: 52px;
&-fixed {
position: fixed;

View File

@@ -1,4 +1,6 @@
import { getSysConf } from '@/api';
import { CACHE_LOCAL_LOCK } from '@/constants/cache-keys-constants';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { localGet, localSet } from '@/utils/cache-local-utils';
import { defineStore } from 'pinia';
@@ -7,7 +9,7 @@ type Locked = {
/**锁定状态 */
isLocked: boolean;
/**锁屏类型 */
lockType: 'lock' | 'reload' | 'upgrade';
lockType: 'lock' | 'reload';
/**超时锁屏时间,秒*/
lockTimeout: number;
};
@@ -20,11 +22,27 @@ const useLockedStore = defineStore('locked', {
}),
getters: {},
actions: {
// 重启等待-轮询
async relaodWait() {
const res = await getSysConf();
if (res.code === RESULT_CODE_SUCCESS && res.data) {
console.log(res);
this.fnLock('lock',false)
} else {
// 延迟5秒
setTimeout(() => {
this.relaodWait();
}, 5_000);
}
},
// 设置锁定
async fnLock(type: 'lock' | 'reload' | 'upgrade', v: boolean) {
async fnLock(type: 'lock' | 'reload', v: boolean) {
this.lockType = type;
this.isLocked = v;
localSet(CACHE_LOCAL_LOCK, `${v}`);
if (type === 'reload') {
this.relaodWait();
}
},
},
});

View File

@@ -18,13 +18,12 @@ import {
importFile,
listServerFile,
} from '@/api/configManage/neManage';
import { parseDateToStr } from '@/utils/date-utils';
import { updateNeConfigReload } from '@/api/configManage/configParam';
import useI18n from '@/hooks/useI18n';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useNeInfoStore from '@/store/modules/neinfo';
import { updateNeConfigReload } from '@/api/configManage/configParam';
const { t } = useI18n();
/**表格所需option */
@@ -537,25 +536,26 @@ function fnRecordRestart(row: Record<string, any>) {
oper: t('views.configManage.neManage.restart'),
}),
onOk() {
const key = 'restartNf';
message.loading({ content: t('common.loading'), key });
restartNf(row).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', {
msg: t('views.configManage.neManage.restart'),
}),
key,
duration: 2,
});
} else {
message.error({
content: `${res.msg}`,
key: key,
duration: 2,
});
}
});
const hide = message.loading(t('common.loading'), 0);
restartNf(row)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', {
msg: t('views.configManage.neManage.restart'),
}),
duration: 3,
});
} else {
message.error({
content: `${res.msg}`,
duration: 3,
});
}
})
.finally(() => {
hide();
});
},
});
}
@@ -713,7 +713,11 @@ function fnGetList(pageNum?: number) {
}
tablePagination.total = res.total;
tableState.data = res.rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) {
if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false;
fnGetList(queryParams.pageNum - 1);
}

View File

@@ -23,6 +23,8 @@ import useI18n from '@/hooks/useI18n';
import useNeInfoStore from '@/store/modules/neinfo';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import useLockedStore from '@/store/modules/locked';
const lockedStore = useLockedStore();
const { t } = useI18n();
/**查询参数 */
@@ -292,6 +294,20 @@ function fnFileModalOk() {
const hide = message.loading(t('common.loading'), 0);
fnType
.then(res => {
// OMC自升级
if (type === 'run' && from.neType === 'OMC') {
if (res.code === RESULT_CODE_SUCCESS) {
fnFileModalCancel();
lockedStore.fnLock('reload', true);
} else {
message.error({
content: `${fileModalState.title} ${res.msg}`,
duration: 3,
});
}
return;
}
// 其他网元
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: fileModalState.title }),
@@ -403,8 +419,12 @@ function fnGetList(pageNum?: number) {
}
tablePagination.total = res.total;
tableState.data = res.rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) {
debugger
if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
debugger;
tableState.loading = false;
fnGetList(queryParams.pageNum - 1);