no message
This commit is contained in:
parent
a82b513755
commit
704454a759
|
|
@ -99,9 +99,38 @@
|
||||||
|
|
||||||
function submitHandler() {
|
function submitHandler() {
|
||||||
if ($.validate.form()) {
|
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() {
|
function selectDeptTree() {
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,29 @@
|
||||||
|
|
||||||
function remove(id) {
|
function remove(id) {
|
||||||
$.modal.confirm("确认要删除吗", function () {
|
$.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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -119,10 +119,36 @@
|
||||||
var data = $("#form-dept-edit").serializeArray();
|
var data = $("#form-dept-edit").serializeArray();
|
||||||
var insuranceIds = $.form.selectCheckeds("insurance");
|
var insuranceIds = $.form.selectCheckeds("insurance");
|
||||||
data.push({"name": "insuranceIds", "value": insuranceIds});
|
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() {
|
function selectDeptTree() {
|
||||||
var treeId = $("#treeId").val();
|
var treeId = $("#treeId").val();
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@
|
||||||
<div id="tree" class="ztree"></div>
|
<div id="tree" class="ztree"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<!-- <div class="form-group">
|
||||||
<div class="form-control-static col-sm-offset-9">
|
<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>
|
<button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>
|
||||||
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭</button>
|
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue