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); + } + } + }