fix(asset): 修复资产借用页面操作反馈和错误处理

- 统一使用双等号进行状态码比较
- 优化成功操作后的页面刷新逻辑,添加延时确保数据同步
- 增加警告状态的处理分支
- 添加 AJAX 请求错误处理机制
- 实现安全的借用列表刷新函数,避免跨窗口访问异常
- 添加控制台警告日志用于调试目的
main
yangk 1 week ago
parent 106cf48305
commit d98a5046be

@ -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);
}
}
}
</script>
</body>
</html>

Loading…
Cancel
Save