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 @@