From 8b5a7d28b8914e7864f8ab3515c38c9d544b669a Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Thu, 7 May 2026 17:15:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8C=BA=E6=9C=8D=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=B7=E6=96=B0=E6=8C=89=E9=92=AE=EF=BC=9B2.?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=88=97=E8=A1=A8UI=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B3.=E9=82=AE=E4=BB=B6=E5=88=97=E8=A1=A8UI=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dashboard/serverList/index.vue | 93 ++++++++++++------- apps/web-antd/src/views/language/language.vue | 15 ++- .../src/views/operation/mail/mail-table.vue | 4 +- 3 files changed, 77 insertions(+), 35 deletions(-) diff --git a/apps/web-antd/src/views/dashboard/serverList/index.vue b/apps/web-antd/src/views/dashboard/serverList/index.vue index eb40f69..9800f8a 100644 --- a/apps/web-antd/src/views/dashboard/serverList/index.vue +++ b/apps/web-antd/src/views/dashboard/serverList/index.vue @@ -12,6 +12,7 @@ import { AccessControl } from '@vben/access'; import dayjs from 'dayjs'; import { $t } from '#/locales' const appId = ref(1); +const refreshCurrentAppLoading = ref(false); const [BaseForm, BaseFormApi] = useVbenForm({ // 所有表单项共用,可单独在表单内覆盖 commonConfig: { @@ -103,28 +104,63 @@ const appList = ref([]); const ServerList = ref([]); const reload = ref(false); const reloadReview = ref(false); + +async function syncCurrentAppInfo(selectedAppId?: number) { + const response = await getAppListApi(); + appList.value = Array.isArray(response) ? response : []; + const targetAppId = selectedAppId ?? appId.value ?? appList.value[0]?.AppId; + const app = appList.value.find((item) => item.AppId === targetAppId) ?? appList.value[0]; + if (!app) { + ServerList.value = []; + return; + } + + appId.value = app.AppId; + BaseFormApi.updateSchema([ + { + component: 'Select', + componentProps: { + options: appList.value.map((item) => ({ + label: $t('page.server.' + item.AppName), + value: item.AppId, + })), + }, + fieldName: 'fieldOptions', + }, + ]); + BaseFormApi.setFieldValue('fieldOptions', app.AppId); + BaseFormApi.setFieldValue( + 'update', + dayjs((app.Update ?? 0) * 1000).format('YYYY-MM-DD HH:mm:ss'), + ); + const serverResponse = await getServerListApi({ AppId: app.AppId }); + ServerList.value = Array.isArray(serverResponse) ? serverResponse : []; +} + +async function refreshCurrentAppInfo(showSuccess = true) { + refreshCurrentAppLoading.value = true; + try { + const value = await BaseFormApi.getValues(); + await syncCurrentAppInfo(value.fieldOptions); + if (showSuccess) { + notification.success({ + duration: 5, + message: '当前APP信息已刷新', + }); + } + } catch (error) { + notification.error({ + duration: 5, + message: '刷新当前APP信息失败', + }); + } finally { + refreshCurrentAppLoading.value = false; + } +} + onMounted(async () => { try { - const response = await getAppListApi(); - appList.value = Array.isArray(response) ? response : []; - const app = appList.value[0]; - if (!app) return; - const updateTime = dayjs((app.Update ?? 0) * 1000).format('YYYY-MM-DD HH:mm:ss') - BaseFormApi.setFieldValue("update", updateTime) - BaseFormApi.updateSchema([ - { - component: 'Select', - componentProps: { - options: appList.value.map((item) => ({ - label: $t('page.server.' + item.AppName), - value: item.AppId, - })), - }, - fieldName: 'fieldOptions', - }, - ]); - const serverResponse = await getServerListApi({ AppId: app.AppId }); - ServerList.value = Array.isArray(serverResponse) ? serverResponse : []; + await syncCurrentAppInfo(); // setInterval(async () => { // const serverResponse = await getServerListApi({ AppId: appId.value }); // ServerList.value = Array.isArray(serverResponse) ? serverResponse : []; @@ -181,12 +217,7 @@ async function update() { duration: 10, message: "服务器更新成功" }) - const response = await getAppListApi(); - appList.value = Array.isArray(response) ? response : []; - const app = appList.value.find((item) => item.AppId === Value.fieldOptions); - if (!app) return; - const updateTime = dayjs((app.Update ?? 0) * 1000).format('YYYY-MM-DD HH:mm:ss') - BaseFormApi.setFieldValue("update", updateTime) + await syncCurrentAppInfo(Value.fieldOptions); } catch (e) { reload.value = false; notification.error({ @@ -206,12 +237,7 @@ async function updateReview() { duration: 10, message: "服务器更新成功" }) - const response = await getAppListApi(); - appList.value = Array.isArray(response) ? response : []; - const app = appList.value.find((item) => item.AppId === Value.fieldOptions); - if (!app) return; - const updateTime = dayjs((app.Update ?? 0) * 1000).format('YYYY-MM-DD HH:mm:ss') - BaseFormApi.setFieldValue("update", updateTime) + await syncCurrentAppInfo(Value.fieldOptions); } catch (e) { reloadReview.value = false; notification.error({ @@ -231,6 +257,9 @@ async function updateReview() { + diff --git a/apps/web-antd/src/views/language/language.vue b/apps/web-antd/src/views/language/language.vue index f9f6c25..11cdabe 100644 --- a/apps/web-antd/src/views/language/language.vue +++ b/apps/web-antd/src/views/language/language.vue @@ -583,6 +583,19 @@ function characterLimitColor(row: languageType, columnName : string) {