From d98a5046be3f69fbaa9bd02168980eac7b362a3e Mon Sep 17 00:00:00 2001 From: yangk Date: Wed, 17 Jun 2026 16:10:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(asset):=20=E4=BF=AE=E5=A4=8D=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E5=80=9F=E7=94=A8=E9=A1=B5=E9=9D=A2=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E5=92=8C=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 统一使用双等号进行状态码比较 - 优化成功操作后的页面刷新逻辑,添加延时确保数据同步 - 增加警告状态的处理分支 - 添加 AJAX 请求错误处理机制 - 实现安全的借用列表刷新函数,避免跨窗口访问异常 - 添加控制台警告日志用于调试目的 --- .../templates/asset/borrow/view.html | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/ruoyi-asset/src/main/resources/templates/asset/borrow/view.html b/ruoyi-asset/src/main/resources/templates/asset/borrow/view.html index 89da276..1e6e7db 100644 --- a/ruoyi-asset/src/main/resources/templates/asset/borrow/view.html +++ b/ruoyi-asset/src/main/resources/templates/asset/borrow/view.html @@ -206,18 +206,43 @@ $.modal.closeLoading(); }, success: function(result) { - if (result.code === web_status.SUCCESS) { + $.modal.closeLoading(); + if (result.code == web_status.SUCCESS) { $.modal.msgSuccess(result.msg); - if (parent && parent.$ && parent.$.table) { - parent.$.table.refresh(); - } - window.location.reload(); + refreshBorrowListQuietly(); + setTimeout(function() { + window.location.reload(); + }, 200); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg); } else { $.modal.alertError(result.msg); } + }, + error: function(xhr) { + $.modal.closeLoading(); + $.modal.alertError(xhr.responseJSON && xhr.responseJSON.msg + ? xhr.responseJSON.msg : "操作请求失败,请刷新页面后重试"); } }); } + + function refreshBorrowListQuietly() { + try { + if (typeof activeWindow !== "function") { + return; + } + var listWindow = activeWindow(); + if (listWindow && listWindow.$ && listWindow.table + && listWindow.table.options && listWindow.table.options.type !== undefined) { + listWindow.$.table.refresh(); + } + } catch (e) { + if (window.console) { + console.warn("刷新借用列表失败", e); + } + } + }