From 704454a759168d826138c01228d13c8aa91b71d3 Mon Sep 17 00:00:00 2001 From: cb <275647614@qq.com> Date: Fri, 20 Jun 2025 17:08:54 +0800 Subject: [PATCH] no message --- .../templates/goods/category/add.html | 31 ++++++++++++++++++- .../templates/goods/category/category.html | 25 +++++++++++++-- .../templates/goods/category/edit.html | 28 ++++++++++++++++- .../templates/goods/category/serviceTree.html | 4 +-- 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/ghy-admin/src/main/resources/templates/goods/category/add.html b/ghy-admin/src/main/resources/templates/goods/category/add.html index 8d755459..d1ba6edb 100644 --- a/ghy-admin/src/main/resources/templates/goods/category/add.html +++ b/ghy-admin/src/main/resources/templates/goods/category/add.html @@ -99,9 +99,38 @@ function submitHandler() { if ($.validate.form()) { - $.operate.save(prefix + "/add", $('#form-dept-add').serialize()); + // 方法一:使用saveModal,新增成功后不刷新表格,只显示提示信息 + //$.operate.saveModal(prefix + "/add", $('#form-dept-add').serialize()); + + // 方法二:使用自定义Ajax保存(如果需要更多控制) + customSave(); } } + + // 自定义保存方法(可选) + function customSave() { + $.ajax({ + url: prefix + "/add", + type: "post", + dataType: "json", + data: $('#form-dept-add').serialize(), + beforeSend: function () { + $.modal.loading("正在处理中,请稍候..."); + }, + success: function(result) { + $.modal.closeLoading(); + if (result.code == web_status.SUCCESS) { + $.modal.alertSuccess(result.msg); + // 如果需要关闭窗口,取消注释下面这行 + $.modal.close(); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg); + } else { + $.modal.alertError(result.msg); + } + } + }); + } /*部门管理-新增-选择父部门树*/ function selectDeptTree() { diff --git a/ghy-admin/src/main/resources/templates/goods/category/category.html b/ghy-admin/src/main/resources/templates/goods/category/category.html index 2fe6b30e..d6c57e6f 100644 --- a/ghy-admin/src/main/resources/templates/goods/category/category.html +++ b/ghy-admin/src/main/resources/templates/goods/category/category.html @@ -124,8 +124,29 @@ function remove(id) { $.modal.confirm("确认要删除吗", function () { - $.operate.post(prefix + '/remove/' + id); - }) + customRemove(id); + }); + } + + function customRemove(id) { + $.ajax({ + url: prefix + '/remove/' + id, + type: "post", + dataType: "json", + beforeSend: function () { + $.modal.loading("正在处理中,请稍候..."); + }, + success: function(result) { + $.modal.closeLoading(); + if (result.code == web_status.SUCCESS) { + $.modal.alertSuccess(result.msg); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg); + } else { + $.modal.alertError(result.msg); + } + } + }); } diff --git a/ghy-admin/src/main/resources/templates/goods/category/edit.html b/ghy-admin/src/main/resources/templates/goods/category/edit.html index e234651a..ee23e670 100644 --- a/ghy-admin/src/main/resources/templates/goods/category/edit.html +++ b/ghy-admin/src/main/resources/templates/goods/category/edit.html @@ -119,10 +119,36 @@ var data = $("#form-dept-edit").serializeArray(); var insuranceIds = $.form.selectCheckeds("insurance"); data.push({"name": "insuranceIds", "value": insuranceIds}); - $.operate.save(prefix + "/edit", data); + + // 自定义保存,不刷新表格 + customEditSave(data); } } + // 自定义编辑保存方法 + function customEditSave(data) { + $.ajax({ + url: prefix + "/edit", + type: "post", + dataType: "json", + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍候..."); + }, + success: function(result) { + $.modal.closeLoading(); + if (result.code == web_status.SUCCESS) { + $.modal.alertSuccess(result.msg); + $.modal.close(); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg); + } else { + $.modal.alertError(result.msg); + } + } + }); + } + /*部门管理-修改-选择部门树*/ function selectDeptTree() { var treeId = $("#treeId").val(); diff --git a/ghy-admin/src/main/resources/templates/goods/category/serviceTree.html b/ghy-admin/src/main/resources/templates/goods/category/serviceTree.html index 434924a0..40e02518 100644 --- a/ghy-admin/src/main/resources/templates/goods/category/serviceTree.html +++ b/ghy-admin/src/main/resources/templates/goods/category/serviceTree.html @@ -23,12 +23,12 @@
-
+