ok-admin/lib/layui_plugins/okLayer/okLayer.js

65 lines
2.1 KiB
JavaScript
Raw Normal View History

2019-05-12 08:15:57 +00:00
layui.define(["layer"], function (exports) {
2019-05-12 11:09:10 +00:00
var $ = layui.jquery;
2019-05-12 08:15:57 +00:00
var okLayer = {
2019-05-12 11:43:52 +00:00
skinStyle: 2,
animStyle: 2,
2019-05-12 08:57:14 +00:00
tableCheck: function (table) {
var checkStatus = table.checkStatus("tableId");
var rows = checkStatus.data.length;
if (rows > 0) {
var idsStr = "";
for (var i = 0; i < checkStatus.data.length; i++) {
idsStr += checkStatus.data[i].id + ",";
}
return idsStr;
} else {
layer.msg("未选择有效数据", {offset: "t", anim: 6});
}
},
2019-05-12 11:09:10 +00:00
tableOperationMsg: function (content) {
layer.msg(content, {icon: 1, time: 1000}, function () {
$(".layui-laypage-btn")[0].click();
});
2019-05-12 11:22:05 +00:00
},
2019-05-12 11:43:52 +00:00
confirm: function (content, yesFunction) {
var options = {skin: okLayer.skinChoose(), icon: 2, title: "提示", anim: okLayer.animChoose()};
layer.confirm(content, options, yesFunction);
},
2019-05-13 00:45:45 +00:00
open: function (title, content, width, height, isRefreshTable) {
2019-05-12 11:22:05 +00:00
layer.open({
title: title,
type: 2,
shade: false,
maxmin: true,
shade: 0.5,
2019-05-12 11:43:52 +00:00
anim: okLayer.animChoose(),
2019-05-12 11:22:05 +00:00
area: [width, height],
content: content,
zIndex: layer.zIndex,
2019-05-12 11:43:52 +00:00
skin: okLayer.skinChoose(),
2019-05-12 11:22:05 +00:00
end: function () {
2019-05-13 00:45:45 +00:00
if (isRefreshTable) {
$(".layui-laypage-btn")[0].click();
}
2019-05-12 11:22:05 +00:00
}
});
2019-05-12 11:43:52 +00:00
},
skinChoose: function () {
if (okLayer.skinStyle == 1) {
return "layui-layer-lan";
} else if (okLayer.skinStyle == 2) {
return "layui-layer-molv";
}
},
animChoose: function () {
if (okLayer.animStyle == 1) {
return 0;
} else if (okLayer.animStyle == 2) {
return Math.floor(Math.random() * 7);
}
2019-05-12 08:15:57 +00:00
}
}
exports("okLayer", okLayer);
});