方法抽取
parent
05696d812d
commit
bb90a65d2b
|
|
@ -63,7 +63,7 @@
|
||||||
}).extend({
|
}).extend({
|
||||||
okLayer: "okLayer/okLayer",
|
okLayer: "okLayer/okLayer",
|
||||||
okUtils: "okUtils/okUtils"
|
okUtils: "okUtils/okUtils"
|
||||||
}).use(["element", "table", "form", "jquery", "laydate", "okLayer", "okUtils"], function () {
|
}).use(["element", "table", "form", "laydate", "okLayer", "okUtils"], function () {
|
||||||
var table = layui.table;
|
var table = layui.table;
|
||||||
var form = layui.form;
|
var form = layui.form;
|
||||||
var $ = layui.jquery;
|
var $ = layui.jquery;
|
||||||
|
|
@ -108,18 +108,9 @@
|
||||||
var data = obj.data;
|
var data = obj.data;
|
||||||
var layEvent = obj.event;
|
var layEvent = obj.event;
|
||||||
if (layEvent === "edit") {
|
if (layEvent === "edit") {
|
||||||
okLayer.open("编辑用户", "user-edit.html", "90%", "90%", function () {
|
edit(data.id)
|
||||||
$(".layui-laypage-btn")[0].click();
|
|
||||||
})
|
|
||||||
} else if (layEvent === "del") {
|
} else if (layEvent === "del") {
|
||||||
okLayer.confirm("确定要删除吗?", function () {
|
del(data.id);
|
||||||
okUtils.ajax("/user/batchDel", "post", {idsStr: data.id}).done(function (response) {
|
|
||||||
console.log(response)
|
|
||||||
okUtils.table.operationSuccessMsg("删除成功");
|
|
||||||
}).fail(function (error) {
|
|
||||||
console.log(error)
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -175,6 +166,23 @@
|
||||||
$(".layui-laypage-btn")[0].click();
|
$(".layui-laypage-btn")[0].click();
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function edit (id) {
|
||||||
|
okLayer.open("编辑用户", "user-edit.html?id=" + id, "90%", "90%", function () {
|
||||||
|
$(".layui-laypage-btn")[0].click();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function del (id) {
|
||||||
|
okLayer.confirm("确定要删除吗?", function () {
|
||||||
|
okUtils.ajax("/user/batchDel", "post", {idsStr: id}).done(function (response) {
|
||||||
|
console.log(response)
|
||||||
|
okUtils.table.operationSuccessMsg("删除成功");
|
||||||
|
}).fail(function (error) {
|
||||||
|
console.log(error)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<!--模板-->
|
<!--模板-->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue