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)', 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"> <div class="lock-screen_login-user">
<a-avatar <a-avatar
shape="circle" shape="circle"
@@ -130,6 +130,13 @@ onUnmounted(() => {
</a-button> </a-button>
</div> </div>
</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> </a-modal>
</template> </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>
<style lang="less"> <style lang="less">

View File

@@ -138,19 +138,6 @@ const logoUrl = computed(() => {
return url.replace('{language}', lang); 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) { function fnClickHelpDoc(language?: string) {
const routeData = router.resolve({ name: 'HelpDoc' }); const routeData = router.resolve({ name: 'HelpDoc' });
@@ -315,7 +302,7 @@ document.addEventListener('visibilitychange', function () {
<template #footerRender="{ width }"> <template #footerRender="{ width }">
<footer class="footer"> <footer class="footer">
<div class="footer-fixed" :style="{ width }"> <div class="footer-fixed" :style="{ width }">
<div style="flex: 1;"> <div style="flex: 1">
<span>{{ appStore.copyright }}</span> <span>{{ appStore.copyright }}</span>
</div> </div>
<a-space direction="horizontal" :size="8"> <a-space direction="horizontal" :size="8">
@@ -367,7 +354,7 @@ document.addEventListener('visibilitychange', function () {
.footer { .footer {
z-index: 16; z-index: 16;
margin: 0px; margin: 0px;
width: auto; width: auto;
margin-top: 52px; margin-top: 52px;
&-fixed { &-fixed {
position: fixed; position: fixed;

View File

@@ -1,4 +1,6 @@
import { getSysConf } from '@/api';
import { CACHE_LOCAL_LOCK } from '@/constants/cache-keys-constants'; 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 { localGet, localSet } from '@/utils/cache-local-utils';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
@@ -7,7 +9,7 @@ type Locked = {
/**锁定状态 */ /**锁定状态 */
isLocked: boolean; isLocked: boolean;
/**锁屏类型 */ /**锁屏类型 */
lockType: 'lock' | 'reload' | 'upgrade'; lockType: 'lock' | 'reload';
/**超时锁屏时间,秒*/ /**超时锁屏时间,秒*/
lockTimeout: number; lockTimeout: number;
}; };
@@ -20,11 +22,27 @@ const useLockedStore = defineStore('locked', {
}), }),
getters: {}, getters: {},
actions: { 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.lockType = type;
this.isLocked = v; this.isLocked = v;
localSet(CACHE_LOCAL_LOCK, `${v}`); localSet(CACHE_LOCAL_LOCK, `${v}`);
if (type === 'reload') {
this.relaodWait();
}
}, },
}, },
}); });

View File

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

View File

@@ -23,6 +23,8 @@ import useI18n from '@/hooks/useI18n';
import useNeInfoStore from '@/store/modules/neinfo'; import useNeInfoStore from '@/store/modules/neinfo';
import { FileType } from 'ant-design-vue/lib/upload/interface'; import { FileType } from 'ant-design-vue/lib/upload/interface';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface'; import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import useLockedStore from '@/store/modules/locked';
const lockedStore = useLockedStore();
const { t } = useI18n(); const { t } = useI18n();
/**查询参数 */ /**查询参数 */
@@ -292,6 +294,20 @@ function fnFileModalOk() {
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
fnType fnType
.then(res => { .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) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
content: t('common.msgSuccess', { msg: fileModalState.title }), content: t('common.msgSuccess', { msg: fileModalState.title }),
@@ -403,8 +419,12 @@ function fnGetList(pageNum?: number) {
} }
tablePagination.total = res.total; tablePagination.total = res.total;
tableState.data = res.rows; tableState.data = res.rows;
if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) { if (
debugger tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
debugger;
tableState.loading = false; tableState.loading = false;
fnGetList(queryParams.pageNum - 1); fnGetList(queryParams.pageNum - 1);