no message

This commit is contained in:
cb 2025-06-20 17:08:54 +08:00
parent a82b513755
commit 704454a759
4 changed files with 82 additions and 6 deletions

View File

@ -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() {

View File

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

View File

@ -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();

View File

@ -23,12 +23,12 @@
<div id="tree" class="ztree"></div>
</div>
</div>
<div class="form-group">
<!-- <div class="form-group">
<div class="form-control-static col-sm-offset-9">
<button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭</button>
</div>
</div>
</div> -->
</form>
</div>
<th:block th:include="include :: footer" />