/*! layer弹层组件拓展类 */
;!function () {
layer.use("skin/layer.ext.css", function () {
layer.layui_layer_extendlayerextjs = !0
});
var a = layer.cache || {}, b = function (b) {
return a.skin ? " " + a.skin + " " + a.skin + "-" + b : ""
};
layer.prompt = function (a, c) {
a = a || {}, "function" == typeof a && (c = a);
var d,
e = 2 == a.formType ? '" : function () {
return ''
}();
return layer.open($.extend({
type:1,
btn: ["确定", "取消"],
content: "
"+ e +"
",
skin: "layui-layer-prompt" + b("prompt"),
success: function (a) {
d = a.find(".layui-layer-input"), d.focus()
},
yes: function (b) {
var e = d.val();
"" === e ? d.focus() : 0 > (a.maxlength || 500) ? layer.tips("最多输入" + (a.maxlength || 500) + "个字数", d, {tips: 1}) : c && c(e, b, d)
}
}, a))
},
// 打开 配置 动态参数
layer.opendynamicparameter = function (a, c) {
// a = a || {}, "function" == typeof a && (c = a);
var str_json = a.value
const value_map = a.value_map;
var parameter_html = ""
console.log("json:",str_json)
for(var key in str_json){
console.log(key+':'+str_json[key]);
key_ = key
if(key.charAt(0) == '_'){
continue;
}
key_list = key_.split("_");
switch (key_list[1]) {
case "sn":
parameter_html += "选择主设备: 全局变量[-{sn}-]
" +
""
break;
case "snlist":
parameter_html += "选择主设备(多选,|分割):
" +
""
break;
case "tab":
parameter_html += "选择数据源:
"
break;
case "text":
tab_v = "内容"
if(key_list.length >= 3){
tab_v = key_list[2]
}
parameter_html += ""+tab_v+":
"
break;
case "str":
tab_v = "文本"
if(key_list.length >= 3){
tab_v = key_list[2]
}
parameter_html += ""+tab_v+":
"
break;
case "font":
tab_v = "字体"
if(key_list.length >= 3){
tab_v = key_list[2]
}
parameter_html += ""+tab_v+":
"
break;
case "int":
tab_v = "整数"
if(key_list.length >= 3){
tab_v = key_list[2]
}
parameter_html += ""+tab_v+":
"
break;
case "folat":
tab_v = "小数"
if(key_list.length >= 3){
tab_v = key_list[2]
}
parameter_html += ""+tab_v+":
"
break;
case "color":
parameter_html += "颜色:
"
break;
case "img":
parameter_html += "图片:
"
break;
case "imglist":
parameter_html += "图片组[数据]:
"
break;
case "textlist":
parameter_html += "文字组[数据]:
"
break;
case "pane":
parameter_html += "面板管理:
" +
""
break;
}
}
// console.log(paramffeter_html)
//
// var d,
// e = 2 == a.formType ? '" : function () {
// return ''
// }();
return layer.open($.extend({
type:1,
btn: ["确定", "取消"],
content: ""+parameter_html + "
",
skin: "layui-layer-prompt" + b("prompt"),
success: function (a) {
d = a.find(".layui-layer-input"), d.focus()
},
yes: function (b) {
for(var key in str_json){
console.log(key+':'+str_json[key]);
key_ = key
if(key.charAt(0) == '_'){
// 隐藏
}else{
// 表单
str_json[key] = $("#S_"+key).val()
}
}
c(str_json, b, d)
}
}, a))
}, layer.tab = function (a) {
a = a || {};
var c = a.tab || {};
return layer.open($.extend({
type: 1, skin: "layui-layer-tab" + b("tab"), title: function () {
var a = c.length, b = 1, d = "";
if (a > 0) for (d = '' + c[0].title + ""; a > b; b++) d += "" + c[b].title + "";
return d
}(), content: '' + function () {
var a = c.length, b = 1, d = "";
if (a > 0) for (d = '- ' + (c[0].content || "no content") + "
"; a > b; b++) d += '- ' + (c[b].content || "no content") + "
";
return d
}() + "
", success: function (b) {
var c = b.find(".layui-layer-title").children(), d = b.find(".layui-layer-tabmain").children();
c.on("mousedown", function (b) {
b.stopPropagation ? b.stopPropagation() : b.cancelBubble = !0;
var c = $(this), e = c.index();
c.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"), d.eq(e).show().siblings().hide(), "function" == typeof a.change && a.change(e)
})
}
}, a))
}, layer.photos = function (a, c, d) {
function e(a, b, c) {
var d = new Image;
d.onload = function () {
d.onload = null, b(d)
}, d.onerror = function (a) {
d.onerror = null, c(a)
}, d.src = a
}
var f = {};
if (a = a || {}, a.photos) {
var g = a.photos.constructor === Object, h = g ? a.photos : {}, i = h.data || [], j = h.start || 0;
if (f.imgIndex = j + 1, g) {
if (0 === i.length) return layer.msg("没有图片")
} else {
var k = $(a.photos), l = function () {
return i = [], k.find(a.img || "img").each(function (a) {
var b = $(this);
i.push({
alt: b.attr("alt"),
pid: b.attr("layer-pid"),
src: b.attr("layer-src") || b.attr("src"),
thumb: b.attr("src")
})
}), arguments.callee
}();
if (0 === i.length) return;
if (c || k.on("click", a.img || "img", function () {
var b = $(this), c = b.index();
l(), layer.photos($.extend(a, {photos: {start: c, data: i, tab: a.tab}, full: a.full}), !0)
}), !c) return
}
f.imgprev = function (a) {
f.imgIndex--, f.imgIndex < 1 && (f.imgIndex = i.length), f.tabimg(a)
}, f.imgnext = function (a, b) {
f.imgIndex++, f.imgIndex > i.length && (f.imgIndex = 1, b) || f.tabimg(a)
}, f.keyup = function (a) {
if (!f.end) {
var b = a.keyCode;
a.preventDefault(), 37 === b ? f.imgprev(!0) : 39 === b ? f.imgnext(!0) : 27 === b && layer.close(f.index)
}
}, f.tabimg = function (b) {
i.length <= 1 || (h.start = f.imgIndex - 1, layer.close(f.index), layer.photos(a, !0, b))
}, f.event = function () {
f.bigimg.hover(function () {
f.imgsee.show()
}, function () {
f.imgsee.hide()
}), f.bigimg.find(".layui-layer-imgprev").on("click", function (a) {
a.preventDefault(), f.imgprev()
}), f.bigimg.find(".layui-layer-imgnext").on("click", function (a) {
a.preventDefault(), f.imgnext()
}), $(document).on("keyup", f.keyup)
}, f.loadi = layer.load(1, {shade: "shade" in a ? !1 : .9, scrollbar: !1}), e(i[j].src, function (c) {
layer.close(f.loadi), f.index = layer.open($.extend({
type: 1,
area: function () {
var b = [c.width, c.height], d = [$(window).width() - 100, $(window).height() - 100];
return !a.full && b[0] > d[0] && (b[0] = d[0], b[1] = b[0] * d[1] / b[0]), [b[0] + "px", b[1] + "px"]
}(),
title: !1,
shade: .9,
shadeClose: !0,
closeBtn: !1,
move: ".layui-layer-phimg img",
moveType: 1,
scrollbar: !1,
moveOut: !0,
shift: 5 * Math.random() | 0,
skin: "layui-layer-photos" + b("photos"),
content: '![' + (i[j].alt ||](' + i[j].src + ')
' + (i.length > 1 ? '
' : "") + '
",
success: function (b, c) {
f.bigimg = b.find(".layui-layer-phimg"), f.imgsee = b.find(".layui-layer-imguide,.layui-layer-imgbar"), f.event(b), a.tab && a.tab(i[j], b)
},
end: function () {
f.end = !0, $(document).off("keyup", f.keyup)
}
}, a))
}, function () {
layer.close(f.loadi), layer.msg("当前图片地址异常
是否继续查看下一张?", {
time: 3e4,
btn: ["下一张", "不看了"],
yes: function () {
i.length > 1 && f.imgnext(!0, !0)
}
})
})
}
}
}();
function f_new_add_dynamicparameter(a, c) {
layer.prompt({
title: '请输入层 (数值越高在上面)',
formType: 0,
value: ""
}, function (value, index, elem) {
// PanelCanvas_P.css('z-index', parseInt(value));
// obj.PanelCanvas_z = parseInt(PanelCanvas_P.css('z-index'));
console.log(value)
console.log(a, c)
layer.close(index);
});
}