From 7a260ee14386ab4883666487f904b5621de03856 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Wed, 7 Oct 2026 08:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E5=85=B3=E6=8E=89=E5=90=8E?= =?UTF-8?q?=E5=86=8D=E7=82=B9=E4=B8=8D=E5=BC=80=E4=BB=A5=E5=8F=8A=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E9=AB=98=E5=BA=A6=E7=BB=9F=E4=B8=80=E6=94=B6=E5=8F=A3?= =?UTF-8?q?=20(#3388)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 统一管理后台弹框更舒展 把 CustomDialog 默认宽度从 600 加到 720,正文给到至少 360 的高度, 默认弹框就不再显得局促。参数编辑弹框也跟着加宽。智能体历史版 本那条列表、对比和恢复预览都给到至少 420 的最小高度,避免内容 少时框太矮看起来小气。其他像添加智能体、绑定设备这些原本就合适 的弹框没动。 * 弹框外观统一收口 原本几个弹框长得参差不齐:标题字号、按钮文案、留白高度各管各的。这次把新建智能体、新建设备、改模型、改参数这几个弹框接到同一个底座上,按钮统一成「确定」「取消」,输入框字号高度对齐,遮罩背景加了模糊,弹框太高就内部滚动,四个弹框看起来一个模子 * 修复弹框关掉后再点不开 之前几个弹框改用新底座的时候,关闭那一路少了一段转发:父页面用双向绑定来收弹框关闭的信号,子页面应该再把关闭事件抛上去告诉父页面。这一段被删了,下次再点添加按钮时父页面那边状态没复位,弹框就拉不开来。现在把这段补回去。 * 弹框宽度和高度统一收口 同一批弹框的尺寸还是各管各的:模型配置里改参数那个是跟着窗口大小按比例伸缩,历史提示词的源编辑弹框是 900 像素,参数管理里又是 720 像素,智能体变更详情那个上下还留了一大块空白。这次收到同一个共用底子上:宽度都对齐到 720 像素,弹框默认上下贴齐屏幕边、内容多时中间滚动,变更详情那个高度撑到接近屏幕顶到底。 * 管理后台弹框按大小分类统一外观 管理后台里的弹框按大小分成两类来收口。占整页的大弹框(历史版本、变更详情、模型修改、模型参数修正等)撑满整个浏览器高度,下面不再留白;小弹框(添加智能体、添加设备、知识库、字典、角色模板等)改成对齐屏幕正中,不再顶在屏幕上沿。修改模型那条弹框也加宽到 960,左右留白加大到 40,跟历史版本对齐,看起来更舒展。 * 大弹框上下留白收口到十像素并按三档统一宽度 大弹框上下各留十像素让边框和圆角清晰可见。宽度按用途分三档:表单 960、含代码 1080、表格 80% 加宽度上限。供应器、上下文供应器、音色克隆都改 960;TTS 从 90% 改 80%;角色模板从 1200 改 1080;缓存查看从 70% 改 80%。新增模板的大文本框改成自适应高度。 * 弹框样式与文案收口处理 AddDeviceDialog 确认后关闭弹框;CustomDialog 去掉 :global 与紧邻选择器,合并 el-dialog__body 样式块;删除未使用的 --dialog-form/--dialog-code;AddWisdomBodyDialog 的 cancel/handleClose 委托到同一个实现;多语言文案同步去冒号与双点。 * 弹框遮罩样式移到全局作用域 scoped 块里的 ::v-deep .v-modal 打不到 body 层的遮罩,改在 global.scss 用全局选择器。 * 弹框 wrapper 居中样式移到全局作用域 scoped 块里的 ::v-deep .el-dialog__wrapper 同样打不到 element-ui 自渲染的 wrapper,跟 .v-modal 一起挪到 global.scss。 * 弹框提交状态异常收口 设备激活码错误路径不再卡 loading;Provider 与固件弹框补 loading 兜底。 * 弹框视觉异常收口 首页删除确认弹框 wrapper 居中;历史版本弹框去掉内层多余滚动条。 * 设备 API 链式返回修复 bindDevice 等方法补上 return,让 .fail() 兜底回调能正常注册到请求对象上。 * 设备 API 错误回调参数补全 device.js 六个方法加 failCallback 参数;user.js login 网络重试补 failCallback;AddDeviceDialog 改四参数签名。 * 设备状态 API 失败回调引用修复 getDeviceStatus 的 .fail() 块把函数体内 callback(res) 改成与签名一致的 if (failCallback) failCallback(err),避免业务错误时抛 ReferenceError。 --- main/manager-web/src/apis/module/device.js | 63 +++-- main/manager-web/src/apis/module/user.js | 2 +- .../src/components/AddDeviceDialog.vue | 121 +++++----- .../src/components/AddModelDialog.vue | 3 +- .../src/components/AddWisdomBodyDialog.vue | 115 ++++----- .../src/components/AgentSnapshotDialog.vue | 18 +- .../src/components/CacheViewer.vue | 22 +- .../src/components/ChatHistoryDialog.vue | 1 + .../src/components/ContextProviderDialog.vue | 45 ++-- .../src/components/CustomDialog.vue | 226 ++++++++++-------- .../src/components/FirmwareDialog.vue | 4 + .../src/components/ModelEditDialog.vue | 27 +-- .../src/components/ParamDialog.vue | 40 +--- .../src/components/ProviderDialog.vue | 8 +- main/manager-web/src/components/TtsModel.vue | 2 +- .../src/components/VoiceCloneDialog.vue | 3 +- main/manager-web/src/i18n/de.js | 6 +- main/manager-web/src/i18n/en.js | 6 +- main/manager-web/src/i18n/pt_BR.js | 6 +- main/manager-web/src/i18n/vi.js | 6 +- main/manager-web/src/i18n/zh_CN.js | 6 +- main/manager-web/src/i18n/zh_TW.js | 6 +- main/manager-web/src/styles/global.scss | 27 +++ .../src/views/AgentTemplateManagement.vue | 5 +- main/manager-web/src/views/OtaManagement.vue | 4 +- .../src/views/ProviderManagement.vue | 18 +- 26 files changed, 449 insertions(+), 341 deletions(-) diff --git a/main/manager-web/src/apis/module/device.js b/main/manager-web/src/apis/module/device.js index b4db9a34a..4b250ad3b 100644 --- a/main/manager-web/src/apis/module/device.js +++ b/main/manager-web/src/apis/module/device.js @@ -3,7 +3,7 @@ import RequestService from '../httpRequest'; export default { // 已绑设备 - getAgentBindDevices(agentId, callback) { + getAgentBindDevices(agentId, callback, failCallback) { RequestService.sendRequest() .url(`${getServiceUrl()}/device/bind/${agentId}`) .method('GET') @@ -11,15 +11,21 @@ export default { RequestService.clearRequestTime(); callback(res); }) + .fail((err) => { + RequestService.clearRequestTime(); + if (failCallback) { + failCallback(err); + } + }) .networkFail((err) => { console.error('获取设备列表失败:', err); RequestService.reAjaxFun(() => { - this.getAgentBindDevices(agentId, callback); + this.getAgentBindDevices(agentId, callback, failCallback); }); }).send(); }, // 解绑设备 - unbindDevice(device_id, callback) { + unbindDevice(device_id, callback, failCallback) { RequestService.sendRequest() .url(`${getServiceUrl()}/device/unbind`) .method('POST') @@ -28,15 +34,21 @@ export default { RequestService.clearRequestTime(); callback(res); }) + .fail((err) => { + RequestService.clearRequestTime(); + if (failCallback) { + failCallback(err); + } + }) .networkFail((err) => { console.error('解绑设备失败:', err); RequestService.reAjaxFun(() => { - this.unbindDevice(device_id, callback); + this.unbindDevice(device_id, callback, failCallback); }); }).send(); }, // 绑定设备 - bindDevice(agentId, deviceCode, callback) { + bindDevice(agentId, deviceCode, callback, failCallback) { RequestService.sendRequest() .url(`${getServiceUrl()}/device/bind/${agentId}/${deviceCode}`) .method('POST') @@ -44,14 +56,20 @@ export default { RequestService.clearRequestTime(); callback(res); }) + .fail((err) => { + RequestService.clearRequestTime(); + if (failCallback) { + failCallback(err); + } + }) .networkFail((err) => { console.error('绑定设备失败:', err); RequestService.reAjaxFun(() => { - this.bindDevice(agentId, deviceCode, callback); + this.bindDevice(agentId, deviceCode, callback, failCallback); }); }).send(); }, - updateDeviceInfo(id, payload, callback) { + updateDeviceInfo(id, payload, callback, failCallback) { RequestService.sendRequest() .url(`${getServiceUrl()}/device/update/${id}`) .method('PUT') @@ -60,16 +78,22 @@ export default { RequestService.clearRequestTime() callback(res) }) + .fail((err) => { + RequestService.clearRequestTime(); + if (failCallback) { + failCallback(err); + } + }) .networkFail((err) => { console.error('更新OTA状态失败:', err) this.$message.error(err.msg || '更新OTA状态失败') RequestService.reAjaxFun(() => { - this.updateDeviceInfo(id, payload, callback) + this.updateDeviceInfo(id, payload, callback, failCallback) }) }).send() }, // 手动添加设备 - manualAddDevice(params, callback) { + manualAddDevice(params, callback, failCallback) { RequestService.sendRequest() .url(`${getServiceUrl()}/device/manual-add`) .method('POST') @@ -78,15 +102,21 @@ export default { RequestService.clearRequestTime(); callback(res); }) + .fail((err) => { + RequestService.clearRequestTime(); + if (failCallback) { + failCallback(err); + } + }) .networkFail((err) => { console.error('手动添加设备失败:', err); RequestService.reAjaxFun(() => { - this.manualAddDevice(params, callback); + this.manualAddDevice(params, callback, failCallback); }); }).send(); }, // 获取设备状态 - getDeviceStatus(agentId, callback) { + getDeviceStatus(agentId, callback, failCallback) { RequestService.sendRequest() .url(`${getServiceUrl()}/device/bind/${agentId}`) .method('POST') @@ -95,14 +125,17 @@ export default { RequestService.clearRequestTime(); callback(res); }) - .fail((res) => { - callback(res); + .fail((err) => { + RequestService.clearRequestTime(); + if (failCallback) { + failCallback(err); + } }) .networkFail((err) => { console.error('获取设备状态失败:', err); RequestService.reAjaxFun(() => { - this.getDeviceStatus(agentId, callback); + this.getDeviceStatus(agentId, callback, failCallback); }); }).send(); }, -} \ No newline at end of file +} diff --git a/main/manager-web/src/apis/module/user.js b/main/manager-web/src/apis/module/user.js index 39f07077e..33730cd5c 100755 --- a/main/manager-web/src/apis/module/user.js +++ b/main/manager-web/src/apis/module/user.js @@ -19,7 +19,7 @@ export default { }) .networkFail(() => { RequestService.reAjaxFun(() => { - this.login(loginForm, callback) + this.login(loginForm, callback, failCallback) }) }).send() }, diff --git a/main/manager-web/src/components/AddDeviceDialog.vue b/main/manager-web/src/components/AddDeviceDialog.vue index 29b9cf305..142979f11 100644 --- a/main/manager-web/src/components/AddDeviceDialog.vue +++ b/main/manager-web/src/components/AddDeviceDialog.vue @@ -1,39 +1,37 @@ \ No newline at end of file diff --git a/main/manager-web/src/components/AddModelDialog.vue b/main/manager-web/src/components/AddModelDialog.vue index b33148021..c9e91a669 100644 --- a/main/manager-web/src/components/AddModelDialog.vue +++ b/main/manager-web/src/components/AddModelDialog.vue @@ -2,7 +2,8 @@ - -
-
- + +
+
+ * + {{ $t('addAgentDialog.agentName') }}
- {{ $t('addAgentDialog.title') }} +
-
-
-
-
*
{{ $t('addAgentDialog.agentName') }}: -
-
- -
-
-
-
- {{ $t('addAgentDialog.confirm') }} -
-
- {{ $t('addAgentDialog.cancel') }} -
-
- + \ No newline at end of file diff --git a/main/manager-web/src/components/AgentSnapshotDialog.vue b/main/manager-web/src/components/AgentSnapshotDialog.vue index 26710036c..b89ad404d 100644 --- a/main/manager-web/src/components/AgentSnapshotDialog.vue +++ b/main/manager-web/src/components/AgentSnapshotDialog.vue @@ -2115,17 +2115,18 @@ export default { display: flex; flex-direction: column; overflow: hidden; - margin: 32px auto !important; + margin: 10px auto !important; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); - max-height: calc(100vh - 64px); + height: calc(100vh - 20px); + max-height: calc(100vh - 20px); } ::v-deep .el-dialog__wrapper { display: flex; - align-items: center; + align-items: stretch; justify-content: center; - overflow: auto; + overflow: hidden; } ::v-deep .el-dialog__header { @@ -2282,9 +2283,7 @@ export default { } .snapshot-table-wrapper { - max-height: 62vh; - overflow: auto; - @include scrollbar-style; + min-height: 420px; } .version-cell { @@ -2328,11 +2327,8 @@ export default { } .snapshot-diff { - min-height: 220px; - max-height: 68vh; - overflow: auto; + min-height: 420px; padding-right: 2px; - @include scrollbar-style; } .restore-risk-alert { diff --git a/main/manager-web/src/components/CacheViewer.vue b/main/manager-web/src/components/CacheViewer.vue index 5bd234e0a..fa4873ae8 100644 --- a/main/manager-web/src/components/CacheViewer.vue +++ b/main/manager-web/src/components/CacheViewer.vue @@ -2,7 +2,7 @@
@@ -204,4 +204,24 @@ h3 { margin-bottom: 10px; font-weight: 500; } + +::v-deep .el-dialog { + margin: 10px auto !important; + height: calc(100vh - 20px); + max-height: calc(100vh - 20px); + border-radius: 10px; + display: flex; + flex-direction: column; + max-width: 1280px; +} + +::v-deep .el-dialog__wrapper { + align-items: stretch; +} + +::v-deep .el-dialog__body { + flex: 1; + max-height: calc(100vh - 20px - 130px); + overflow-y: auto; +} \ No newline at end of file diff --git a/main/manager-web/src/components/ChatHistoryDialog.vue b/main/manager-web/src/components/ChatHistoryDialog.vue index 2846b97d7..a8eab2142 100644 --- a/main/manager-web/src/components/ChatHistoryDialog.vue +++ b/main/manager-web/src/components/ChatHistoryDialog.vue @@ -3,6 +3,7 @@ :title="$t('chatHistory.with') + agentName + $t('chatHistory.dialogTitle')" :visible.sync="dialogVisible" width="80%" + size="large" :footer="false" :close-on-click-modal="false" custom-class="chat-history-dialog"> diff --git a/main/manager-web/src/components/ContextProviderDialog.vue b/main/manager-web/src/components/ContextProviderDialog.vue index 84eae4a92..9c6edf5c6 100644 --- a/main/manager-web/src/components/ContextProviderDialog.vue +++ b/main/manager-web/src/components/ContextProviderDialog.vue @@ -1,11 +1,14 @@ + diff --git a/main/manager-web/src/components/CustomDialog.vue b/main/manager-web/src/components/CustomDialog.vue index 429b21a3a..6c91b1350 100644 --- a/main/manager-web/src/components/CustomDialog.vue +++ b/main/manager-web/src/components/CustomDialog.vue @@ -7,7 +7,7 @@ :close-on-press-escape="closeOnPressEscape" :show-close="showClose" :destroy-on-close="destroyOnClose" - :custom-class="customClass" + :custom-class="dialogCustomClass" class="custom-dialog" @close="handleClose" @open="handleOpen" @@ -54,7 +54,7 @@ export default { }, width: { type: String, - default: "600px" + default: "720px" }, footer: { type: Boolean, @@ -80,6 +80,11 @@ export default { type: String, default: "" }, + size: { + type: String, + default: "small", + validator: (val) => ["small", "large"].includes(val), + }, cancelText: { type: String, default: "取消" @@ -94,6 +99,15 @@ export default { dialogVisible: this.visible }; }, + computed: { + dialogCustomClass() { + const classes = ["custom-dialog"]; + if (this.customClass) classes.push(this.customClass); + if (this.size === "large") classes.push("custom-dialog--large"); + if (String(this.width).includes("%")) classes.push("custom-dialog--fluid"); + return classes.join(" "); + }, + }, components: { CustomButton }, @@ -124,110 +138,134 @@ export default { diff --git a/main/manager-web/src/components/FirmwareDialog.vue b/main/manager-web/src/components/FirmwareDialog.vue index fab04124f..d73b318bb 100644 --- a/main/manager-web/src/components/FirmwareDialog.vue +++ b/main/manager-web/src/components/FirmwareDialog.vue @@ -111,6 +111,10 @@ export default { this.saving = true // 提交成功后将关闭对话框的逻辑交给父组件处理 this.$emit('submit', this.form) + // 兜底:父组件若未在回调内重置 saving,3 秒后强制释放加载状态 + setTimeout(() => { + this.saving = false + }, 3000) } }) }, diff --git a/main/manager-web/src/components/ModelEditDialog.vue b/main/manager-web/src/components/ModelEditDialog.vue index ac6b18e39..adf193759 100644 --- a/main/manager-web/src/components/ModelEditDialog.vue +++ b/main/manager-web/src/components/ModelEditDialog.vue @@ -2,14 +2,14 @@ -
{{ $t("modelConfigDialog.modelInfo") }}
@@ -93,7 +93,6 @@
-
@@ -466,19 +465,16 @@ export default { diff --git a/main/manager-web/src/components/ParamDialog.vue b/main/manager-web/src/components/ParamDialog.vue index 0f6de8d7f..bd5ef776f 100644 --- a/main/manager-web/src/components/ParamDialog.vue +++ b/main/manager-web/src/components/ParamDialog.vue @@ -2,11 +2,13 @@
@@ -147,6 +149,7 @@ export default { cancel() { this.saving = false; // 取消时重置状态 this.dialogKey = Date.now(); + this.$emit('update:visible', false); this.$emit('cancel'); }, @@ -183,36 +186,19 @@ export default { }; - - diff --git a/main/manager-web/src/components/ProviderDialog.vue b/main/manager-web/src/components/ProviderDialog.vue index 713aefd34..5cb03db9b 100644 --- a/main/manager-web/src/components/ProviderDialog.vue +++ b/main/manager-web/src/components/ProviderDialog.vue @@ -2,7 +2,8 @@ { + this.saving = false; + }, 3000); } }); }, diff --git a/main/manager-web/src/components/TtsModel.vue b/main/manager-web/src/components/TtsModel.vue index 6a33f289e..73cd6e480 100644 --- a/main/manager-web/src/components/TtsModel.vue +++ b/main/manager-web/src/components/TtsModel.vue @@ -1,5 +1,5 @@