/** layui-v2.4.3 MIT License By https://www.layui.com */ ; !function (e) { "use strict"; var t = document, o = { modules : {}, status : {}, timeout : 10, event : {} }, n = function () { this.v = "2.4.3" }, r = function () { var e = t.currentScript ? t.currentScript.src : function () { for (var e, o = t.scripts, n = o.length - 1, r = n; r > 0; r--) if ("interactive" === o[r].readyState) { e = o[r].src; break } return e || o[n].src } (); return e.substring(0, e.lastIndexOf("/") + 1) } (), i = function (t) { e.console && console.error && console.error("Layui hint: " + t) }, a = "undefined" != typeof opera && "[object Opera]" === opera.toString(), u = { layer : "modules/layer", laydate : "modules/laydate", laypage : "modules/laypage", laytpl : "modules/laytpl", layim : "modules/layim", layedit : "modules/layedit", form : "modules/form", upload : "modules/upload", tree : "modules/tree", table : "modules/table", element : "modules/element", rate : "modules/rate", colorpicker : "modules/colorpicker", slider : "modules/slider", carousel : "modules/carousel", flow : "modules/flow", util : "modules/util", code : "modules/code", jquery : "modules/jquery", mobile : "modules/mobile", "layui.all" : "../layui.all" }; n.prototype.cache = o, n.prototype.define = function (e, t) { var n = this, r = "function" == typeof e, i = function () { var e = function (e, t) { layui[e] = t, o.status[e] = !0 }; return "function" == typeof t && t(function (n, r) { e(n, r), o.callback[n] = function () { t(e) } }), this }; return r && (t = e, e = []), layui["layui.all"] || !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n) }, n.prototype.use = function (e, n, l) { function s(e, t) { var n = "PLaySTATION 3" === navigator.platform ? /^complete$/ : /^(complete|loaded)$/; ("load" === e.type || n.test((e.currentTarget || e.srcElement).readyState)) && (o.modules[f] = t, d.removeChild(v), function r() { return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void(o.status[f] ? c() : setTimeout(r, 4)) } ()) } function c() { l.push(layui[f]), e.length > 1 ? y.use(e.slice(1), n, l) : "function" == typeof n && n.apply(layui, l) } var y = this, p = o.dir = o.dir ? o.dir : r, d = t.getElementsByTagName("head")[0]; e = "string" == typeof e ? [e] : e, window.jQuery && jQuery.fn.on && (y.each(e, function (t, o) { "jquery" === o && e.splice(t, 1) }), layui.jquery = layui.$ = jQuery); var f = e[0], m = 0; if (l = l || [], o.host = o.host || (p.match(/\/\/([\s\S]+?)\//) || ["//" + location.host + "/"])[0], 0 === e.length || layui["layui.all"] && u[f] || !layui["layui.all"] && layui["layui.mobile"] && u[f]) return c(), y; if (o.modules[f]) !function g() { return ++m > 1e3 * o.timeout / 4 ? i(f + " is not a valid module") : void("string" == typeof o.modules[f] && o.status[f] ? c() : setTimeout(g, 4)) } (); else { var v = t.createElement("script"), h = (u[f] ? p + "lay/" : /^\{\/\}/.test(y.modules[f]) ? "" : o.base || "") + (y.modules[f] || f) + ".js"; h = h.replace(/^\{\/\}/, ""), v.async = !0, v.charset = "utf-8", v.src = h + function () { var e = o.version === !0 ? o.v || (new Date).getTime() : o.version || ""; return e ? "?v=" + e : "" } (), d.appendChild(v), !v.attachEvent || v.attachEvent.toString && v.attachEvent.toString().indexOf("[native code") < 0 || a ? v.addEventListener("load", function (e) { s(e, h) }, !1) : v.attachEvent("onreadystatechange", function (e) { s(e, h) }), o.modules[f] = h } return y }, n.prototype.getStyle = function (t, o) { var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null); return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](o) }, n.prototype.link = function (e, n, r) { var a = this, u = t.createElement("link"), l = t.getElementsByTagName("head")[0]; "string" == typeof n && (r = n); var s = (r || e).replace(/\.|\//g, ""), c = u.id = "layuicss-" + s, y = 0; return u.rel = "stylesheet", u.href = e + (o.debug ? "?v=" + (new Date).getTime() : ""), u.media = "all", t.getElementById(c) || l.appendChild(u), "function" != typeof n ? a : (function p() { return ++y > 1e3 * o.timeout / 100 ? i(e + " timeout") : void(1989 === parseInt(a.getStyle(t.getElementById(c), "width")) ? function () { n() } () : setTimeout(p, 100)) } (), a) }, o.callback = {}, n.prototype.factory = function (e) { if (layui[e]) return "function" == typeof o.callback[e] ? o.callback[e] : null }, n.prototype.addcss = function (e, t, n) { return layui.link(o.dir + "css/" + e, t, n) }, n.prototype.img = function (e, t, o) { var n = new Image; return n.src = e, n.complete ? t(n) : (n.onload = function () { n.onload = null, "function" == typeof t && t(n) }, void(n.onerror = function (e) { n.onerror = null, "function" == typeof o && o(e) })) }, n.prototype.config = function (e) { e = e || {}; for (var t in e) o[t] = e[t]; return this }, n.prototype.modules = function () { var e = {}; for (var t in u) e[t] = u[t]; return e } (), n.prototype.extend = function (e) { var t = this; e = e || {}; for (var o in e) t[o] || t.modules[o] ? i("妯″潡鍚� " + o + " 宸茶鍗犵敤") : t.modules[o] = e[o]; return t }, n.prototype.router = function (e) { var t = this, e = e || location.hash, o = { path : [], search : {}, hash : (e.match(/[^#](#.*$)/) || [])[1] || "" }; return /^#\//.test(e) ? (e = e.replace(/^#\//, ""), o.href = "/" + e, e = e.replace(/([^#])(#.*$)/, "$1").split("/") || [], t.each(e, function (e, t) { /^\w+=/.test(t) ? function () { t = t.split("="), o.search[t[0]] = t[1] } () : o.path.push(t) }), o) : o }, n.prototype.data = function (t, o, n) { if (t = t || "layui", n = n || localStorage, e.JSON && e.JSON.parse) { if (null === o) return delete n[t]; o = "object" == typeof o ? o : { key : o }; try { var r = JSON.parse(n[t]) } catch (i) { var r = {} } return "value" in o && (r[o.key] = o.value), o.remove && delete r[o.key], n[t] = JSON.stringify(r), o.key ? r[o.key] : r } }, n.prototype.sessionData = function (e, t) { return this.data(e, t, sessionStorage) }, n.prototype.device = function (t) { var o = navigator.userAgent.toLowerCase(), n = function (e) { var t = new RegExp(e + "/([^\\s\\_\\-]+)"); return e = (o.match(t) || [])[1], e || !1 }, r = { os : function () { return /windows/.test(o) ? "windows" : /linux/.test(o) ? "linux" : /iphone|ipod|ipad|ios/.test(o) ? "ios" : /mac/.test(o) ? "mac" : void 0 } (), ie : function () { return !!(e.ActiveXObject || "ActiveXObject" in e) && ((o.match(/msie\s(\d+)/) || [])[1] || "11") } (), weixin : n("micromessenger") }; return t && !r[t] && (r[t] = n(t)), r.android = /android/.test(o), r.ios = "ios" === r.os, r }, n.prototype.hint = function () { return { error : i } }, n.prototype.each = function (e, t) { var o, n = this; if ("function" != typeof t) return n; if (e = e || [], e.constructor === Object) { for (o in e) if (t.call(e[o], o, e[o])) break } else for (o = 0; o < e.length && !t.call(e[o], o, e[o]); o++); return n }, n.prototype.sort = function (e, t, o) { var n = JSON.parse(JSON.stringify(e || [])); return t ? (n.sort(function (e, o) { var n = /^-?\d+$/, r = e[t], i = o[t]; return n.test(r) && (r = parseFloat(r)), n.test(i) && (i = parseFloat(i)), r && !i ? 1 : !r && i ? -1 : r > i ? 1 : r < i ? -1 : 0 }), o && n.reverse(), n) : n }, n.prototype.stope = function (t) { t = t || e.event; try { t.stopPropagation() } catch (o) { t.cancelBubble = !0 } }, n.prototype.onevent = function (e, t, o) { return "string" != typeof e || "function" != typeof o ? this : n.event(e, t, null, o) }, n.prototype.event = n.event = function (e, t, n, r) { var i = this, a = null, u = t.match(/\((.*)\)$/) || [], l = (e + "." + t).replace(u[0], ""), s = u[1] || "", c = function (e, t) { var o = t && t.call(i, n); o === !1 && null === a && (a = !1) }; return r ? (o.event[l] = o.event[l] || {}, o.event[l][s] = [r], this) : (layui.each(o.event[l], function (e, t) { return "{*}" === s ? void layui.each(t, c) : ("" === e && layui.each(t, c), void(e === s && layui.each(t, c))) }), a) }, e.layui = new n } (window); layui.define(function (a) { var i = layui.cache; layui.config({ dir : i.dir.replace(/lay\/dest\/$/, "") }), a("layui.all", layui.v) }); layui.define(function (e) { "use strict"; var r = { open : "{{", close : "}}" }, c = { exp : function (e) { return new RegExp(e, "g") }, query : function (e, c, t) { var o = ["#([\\s\\S])+?", "([^{#}])*?"][e || 0]; return n((c || "") + r.open + o + r.close + (t || "")) }, escape : function (e) { return String(e || "").replace(/&(?!#?[a-zA-Z0-9]+;)/g, "&").replace(//g, ">").replace(/'/g, "'").replace(/"/g, """) }, error : function (e, r) { var c = "Laytpl Error锛�"; return "object" == typeof console && console.error(c + e + "\n" + (r || "")), c + e } }, n = c.exp, t = function (e) { this.tpl = e }; t.pt = t.prototype, window.errors = 0, t.pt.parse = function (e, t) { var o = this, p = e, a = n("^" + r.open + "#", ""), l = n(r.close + "$", ""); e = e.replace(/\s+|\r|\t|\n/g, " ").replace(n(r.open + "#"), r.open + "# ").replace(n(r.close + "}"), "} " + r.close).replace(/\\/g, "\\\\").replace(n(r.open + "!(.+?)!" + r.close), function (e) { return e = e.replace(n("^" + r.open + "!"), "").replace(n("!" + r.close), "").replace(n(r.open + "|" + r.close), function (e) { return e.replace(/(.)/g, "\\$1") }) }).replace(/(?="|')/g, "\\").replace(c.query(), function (e) { return e = e.replace(a, "").replace(l, ""), '";' + e.replace(/\\/g, "") + ';view+="' }).replace(c.query(1), function (e) { var c = '"+('; return e.replace(/\s/g, "") === r.open + r.close ? "" : (e = e.replace(n(r.open + "|" + r.close), ""), /^=/.test(e) && (e = e.replace(/^=/, ""), c = '"+_escape_('), c + e.replace(/\\/g, "") + ')+"') }), e = '"use strict";var view = "' + e + '";return view;'; try { return o.cache = e = new Function("d, _escape_", e), e(t, c.escape) } catch (u) { return delete o.cache, c.error(u, p) } }, t.pt.render = function (e, r) { var n, t = this; return e ? (n = t.cache ? t.cache(e, c.escape) : t.parse(t.tpl, e), r ? void r(n) : n) : c.error("no data") }; var o = function (e) { return "string" != typeof e ? c.error("Template not found") : new t(e) }; o.config = function (e) { e = e || {}; for (var c in e) r[c] = e[c] }, o.v = "1.2.0", e("laytpl", o) }); /** @Name : layui.laypage 鍒嗛〉缁勪欢 @Author锛氳搐蹇� @License锛歁IT */ layui.define(function(exports){ "use strict"; var doc = document ,id = 'getElementById' ,tag = 'getElementsByTagName' //瀛楃甯搁噺 ,MOD_NAME = 'laypage', DISABLED = 'layui-disabled' //鏋勯�犲櫒 ,Class = function(options){ var that = this; that.config = options || {}; that.config.index = ++laypage.index; that.render(true); }; //鍒ゆ柇浼犲叆鐨勫鍣ㄧ被鍨� Class.prototype.type = function(){ var config = this.config; if(typeof config.elem === 'object'){ return config.elem.length === undefined ? 2 : 3; } }; //鍒嗛〉瑙嗗浘 Class.prototype.view = function(){ var that = this ,config = that.config ,groups = config.groups = 'groups' in config ? (config.groups|0) : 5; //杩炵画椤电爜涓暟 //鎺掔増 config.layout = typeof config.layout === 'object' ? config.layout : ['prev', 'page', 'next']; config.count = config.count|0; //鏁版嵁鎬绘暟 config.curr = (config.curr|0) || 1; //褰撳墠椤� //姣忛〉鏉℃暟鐨勯�夋嫨椤� config.limits = typeof config.limits === 'object' ? config.limits : [10, 20, 30, 40, 50]; config.limit = (config.limit|0) || 10; //榛樿鏉℃暟 //鎬婚〉鏁� config.pages = Math.ceil(config.count/config.limit) || 1; //褰撳墠椤典笉鑳借秴杩囨�婚〉鏁� if(config.curr > config.pages){ config.curr = config.pages; } //杩炵画鍒嗛〉涓暟涓嶈兘浣庝簬0涓斾笉鑳藉ぇ浜庢�婚〉鏁� if(groups < 0){ groups = 1; } else if (groups > config.pages){ groups = config.pages; } config.prev = 'prev' in config ? config.prev : '上一页'; //涓婁竴椤垫枃鏈� config.next = 'next' in config ? config.next : '下一页'; //涓嬩竴椤垫枃鏈� //璁$畻褰撳墠缁� var index = config.pages > groups ? Math.ceil( (config.curr + (groups > 1 ? 1 : 0)) / (groups > 0 ? groups : 1) ) : 1 //瑙嗗浘鐗囨 ,views = { //涓婁竴椤� prev: function(){ return config.prev ? ''+ config.prev +'' : ''; }() //椤电爜 ,page: function(){ var pager = []; //鏁版嵁閲忎负0鏃讹紝涓嶈緭鍑洪〉鐮� if(config.count < 1){ return ''; } //棣栭〉 if(index > 1 && config.first !== false && groups !== 0){ pager.push(''+ (config.first || 1) +''); } //璁$畻褰撳墠椤电爜缁勭殑璧峰椤� var halve = Math.floor((groups-1)/2) //椤电爜鏁扮瓑鍒� ,start = index > 1 ? config.curr - halve : 1 ,end = index > 1 ? (function(){ var max = config.curr + (groups - halve - 1); return max > config.pages ? config.pages : max; }()) : groups; //闃叉鏈�鍚庝竴缁勫嚭鐜扳�滀笉瑙勫畾鈥濈殑杩炵画椤电爜鏁� if(end - start < groups - 1){ start = end - groups + 1; } //杈撳嚭宸﹀垎鍓茬 if(config.first !== false && start > 2){ pager.push('') } //杈撳嚭杩炵画椤电爜 for(; start <= end; start++){ if(start === config.curr){ //褰撳墠椤� pager.push(''+ start +''); } else { pager.push(''+ start +''); } } //杈撳嚭杈撳嚭鍙冲垎闅旂 & 鏈〉 if(config.pages > groups && config.pages > end && config.last !== false){ if(end + 1 < config.pages){ pager.push(''); } if(groups !== 0){ pager.push(''+ (config.last || config.pages) +''); } } return pager.join(''); }() //涓嬩竴椤� ,next: function(){ return config.next ? ''+ config.next +'' : ''; }() //鏁版嵁鎬绘暟 ,count: '鍏� '+ config.count +' 鏉�' //姣忛〉鏉℃暟 ,limit: function(){ var options = [''; }() //鍒锋柊褰撳墠椤� ,refresh: ['' ,'' ,''].join('') //璺抽〉鍖哄煙 ,skip: function(){ return ['到第' ,'' ,'页' ,''].join(''); }() }; return ['
' ,function(){ var plate = []; layui.each(config.layout, function(index, item){ if(views[item]){ plate.push(views[item]) } }); return plate.join(''); }() ,'
'].join(''); }; //璺抽〉鐨勫洖璋� Class.prototype.jump = function(elem, isskip){ if(!elem) return; var that = this ,config = that.config ,childs = elem.children ,btn = elem[tag]('button')[0] ,input = elem[tag]('input')[0] ,select = elem[tag]('select')[0] ,skip = function(){ var curr = input.value.replace(/\s|\D/g, '')|0; if(curr){ config.curr = curr; that.render(); } }; if(isskip) return skip(); //椤电爜 for(var i = 0, len = childs.length; i < len; i++){ if(childs[i].nodeName.toLowerCase() === 'a'){ laypage.on(childs[i], 'click', function(){ var curr = this.getAttribute('data-page')|0; if(curr < 1 || curr > config.pages) return; config.curr = curr; that.render(); }); } } //鏉℃暟 if(select){ laypage.on(select, 'change', function(){ var value = this.value; if(config.curr*value > config.count){ config.curr = Math.ceil(config.count/value); } config.limit = value; that.render(); }); } //纭畾 if(btn){ laypage.on(btn, 'click', function(){ skip(); }); } //杈撳叆 if(input){ laypage.on(input, 'change', function(){ skip(); }); } }; //杈撳叆椤垫暟瀛楁帶鍒� Class.prototype.skip = function(elem){ if(!elem) return; var that = this, input = elem[tag]('input')[0]; if(!input) return; laypage.on(input, 'keyup', function(e){ var value = this.value ,keyCode = e.keyCode; if(/^(37|38|39|40)$/.test(keyCode)) return; if(/\D/.test(value)){ this.value = value.replace(/\D/, ''); } if(keyCode === 13){ that.jump(elem, true) } }); }; //娓叉煋鍒嗛〉 Class.prototype.render = function(load){ var that = this ,config = that.config ,type = that.type() ,view = that.view(); if(type === 2){ config.elem && (config.elem.innerHTML = view); } else if(type === 3){ config.elem.html(view); } else { if(doc[id](config.elem)){ doc[id](config.elem).innerHTML = view; } } config.jump && config.jump(config, load); var elem = doc[id]('layui-laypage-' + config.index); that.jump(elem); if(config.hash && !load){ location.hash = '!'+ config.hash +'='+ config.curr; } that.skip(elem); }; //澶栭儴鎺ュ彛 var laypage = { //鍒嗛〉娓叉煋 render: function(options){ var o = new Class(options); return o.index; } ,index: layui.laypage ? (layui.laypage.index + 10000) : 0 ,on: function(elem, even, fn){ elem.attachEvent ? elem.attachEvent('on'+ even, function(e){ //for ie e.target = e.srcElement; fn.call(elem, e); }) : elem.addEventListener(even, fn, false); return this; } } exports(MOD_NAME, laypage); }); !function () { "use strict"; var e = window.layui && layui.define, t = { getPath : function () { var e = document.currentScript ? document.currentScript.src : function () { for (var e, t = document.scripts, n = t.length - 1, a = n; a > 0; a--) if ("interactive" === t[a].readyState) { e = t[a].src; break } return e || t[n].src } (); return e.substring(0, e.lastIndexOf("/") + 1) } (), getStyle : function (e, t) { var n = e.currentStyle ? e.currentStyle : window.getComputedStyle(e, null); return n[n.getPropertyValue ? "getPropertyValue" : "getAttribute"](t) }, link : function (e, a, i) { if (n.path) { var r = document.getElementsByTagName("head")[0], o = document.createElement("link"); "string" == typeof a && (i = a); var s = (i || e).replace(/\.|\//g, ""), l = "layuicss-" + s, d = 0; o.rel = "stylesheet", o.href = n.path + e, o.id = l, document.getElementById(l) || r.appendChild(o), "function" == typeof a && !function c() { return ++d > 80 ? window.console && console.error("laydate.css: Invalid") : void(1989 === parseInt(t.getStyle(document.getElementById(l), "width")) ? a() : setTimeout(c, 100)) } () } } }, n = { v : "5.0.9", config : {}, index : window.laydate && window.laydate.v ? 1e5 : 0, path : t.getPath, set : function (e) { var t = this; return t.config = w.extend({}, t.config, e), t }, ready : function (a) { var i = "laydate", r = "", o = (e ? "modules/laydate/" : "theme/") + "default/laydate.css?v=" + n.v + r; return e ? layui.addcss(o, a, i) : t.link(o, a, i), this } }, a = function () { var e = this; return { hint : function (t) { e.hint.call(e, t) }, config : e.config } }, i = "laydate", r = ".layui-laydate", o = "layui-this", s = "laydate-disabled", l = "寮�濮嬫棩鏈熻秴鍑轰簡缁撴潫鏃ユ湡
寤鸿閲嶆柊閫夋嫨", d = [100, 2e5], c = "layui-laydate-static", m = "layui-laydate-list", u = "laydate-selected", h = "layui-laydate-hint", y = "laydate-day-prev", f = "laydate-day-next", p = "layui-laydate-footer", g = ".laydate-btns-confirm", v = "laydate-time-text", D = ".laydate-btns-time", T = function (e) { var t = this; t.index = ++n.index, t.config = w.extend({}, t.config, n.config, e), n.ready(function () { t.init() }) }, w = function (e) { return new C(e) }, C = function (e) { for (var t = 0, n = "object" == typeof e ? [e] : (this.selector = e, document.querySelectorAll(e || null)); t < n.length; t++) this.push(n[t]) }; C.prototype = [], C.prototype.constructor = C, w.extend = function () { var e = 1, t = arguments, n = function (e, t) { e = e || (t.constructor === Array ? [] : {}); for (var a in t) e[a] = t[a] && t[a].constructor === Object ? n(e[a], t[a]) : t[a]; return e }; for (t[0] = "object" == typeof t[0] ? t[0] : {}; e < t.length; e++) "object" == typeof t[e] && n(t[0], t[e]); return t[0] }, w.ie = function () { var e = navigator.userAgent.toLowerCase(); return !!(window.ActiveXObject || "ActiveXObject" in window) && ((e.match(/msie\s(\d+)/) || [])[1] || "11") } (), w.stope = function (e) { e = e || window.event, e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0 }, w.each = function (e, t) { var n, a = this; if ("function" != typeof t) return a; if (e = e || [], e.constructor === Object) { for (n in e) if (t.call(e[n], n, e[n])) break } else for (n = 0; n < e.length && !t.call(e[n], n, e[n]); n++); return a }, w.digit = function (e, t, n) { var a = ""; e = String(e), t = t || 2; for (var i = e.length; i < t; i++) a += "0"; return e < Math.pow(10, t) ? a + (0 | e) : e }, w.elem = function (e, t) { var n = document.createElement(e); return w.each(t || {}, function (e, t) { n.setAttribute(e, t) }), n }, C.addStr = function (e, t) { return e = e.replace(/\s+/, " "), t = t.replace(/\s+/, " ").split(" "), w.each(t, function (t, n) { new RegExp("\\b" + n + "\\b").test(e) || (e = e + " " + n) }), e.replace(/^\s|\s$/, "") }, C.removeStr = function (e, t) { return e = e.replace(/\s+/, " "), t = t.replace(/\s+/, " ").split(" "), w.each(t, function (t, n) { var a = new RegExp("\\b" + n + "\\b"); a.test(e) && (e = e.replace(a, "")) }), e.replace(/\s+/, " ").replace(/^\s|\s$/, "") }, C.prototype.find = function (e) { var t = this, n = 0, a = [], i = "object" == typeof e; return this.each(function (r, o) { for (var s = i ? [e] : o.querySelectorAll(e || null); n < s.length; n++) a.push(s[n]); t.shift() }), i || (t.selector = (t.selector ? t.selector + " " : "") + e), w.each(a, function (e, n) { t.push(n) }), t }, C.prototype.each = function (e) { return w.each.call(this, this, e) }, C.prototype.addClass = function (e, t) { return this.each(function (n, a) { a.className = C[t ? "removeStr" : "addStr"](a.className, e) }) }, C.prototype.removeClass = function (e) { return this.addClass(e, !0) }, C.prototype.hasClass = function (e) { var t = !1; return this.each(function (n, a) { new RegExp("\\b" + e + "\\b").test(a.className) && (t = !0) }), t }, C.prototype.attr = function (e, t) { var n = this; return void 0 === t ? function () { if (n.length > 0) return n[0].getAttribute(e) } () : n.each(function (n, a) { a.setAttribute(e, t) }) }, C.prototype.removeAttr = function (e) { return this.each(function (t, n) { n.removeAttribute(e) }) }, C.prototype.html = function (e) { return this.each(function (t, n) { n.innerHTML = e }) }, C.prototype.val = function (e) { return this.each(function (t, n) { n.value = e }) }, C.prototype.append = function (e) { return this.each(function (t, n) { "object" == typeof e ? n.appendChild(e) : n.innerHTML = n.innerHTML + e }) }, C.prototype.remove = function (e) { return this.each(function (t, n) { e ? n.removeChild(e) : n.parentNode.removeChild(n) }) }, C.prototype.on = function (e, t) { return this.each(function (n, a) { a.attachEvent ? a.attachEvent("on" + e, function (e) { e.target = e.srcElement, t.call(a, e) }) : a.addEventListener(e, t, !1) }) }, C.prototype.off = function (e, t) { return this.each(function (n, a) { a.detachEvent ? a.detachEvent("on" + e, t) : a.removeEventListener(e, t, !1) }) }, T.isLeapYear = function (e) { return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0 }, T.prototype.config = { type : "date", range : !1, format : "yyyy-MM-dd", value : null, isInitValue : !0, min : "1900-1-1", max : "2099-12-31", trigger : "focus", show : !1, showBottom : !0, btns : ["clear", "now", "confirm"], lang : "cn", theme : "default", position : null, calendar : !1, mark : {}, zIndex : null, done : null, change : null }, T.prototype.lang = function () { var e = this, t = e.config, n = { cn : { weeks : ["鏃�", "涓�", "浜�", "涓�", "鍥�", "浜�", "鍏�"], time : ["鏃�", "鍒�", "绉�"], timeTips : "閫夋嫨鏃堕棿", startTime : "寮�濮嬫椂闂�", endTime : "缁撴潫鏃堕棿", dateTips : "杩斿洖鏃ユ湡", month : ["涓�", "浜�", "涓�", "鍥�", "浜�", "鍏�", "涓�", "鍏�", "涔�", "鍗�", "鍗佷竴", "鍗佷簩"], tools : { confirm : "纭畾", clear : "娓呯┖", now : "鐜板湪" } }, en : { weeks : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], time : ["Hours", "Minutes", "Seconds"], timeTips : "Select Time", startTime : "Start Time", endTime : "End Time", dateTips : "Select Date", month : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], tools : { confirm : "Confirm", clear : "Clear", now : "Now" } } }; return n[t.lang] || n.cn }, T.prototype.init = function () { var e = this, t = e.config, n = "yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s", a = "static" === t.position, i = { year : "yyyy", month : "yyyy-MM", date : "yyyy-MM-dd", time : "HH:mm:ss", datetime : "yyyy-MM-dd HH:mm:ss" }; t.elem = w(t.elem), t.eventElem = w(t.eventElem), t.elem[0] && (t.range === !0 && (t.range = "-"), t.format === i.date && (t.format = i[t.type]), e.format = t.format.match(new RegExp(n + "|.", "g")) || [], e.EXP_IF = "", e.EXP_SPLIT = "", w.each(e.format, function (t, a) { var i = new RegExp(n).test(a) ? "\\d{" + function () { return new RegExp(n).test(e.format[0 === t ? t + 1 : t - 1] || "") ? /^yyyy|y$/.test(a) ? 4 : a.length : /^yyyy$/.test(a) ? "1,4" : /^y$/.test(a) ? "1,308" : "1,2" } () + "}" : "\\" + a; e.EXP_IF = e.EXP_IF + i, e.EXP_SPLIT = e.EXP_SPLIT + "(" + i + ")" }), e.EXP_IF = new RegExp("^" + (t.range ? e.EXP_IF + "\\s\\" + t.range + "\\s" + e.EXP_IF : e.EXP_IF) + "$"), e.EXP_SPLIT = new RegExp("^" + e.EXP_SPLIT + "$", ""), e.isInput(t.elem[0]) || "focus" === t.trigger && (t.trigger = "click"), t.elem.attr("lay-key") || (t.elem.attr("lay-key", e.index), t.eventElem.attr("lay-key", e.index)), t.mark = w.extend({}, t.calendar && "cn" === t.lang ? { "0-1-1" : "鍏冩棪", "0-2-14" : "鎯呬汉", "0-3-8" : "濡囧コ", "0-3-12" : "妞嶆爲", "0-4-1" : "鎰氫汉", "0-5-1" : "鍔冲姩", "0-5-4" : "闈掑勾", "0-6-1" : "鍎跨", "0-9-10" : "鏁欏笀", "0-9-18" : "鍥借��", "0-10-1" : "鍥藉簡", "0-12-25" : "鍦h癁" } : {}, t.mark), w.each(["min", "max"], function (e, n) { var a = [], i = []; if ("number" == typeof t[n]) { var r = t[n], o = (new Date).getTime(), s = 864e5, l = new Date(r ? r < s ? o + r * s : r : o); a = [l.getFullYear(), l.getMonth() + 1, l.getDate()], r < s || (i = [l.getHours(), l.getMinutes(), l.getSeconds()]) } else a = (t[n].match(/\d+-\d+-\d+/) || [""])[0].split("-"), i = (t[n].match(/\d+:\d+:\d+/) || [""])[0].split(":"); t[n] = { year : 0 | a[0] || (new Date).getFullYear(), month : a[1] ? (0 | a[1]) - 1 : (new Date).getMonth(), date : 0 | a[2] || (new Date).getDate(), hours : 0 | i[0], minutes : 0 | i[1], seconds : 0 | i[2] } }), e.elemID = "layui-laydate" + t.elem.attr("lay-key"), (t.show || a) && e.render(), a || e.events(), t.value && t.isInitValue && (t.value.constructor === Date ? e.setValue(e.parse(0, e.systemDate(t.value))) : e.setValue(t.value))) }, T.prototype.render = function () { var e = this, t = e.config, n = e.lang(), a = "static" === t.position, i = e.elem = w.elem("div", { id : e.elemID, "class" : ["layui-laydate", t.range ? " layui-laydate-range" : "", a ? " " + c : "", t.theme && "default" !== t.theme && !/^#/.test(t.theme) ? " laydate-theme-" + t.theme : ""].join("") }), r = e.elemMain = [], o = e.elemHeader = [], s = e.elemCont = [], l = e.table = [], d = e.footer = w.elem("div", { "class" : p }); if (t.zIndex && (i.style.zIndex = t.zIndex), w.each(new Array(2), function (e) { if (!t.range && e > 0) return !0; var a = w.elem("div", { "class" : "layui-laydate-header" }), i = [function () { var e = w.elem("i", { "class" : "layui-icon laydate-icon laydate-prev-y" }); return e.innerHTML = "", e } (), function () { var e = w.elem("i", { "class" : "layui-icon laydate-icon laydate-prev-m" }); return e.innerHTML = "", e } (), function () { var e = w.elem("div", { "class" : "laydate-set-ym" }), t = w.elem("span"), n = w.elem("span"); return e.appendChild(t), e.appendChild(n), e } (), function () { var e = w.elem("i", { "class" : "layui-icon laydate-icon laydate-next-m" }); return e.innerHTML = "", e } (), function () { var e = w.elem("i", { "class" : "layui-icon laydate-icon laydate-next-y" }); return e.innerHTML = "", e } ()], d = w.elem("div", { "class" : "layui-laydate-content" }), c = w.elem("table"), m = w.elem("thead"), u = w.elem("tr"); w.each(i, function (e, t) { a.appendChild(t) }), m.appendChild(u), w.each(new Array(6), function (e) { var t = c.insertRow(0); w.each(new Array(7), function (a) { if (0 === e) { var i = w.elem("th"); i.innerHTML = n.weeks[a], u.appendChild(i) } t.insertCell(a) }) }), c.insertBefore(m, c.children[0]), d.appendChild(c), r[e] = w.elem("div", { "class" : "layui-laydate-main laydate-main-list-" + e }), r[e].appendChild(a), r[e].appendChild(d), o.push(i), s.push(d), l.push(c) }), w(d).html(function () { var e = [], i = []; return "datetime" === t.type && e.push('' + n.timeTips + ""), w.each(t.btns, function (e, r) { var o = n.tools[r] || "btn"; t.range && "now" === r || (a && "clear" === r && (o = "cn" === t.lang ? "閲嶇疆" : "Reset"), i.push('' + o + "")) }), e.push('"), e.join("") } ()), w.each(r, function (e, t) { i.appendChild(t) }), t.showBottom && i.appendChild(d), /^#/.test(t.theme)) { var m = w.elem("style"), u = ["#{{id}} .layui-laydate-header{background-color:{{theme}};}", "#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g, e.elemID).replace(/{{theme}}/g, t.theme); "styleSheet" in m ? (m.setAttribute("type", "text/css"), m.styleSheet.cssText = u) : m.innerHTML = u, w(i).addClass("laydate-theme-molv"), i.appendChild(m) } e.remove(T.thisElemDate), a ? t.elem.append(i) : (document.body.appendChild(i), e.position()), e.checkDate().calendar(), e.changeEvent(), T.thisElemDate = e.elemID, "function" == typeof t.ready && t.ready(w.extend({}, t.dateTime, { month : t.dateTime.month + 1 })) }, T.prototype.remove = function (e) { var t = this, n = (t.config, w("#" + (e || t.elemID))); return n.hasClass(c) || t.checkDate(function () { n.remove() }), t }, T.prototype.position = function () { var e = this, t = e.config, n = e.bindElem || t.elem[0], a = n.getBoundingClientRect(), i = e.elem.offsetWidth, r = e.elem.offsetHeight, o = function (e) { return e = e ? "scrollLeft" : "scrollTop", document.body[e] | document.documentElement[e] }, s = function (e) { return document.documentElement[e ? "clientWidth" : "clientHeight"] }, l = 5, d = a.left, c = a.bottom; d + i + l > s("width") && (d = s("width") - i - l), c + r + l > s() && (c = a.top > r ? a.top - r : s() - r, c -= 2 * l), t.position && (e.elem.style.position = t.position), e.elem.style.left = d + ("fixed" === t.position ? 0 : o(1)) + "px", e.elem.style.top = c + ("fixed" === t.position ? 0 : o()) + "px" }, T.prototype.hint = function (e) { var t = this, n = (t.config, w.elem("div", { "class" : h })); t.elem && (n.innerHTML = e || "", w(t.elem).find("." + h).remove(), t.elem.appendChild(n), clearTimeout(t.hinTimer), t.hinTimer = setTimeout(function () { w(t.elem).find("." + h).remove() }, 3e3)) }, T.prototype.getAsYM = function (e, t, n) { return n ? t-- : t++, t < 0 && (t = 11, e--), t > 11 && (t = 0, e++), [e, t] }, T.prototype.systemDate = function (e) { var t = e || new Date; return { year : t.getFullYear(), month : t.getMonth(), date : t.getDate(), hours : e ? e.getHours() : 0, minutes : e ? e.getMinutes() : 0, seconds : e ? e.getSeconds() : 0 } }, T.prototype.checkDate = function (e) { var t, a, i = this, r = (new Date, i.config), o = r.dateTime = r.dateTime || i.systemDate(), s = i.bindElem || r.elem[0], l = (i.isInput(s) ? "val" : "html", i.isInput(s) ? s.value : "static" === r.position ? "" : s.innerHTML), c = function (e) { e.year > d[1] && (e.year = d[1], a = !0), e.month > 11 && (e.month = 11, a = !0), e.hours > 23 && (e.hours = 0, a = !0), e.minutes > 59 && (e.minutes = 0, e.hours++, a = !0), e.seconds > 59 && (e.seconds = 0, e.minutes++, a = !0), t = n.getEndDate(e.month + 1, e.year), e.date > t && (e.date = t, a = !0) }, m = function (e, t, n) { var o = ["startTime", "endTime"]; t = (t.match(i.EXP_SPLIT) || []).slice(1), n = n || 0, r.range && (i[o[n]] = i[o[n]] || {}), w.each(i.format, function (s, l) { var c = parseFloat(t[s]); t[s].length < l.length && (a = !0), /yyyy|y/.test(l) ? (c < d[0] && (c = d[0], a = !0), e.year = c) : /MM|M/.test(l) ? (c < 1 && (c = 1, a = !0), e.month = c - 1) : /dd|d/.test(l) ? (c < 1 && (c = 1, a = !0), e.date = c) : /HH|H/.test(l) ? (c < 1 && (c = 0, a = !0), e.hours = c, r.range && (i[o[n]].hours = c)) : /mm|m/.test(l) ? (c < 1 && (c = 0, a = !0), e.minutes = c, r.range && (i[o[n]].minutes = c)) : /ss|s/.test(l) && (c < 1 && (c = 0, a = !0), e.seconds = c, r.range && (i[o[n]].seconds = c)) }), c(e) }; return "limit" === e ? (c(o), i) : (l = l || r.value, "string" == typeof l && (l = l.replace(/\s+/g, " ").replace(/^\s|\s$/g, "")), i.startState && !i.endState && (delete i.startState, i.endState = !0), "string" == typeof l && l ? i.EXP_IF.test(l) ? r.range ? (l = l.split(" " + r.range + " "), i.startDate = i.startDate || i.systemDate(), i.endDate = i.endDate || i.systemDate(), r.dateTime = w.extend({}, i.startDate), w.each([i.startDate, i.endDate], function (e, t) { m(t, l[e], e) })) : m(o, l) : (i.hint("鏃ユ湡鏍煎紡涓嶅悎娉�
蹇呴』閬靛惊涓嬭堪鏍煎紡锛�
" + (r.range ? r.format + " " + r.range + " " + r.format : r.format) + "
宸蹭负浣犻噸缃�"), a = !0) : l && l.constructor === Date ? r.dateTime = i.systemDate(l) : (r.dateTime = i.systemDate(), delete i.startState, delete i.endState, delete i.startDate, delete i.endDate, delete i.startTime, delete i.endTime), c(o), a && l && i.setValue(r.range ? i.endDate ? i.parse() : "" : i.parse()), e && e(), i) }, T.prototype.mark = function (e, t) { var n, a = this, i = a.config; return w.each(i.mark, function (e, a) { var i = e.split("-"); i[0] != t[0] && 0 != i[0] || i[1] != t[1] && 0 != i[1] || i[2] != t[2] || (n = a || t[2]) }), n && e.html('' + n + ""), a }, T.prototype.limit = function (e, t, n, a) { var i, r = this, o = r.config, l = {}, d = o[n > 41 ? "endDate" : "dateTime"], c = w.extend({}, d, t || {}); return w.each({ now : c, min : o.min, max : o.max }, function (e, t) { l[e] = r.newDate(w.extend({ year : t.year, month : t.month, date : t.date }, function () { var e = {}; return w.each(a, function (n, a) { e[a] = t[a] }), e } ())).getTime() }), i = l.now < l.min || l.now > l.max, e && e[i ? "addClass" : "removeClass"](s), i }, T.prototype.calendar = function (e) { var t, a, i, r = this, s = r.config, l = e || s.dateTime, c = new Date, m = r.lang(), u = "date" !== s.type && "datetime" !== s.type, h = e ? 1 : 0, y = w(r.table[h]).find("td"), f = w(r.elemHeader[h][2]).find("span"); if (l.year < d[0] && (l.year = d[0], r.hint("鏈�浣庡彧鑳芥敮鎸佸埌鍏厓" + d[0] + "骞�")), l.year > d[1] && (l.year = d[1], r.hint("鏈�楂樺彧鑳芥敮鎸佸埌鍏厓" + d[1] + "骞�")), r.firstDate || (r.firstDate = w.extend({}, l)), c.setFullYear(l.year, l.month, 1), t = c.getDay(), a = n.getEndDate(l.month || 12, l.year), i = n.getEndDate(l.month + 1, l.year), w.each(y, function (e, n) { var d = [l.year, l.month], c = 0; n = w(n), n.removeAttr("class"), e < t ? (c = a - t + e, n.addClass("laydate-day-prev"), d = r.getAsYM(l.year, l.month, "sub")) : e >= t && e < i + t ? (c = e - t, s.range || c + 1 === l.date && n.addClass(o)) : (c = e - i - t, n.addClass("laydate-day-next"), d = r.getAsYM(l.year, l.month)), d[1]++, d[2] = c + 1, n.attr("lay-ymd", d.join("-")).html(d[2]), r.mark(n, d).limit(n, { year : d[0], month : d[1] - 1, date : d[2] }, e) }), w(f[0]).attr("lay-ym", l.year + "-" + (l.month + 1)), w(f[1]).attr("lay-ym", l.year + "-" + (l.month + 1)), "cn" === s.lang ? (w(f[0]).attr("lay-type", "year").html(l.year + "骞�"), w(f[1]).attr("lay-type", "month").html(l.month + 1 + "鏈�")) : (w(f[0]).attr("lay-type", "month").html(m.month[l.month]), w(f[1]).attr("lay-type", "year").html(l.year)), u && (s.range && (e ? r.endDate = r.endDate || { year : l.year + ("year" === s.type ? 1 : 0), month : l.month + ("month" === s.type ? 0 : -1) } : r.startDate = r.startDate || { year : l.year, month : l.month }, e && (r.listYM = [[r.startDate.year, r.startDate.month + 1], [r.endDate.year, r.endDate.month + 1]], r.list(s.type, 0).list(s.type, 1), "time" === s.type ? r.setBtnStatus("鏃堕棿", w.extend({}, r.systemDate(), r.startTime), w.extend({}, r.systemDate(), r.endTime)) : r.setBtnStatus(!0))), s.range || (r.listYM = [[l.year, l.month + 1]], r.list(s.type, 0))), s.range && !e) { var p = r.getAsYM(l.year, l.month); r.calendar(w.extend({}, l, { year : p[0], month : p[1] })) } return s.range || r.limit(w(r.footer).find(g), null, 0, ["hours", "minutes", "seconds"]), s.range && e && !u && r.stampRange(), r }, T.prototype.list = function (e, t) { var n = this, a = n.config, i = a.dateTime, r = n.lang(), l = a.range && "date" !== a.type && "datetime" !== a.type, d = w.elem("ul", { "class" : m + " " + { year : "laydate-year-list", month : "laydate-month-list", time : "laydate-time-list" } [e] }), c = n.elemHeader[t], u = w(c[2]).find("span"), h = n.elemCont[t || 0], y = w(h).find("." + m)[0], f = "cn" === a.lang, p = f ? "骞�" : "", T = n.listYM[t] || {}, C = ["hours", "minutes", "seconds"], x = ["startTime", "endTime"][t]; if (T[0] < 1 && (T[0] = 1), "year" === e) { var M, b = M = T[0] - 7; b < 1 && (b = M = 1), w.each(new Array(15), function (e) { var i = w.elem("li", { "lay-ym" : M }), r = { year : M }; M == T[0] && w(i).addClass(o), i.innerHTML = M + p, d.appendChild(i), M < n.firstDate.year ? (r.month = a.min.month, r.date = a.min.date) : M >= n.firstDate.year && (r.month = a.max.month, r.date = a.max.date), n.limit(w(i), r, t), M++ }), w(u[f ? 0 : 1]).attr("lay-ym", M - 8 + "-" + T[1]).html(b + p + " - " + (M - 1 + p)) } else if ("month" === e) w.each(new Array(12), function (e) { var i = w.elem("li", { "lay-ym" : e }), s = { year : T[0], month : e }; e + 1 == T[1] && w(i).addClass(o), i.innerHTML = r.month[e] + (f ? "鏈�" : ""), d.appendChild(i), T[0] < n.firstDate.year ? s.date = a.min.date : T[0] >= n.firstDate.year && (s.date = a.max.date), n.limit(w(i), s, t) }), w(u[f ? 0 : 1]).attr("lay-ym", T[0] + "-" + T[1]).html(T[0] + p); else if ("time" === e) { var E = function () { w(d).find("ol").each(function (e, a) { w(a).find("li").each(function (a, i) { n.limit(w(i), [{ hours : a }, { hours : n[x].hours, minutes : a }, { hours : n[x].hours, minutes : n[x].minutes, seconds : a } ][e], t, [["hours"], ["hours", "minutes"], ["hours", "minutes", "seconds"]][e]) }) }), a.range || n.limit(w(n.footer).find(g), n[x], 0, ["hours", "minutes", "seconds"]) }; a.range ? n[x] || (n[x] = { hours : 0, minutes : 0, seconds : 0 }) : n[x] = i, w.each([24, 60], function (e, t) { var a = w.elem("li"), i = ["

" + r.time[e] + "

    "]; w.each(new Array(t), function (t) { i.push("" + w.digit(t, 2) + "") }), a.innerHTML = i.join("") + "
", d.appendChild(a) }), E() } if (y && h.removeChild(y), h.appendChild(d), "year" === e || "month" === e) w(n.elemMain[t]).addClass("laydate-ym-show"), w(d).find("li").on("click", function () { var r = 0 | w(this).attr("lay-ym"); if (!w(this).hasClass(s)) { if (0 === t) i[e] = r, l && (n.startDate[e] = r), n.limit(w(n.footer).find(g), null, 0); else if (l) n.endDate[e] = r; else { var c = "year" === e ? n.getAsYM(r, T[1] - 1, "sub") : n.getAsYM(T[0], r, "sub"); w.extend(i, { year : c[0], month : c[1] }) } "year" === a.type || "month" === a.type ? (w(d).find("." + o).removeClass(o), w(this).addClass(o), "month" === a.type && "year" === e && (n.listYM[t][0] = r, l && (n[["startDate", "endDate"][t]].year = r), n.list("month", t))) : (n.checkDate("limit").calendar(), n.closeList()), n.setBtnStatus(), a.range || n.done(null, "change"), w(n.footer).find(D).removeClass(s) } }); else { var S = w.elem("span", { "class" : v }), k = function () { w(d).find("ol").each(function (e) { var t = this, a = w(t).find("li"); t.scrollTop = 30 * (n[x][C[e]] - 2), t.scrollTop <= 0 && a.each(function (e, n) { if (!w(this).hasClass(s)) return t.scrollTop = 30 * (e - 2), !0 }) }) }, H = w(c[2]).find("." + v); k(), S.innerHTML = a.range ? [r.startTime, r.endTime][t] : r.timeTips, w(n.elemMain[t]).addClass("laydate-time-show"), H[0] && H.remove(), c[2].appendChild(S), w(d).find("ol").each(function (e) { var t = this; w(t).find("li").on("click", function () { var r = 0 | this.innerHTML; w(this).hasClass(s) || (a.range ? n[x][C[e]] = r : i[C[e]] = r, w(t).find("." + o).removeClass(o), w(this).addClass(o), E(), k(), (n.endDate || "time" === a.type) && n.done(null, "change"), n.setBtnStatus()) }) }) } return n }, T.prototype.listYM = [], T.prototype.closeList = function () { var e = this; e.config; w.each(e.elemCont, function (t, n) { w(this).find("." + m).remove(), w(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show") }), w(e.elem).find("." + v).remove() }, T.prototype.setBtnStatus = function (e, t, n) { var a, i = this, r = i.config, o = w(i.footer).find(g), d = r.range && "date" !== r.type && "time" !== r.type; d && (t = t || i.startDate, n = n || i.endDate, a = i.newDate(t).getTime() > i.newDate(n).getTime(), i.limit(null, t) || i.limit(null, n) ? o.addClass(s) : o[a ? "addClass" : "removeClass"](s), e && a && i.hint("string" == typeof e ? l.replace(/鏃ユ湡/g, e) : l)) }, T.prototype.parse = function (e, t) { var n = this, a = n.config, i = t || (e ? w.extend({}, n.endDate, n.endTime) : a.range ? w.extend({}, n.startDate, n.startTime) : a.dateTime), r = n.format.concat(); return w.each(r, function (e, t) { /yyyy|y/.test(t) ? r[e] = w.digit(i.year, t.length) : /MM|M/.test(t) ? r[e] = w.digit(i.month + 1, t.length) : /dd|d/.test(t) ? r[e] = w.digit(i.date, t.length) : /HH|H/.test(t) ? r[e] = w.digit(i.hours, t.length) : /mm|m/.test(t) ? r[e] = w.digit(i.minutes, t.length) : /ss|s/.test(t) && (r[e] = w.digit(i.seconds, t.length)) }), a.range && !e ? r.join("") + " " + a.range + " " + n.parse(1) : r.join("") }, T.prototype.newDate = function (e) { return e = e || {}, new Date(e.year || 1, e.month || 0, e.date || 1, e.hours || 0, e.minutes || 0, e.seconds || 0) }, T.prototype.setValue = function (e) { var t = this, n = t.config, a = t.bindElem || n.elem[0], i = t.isInput(a) ? "val" : "html"; return "static" === n.position || w(a)[i](e || ""), this }, T.prototype.stampRange = function () { var e, t, n = this, a = n.config, i = w(n.elem).find("td"); if (a.range && !n.endDate && w(n.footer).find(g).addClass(s), n.endDate) return e = n.newDate({ year : n.startDate.year, month : n.startDate.month, date : n.startDate.date }).getTime(), t = n.newDate({ year : n.endDate.year, month : n.endDate.month, date : n.endDate.date }).getTime(), e > t ? n.hint(l) : void w.each(i, function (a, i) { var r = w(i).attr("lay-ymd").split("-"), s = n.newDate({ year : r[0], month : r[1] - 1, date : r[2] }).getTime(); w(i).removeClass(u + " " + o), s !== e && s !== t || w(i).addClass(w(i).hasClass(y) || w(i).hasClass(f) ? u : o), s > e && s < t && w(i).addClass(u) }) }, T.prototype.done = function (e, t) { var n = this, a = n.config, i = w.extend({}, n.startDate ? w.extend(n.startDate, n.startTime) : a.dateTime), r = w.extend({}, w.extend(n.endDate, n.endTime)); return w.each([i, r], function (e, t) { "month" in t && w.extend(t, { month : t.month + 1 }) }), e = e || [n.parse(), i, r], "function" == typeof a[t || "done"] && a[t || "done"].apply(a, e), n }, T.prototype.choose = function (e) { var t = this, n = t.config, a = n.dateTime, i = w(t.elem).find("td"), r = e.attr("lay-ymd").split("-"), l = function (e) { new Date; e && w.extend(a, r), n.range && (t.startDate ? w.extend(t.startDate, r) : t.startDate = w.extend({}, r, t.startTime), t.startYMD = r) }; if (r = { year : 0 | r[0], month : (0 | r[1]) - 1, date : 0 | r[2] }, !e.hasClass(s)) if (n.range) { if (w.each(["startTime", "endTime"], function (e, n) { t[n] = t[n] || { hours : 0, minutes : 0, seconds : 0 } }), t.endState) l(), delete t.endState, delete t.endDate, t.startState = !0, i.removeClass(o + " " + u), e.addClass(o); else if (t.startState) { if (e.addClass(o), t.endDate ? w.extend(t.endDate, r) : t.endDate = w.extend({}, r, t.endTime), t.newDate(r).getTime() < t.newDate(t.startYMD).getTime()) { var d = w.extend({}, t.endDate, { hours : t.startDate.hours, minutes : t.startDate.minutes, seconds : t.startDate.seconds }); w.extend(t.endDate, t.startDate, { hours : t.endDate.hours, minutes : t.endDate.minutes, seconds : t.endDate.seconds }), t.startDate = d } n.showBottom || t.done(), t.stampRange(), t.endState = !0, t.done(null, "change") } else e.addClass(o), l(), t.startState = !0; w(t.footer).find(g)[t.endDate ? "removeClass" : "addClass"](s) } else "static" === n.position ? (l(!0), t.calendar().done().done(null, "change")) : "date" === n.type ? (l(!0), t.setValue(t.parse()).remove().done()) : "datetime" === n.type && (l(!0), t.calendar().done(null, "change")) }, T.prototype.tool = function (e, t) { var n = this, a = n.config, i = a.dateTime, r = "static" === a.position, o = { datetime : function () { w(e).hasClass(s) || (n.list("time", 0), a.range && n.list("time", 1), w(e).attr("lay-type", "date").html(n.lang().dateTips)) }, date : function () { n.closeList(), w(e).attr("lay-type", "datetime").html(n.lang().timeTips) }, clear : function () { n.setValue("").remove(), r && (w.extend(i, n.firstDate), n.calendar()), a.range && (delete n.startState, delete n.endState, delete n.endDate, delete n.startTime, delete n.endTime), n.done(["", {}, {} ]) }, now : function () { var e = new Date; w.extend(i, n.systemDate(), { hours : e.getHours(), minutes : e.getMinutes(), seconds : e.getSeconds() }), n.setValue(n.parse()).remove(), r && n.calendar(), n.done() }, confirm : function () { if (a.range) { if (!n.endDate) return n.hint("璇峰厛閫夋嫨鏃ユ湡鑼冨洿"); if (w(e).hasClass(s)) return n.hint("time" === a.type ? l.replace(/鏃ユ湡/g, "鏃堕棿") : l) } else if (w(e).hasClass(s)) return n.hint("涓嶅湪鏈夋晥鏃ユ湡鎴栨椂闂磋寖鍥村唴"); n.done(), n.setValue(n.parse()).remove() } }; o[t] && o[t]() }, T.prototype.change = function (e) { var t = this, n = t.config, a = n.dateTime, i = n.range && ("year" === n.type || "month" === n.type), r = t.elemCont[e || 0], o = t.listYM[e], s = function (s) { var l = ["startDate", "endDate"][e], d = w(r).find(".laydate-year-list")[0], c = w(r).find(".laydate-month-list")[0]; return d && (o[0] = s ? o[0] - 15 : o[0] + 15, t.list("year", e)), c && (s ? o[0]-- : o[0]++, t.list("month", e)), (d || c) && (w.extend(a, { year : o[0] }), i && (t[l].year = o[0]), n.range || t.done(null, "change"), t.setBtnStatus(), n.range || t.limit(w(t.footer).find(g), { year : o[0] })), d || c }; return { prevYear : function () { s("sub") || (a.year--, t.checkDate("limit").calendar(), n.range || t.done(null, "change")) }, prevMonth : function () { var e = t.getAsYM(a.year, a.month, "sub"); w.extend(a, { year : e[0], month : e[1] }), t.checkDate("limit").calendar(), n.range || t.done(null, "change") }, nextMonth : function () { var e = t.getAsYM(a.year, a.month); w.extend(a, { year : e[0], month : e[1] }), t.checkDate("limit").calendar(), n.range || t.done(null, "change") }, nextYear : function () { s() || (a.year++, t.checkDate("limit").calendar(), n.range || t.done(null, "change")) } } }, T.prototype.changeEvent = function () { var e = this; e.config; w(e.elem).on("click", function (e) { w.stope(e) }), w.each(e.elemHeader, function (t, n) { w(n[0]).on("click", function (n) { e.change(t).prevYear() }), w(n[1]).on("click", function (n) { e.change(t).prevMonth() }), w(n[2]).find("span").on("click", function (n) { var a = w(this), i = a.attr("lay-ym"), r = a.attr("lay-type"); i && (i = i.split("-"), e.listYM[t] = [0 | i[0], 0 | i[1]], e.list(r, t), w(e.footer).find(D).addClass(s)) }), w(n[3]).on("click", function (n) { e.change(t).nextMonth() }), w(n[4]).on("click", function (n) { e.change(t).nextYear() }) }), w.each(e.table, function (t, n) { var a = w(n).find("td"); a.on("click", function () { e.choose(w(this)) }) }), w(e.footer).find("span").on("click", function () { var t = w(this).attr("lay-type"); e.tool(this, t) }) }, T.prototype.isInput = function (e) { return /input|textarea/.test(e.tagName.toLocaleLowerCase()) }, T.prototype.events = function () { var e = this, t = e.config, n = function (n, a) { n.on(t.trigger, function () { a && (e.bindElem = this), e.render() }) }; t.elem[0] && !t.elem[0].eventHandler && (n(t.elem, "bind"), n(t.eventElem), w(document).on("click", function (n) { n.target !== t.elem[0] && n.target !== t.eventElem[0] && n.target !== w(t.closeStop)[0] && e.remove() }).on("keydown", function (t) { 13 === t.keyCode && w("#" + e.elemID)[0] && e.elemID === T.thisElem && (t.preventDefault(), w(e.footer).find(g)[0].click()) }), w(window).on("resize", function () { return !(!e.elem || !w(r)[0]) && void e.position() }), t.elem[0].eventHandler = !0) }, n.render = function (e) { var t = new T(e); return a.call(t) }, n.getEndDate = function (e, t) { var n = new Date; return n.setFullYear(t || n.getFullYear(), e || n.getMonth() + 1, 1), new Date(n.getTime() - 864e5).getDate() }, window.lay = window.lay || w, e ? (n.ready(), layui.define(function (e) { n.path = layui.cache.dir, e(i, n) })) : "function" == typeof define && define.amd ? define(function () { return n }) : function () { n.ready(), window.laydate = n } () } (); !function (e, t) { "object" == typeof module && "object" == typeof module.exports ? module.exports = e.document ? t(e, !0) : function (e) { if (!e.document) throw new Error("jQuery requires a window with a document"); return t(e) } : t(e) } ("undefined" != typeof window ? window : this, function (e, t) { function n(e) { var t = !!e && "length" in e && e.length, n = pe.type(e); return "function" !== n && !pe.isWindow(e) && ("array" === n || 0 === t || "number" == typeof t && t > 0 && t - 1 in e) } function r(e, t, n) { if (pe.isFunction(t)) return pe.grep(e, function (e, r) { return !!t.call(e, r, e) !== n }); if (t.nodeType) return pe.grep(e, function (e) { return e === t !== n }); if ("string" == typeof t) { if (Ce.test(t)) return pe.filter(t, e, n); t = pe.filter(t, e) } return pe.grep(e, function (e) { return pe.inArray(e, t) > -1 !== n }) } function i(e, t) { do e = e[t]; while (e && 1 !== e.nodeType); return e } function o(e) { var t = {}; return pe.each(e.match(De) || [], function (e, n) { t[n] = !0 }), t } function a() { re.addEventListener ? (re.removeEventListener("DOMContentLoaded", s), e.removeEventListener("load", s)) : (re.detachEvent("onreadystatechange", s), e.detachEvent("onload", s)) } function s() { (re.addEventListener || "load" === e.event.type || "complete" === re.readyState) && (a(), pe.ready()) } function u(e, t, n) { if (void 0 === n && 1 === e.nodeType) { var r = "data-" + t.replace(_e, "-$1").toLowerCase(); if (n = e.getAttribute(r), "string" == typeof n) { try { n = "true" === n || "false" !== n && ("null" === n ? null : +n + "" === n ? +n : qe.test(n) ? pe.parseJSON(n) : n) } catch (i) {} pe.data(e, t, n) } else n = void 0 } return n } function l(e) { var t; for (t in e) if (("data" !== t || !pe.isEmptyObject(e[t])) && "toJSON" !== t) return !1; return !0 } function c(e, t, n, r) { if (He(e)) { var i, o, a = pe.expando, s = e.nodeType, u = s ? pe.cache : e, l = s ? e[a] : e[a] && a; if (l && u[l] && (r || u[l].data) || void 0 !== n || "string" != typeof t) return l || (l = s ? e[a] = ne.pop() || pe.guid++ : a), u[l] || (u[l] = s ? {} : { toJSON : pe.noop }), "object" != typeof t && "function" != typeof t || (r ? u[l] = pe.extend(u[l], t) : u[l].data = pe.extend(u[l].data, t)), o = u[l], r || (o.data || (o.data = {}), o = o.data), void 0 !== n && (o[pe.camelCase(t)] = n), "string" == typeof t ? (i = o[t], null == i && (i = o[pe.camelCase(t)])) : i = o, i } } function f(e, t, n) { if (He(e)) { var r, i, o = e.nodeType, a = o ? pe.cache : e, s = o ? e[pe.expando] : pe.expando; if (a[s]) { if (t && (r = n ? a[s] : a[s].data)) { pe.isArray(t) ? t = t.concat(pe.map(t, pe.camelCase)) : t in r ? t = [t] : (t = pe.camelCase(t), t = t in r ? [t] : t.split(" ")), i = t.length; for (; i--; ) delete r[t[i]]; if (n ? !l(r) : !pe.isEmptyObject(r)) return } (n || (delete a[s].data, l(a[s]))) && (o ? pe.cleanData([e], !0) : fe.deleteExpando || a != a.window ? delete a[s] : a[s] = void 0) } } } function d(e, t, n, r) { var i, o = 1, a = 20, s = r ? function () { return r.cur() } : function () { return pe.css(e, t, "") }, u = s(), l = n && n[3] || (pe.cssNumber[t] ? "" : "px"), c = (pe.cssNumber[t] || "px" !== l && +u) && Me.exec(pe.css(e, t)); if (c && c[3] !== l) { l = l || c[3], n = n || [], c = +u || 1; do o = o || ".5", c /= o, pe.style(e, t, c + l); while (o !== (o = s() / u) && 1 !== o && --a) } return n && (c = +c || +u || 0, i = n[1] ? c + (n[1] + 1) * n[2] : +n[2], r && (r.unit = l, r.start = c, r.end = i)), i } function p(e) { var t = ze.split("|"), n = e.createDocumentFragment(); if (n.createElement) for (; t.length; ) n.createElement(t.pop()); return n } function h(e, t) { var n, r, i = 0, o = "undefined" != typeof e.getElementsByTagName ? e.getElementsByTagName(t || "*") : "undefined" != typeof e.querySelectorAll ? e.querySelectorAll(t || "*") : void 0; if (!o) for (o = [], n = e.childNodes || e; null != (r = n[i]); i++) !t || pe.nodeName(r, t) ? o.push(r) : pe.merge(o, h(r, t)); return void 0 === t || t && pe.nodeName(e, t) ? pe.merge([e], o) : o } function g(e, t) { for (var n, r = 0; null != (n = e[r]); r++) pe._data(n, "globalEval", !t || pe._data(t[r], "globalEval")) } function m(e) { Be.test(e.type) && (e.defaultChecked = e.checked) } function y(e, t, n, r, i) { for (var o, a, s, u, l, c, f, d = e.length, y = p(t), v = [], x = 0; x < d; x++) if (a = e[x], a || 0 === a) if ("object" === pe.type(a)) pe.merge(v, a.nodeType ? [a] : a); else if (Ue.test(a)) { for (u = u || y.appendChild(t.createElement("div")), l = (We.exec(a) || ["", ""])[1].toLowerCase(), f = Xe[l] || Xe._default, u.innerHTML = f[1] + pe.htmlPrefilter(a) + f[2], o = f[0]; o--; ) u = u.lastChild; if (!fe.leadingWhitespace && $e.test(a) && v.push(t.createTextNode($e.exec(a)[0])), !fe.tbody) for (a = "table" !== l || Ve.test(a) ? "" !== f[1] || Ve.test(a) ? 0 : u : u.firstChild, o = a && a.childNodes.length; o--; ) pe.nodeName(c = a.childNodes[o], "tbody") && !c.childNodes.length && a.removeChild(c); for (pe.merge(v, u.childNodes), u.textContent = ""; u.firstChild; ) u.removeChild(u.firstChild); u = y.lastChild } else v.push(t.createTextNode(a)); for (u && y.removeChild(u), fe.appendChecked || pe.grep(h(v, "input"), m), x = 0; a = v[x++]; ) if (r && pe.inArray(a, r) > -1) i && i.push(a); else if (s = pe.contains(a.ownerDocument, a), u = h(y.appendChild(a), "script"), s && g(u), n) for (o = 0; a = u[o++]; ) Ie.test(a.type || "") && n.push(a); return u = null, y } function v() { return !0 } function x() { return !1 } function b() { try { return re.activeElement } catch (e) {} } function w(e, t, n, r, i, o) { var a, s; if ("object" == typeof t) { "string" != typeof n && (r = r || n, n = void 0); for (s in t) w(e, s, n, r, t[s], o); return e } if (null == r && null == i ? (i = n, r = n = void 0) : null == i && ("string" == typeof n ? (i = r, r = void 0) : (i = r, r = n, n = void 0)), i === !1) i = x; else if (!i) return e; return 1 === o && (a = i, i = function (e) { return pe().off(e), a.apply(this, arguments) }, i.guid = a.guid || (a.guid = pe.guid++)), e.each(function () { pe.event.add(this, t, i, r, n) }) } function T(e, t) { return pe.nodeName(e, "table") && pe.nodeName(11 !== t.nodeType ? t : t.firstChild, "tr") ? e.getElementsByTagName("tbody")[0] || e.appendChild(e.ownerDocument.createElement("tbody")) : e } function C(e) { return e.type = (null !== pe.find.attr(e, "type")) + "/" + e.type, e } function E(e) { var t = it.exec(e.type); return t ? e.type = t[1] : e.removeAttribute("type"), e } function N(e, t) { if (1 === t.nodeType && pe.hasData(e)) { var n, r, i, o = pe._data(e), a = pe._data(t, o), s = o.events; if (s) { delete a.handle, a.events = {}; for (n in s) for (r = 0, i = s[n].length; r < i; r++) pe.event.add(t, n, s[n][r]) } a.data && (a.data = pe.extend({}, a.data)) } } function k(e, t) { var n, r, i; if (1 === t.nodeType) { if (n = t.nodeName.toLowerCase(), !fe.noCloneEvent && t[pe.expando]) { i = pe._data(t); for (r in i.events) pe.removeEvent(t, r, i.handle); t.removeAttribute(pe.expando) } "script" === n && t.text !== e.text ? (C(t).text = e.text, E(t)) : "object" === n ? (t.parentNode && (t.outerHTML = e.outerHTML), fe.html5Clone && e.innerHTML && !pe.trim(t.innerHTML) && (t.innerHTML = e.innerHTML)) : "input" === n && Be.test(e.type) ? (t.defaultChecked = t.checked = e.checked, t.value !== e.value && (t.value = e.value)) : "option" === n ? t.defaultSelected = t.selected = e.defaultSelected : "input" !== n && "textarea" !== n || (t.defaultValue = e.defaultValue) } } function S(e, t, n, r) { t = oe.apply([], t); var i, o, a, s, u, l, c = 0, f = e.length, d = f - 1, p = t[0], g = pe.isFunction(p); if (g || f > 1 && "string" == typeof p && !fe.checkClone && rt.test(p)) return e.each(function (i) { var o = e.eq(i); g && (t[0] = p.call(this, i, o.html())), S(o, t, n, r) }); if (f && (l = y(t, e[0].ownerDocument, !1, e, r), i = l.firstChild, 1 === l.childNodes.length && (l = i), i || r)) { for (s = pe.map(h(l, "script"), C), a = s.length; c < f; c++) o = l, c !== d && (o = pe.clone(o, !0, !0), a && pe.merge(s, h(o, "script"))), n.call(e[c], o, c); if (a) for (u = s[s.length - 1].ownerDocument, pe.map(s, E), c = 0; c < a; c++) o = s[c], Ie.test(o.type || "") && !pe._data(o, "globalEval") && pe.contains(u, o) && (o.src ? pe._evalUrl && pe._evalUrl(o.src) : pe.globalEval((o.text || o.textContent || o.innerHTML || "").replace(ot, ""))); l = i = null } return e } function A(e, t, n) { for (var r, i = t ? pe.filter(t, e) : e, o = 0; null != (r = i[o]); o++) n || 1 !== r.nodeType || pe.cleanData(h(r)), r.parentNode && (n && pe.contains(r.ownerDocument, r) && g(h(r, "script")), r.parentNode.removeChild(r)); return e } function D(e, t) { var n = pe(t.createElement(e)).appendTo(t.body), r = pe.css(n[0], "display"); return n.detach(), r } function j(e) { var t = re, n = lt[e]; return n || (n = D(e, t), "none" !== n && n || (ut = (ut || pe("'; break; case 3: delete config.title; delete config.closeBtn; config.icon === -1 && (config.icon === 0); layer.closeAll('loading'); break; case 4: conType || (config.content = [config.content, 'body']); config.follow = config.content[1]; config.content = config.content[0] + ''; delete config.title; config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true]; config.tipsMore || layer.closeAll('tips'); break; } //寤虹珛瀹瑰櫒 that.vessel(conType, function(html, titleHTML, moveElem){ body.append(html[0]); conType ? function(){ (config.type == 2 || config.type == 4) ? function(){ $('body').append(html[1]); }() : function(){ if(!content.parents('.'+doms[0])[0]){ content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]); $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML); } }(); }() : body.append(html[1]); $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem); that.layero = $('#'+ doms[0] + times); config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times); }).auto(times); //閬僵 $('#layui-layer-shade'+ that.index).css({ 'background-color': config.shade[1] || '#000' ,'opacity': config.shade[0]||config.shade }); config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]); //鍧愭爣鑷�傚簲娴忚鍣ㄧ獥鍙e昂瀵� config.type == 4 ? that.tips() : that.offset(); if(config.fixed){ win.on('resize', function(){ that.offset(); (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times); config.type == 4 && that.tips(); }); } config.time <= 0 || setTimeout(function(){ layer.close(that.index) }, config.time); that.move().callback(); //涓哄吋瀹筳Query3.0鐨刢ss鍔ㄧ敾褰卞搷鍏冪礌灏哄璁$畻 if(doms.anim[config.anim]){ var animClass = 'layer-anim '+ doms.anim[config.anim]; that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ $(this).removeClass(animClass); }); }; //璁板綍鍏抽棴鍔ㄧ敾 if(config.isOutAnim){ that.layero.data('isOutAnim', true); } }; //鑷�傚簲 Class.pt.auto = function(index){ var that = this, config = that.config, layero = $('#'+ doms[0] + index); if(config.area[0] === '' && config.maxWidth > 0){ //涓轰簡淇IE7涓嬩竴涓浜洪毦浠ョ悊瑙g殑bug if(layer.ie && layer.ie < 8 && config.btn){ layero.width(layero.innerWidth()); } layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth); } var area = [layero.innerWidth(), layero.innerHeight()] ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 ,setHeight = function(elem){ elem = layero.find(elem); elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0)); }; switch(config.type){ case 2: setHeight('iframe'); break; default: if(config.area[1] === ''){ if(config.maxHeight > 0 && layero.outerHeight() > config.maxHeight){ area[1] = config.maxHeight; setHeight('.'+doms[5]); } else if(config.fixed && area[1] >= win.height()){ area[1] = win.height(); setHeight('.'+doms[5]); } } else { setHeight('.'+doms[5]); } break; }; return that; }; //璁$畻鍧愭爣 Class.pt.offset = function(){ var that = this, config = that.config, layero = that.layero; var area = [layero.outerWidth(), layero.outerHeight()]; var type = typeof config.offset === 'object'; that.offsetTop = (win.height() - area[1])/2; that.offsetLeft = (win.width() - area[0])/2; if(type){ that.offsetTop = config.offset[0]; that.offsetLeft = config.offset[1]||that.offsetLeft; } else if(config.offset !== 'auto'){ if(config.offset === 't'){ //涓� that.offsetTop = 0; } else if(config.offset === 'r'){ //鍙� that.offsetLeft = win.width() - area[0]; } else if(config.offset === 'b'){ //涓� that.offsetTop = win.height() - area[1]; } else if(config.offset === 'l'){ //宸� that.offsetLeft = 0; } else if(config.offset === 'lt'){ //宸︿笂瑙� that.offsetTop = 0; that.offsetLeft = 0; } else if(config.offset === 'lb'){ //宸︿笅瑙� that.offsetTop = win.height() - area[1]; that.offsetLeft = 0; } else if(config.offset === 'rt'){ //鍙充笂瑙� that.offsetTop = 0; that.offsetLeft = win.width() - area[0]; } else if(config.offset === 'rb'){ //鍙充笅瑙� that.offsetTop = win.height() - area[1]; that.offsetLeft = win.width() - area[0]; } else { that.offsetTop = config.offset; } } if(!config.fixed){ that.offsetTop = /%$/.test(that.offsetTop) ? win.height()*parseFloat(that.offsetTop)/100 : parseFloat(that.offsetTop); that.offsetLeft = /%$/.test(that.offsetLeft) ? win.width()*parseFloat(that.offsetLeft)/100 : parseFloat(that.offsetLeft); that.offsetTop += win.scrollTop(); that.offsetLeft += win.scrollLeft(); } if(layero.attr('minLeft')){ that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0); that.offsetLeft = layero.css('left'); } layero.css({top: that.offsetTop, left: that.offsetLeft}); }; //Tips Class.pt.tips = function(){ var that = this, config = that.config, layero = that.layero; var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow); if(!follow[0]) follow = $('body'); var goal = { width: follow.outerWidth(), height: follow.outerHeight(), top: follow.offset().top, left: follow.offset().left }, tipsG = layero.find('.layui-layer-TipsG'); var guide = config.tips[0]; config.tips[1] || tipsG.remove(); goal.autoLeft = function(){ if(goal.left + layArea[0] - win.width() > 0){ goal.tipLeft = goal.left + goal.width - layArea[0]; tipsG.css({right: 12, left: 'auto'}); } else { goal.tipLeft = goal.left; }; }; //杈ㄥ埆tips鐨勬柟浣� goal.where = [function(){ //涓� goal.autoLeft(); goal.tipTop = goal.top - layArea[1] - 10; tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]); }, function(){ //鍙� goal.tipLeft = goal.left + goal.width + 10; goal.tipTop = goal.top; tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); }, function(){ //涓� goal.autoLeft(); goal.tipTop = goal.top + goal.height + 10; tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]); }, function(){ //宸� goal.tipLeft = goal.left - layArea[0] - 10; goal.tipTop = goal.top; tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]); }]; goal.where[guide-1](); /* 8*2涓哄皬涓夎褰㈠崰鎹殑绌洪棿 */ if(guide === 1){ goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2](); } else if(guide === 2){ win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]() } else if(guide === 3){ (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0](); } else if(guide === 4){ layArea[0] + 8*2 - goal.left > 0 && goal.where[1]() } layero.find('.'+doms[5]).css({ 'background-color': config.tips[1], 'padding-right': (config.closeBtn ? '30px' : '') }); layero.css({ left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), top: goal.tipTop - (config.fixed ? win.scrollTop() : 0) }); } //鎷栨嫿灞� Class.pt.move = function(){ var that = this ,config = that.config ,_DOC = $(document) ,layero = that.layero ,moveElem = layero.find(config.move) ,resizeElem = layero.find('.layui-layer-resize') ,dict = {}; if(config.move){ moveElem.css('cursor', 'move'); } moveElem.on('mousedown', function(e){ e.preventDefault(); if(config.move){ dict.moveStart = true; dict.offset = [ e.clientX - parseFloat(layero.css('left')) ,e.clientY - parseFloat(layero.css('top')) ]; ready.moveElem.css('cursor', 'move').show(); } }); resizeElem.on('mousedown', function(e){ e.preventDefault(); dict.resizeStart = true; dict.offset = [e.clientX, e.clientY]; dict.area = [ layero.outerWidth() ,layero.outerHeight() ]; ready.moveElem.css('cursor', 'se-resize').show(); }); _DOC.on('mousemove', function(e){ //鎷栨嫿绉诲姩 if(dict.moveStart){ var X = e.clientX - dict.offset[0] ,Y = e.clientY - dict.offset[1] ,fixed = layero.css('position') === 'fixed'; e.preventDefault(); dict.stX = fixed ? 0 : win.scrollLeft(); dict.stY = fixed ? 0 : win.scrollTop(); //鎺у埗鍏冪礌涓嶈鎷栧嚭绐楀彛澶� if(!config.moveOut){ var setRig = win.width() - layero.outerWidth() + dict.stX ,setBot = win.height() - layero.outerHeight() + dict.stY; X < dict.stX && (X = dict.stX); X > setRig && (X = setRig); Y < dict.stY && (Y = dict.stY); Y > setBot && (Y = setBot); } layero.css({ left: X ,top: Y }); } //Resize if(config.resize && dict.resizeStart){ var X = e.clientX - dict.offset[0] ,Y = e.clientY - dict.offset[1]; e.preventDefault(); layer.style(that.index, { width: dict.area[0] + X ,height: dict.area[1] + Y }) dict.isResize = true; config.resizing && config.resizing(layero); } }).on('mouseup', function(e){ if(dict.moveStart){ delete dict.moveStart; ready.moveElem.hide(); config.moveEnd && config.moveEnd(layero); } if(dict.resizeStart){ delete dict.resizeStart; ready.moveElem.hide(); } }); return that; }; Class.pt.callback = function(){ var that = this, layero = that.layero, config = that.config; that.openLayer(); if(config.success){ if(config.type == 2){ layero.find('iframe').on('load', function(){ config.success(layero, that.index); }); } else { config.success(layero, that.index); } } layer.ie == 6 && that.IE6(layero); //鎸夐挳 layero.find('.'+ doms[6]).children('a').on('click', function(){ //TODO var _opts = $(this).attr("_opts"); if (_opts) { _opts = JSON.parse(_opts); var events = _opts.events; _opts.layerIndex = that.index; var rt = true; for (var e in events) { var event = events[e]; if (event.name == "click") { rt = iplatform.uiexecute.executeEvent(event,$(this),_opts); } } if (!rt) { return rt; } layer.close(that.index); } else { var index = $(this).index(); if(index === 0){ if(config.yes){ config.yes(that.index, layero, index); layer.close(that.index); } else if(config['btn1']){ config['btn1'](that.index, layero, index); layer.close(that.index); } else { layer.close(that.index); } } else { var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero, index); close === false || layer.close(that.index); } } }); //鎸夐挳 /*layero.find('.layui-layer-b-btn').children('a').on('click', function(){ //TODO var index = $(this).index(); if(index === 0){ if(config.yes){ config.yes(that.index, layero, index) } else if(config['btn1']){ config['btn1'](that.index, layero, index) } else { layer.close(that.index); } } else { var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero, index); close === false || layer.close(that.index); } });*/ //鍙栨秷 function cancel(){ var close = config.cancel && config.cancel(that.index, layero); close === false || layer.close(that.index); } //鍙充笂瑙掑叧闂洖璋� layero.find('.'+ doms[7]).on('click', cancel); //鐐归伄缃╁叧闂� if(config.shadeClose){ $('#layui-layer-shade'+ that.index).on('click', function(){ layer.close(that.index); }); } //鏈�灏忓寲 layero.find('.layui-layer-min').on('click', function(){ var min = config.min && config.min(layero); min === false || layer.min(that.index, config); }); //鍏ㄥ睆/杩樺師 layero.find('.layui-layer-max').on('click', function(){ if($(this).hasClass('layui-layer-maxmin')){ layer.restore(that.index); config.restore && config.restore(layero); } else { layer.full(that.index, config); setTimeout(function(){ config.full && config.full(layero); }, 100); } }); config.end && (ready.end[that.index] = config.end); }; //for ie6 鎭㈠select ready.reselect = function(){ $.each($('select'), function(index , value){ var sthis = $(this); if(!sthis.parents('.'+doms[0])[0]){ (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); } sthis = null; }); }; Class.pt.IE6 = function(layero){ //闅愯棌select $('select').each(function(index , value){ var sthis = $(this); if(!sthis.parents('.'+doms[0])[0]){ sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide(); } sthis = null; }); }; //闇�渚濊禆鍘熷瀷鐨勫澶栨柟娉� Class.pt.openLayer = function(){ var that = this; //缃《褰撳墠绐楀彛 layer.zIndex = that.config.zIndex; layer.setTop = function(layero){ var setZindex = function(){ layer.zIndex++; layero.css('z-index', layer.zIndex + 1); }; layer.zIndex = parseInt(layero[0].style.zIndex); layero.on('mousedown', setZindex); return layer.zIndex; }; }; ready.record = function(layero){ var area = [ layero.width(), layero.height(), layero.position().top, layero.position().left + parseFloat(layero.css('margin-left')) ]; layero.find('.layui-layer-max').addClass('layui-layer-maxmin'); layero.attr({area: area}); }; ready.rescollbar = function(index){ if(doms.html.attr('layer-full') == index){ if(doms.html[0].style.removeProperty){ doms.html[0].style.removeProperty('overflow'); } else { doms.html[0].style.removeAttribute('overflow'); } doms.html.removeAttr('layer-full'); } }; /** 鍐呯疆鎴愬憳 */ window.layer = layer; //鑾峰彇瀛恑frame鐨凞OM layer.getChildFrame = function(selector, index){ index = index || $('.'+doms[4]).attr('times'); return $('#'+ doms[0] + index).find('iframe').contents().find(selector); }; //寰楀埌褰撳墠iframe灞傜殑绱㈠紩锛屽瓙iframe鏃朵娇鐢� layer.getFrameIndex = function(name){ return $('#'+ name).parents('.'+doms[4]).attr('times'); }; //iframe灞傝嚜閫傚簲瀹介珮 layer.iframeAuto = function(index){ if(!index) return; var heg = layer.getChildFrame('html', index).outerHeight(); var layero = $('#'+ doms[0] + index); var titHeight = layero.find(doms[1]).outerHeight() || 0; var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0; layero.css({height: heg + titHeight + btnHeight}); layero.find('iframe').css({height: heg}); }; //閲嶇疆iframe url layer.iframeSrc = function(index, url){ $('#'+ doms[0] + index).find('iframe').attr('src', url); }; //璁惧畾灞傜殑鏍峰紡 layer.style = function(index, options, limit){ var layero = $('#'+ doms[0] + index) ,contElem = layero.find('.layui-layer-content') ,type = layero.attr('type') ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 ,minLeft = layero.attr('minLeft'); if(type === ready.type[3] || type === ready.type[4]){ return; } if(!limit){ if(parseFloat(options.width) <= 260){ options.width = 260; }; if(parseFloat(options.height) - titHeight - btnHeight <= 64){ options.height = 64 + titHeight + btnHeight; }; } layero.css(options); btnHeight = layero.find('.'+doms[6]).outerHeight(); if(type === ready.type[2]){ layero.find('iframe').css({ height: parseFloat(options.height) - titHeight - btnHeight }); } else { contElem.css({ height: parseFloat(options.height) - titHeight - btnHeight - parseFloat(contElem.css('padding-top')) - parseFloat(contElem.css('padding-bottom')) }) } }; //鏈�灏忓寲 layer.min = function(index, options){ var layero = $('#'+ doms[0] + index) ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' ,position = layero.css('position'); ready.record(layero); if(ready.minLeft[0]){ left = ready.minLeft[0]; ready.minLeft.shift(); } layero.attr('position', position); layer.style(index, { width: 180 ,height: titHeight ,left: left ,top: win.height() - titHeight ,position: 'fixed' ,overflow: 'hidden' }, true); layero.find('.layui-layer-min').hide(); layero.attr('type') === 'page' && layero.find(doms[4]).hide(); ready.rescollbar(index); if(!layero.attr('minLeft')){ ready.minIndex++; } layero.attr('minLeft', left); }; //杩樺師 layer.restore = function(index){ var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(','); var type = layero.attr('type'); layer.style(index, { width: parseFloat(area[0]), height: parseFloat(area[1]), top: parseFloat(area[2]), left: parseFloat(area[3]), position: layero.attr('position'), overflow: 'visible' }, true); layero.find('.layui-layer-max').removeClass('layui-layer-maxmin'); layero.find('.layui-layer-min').show(); layero.attr('type') === 'page' && layero.find(doms[4]).show(); ready.rescollbar(index); }; //鍏ㄥ睆 layer.full = function(index){ var layero = $('#'+ doms[0] + index), timer; ready.record(layero); if(!doms.html.attr('layer-full')){ doms.html.css('overflow','hidden').attr('layer-full', index); } clearTimeout(timer); timer = setTimeout(function(){ var isfix = layero.css('position') === 'fixed'; layer.style(index, { top: isfix ? 0 : win.scrollTop(), left: isfix ? 0 : win.scrollLeft(), width: win.width(), height: win.height() }, true); layero.find('.layui-layer-min').hide(); }, 100); }; //鏀瑰彉title layer.title = function(name, index){ var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]); title.html(name); }; //鍏抽棴layer鎬绘柟娉� layer.close = function(index){ var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close'; if(!layero[0]) return; var WRAP = 'layui-layer-wrap', remove = function(){ if(type === ready.type[1] && layero.attr('conType') === 'object'){ layero.children(':not(.'+ doms[5] +')').remove(); var wrap = layero.find('.'+WRAP); for(var i = 0; i < 2; i++){ wrap.unwrap(); } wrap.css('display', wrap.data('display')).removeClass(WRAP); } else { //浣庣増鏈琁E 鍥炴敹 iframe if(type === ready.type[2]){ try { var iframe = $('#'+doms[4]+index)[0]; iframe.contentWindow.document.write(''); iframe.contentWindow.close(); layero.find('.'+doms[5])[0].removeChild(iframe); } catch(e){} } layero[0].innerHTML = ''; layero.remove(); } typeof ready.end[index] === 'function' && ready.end[index](); delete ready.end[index]; }; if(layero.data('isOutAnim')){ layero.addClass('layer-anim '+ closeAnim); } $('#layui-layer-moves, #layui-layer-shade' + index).remove(); layer.ie == 6 && ready.reselect(); ready.rescollbar(index); if(layero.attr('minLeft')){ ready.minIndex--; ready.minLeft.push(layero.attr('minLeft')); } if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){ remove() } else { setTimeout(function(){ remove(); }, 200); } }; //鍏抽棴鎵�鏈夊眰 layer.closeAll = function(type){ $.each($('.'+doms[0]), function(){ var othis = $(this); var is = type ? (othis.attr('type') === type) : 1; is && layer.close(othis.attr('times')); is = null; }); }; /** 鎷撳睍妯″潡锛宭ayui寮�濮嬪悎骞跺湪涓�璧� */ var cache = layer.cache||{}, skin = function(type){ return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : ''); }; //浠跨郴缁焢rompt layer.prompt = function(options, yes){ var style = ''; options = options || {}; if(typeof options === 'function') yes = options; if(options.area){ var area = options.area; style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; delete options.area; } var prompt, content = options.formType == 2 ? '' : function(){ return ''; }(); var success = options.success; delete options.success; return layer.open($.extend({ type: 1 ,btn: ['确定','取消'] ,content: content ,skin: 'layui-layer-prompt' + skin('prompt') ,maxWidth: win.width() ,success: function(layero){ prompt = layero.find('.layui-layer-input'); prompt.val(options.value || '').focus(); typeof success === 'function' && success(layero); } ,resize: false ,yes: function(index){ var value = prompt.val(); if(value === ''){ prompt.focus(); } else if(value.length > (options.maxlength||500)) { layer.tips('最多输入'+ (options.maxlength || 500) +'个字数', prompt, {tips: 1}); } else { yes && yes(value, index, prompt); } } }, options)); }; //tab灞� layer.tab = function(options){ options = options || {}; var tab = options.tab || {} ,THIS = 'layui-this' ,success = options.success; delete options.success; return layer.open($.extend({ type: 1, skin: 'layui-layer-tab' + skin('tab'), resize: false, title: function(){ var len = tab.length, ii = 1, str = ''; if(len > 0){ str = ''+ tab[0].title +''; for(; ii < len; ii++){ str += ''+ tab[ii].title +''; } } return str; }(), content: '', success: function(layero){ var btn = layero.find('.layui-layer-title').children(); var main = layero.find('.layui-layer-tabmain').children(); btn.on('mousedown', function(e){ e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; var othis = $(this), index = othis.index(); othis.addClass(THIS).siblings().removeClass(THIS); main.eq(index).show().siblings().hide(); typeof options.change === 'function' && options.change(index); }); typeof success === 'function' && success(layero); } }, options)); }; //鐩稿唽灞� layer.photos = function(options, loop, key){ var dict = {}; options = options || {}; if(!options.photos) return; var type = options.photos.constructor === Object; var photos = type ? options.photos : {}, data = photos.data || []; var start = photos.start || 0; dict.imgIndex = (start|0) + 1; options.img = options.img || 'img'; var success = options.success; delete options.success; if(!type){ //椤甸潰鐩存帴鑾峰彇 var parent = $(options.photos), pushData = function(){ data = []; parent.find(options.img).each(function(index){ var othis = $(this); othis.attr('layer-index', index); data.push({ alt: othis.attr('alt'), pid: othis.attr('layer-pid'), src: othis.attr('layer-src') || othis.attr('src'), thumb: othis.attr('src') }); }) }; pushData(); if (data.length === 0) return; loop || parent.on('click', options.img, function(){ var othis = $(this), index = othis.attr('layer-index'); layer.photos($.extend(options, { photos: { start: index, data: data, tab: options.tab }, full: options.full }), true); pushData(); }) //涓嶇洿鎺ュ脊鍑� if(!loop) return; } else if (data.length === 0){ return layer.msg('没有图片'); } //涓婁竴寮� dict.imgprev = function(key){ dict.imgIndex--; if(dict.imgIndex < 1){ dict.imgIndex = data.length; } dict.tabimg(key); }; //涓嬩竴寮� dict.imgnext = function(key,errorMsg){ dict.imgIndex++; if(dict.imgIndex > data.length){ dict.imgIndex = 1; if (errorMsg) {return}; } dict.tabimg(key) }; //鏂瑰悜閿� dict.keyup = function(event){ if(!dict.end){ var code = event.keyCode; event.preventDefault(); if(code === 37){ dict.imgprev(true); } else if(code === 39) { dict.imgnext(true); } else if(code === 27) { layer.close(dict.index); } } } //鍒囨崲 dict.tabimg = function(key){ if(data.length <= 1) return; photos.start = dict.imgIndex - 1; layer.close(dict.index); return layer.photos(options, true, key); setTimeout(function(){ layer.photos(options, true, key); }, 200); } //涓�浜涘姩浣� dict.event = function(){ dict.bigimg.hover(function(){ dict.imgsee.show(); }, function(){ dict.imgsee.hide(); }); dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ event.preventDefault(); dict.imgprev(); }); dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ event.preventDefault(); dict.imgnext(); }); $(document).on('keyup', dict.keyup); }; //鍥剧墖棰勫姞杞� function loadImage(url, callback, error) { var img = new Image(); img.src = url; if(img.complete){ return callback(img); } img.onload = function(){ img.onload = null; callback(img); }; img.onerror = function(e){ img.onerror = null; error(e); }; }; dict.loadi = layer.load(1, { shade: 'shade' in options ? false : 0.9, scrollbar: false }); loadImage(data[start].src, function(img){ layer.close(dict.loadi); dict.index = layer.open($.extend({ type: 1, id: 'layui-layer-photos', area: function(){ var imgarea = [img.width, img.height]; var winarea = [$(window).width() - 100, $(window).height() - 100]; //濡傛灉 瀹為檯鍥剧墖鐨勫鎴栬�呴珮姣� 灞忓箷澶э紙閭d箞杩涜缂╂斁锛� if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){ var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//鍙栧搴︾缉鏀炬瘮渚嬨�侀珮搴︾缉鏀炬瘮渚� if(wh[0] > wh[1]){//鍙栫缉鏀炬瘮渚嬫渶澶х殑杩涜缂╂斁 imgarea[0] = imgarea[0]/wh[0]; imgarea[1] = imgarea[1]/wh[0]; } else if(wh[0] < wh[1]){ imgarea[0] = imgarea[0]/wh[1]; imgarea[1] = imgarea[1]/wh[1]; } } return [imgarea[0]+'px', imgarea[1]+'px']; }(), title: false, shade: 0.9, shadeClose: true, closeBtn: false, move: '.layui-layer-phimg img', moveType: 1, scrollbar: false, moveOut: true, //anim: Math.random()*5|0, isOutAnim: false, skin: 'layui-layer-photos' + skin('photos'), content: '
' +''+ (data[start].alt||'') +'' +'
' +(data.length > 1 ? '' : '') +'
'+ (data[start].alt||'') +''+ dict.imgIndex +'/'+ data.length +'
' +'
' +'
', success: function(layero, index){ dict.bigimg = layero.find('.layui-layer-phimg'); dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar'); dict.event(layero); options.tab && options.tab(data[start], layero); typeof success === 'function' && success(layero); }, end: function(){ dict.end = true; $(document).off('keyup', dict.keyup); } }, options)); }, function(){ layer.close(dict.loadi); layer.msg('当前图片地址异常
是否继续查看下一张?', { time: 30000, btn: ['下一张', '不看了'], yes: function(){ data.length > 1 && dict.imgnext(true,true); } }); }); }; //涓诲叆鍙� ready.run = function(_$){ $ = _$; win = $(window); doms.html = $('html'); layer.open = function(deliver){ var o = new Class(deliver); return o.index; }; }; //鍔犺浇鏂瑰紡 window.layui && layui.define ? ( layer.ready() ,layui.define('jquery', function(exports){ //layui鍔犺浇 layer.path = layui.cache.dir; ready.run(layui.$); //鏆撮湶妯″潡 window.layer = layer; exports('layer', layer); }) ) : ( (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs鍔犺浇 ready.run(window.jQuery); return layer; }) : function(){ //鏅�歴cript鏍囩鍔犺浇 ready.run(window.jQuery); layer.ready(); }() ); }(window); layui.define("jquery", function (t) { "use strict"; var a = layui.$, i = (layui.hint(), layui.device()), e = "element", l = "layui-this", n = "layui-show", s = function () { this.config = {} }; s.prototype.set = function (t) { var i = this; return a.extend(!0, i.config, t), i }, s.prototype.on = function (t, a) { return layui.onevent.call(this, e, t, a) }, s.prototype.tabAdd = function (t, i) { var e = ".layui-tab-title", l = a(".layui-tab[lay-filter=" + t + "]"), n = l.children(e), s = n.children(".layui-tab-bar"), o = l.children(".layui-tab-content"), r = '
  • " + (i.title || "unnaming") + "
  • "; return s[0] ? s.before(r) : n.append(r), o.append('
    ' + (i.content || "") + "
    "), f.hideTabMore(!0), f.tabAuto(), this }, s.prototype.tabDelete = function (t, i) { var e = ".layui-tab-title", l = a(".layui-tab[lay-filter=" + t + "]"), n = l.children(e), s = n.find('>li[lay-id="' + i + '"]'); return f.tabDelete(null, s), this }, s.prototype.tabChange = function (t, i) { var e = ".layui-tab-title", l = a(".layui-tab[lay-filter=" + t + "]"), n = l.children(e), s = n.find('>li[lay-id="' + i + '"]'); return f.tabClick.call(s[0], null, null, s), this }, s.prototype.tab = function (t) { t = t || {}, b.on("click", t.headerElem, function (i) { var e = a(this).index(); f.tabClick.call(this, i, e, null, t) }) }, s.prototype.progress = function (t, i) { var e = "layui-progress", l = a("." + e + "[lay-filter=" + t + "]"), n = l.find("." + e + "-bar"), s = n.find("." + e + "-text"); return n.css("width", i), s.text(i), this }; var o = ".layui-nav", r = "layui-nav-item", c = "layui-nav-bar", u = "layui-nav-tree", d = "layui-nav-child", y = "layui-nav-more", h = "layui-anim layui-anim-upbit", f = { tabClick : function (t, i, s, o) { o = o || {}; var r = s || a(this), i = i || r.parent().children("li").index(r), c = o.headerElem ? r.parent() : r.parents(".layui-tab").eq(0), u = o.bodyElem ? a(o.bodyElem) : c.children(".layui-tab-content").children(".layui-tab-item"), d = r.find("a"), y = c.attr("lay-filter"); "javascript:;" !== d.attr("href") && "_blank" === d.attr("target") || (r.addClass(l).siblings().removeClass(l), u.eq(i).addClass(n).siblings().removeClass(n)), layui.event.call(this, e, "tab(" + y + ")", { elem : c, index : i }) }, tabDelete : function (t, i) { var n = i || a(this).parent(), s = n.index(), o = n.parents(".layui-tab").eq(0), r = o.children(".layui-tab-content").children(".layui-tab-item"), c = o.attr("lay-filter"); n.hasClass(l) && (n.next()[0] ? f.tabClick.call(n.next()[0], null, s + 1) : n.prev()[0] && f.tabClick.call(n.prev()[0], null, s - 1)), n.remove(), r.eq(s).remove(), setTimeout(function () { f.tabAuto() }, 50), layui.event.call(this, e, "tabDelete(" + c + ")", { elem : o, index : s }) }, tabAuto : function () { var t = "layui-tab-more", e = "layui-tab-bar", l = "layui-tab-close", n = this; a(".layui-tab").each(function () { var s = a(this), o = s.children(".layui-tab-title"), r = (s.children(".layui-tab-content").children(".layui-tab-item"), 'lay-stope="tabmore"'), c = a(''); if (n === window && 8 != i.ie && f.hideTabMore(!0), s.attr("lay-allowClose") && o.find("li").each(function () { var t = a(this); if (!t.find("." + l)[0]) { var i = a(''); i.on("click", f.tabDelete), t.append(i) } }), "string" != typeof s.attr("lay-unauto")) if (o.prop("scrollWidth") > o.outerWidth() + 1) { if (o.find("." + e)[0]) return; o.append(c), s.attr("overflow", ""), c.on("click", function (a) { o[this.title ? "removeClass" : "addClass"](t), this.title = this.title ? "" : "鏀剁缉" }) } else o.find("." + e).remove(), s.removeAttr("overflow") }) }, hideTabMore : function (t) { var i = a(".layui-tab-title"); t !== !0 && "tabmore" === a(t.target).attr("lay-stope") || (i.removeClass("layui-tab-more"), i.find(".layui-tab-bar").attr("title", "")) }, clickThis : function () { var t = a(this), i = t.parents(o), n = i.attr("lay-filter"), s = t.parent(), c = t.siblings("." + d), y = "string" == typeof s.attr("lay-unselect"); "javascript:;" !== t.attr("href") && "_blank" === t.attr("target") || y || c[0] || (i.find("." + l).removeClass(l), s.addClass(l)), i.hasClass(u) && (c.removeClass(h), c[0] && (s["none" === c.css("display") ? "addClass" : "removeClass"](r + "ed"), "all" === i.attr("lay-shrink") && s.siblings().removeClass(r + "ed"))), layui.event.call(this, e, "nav(" + n + ")", t) }, collapse : function () { var t = a(this), i = t.find(".layui-colla-icon"), l = t.siblings(".layui-colla-content"), s = t.parents(".layui-collapse").eq(0), o = s.attr("lay-filter"), r = "none" === l.css("display"); if ("string" == typeof s.attr("lay-accordion")) { var c = s.children(".layui-colla-item").children("." + n); c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""), c.removeClass(n) } l[r ? "addClass" : "removeClass"](n), i.html(r ? "" : ""), layui.event.call(this, e, "collapse(" + o + ")", { title : t, content : l, show : r }) } }; s.prototype.init = function (t, e) { var l = function () { return e ? '[lay-filter="' + e + '"]' : "" } (), s = { tab : function () { f.tabAuto.call({}) }, nav : function () { var t = 200, e = {}, s = {}, p = {}, b = function (l, o, r) { var c = a(this), f = c.find("." + d); o.hasClass(u) ? l.css({ top : c.position().top, height : c.children("a").outerHeight(), opacity : 1 }) : (f.addClass(h), l.css({ left : c.position().left + parseFloat(c.css("marginLeft")), top : c.position().top + c.height() - l.height() }), e[r] = setTimeout(function () { l.css({ width : c.width(), opacity : 1 }) }, i.ie && i.ie < 10 ? 0 : t), clearTimeout(p[r]), "block" === f.css("display") && clearTimeout(s[r]), s[r] = setTimeout(function () { f.addClass(n), c.find("." + y).addClass(y + "d") }, 300)) }; a(o + l).each(function (i) { var l = a(this), o = a(''), h = l.find("." + r); l.find("." + c)[0] || (l.append(o), h.on("mouseenter", function () { b.call(this, o, l, i) }).on("mouseleave", function () { l.hasClass(u) || (clearTimeout(s[i]), s[i] = setTimeout(function () { l.find("." + d).removeClass(n), l.find("." + y).removeClass(y + "d") }, 300)) }), l.on("mouseleave", function () { clearTimeout(e[i]), p[i] = setTimeout(function () { l.hasClass(u) ? o.css({ height : 0, top : o.position().top + o.height() / 2, opacity : 0 }) : o.css({ width : 0, left : o.position().left + o.width() / 2, opacity : 0 }) }, t) })), h.find("a").each(function () { var t = a(this), i = (t.parent(), t.siblings("." + d)); i[0] && !t.children("." + y)[0] && t.append(''), t.off("click", f.clickThis).on("click", f.clickThis) }) }) }, breadcrumb : function () { var t = ".layui-breadcrumb"; a(t + l).each(function () { var t = a(this), i = "lay-separator", e = t.attr(i) || "/", l = t.find("a"); l.next("span[" + i + "]")[0] || (l.each(function (t) { t !== l.length - 1 && a(this).after("" + e + "") }), t.css("visibility", "visible")) }) }, progress : function () { var t = "layui-progress"; a("." + t + l).each(function () { var i = a(this), e = i.find(".layui-progress-bar"), l = e.attr("lay-percent"); e.css("width", function () { return /^.+\/.+$/.test(l) ? 100 * new Function("return " + l)() + "%" : l } ()), i.attr("lay-showPercent") && setTimeout(function () { e.html('' + l + "") }, 350) }) }, collapse : function () { var t = "layui-collapse"; a("." + t + l).each(function () { var t = a(this).find(".layui-colla-item"); t.each(function () { var t = a(this), i = t.find(".layui-colla-title"), e = t.find(".layui-colla-content"), l = "none" === e.css("display"); i.find(".layui-colla-icon").remove(), i.append('' + (l ? "" : "") + ""), i.off("click", f.collapse).on("click", f.collapse) }) }) } }; return s[t] ? s[t]() : layui.each(s, function (t, a) { a() }) }, s.prototype.render = s.prototype.init; var p = new s, b = a(document); p.render(); var v = ".layui-tab-title li"; b.on("click", v, f.tabClick), b.on("click", f.hideTabMore), a(window).on("resize", f.tabAuto), t(e, p) }); layui.define("layer", function (e) { "use strict"; var i = layui.$, t = layui.layer, n = layui.hint(), a = layui.device(), o = { config : {}, set : function (e) { var t = this; return t.config = i.extend({}, t.config, e), t }, on : function (e, i) { return layui.onevent.call(this, r, e, i) } }, l = function () { var e = this; return { upload : function (i) { e.upload.call(e, i) }, config : e.config } }, r = "upload", u = "layui-upload-file", c = "layui-upload-form", f = "layui-upload-iframe", s = "layui-upload-choose", p = function (e) { var t = this; t.config = i.extend({}, t.config, o.config, e), t.render() }; p.prototype.config = { accept : "images", exts : "", auto : !0, bindAction : "", url : "", field : "file", method : "post", data : {}, drag : !0, size : 0, number : 0, multiple : !1 }, p.prototype.render = function (e) { var t = this, e = t.config; e.elem = i(e.elem), e.bindAction = i(e.bindAction), t.file(), t.events() }, p.prototype.file = function () { var e = this, t = e.config, n = e.elemFile = i(['"].join("")), o = t.elem.next(); (o.hasClass(u) || o.hasClass(c)) && o.remove(), a.ie && a.ie < 10 && t.elem.wrap('
    '), e.isFile() ? (e.elemFile = t.elem, t.field = t.elem[0].name) : t.elem.after(n), a.ie && a.ie < 10 && e.initIE() }, p.prototype.initIE = function () { var e = this, t = e.config, n = i(''), a = i(['', ""].join("")); i("#" + f)[0] || i("body").append(n), t.elem.next().hasClass(c) || (e.elemFile.wrap(a), t.elem.next("." + c).append(function () { var e = []; return layui.each(t.data, function (i, t) { t = "function" == typeof t ? t() : t, e.push('') }), e.join("") } ())) }, p.prototype.msg = function (e) { return t.msg(e, { icon : 2, shift : 6 }) }, p.prototype.isFile = function () { var e = this.config.elem[0]; if (e) return "input" === e.tagName.toLocaleLowerCase() && "file" === e.type }, p.prototype.preview = function (e) { var i = this; window.FileReader && layui.each(i.chooseFiles, function (i, t) { var n = new FileReader; n.readAsDataURL(t), n.onload = function () { e && e(i, t, this.result) } }) }, p.prototype.upload = function (e, t) { var n, o = this, l = o.config, r = o.elemFile[0], u = function () { var t = 0, n = 0, a = e || o.files || o.chooseFiles || r.files, u = function () { l.multiple && t + n === o.fileLength && "function" == typeof l.allDone && l.allDone({ total : o.fileLength, successful : t, aborted : n }) }; layui.each(a, function (e, a) { var r = new FormData; r.append(l.field, a), layui.each(l.data, function (e, i) { i = "function" == typeof i ? i() : i, r.append(e, i) }), i.ajax({ url : l.url, type : "post", data : r, contentType : !1, processData : !1, dataType : "json", headers : l.headers || {}, success : function (i) { t++, d(e, i), u() }, error : function () { n++, o.msg("璇锋眰涓婁紶鎺ュ彛鍑虹幇寮傚父"), m(e), u() } }) }) }, c = function () { var e = i("#" + f); o.elemFile.parent().submit(), clearInterval(p.timer), p.timer = setInterval(function () { var i, t = e.contents().find("body"); try { i = t.text() } catch (n) { o.msg("鑾峰彇涓婁紶鍚庣殑鍝嶅簲淇℃伅鍑虹幇寮傚父"), clearInterval(p.timer), m() } i && (clearInterval(p.timer), t.html(""), d(0, i)) }, 30) }, d = function (e, i) { if (o.elemFile.next("." + s).remove(), r.value = "", "object" != typeof i) try { i = JSON.parse(i) } catch (t) { return i = {}, o.msg("璇峰涓婁紶鎺ュ彛杩斿洖鏈夋晥JSON") } "function" == typeof l.done && l.done(i, e || 0, function (e) { o.upload(e) }) }, m = function (e) { l.auto && (r.value = ""), "function" == typeof l.error && l.error(e || 0, function (e) { o.upload(e) }) }, h = l.exts, v = function () { var i = []; return layui.each(e || o.chooseFiles, function (e, t) { i.push(t.name) }), i } (), g = { preview : function (e) { o.preview(e) }, upload : function (e, i) { var t = {}; t[e] = i, o.upload(t) }, pushFile : function () { return o.files = o.files || {}, layui.each(o.chooseFiles, function (e, i) { o.files[e] = i }), o.files }, resetFile : function (e, i, t) { var n = new File([i], t); o.files = o.files || {}, o.files[e] = n } }, y = function () { if ("choose" !== t && !l.auto || (l.choose && l.choose(g), "choose" !== t)) return l.before && l.before(g), a.ie ? a.ie > 9 ? u() : c() : void u() }; if (v = 0 === v.length ? r.value.match(/[^\/\\]+\..+/g) || [] || "" : v, 0 !== v.length) { switch (l.accept) { case "file": if (h && !RegExp("\\w\\.(" + h + ")$", "i").test(escape(v))) return o.msg("閫夋嫨鐨勬枃浠朵腑鍖呭惈涓嶆敮鎸佺殑鏍煎紡"), r.value = ""; break; case "video": if (!RegExp("\\w\\.(" + (h || "avi|mp4|wma|rmvb|rm|flash|3gp|flv") + ")$", "i").test(escape(v))) return o.msg("閫夋嫨鐨勮棰戜腑鍖呭惈涓嶆敮鎸佺殑鏍煎紡"), r.value = ""; break; case "audio": if (!RegExp("\\w\\.(" + (h || "mp3|wav|mid") + ")$", "i").test(escape(v))) return o.msg("閫夋嫨鐨勯煶棰戜腑鍖呭惈涓嶆敮鎸佺殑鏍煎紡"), r.value = ""; break; default: if (layui.each(v, function (e, i) { RegExp("\\w\\.(" + (h || "jpg|png|gif|bmp|jpeg$") + ")", "i").test(escape(i)) || (n = !0) }), n) return o.msg("閫夋嫨鐨勫浘鐗囦腑鍖呭惈涓嶆敮鎸佺殑鏍煎紡"), r.value = "" } if (o.fileLength = function () { var i = 0, t = e || o.files || o.chooseFiles || r.files; return layui.each(t, function () { i++ }), i } (), l.number && o.fileLength > l.number) return o.msg("鍚屾椂鏈�澶氬彧鑳戒笂浼犵殑鏁伴噺涓猴細" + l.number); if (l.size > 0 && !(a.ie && a.ie < 10)) { var F; if (layui.each(o.chooseFiles, function (e, i) { if (i.size > 1024 * l.size) { var t = l.size / 1024; t = t >= 1 ? t.toFixed(2) + "MB" : l.size + "KB", r.value = "", F = t } }), F) return o.msg("鏂囦欢涓嶈兘瓒呰繃" + F) } y() } }, p.prototype.events = function () { var e = this, t = e.config, o = function (i) { e.chooseFiles = {}, layui.each(i, function (i, t) { var n = (new Date).getTime(); e.chooseFiles[n + "-" + i] = t }) }, l = function (i, n) { var a = e.elemFile, o = i.length > 1 ? i.length + "涓枃浠�" : (i[0] || {}).name || a[0].value.match(/[^\/\\]+\..+/g) || [] || ""; a.next().hasClass(s) && a.next().remove(), e.upload(null, "choose"), e.isFile() || t.choose || a.after('' + o + "") }; t.elem.off("upload.start").on("upload.start", function () { var a = i(this), o = a.attr("lay-data"); if (o) try { o = new Function("return " + o)(), e.config = i.extend({}, t, o) } catch (l) { n.error("Upload element property lay-data configuration item has a syntax error: " + o) } e.config.item = a, e.elemFile[0].click() }), a.ie && a.ie < 10 || t.elem.off("upload.over").on("upload.over", function () { var e = i(this); e.attr("lay-over", "") }).off("upload.leave").on("upload.leave", function () { var e = i(this); e.removeAttr("lay-over") }).off("upload.drop").on("upload.drop", function (n, a) { var r = i(this), u = a.originalEvent.dataTransfer.files || []; r.removeAttr("lay-over"), o(u), t.auto ? e.upload(u) : l(u) }), e.elemFile.off("upload.change").on("upload.change", function () { var i = this.files || []; o(i), t.auto ? e.upload() : l(i) }), t.bindAction.off("upload.action").on("upload.action", function () { e.upload() }), t.elem.data("haveEvents") || (e.elemFile.on("change", function () { i(this).trigger("upload.change") }), t.elem.on("click", function () { e.isFile() || i(this).trigger("upload.start") }), t.drag && t.elem.on("dragover", function (e) { e.preventDefault(), i(this).trigger("upload.over") }).on("dragleave", function (e) { i(this).trigger("upload.leave") }).on("drop", function (e) { e.preventDefault(), i(this).trigger("upload.drop", e) }), t.bindAction.on("click", function () { i(this).trigger("upload.action") }), t.elem.data("haveEvents", !0)) }, o.render = function (e) { var i = new p(e); return l.call(i) }, e(r, o) }); layui.define("jquery", function (e) { "use strict"; var i = layui.jquery, t = { config : {}, index : layui.slider ? layui.slider.index + 1e4 : 0, set : function (e) { var t = this; return t.config = i.extend({}, t.config, e), t }, on : function (e, i) { return layui.onevent.call(this, n, e, i) } }, a = function () { var e = this, i = e.config; return { setValue : function (i, t) { return e.slide("set", i, t || 0) }, config : i } }, n = "slider", l = "layui-disabled", s = "layui-slider", r = "layui-slider-bar", o = "layui-slider-wrap", u = "layui-slider-wrap-btn", d = "layui-slider-tips", v = "layui-slider-input", c = "layui-slider-input-txt", f = "layui-slider-input-btn", m = "layui-slider-hover", p = function (e) { var a = this; a.index = ++t.index, a.config = i.extend({}, a.config, t.config, e), a.render() }; p.prototype.config = { type : "default", min : 0, max : 100, value : 0, step : 1, showstep : !1, tips : !0, input : !1, range : !1, height : 200, disabled : !1, theme : "#009688" }, p.prototype.render = function () { var e = this, t = e.config; if (t.min = t.min < 0 ? 0 : t.min, t.range) { t.value = "object" == typeof t.value ? t.value : [t.min, t.value]; var a = Math.min(t.value[0], t.value[1]), n = Math.max(t.value[0], t.value[1]); t.value[0] = a > t.min ? a : t.min, t.value[1] = n > t.min ? n : t.min, t.value[0] = t.value[0] > t.max ? t.max : t.value[0], t.value[1] = t.value[1] > t.max ? t.max : t.value[1]; var r = Math.floor((t.value[0] - t.min) / (t.max - t.min) * 100), v = Math.floor((t.value[1] - t.min) / (t.max - t.min) * 100), f = v - r + "%"; r += "%", v += "%" } else { t.value = "object" == typeof t.value ? Math.min(t.value[0], t.value[1]) : t.value, t.value = t.value > t.min ? t.value : t.min; var f = Math.floor((t.value - t.min) / (t.max - t.min) * 100) + "%" } var m = t.disabled ? "#c2c2c2" : t.theme, p = '
    ' + (t.tips ? '
    ' : "") + '
    ' + (t.range ? '
    ' : "") + "
    ", h = i(t.elem), y = h.next("." + s); if (y[0] && y.remove(), e.elemTemp = i(p), t.range ? (e.elemTemp.find("." + o).eq(0).data("value", t.value[0]), e.elemTemp.find("." + o).eq(1).data("value", t.value[1])) : e.elemTemp.find("." + o).data("value", t.value), h.html(e.elemTemp), "vertical" === t.type && e.elemTemp.height(t.height + "px"), t.showstep) { for (var g = (t.max - t.min) / t.step, b = "", x = 1; x < g + 1; x++) { var T = 100 * x / g; T < 100 && (b += '
    ') } e.elemTemp.append(b) } if (t.input && !t.range) { var w = i('
    '); h.css("position", "relative"), h.append(w), h.find("." + c).children("input").val(t.value), "vertical" === t.type ? w.css({ left : 0, top : -48 }) : e.elemTemp.css("margin-right", w.outerWidth() + 15) } t.disabled ? (e.elemTemp.addClass(l), e.elemTemp.find("." + u).addClass(l)) : e.slide(), e.elemTemp.find("." + u).on("mouseover", function () { var a = "vertical" === t.type ? t.height : e.elemTemp[0].offsetWidth, n = e.elemTemp.find("." + o), l = "vertical" === t.type ? a - i(this).parent()[0].offsetTop - n.height() : i(this).parent()[0].offsetLeft, s = l / a * 100, r = i(this).parent().data("value"), u = t.setTips ? t.setTips(r) : r; e.elemTemp.find("." + d).html(u), "vertical" === t.type ? e.elemTemp.find("." + d).css({ bottom : s + "%", "margin-bottom" : "20px", display : "inline-block" }) : e.elemTemp.find("." + d).css({ left : s + "%", display : "inline-block" }) }).on("mouseout", function () { e.elemTemp.find("." + d).css("display", "none") }) }, p.prototype.slide = function (e, t, a) { var n = this, l = n.config, s = n.elemTemp, p = function () { return "vertical" === l.type ? l.height : s[0].offsetWidth }, h = s.find("." + o), y = s.next("." + v), g = y.children("." + c).children("input").val(), b = 100 / ((l.max - l.min) / Math.ceil(l.step)), x = function (e, i) { e = Math.ceil(e) * b > 100 ? Math.ceil(e) * b : Math.round(e) * b, e = e > 100 ? 100 : e, h.eq(i).css("vertical" === l.type ? "bottom" : "left", e + "%"); var t = T(h[0].offsetLeft), a = l.range ? T(h[1].offsetLeft) : 0; "vertical" === l.type ? (s.find("." + d).css({ bottom : e + "%", "margin-bottom" : "20px" }), t = T(p() - h[0].offsetTop - h.height()), a = l.range ? T(p() - h[1].offsetTop - h.height()) : 0) : s.find("." + d).css("left", e + "%"), t = t > 100 ? 100 : t, a = a > 100 ? 100 : a; var n = Math.min(t, a), o = Math.abs(t - a); "vertical" === l.type ? s.find("." + r).css({ height : o + "%", bottom : n + "%" }) : s.find("." + r).css({ width : o + "%", left : n + "%" }); var u = l.min + Math.round((l.max - l.min) * e / 100); if (g = u, y.children("." + c).children("input").val(g), h.eq(i).data("value", u), u = l.setTips ? l.setTips(u) : u, s.find("." + d).html(u), l.range) { var v = [h.eq(0).data("value"), h.eq(1).data("value")]; v[0] > v[1] && v.reverse() } l.change && l.change(l.range ? v : u) }, T = function (e) { var i = e / p() * 100 / b, t = Math.round(i) * b; return e == p() && (t = Math.ceil(i) * b), t }, w = i(['
    p() && (r = p()); var o = r / p() * 100 / b; x(o, e), t.addClass(m), s.find("." + d).show(), i.preventDefault() }, o = function () { t.removeClass(m), s.find("." + d).hide() }; M(r, o) }) }), s.on("click", function (e) { var t = i("." + u); if (!t.is(event.target) && 0 === t.has(event.target).length && t.length) { var a, n = "vertical" === l.type ? p() - e.clientY + i(this).offset().top : e.clientX - i(this).offset().left; n < 0 && (n = 0), n > p() && (n = p()); var s = n / p() * 100 / b; a = l.range ? "vertical" === l.type ? Math.abs(n - parseInt(i(h[0]).css("bottom"))) > Math.abs(n - parseInt(i(h[1]).css("bottom"))) ? 1 : 0 : Math.abs(n - h[0].offsetLeft) > Math.abs(n - h[1].offsetLeft) ? 1 : 0 : 0, x(s, a), e.preventDefault() } }), y.hover(function () { var e = i(this); e.children("." + f).fadeIn("fast") }, function () { var e = i(this); e.children("." + f).fadeOut("fast") }), y.children("." + f).children("i").each(function (e) { i(this).on("click", function () { g = 1 == e ? g - b < l.min ? l.min : g - b : Number(g) + b > l.max ? l.max : Number(g) + b; var i = (g - l.min) / (l.max - l.min) * 100 / b; x(i, 0) }) }); var q = function () { var e = this.value; e = isNaN(e) ? 0 : e, e = e < l.min ? l.min : e, e = e > l.max ? l.max : e, this.value = e; var i = (e - l.min) / (l.max - l.min) * 100 / b; x(i, 0) }; y.children("." + c).children("input").on("keydown", function (e) { 13 === e.keyCode && (e.preventDefault(), q.call(this)) }).on("change", q) }, p.prototype.events = function () { var e = this; e.config }, t.render = function (e) { var i = new p(e); return a.call(i) }, e(n, t) }); layui.define("jquery", function (e) { "use strict"; var i = layui.jquery, o = { config : {}, index : layui.colorpicker ? layui.colorpicker.index + 1e4 : 0, set : function (e) { var o = this; return o.config = i.extend({}, o.config, e), o }, on : function (e, i) { return layui.onevent.call(this, "colorpicker", e, i) } }, r = function () { var e = this, i = e.config; return { config : i } }, t = "colorpicker", n = "layui-show", l = "layui-colorpicker", c = ".layui-colorpicker-main", a = "layui-icon-down", s = "layui-icon-close", f = "layui-colorpicker-trigger-span", d = "layui-colorpicker-trigger-i", u = "layui-colorpicker-side", p = "layui-colorpicker-side-slider", g = "layui-colorpicker-basis", v = "layui-colorpicker-alpha-bgcolor", h = "layui-colorpicker-alpha-slider", m = "layui-colorpicker-basis-cursor", b = "layui-colorpicker-main-input", k = function (e) { var i = { h : 0, s : 0, b : 0 }, o = Math.min(e.r, e.g, e.b), r = Math.max(e.r, e.g, e.b), t = r - o; return i.b = r, i.s = 0 != r ? 255 * t / r : 0, 0 != i.s ? e.r == r ? i.h = (e.g - e.b) / t : e.g == r ? i.h = 2 + (e.b - e.r) / t : i.h = 4 + (e.r - e.g) / t : i.h = -1, r == o && (i.h = 0), i.h *= 60, i.h < 0 && (i.h += 360), i.s *= 100 / 255, i.b *= 100 / 255, i }, y = function (e) { var e = e.indexOf("#") > -1 ? e.substring(1) : e; if (3 == e.length) { var i = e.split(""); e = i[0] + i[0] + i[1] + i[1] + i[2] + i[2] } e = parseInt(e, 16); var o = { r : e >> 16, g : (65280 & e) >> 8, b : 255 & e }; return k(o) }, x = function (e) { var i = {}, o = e.h, r = 255 * e.s / 100, t = 255 * e.b / 100; if (0 == r) i.r = i.g = i.b = t; else { var n = t, l = (255 - r) * t / 255, c = (n - l) * (o % 60) / 60; 360 == o && (o = 0), o < 60 ? (i.r = n, i.b = l, i.g = l + c) : o < 120 ? (i.g = n, i.b = l, i.r = n - c) : o < 180 ? (i.g = n, i.r = l, i.b = l + c) : o < 240 ? (i.b = n, i.r = l, i.g = n - c) : o < 300 ? (i.b = n, i.g = l, i.r = l + c) : o < 360 ? (i.r = n, i.g = l, i.b = n - c) : (i.r = 0, i.g = 0, i.b = 0) } return { r : Math.round(i.r), g : Math.round(i.g), b : Math.round(i.b) } }, C = function (e) { var o = x(e), r = [o.r.toString(16), o.g.toString(16), o.b.toString(16)]; return i.each(r, function (e, i) { 1 == i.length && (r[e] = "0" + i) }), r.join("") }, P = function (e) { var i = /[0-9]{1,3}/g, o = e.match(i) || []; return { r : o[0], g : o[1], b : o[2] } }, B = i(window), w = i(document), D = function (e) { var r = this; r.index = ++o.index, r.config = i.extend({}, r.config, o.config, e), r.render() }; D.prototype.config = { color : "", size : null, alpha : !1, format : "hex", predefine : !1, colors : ["#009688", "#5FB878", "#1E9FFF", "#FF5722", "#FFB800", "#01AAED", "#999", "#c00", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585", "rgb(0, 186, 189)", "rgb(255, 120, 0)", "rgb(250, 212, 0)", "#393D49", "rgba(0,0,0,.5)", "rgba(255, 69, 0, 0.68)", "rgba(144, 240, 144, 0.5)", "rgba(31, 147, 255, 0.73)"] }, D.prototype.render = function () { var e = this, o = e.config, r = i(['
    ', "", ' 3 && (o.alpha && "rgb" == o.format || (e = "#" + C(k(P(o.color))))), "background: " + e) : e } () + '">', '', "", "", "
    "].join("")), t = i(o.elem); o.size && r.addClass("layui-colorpicker-" + o.size), t.addClass("layui-inline").html(e.elemColorBox = r), e.color = e.elemColorBox.find("." + f)[0].style.background, e.events() }, D.prototype.renderPicker = function () { var e = this, o = e.config, r = e.elemColorBox[0], t = e.elemPicker = i(['
    ', '
    ', '
    ', '
    ', '
    ', '
    ', "
    ", '
    ', '
    ', "
    ", "
    ", '
    ', '
    ', '
    ', "
    ", "
    ", function () { if (o.predefine) { var e = ['
    ']; return layui.each(o.colors, function (i, o) { e.push(['
    ', '
    ', "
    "].join("")) }), e.push("
    "), e.join("") } return "" } (), '
    ', '
    ', '', "
    ", '
    ', '', '', "", "
    "].join("")); e.elemColorBox.find("." + f)[0]; i(c)[0] && i(c).data("index") == e.index ? e.removePicker(D.thisElemInd) : (e.removePicker(D.thisElemInd), i("body").append(t)), D.thisElemInd = e.index, D.thisColor = r.style.background, e.position(), e.pickerEvents() }, D.prototype.removePicker = function (e) { var o = this; o.config; return i("#layui-colorpicker" + (e || o.index)).remove(), o }, D.prototype.position = function () { var e = this, i = e.config, o = e.bindElem || e.elemColorBox[0], r = e.elemPicker[0], t = o.getBoundingClientRect(), n = r.offsetWidth, l = r.offsetHeight, c = function (e) { return e = e ? "scrollLeft" : "scrollTop", document.body[e] | document.documentElement[e] }, a = function (e) { return document.documentElement[e ? "clientWidth" : "clientHeight"] }, s = 5, f = t.left, d = t.bottom; f -= (n - o.offsetWidth) / 2, d += s, f + n + s > a("width") ? f = a("width") - n - s : f < s && (f = s), d + l + s > a() && (d = t.top > l ? t.top - l : a() - l, d -= 2 * s), i.position && (r.style.position = i.position), r.style.left = f + ("fixed" === i.position ? 0 : c(1)) + "px", r.style.top = d + ("fixed" === i.position ? 0 : c()) + "px" }, D.prototype.val = function () { var e = this, i = (e.config, e.elemColorBox.find("." + f)), o = e.elemPicker.find("." + b), r = i[0], t = r.style.backgroundColor; if (t) { var n = k(P(t)), l = i.attr("lay-type"); if (e.select(n.h, n.s, n.b), "torgb" === l && o.find("input").val(t), "rgba" === l) { var c = P(t); if (3 == (t.match(/[0-9]{1,3}/g) || []).length) o.find("input").val("rgba(" + c.r + ", " + c.g + ", " + c.b + ", 1)"), e.elemPicker.find("." + h).css("left", 280); else { o.find("input").val(t); var a = 280 * t.slice(t.lastIndexOf(",") + 1, t.length - 1); e.elemPicker.find("." + h).css("left", a) } e.elemPicker.find("." + v)[0].style.background = "linear-gradient(to right, rgba(" + c.r + ", " + c.g + ", " + c.b + ", 0), rgb(" + c.r + ", " + c.g + ", " + c.b + "))" } } else e.select(0, 100, 100), o.find("input").val(""), e.elemPicker.find("." + v)[0].style.background = "", e.elemPicker.find("." + h).css("left", 280) }, D.prototype.side = function () { var e = this, o = e.config, r = e.elemColorBox.find("." + f), t = r.attr("lay-type"), n = e.elemPicker.find("." + u), l = e.elemPicker.find("." + p), c = e.elemPicker.find("." + g), y = e.elemPicker.find("." + m), C = e.elemPicker.find("." + v), w = e.elemPicker.find("." + h), D = l[0].offsetTop / 180 * 360, E = 100 - (y[0].offsetTop + 3) / 180 * 100, H = (y[0].offsetLeft + 3) / 260 * 100, W = Math.round(w[0].offsetLeft / 280 * 100) / 100, j = e.elemColorBox.find("." + d), F = e.elemPicker.find(".layui-colorpicker-pre").children("div"), L = function (i, n, l, c) { e.select(i, n, l); var f = x({ h : i, s : n, b : l }); if (j.addClass(a).removeClass(s), r[0].style.background = "rgb(" + f.r + ", " + f.g + ", " + f.b + ")", "torgb" === t && e.elemPicker.find("." + b).find("input").val("rgb(" + f.r + ", " + f.g + ", " + f.b + ")"), "rgba" === t) { var d = 0; d = 280 * c, w.css("left", d), e.elemPicker.find("." + b).find("input").val("rgba(" + f.r + ", " + f.g + ", " + f.b + ", " + c + ")"), r[0].style.background = "rgba(" + f.r + ", " + f.g + ", " + f.b + ", " + c + ")", C[0].style.background = "linear-gradient(to right, rgba(" + f.r + ", " + f.g + ", " + f.b + ", 0), rgb(" + f.r + ", " + f.g + ", " + f.b + "))" } o.change && o.change(e.elemPicker.find("." + b).find("input").val()) }, M = i(['
    t && (r = t); var l = r / 180 * 360; D = l, L(l, H, E, W), e.preventDefault() }; Y(r), e.preventDefault() }), n.on("click", function (e) { var o = e.clientY - i(this).offset().top; o < 0 && (o = 0), o > this.offsetHeight && (o = this.offsetHeight); var r = o / 180 * 360; D = r, L(r, H, E, W), e.preventDefault() }), y.on("mousedown", function (e) { var i = this.offsetTop, o = this.offsetLeft, r = e.clientY, t = e.clientX, n = function (e) { var n = i + (e.clientY - r), l = o + (e.clientX - t), a = c[0].offsetHeight - 3, s = c[0].offsetWidth - 3; n < -3 && (n = -3), n > a && (n = a), l < -3 && (l = -3), l > s && (l = s); var f = (l + 3) / 260 * 100, d = 100 - (n + 3) / 180 * 100; E = d, H = f, L(D, f, d, W), e.preventDefault() }; layui.stope(e), Y(n), e.preventDefault() }), c.on("mousedown", function (e) { var o = e.clientY - i(this).offset().top - 3 + B.scrollTop(), r = e.clientX - i(this).offset().left - 3 + B.scrollLeft(); o < -3 && (o = -3), o > this.offsetHeight - 3 && (o = this.offsetHeight - 3), r < -3 && (r = -3), r > this.offsetWidth - 3 && (r = this.offsetWidth - 3); var t = (r + 3) / 260 * 100, n = 100 - (o + 3) / 180 * 100; E = n, H = t, L(D, t, n, W), e.preventDefault(), y.trigger(e, "mousedown") }), w.on("mousedown", function (e) { var i = this.offsetLeft, o = e.clientX, r = function (e) { var r = i + (e.clientX - o), t = C[0].offsetWidth; r < 0 && (r = 0), r > t && (r = t); var n = Math.round(r / 280 * 100) / 100; W = n, L(D, H, E, n), e.preventDefault() }; Y(r), e.preventDefault() }), C.on("click", function (e) { var o = e.clientX - i(this).offset().left; o < 0 && (o = 0), o > this.offsetWidth && (o = this.offsetWidth); var r = Math.round(o / 280 * 100) / 100; W = r, L(D, H, E, r), e.preventDefault() }), F.each(function () { i(this).on("click", function () { i(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected"); var e, o = this.style.backgroundColor, r = k(P(o)), t = o.slice(o.lastIndexOf(",") + 1, o.length - 1); D = r.h, H = r.s, E = r.b, 3 == (o.match(/[0-9]{1,3}/g) || []).length && (t = 1), W = t, e = 280 * t, L(r.h, r.s, r.b, t) }) }) }, D.prototype.select = function (e, i, o, r) { var t = this, n = (t.config, C({ h : e, s : 100, b : 100 })), l = C({ h : e, s : i, b : o }), c = e / 360 * 180, a = 180 - o / 100 * 180 - 3, s = i / 100 * 260 - 3; t.elemPicker.find("." + p).css("top", c), t.elemPicker.find("." + g)[0].style.background = "#" + n, t.elemPicker.find("." + m).css({ top : a, left : s }), "change" !== r && t.elemPicker.find("." + b).find("input").val("#" + l) }, D.prototype.pickerEvents = function () { var e = this, o = e.config, r = e.elemColorBox.find("." + f), t = e.elemPicker.find("." + b + " input"), n = { clear : function (i) { r[0].style.background = "", e.elemColorBox.find("." + d).removeClass(a).addClass(s), e.color = "", o.done && o.done(""), e.removePicker() }, confirm : function (i, n) { var l = t.val(), c = l, f = {}; if (l.indexOf(",") > -1) { if (f = k(P(l)), e.select(f.h, f.s, f.b), r[0].style.background = c = "#" + C(f), (l.match(/[0-9]{1,3}/g) || []).length > 3 && "rgba" === r.attr("lay-type")) { var u = 280 * l.slice(l.lastIndexOf(",") + 1, l.length - 1); e.elemPicker.find("." + h).css("left", u), r[0].style.background = l, c = l } } else f = y(l), r[0].style.background = c = "#" + C(f), e.elemColorBox.find("." + d).removeClass(s).addClass(a); return "change" === n ? (e.select(f.h, f.s, f.b, n), void(o.change && o.change(c))) : (e.color = l, o.done && o.done(l), void e.removePicker()) } }; e.elemPicker.on("click", "*[colorpicker-events]", function () { var e = i(this), o = e.attr("colorpicker-events"); n[o] && n[o].call(this, e) }), t.on("keyup", function (e) { var o = i(this); n.confirm.call(this, o, 13 === e.keyCode ? null : "change") }) }, D.prototype.events = function () { var e = this, o = e.config, r = e.elemColorBox.find("." + f); e.elemColorBox.on("click", function () { e.renderPicker(), i(c)[0] && (e.val(), e.side()) }), o.elem[0] && !e.elemColorBox[0].eventHandler && (w.on("click", function (o) { if (!i(o.target).hasClass(l) && !i(o.target).parents("." + l)[0] && !i(o.target).hasClass(c.replace(/\./g, "")) && !i(o.target).parents(c)[0] && e.elemPicker) { if (e.color) { var t = k(P(e.color)); e.select(t.h, t.s, t.b) } else e.elemColorBox.find("." + d).removeClass(a).addClass(s); r[0].style.background = e.color || "", e.removePicker() } }), B.on("resize", function () { return !(!e.elemPicker || !i(c)[0]) && void e.position() }), e.elemColorBox[0].eventHandler = !0) }, o.render = function (e) { var i = new D(e); return r.call(i) }, e(t, o) }); layui.define("layer", function (e) { "use strict"; var i = layui.$, t = layui.layer, a = layui.hint(), n = layui.device(), l = "form", r = ".layui-form", s = "layui-this", o = "layui-hide", c = "layui-disabled", u = function () { this.config = { verify : { required : [/[\S]+/, "蹇呭~椤逛笉鑳戒负绌�"], phone : [/^1\d{10}$/, "璇疯緭鍏ユ纭殑鎵嬫満鍙�"], email : [/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/, "閭鏍煎紡涓嶆纭�"], url : [/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/, "閾炬帴鏍煎紡涓嶆纭�"], number : function (e) { if (!e || isNaN(e)) return "鍙兘濉啓鏁板瓧" }, date : [/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/, "鏃ユ湡鏍煎紡涓嶆纭�"], identity : [/(^\d{15}$)|(^\d{17}(x|X|\d)$)/, "璇疯緭鍏ユ纭殑韬唤璇佸彿"] } } }; u.prototype.set = function (e) { var t = this; return i.extend(!0, t.config, e), t }, u.prototype.verify = function (e) { var t = this; return i.extend(!0, t.config.verify, e), t }, u.prototype.on = function (e, i) { return layui.onevent.call(this, l, e, i) }, u.prototype.val = function (e, t) { var a = i(r + '[lay-filter="' + e + '"]'); a.each(function (e, a) { var n = i(this); layui.each(t, function (e, i) { var t, a = n.find('[name="' + e + '"]'); a[0] && (t = a[0].type, "checkbox" === t ? a[0].checked = i : "radio" === t ? a.each(function () { this.value === i && (this.checked = !0) }) : a.val(i)) }) }), f.render(null, e) }, u.prototype.render = function (e, t) { var n = this, u = i(r + function () { return t ? '[lay-filter="' + t + '"]' : "" } ()), d = { select : function () { var e, t = "璇烽�夋嫨", a = "layui-form-select", n = "layui-select-title", r = "layui-select-none", d = "", f = u.find("select"), v = function (t, l) { i(t.target).parent().hasClass(n) && !l || (i("." + a).removeClass(a + "ed " + a + "up"), e && d && e.val(d)), e = null }, y = function (t, u, f) { var y, p = i(this), m = t.find("." + n), k = m.find("input"), x = t.find("dl"), g = x.children("dd"), b = this.selectedIndex; if (!u) { var C = function () { var e = t.offset().top + t.outerHeight() + 5 - h.scrollTop(), i = x.outerHeight(); b = p[0].selectedIndex, t.addClass(a + "ed"), g.removeClass(o), y = null, g.eq(b).addClass(s).siblings().removeClass(s), e + i > h.height() && e >= i && t.addClass(a + "up"), $() }, w = function (e) { t.removeClass(a + "ed " + a + "up"), k.blur(), y = null, e || T(k.val(), function (e) { e && (d = x.find("." + s).html(), k && k.val(d)) }) }, $ = function () { var e = x.children("dd." + s); if (e[0]) { var i = e.position().top, t = x.height(), a = e.height(); i > t && x.scrollTop(i + x.scrollTop() - t + a - 5), i < 0 && x.scrollTop(i + x.scrollTop() - 5) } }; m.on("click", function (e) { t.hasClass(a + "ed") ? w() : (v(e, !0), C()), x.find("." + r).remove() }), m.find(".layui-edge").on("click", function () { k.focus() }), k.on("keyup", function (e) { var i = e.keyCode; 9 === i && C() }).on("keydown", function (e) { var i = e.keyCode; 9 === i && w(); var t = function (i, a) { var n, l; e.preventDefault(); var r = function () { var e = x.children("dd." + s); if (x.children("dd." + o)[0] && "next" === i) { var t = x.children("dd:not(." + o + ",." + c + ")"), n = t.eq(0).index(); if (n >= 0 && n < e.index() && !t.hasClass(s)) return t.eq(0).prev()[0] ? t.eq(0).prev() : x.children(":last") } return a && a[0] ? a : y && y[0] ? y : e } (); return l = r[i](), n = r[i]("dd:not(." + o + ")"), l[0] ? (y = r[i](), n[0] && !n.hasClass(c) || !y[0] ? (n.addClass(s).siblings().removeClass(s), void $()) : t(i, y)) : y = null }; 38 === i && t("prev"), 40 === i && t("next"), 13 === i && (e.preventDefault(), x.children("dd." + s).trigger("click")) }); var T = function (e, t, a) { var n = 0; layui.each(g, function () { var t = i(this), l = t.text(), r = l.indexOf(e) === -1; ("" === e || "blur" === a ? e !== l : r) && n++, "keyup" === a && t[r ? "addClass" : "removeClass"](o) }); var l = n === g.length; return t(l), l }, j = function (e) { var i = this.value, t = e.keyCode; return 9 !== t && 13 !== t && 37 !== t && 38 !== t && 39 !== t && 40 !== t && (T(i, function (e) { e ? x.find("." + r)[0] || x.append('

    鏃犲尮閰嶉」

    ') : x.find("." + r).remove() }, "keyup"), "" === i && x.find("." + r).remove(), void $()) }; f && k.on("keyup", j).on("blur", function (t) { var a = p[0].selectedIndex; e = k, d = i(p[0].options[a]).html(), setTimeout(function () { T(k.val(), function (e) { d || k.val("") }, "blur") }, 200) }), g.on("click", function () { var e = i(this), a = e.attr("lay-value"), n = p.attr("lay-filter"); return !e.hasClass(c) && (e.hasClass("layui-select-tips") ? k.val("") : (k.val(e.text()), e.addClass(s)), e.siblings().removeClass(s), p.val(a).removeClass("layui-form-danger"), layui.event.call(this, l, "select(" + n + ")", { elem : p[0], value : a, othis : t }), w(!0), !1) }), t.find("dl>dt").on("click", function (e) { return !1 }), i(document).off("click", v).on("click", v) } }; f.each(function (e, l) { var r = i(this), o = r.next("." + a), u = this.disabled, d = l.value, f = i(l.options[l.selectedIndex]), v = l.options[0]; if ("string" == typeof r.attr("lay-ignore")) return r.show(); var h = "string" == typeof r.attr("lay-search"), p = v ? v.value ? t : v.innerHTML || t : t, m = i(['
    ', '
    ', '', '
    ', '
    ', function (e) { var i = []; return layui.each(e, function (e, a) { 0 !== e || a.value ? "optgroup" === a.tagName.toLowerCase() ? i.push("
    " + a.label + "
    ") : i.push('
    ' + a.innerHTML + "
    ") : i.push('
    ' + (a.innerHTML || t) + "
    ") }), 0 === i.length && i.push('
    娌℃湁閫夐」
    '), i.join("") } (r.find("*")) + "
    ", "
    "].join("")); o[0] && o.remove(), r.after(m), y.call(this, m, u, h) }) }, checkbox : function () { var e = { checkbox : ["layui-form-checkbox", "layui-form-checked", "checkbox"], _switch : ["layui-form-switch", "layui-form-onswitch", "switch"] }, t = u.find("input[type=checkbox]"), a = function (e, t) { var a = i(this); e.on("click", function () { var i = a.attr("lay-filter"), n = (a.attr("lay-text") || "").split("|"); a[0].disabled || (a[0].checked ? (a[0].checked = !1, e.removeClass(t[1]).find("em").text(n[1])) : (a[0].checked = !0, e.addClass(t[1]).find("em").text(n[0])), layui.event.call(a[0], l, t[2] + "(" + i + ")", { elem : a[0], value : a[0].value, othis : e })) }) }; t.each(function (t, n) { var l = i(this), r = l.attr("lay-skin"), s = (l.attr("lay-text") || "").split("|"), o = this.disabled; "switch" === r && (r = "_" + r); var u = e[r] || e.checkbox; if ("string" == typeof l.attr("lay-ignore")) return l.show(); var d = l.next("." + u[0]), f = i(['
    ", function () { var e = n.title.replace(/\s/g, ""), i = { checkbox : [e ? "" + n.title + "" : "", ''].join(""), _switch : "" + ((n.checked ? s[0] : s[1]) || "") + "" }; return i[r] || i.checkbox } (), "
    "].join("")); d[0] && d.remove(), l.after(f), a.call(this, f, u) }) }, radio : function () { var e = "layui-form-radio", t = ["", ""], a = u.find("input[type=radio]"), n = function (a) { var n = i(this), s = "layui-anim-scaleSpring"; a.on("click", function () { var o = n[0].name, c = n.parents(r), u = n.attr("lay-filter"), d = c.find("input[name=" + o.replace(/(\.|#|\[|\])/g, "\\$1") + "]"); n[0].disabled || (layui.each(d, function () { var a = i(this).next("." + e); this.checked = !1, a.removeClass(e + "ed"), a.find(".layui-icon").removeClass(s).html(t[1]) }), n[0].checked = !0, a.addClass(e + "ed"), a.find(".layui-icon").addClass(s).html(t[0]), layui.event.call(n[0], l, "radio(" + u + ")", { elem : n[0], value : n[0].value, othis : a })) }) }; a.each(function (a, l) { var r = i(this), s = r.next("." + e), o = this.disabled; if ("string" == typeof r.attr("lay-ignore")) return r.show(); s[0] && s.remove(); var u = i(['
    ', '' + t[l.checked ? 0 : 1] + "", "
    " + function () { var e = l.title || ""; return "string" == typeof r.next().attr("lay-radio") && (e = r.next().html(), r.next().remove()), e } () + "
    ", "
    "].join("")); r.after(u), n.call(this, u) }) } }; return e ? d[e] ? d[e]() : a.error("涓嶆敮鎸佺殑" + e + "琛ㄥ崟娓叉煋") : layui.each(d, function (e, i) { i() }), n }; var d = function () { var e = i(this), a = f.config.verify, s = null, o = "layui-form-danger", c = {}, u = e.parents(r), d = u.find("*[lay-verify]"), v = e.parents("form")[0], h = u.find("input,select,textarea"), y = e.attr("lay-filter"); if (layui.each(d, function (e, l) { var r = i(this), c = r.attr("lay-verify").split("|"), u = r.attr("lay-verType"), d = r.val(); if (r.removeClass(o), layui.each(c, function (e, i) { var c, f = "", v = "function" == typeof a[i]; if (a[i]) { var c = v ? f = a[i](d, l) : !a[i][0].test(d); if (f = f || a[i][1], c) return "tips" === u ? t.tips(f, function () { return "string" == typeof r.attr("lay-ignore") || "select" !== l.tagName.toLowerCase() && !/^checkbox|radio$/.test(l.type) ? r : r.next() } (), { tips : 1 }) : "alert" === u ? t.alert(f, { title : "鎻愮ず", shadeClose : !0 }) : t.msg(f, { icon : 5, shift : 6 }), n.android || n.ios || l.focus(), r.addClass(o), s = !0 } }), s)return s }), s)return !1; var p = {}; return layui.each(h, function (e, i) { if (i.name = (i.name || "").replace(/^\s*|\s*&/, ""), i.name) { if (/^.*\[\]$/.test(i.name)) { var t = i.name.match(/^(.*)\[\]$/g)[0]; p[t] = 0 | p[t], i.name = i.name.replace(/^(.*)\[\]$/, "$1[" + p[t]++ + "]") } /^checkbox|radio$/.test(i.type) && !i.checked || (c[i.name] = i.value) } }), layui.event.call(this, l, "submit(" + y + ")", { elem : this, form : v, field : c }) }, f = new u, v = i(document), h = i(window); f.render(), v.on("reset", r, function () { var e = i(this).attr("lay-filter"); setTimeout(function () { f.render(null, e) }, 50) }), v.on("submit", r, d).on("click", "*[lay-submit]", d), e(l, f) }); layui.define("jquery", function (e) { "use strict"; var o = layui.$, a = layui.hint(), i = "layui-tree-enter", r = function (e) { this.options = e }, t = { arrow : ["", ""], checkbox : ["", ""], radio : ["", ""], branch : ["", ""], leaf : "" }; r.prototype.init = function (e) { var o = this; e.addClass("layui-box layui-tree"), o.options.skin && e.addClass("layui-tree-skin-" + o.options.skin), o.tree(e), o.on(e) }, r.prototype.tree = function (e, a) { var i = this, r = i.options, n = a || r.nodes; layui.each(n, function (a, n) { var l = n.children && n.children.length > 0, c = o('
      '), s = o(["
    • ", function () { return l ? '' + (n.spread ? t.arrow[1] : t.arrow[0]) + "" : "" } (), function () { return r.check ? '' + ("checkbox" === r.check ? t.checkbox[0] : "radio" === r.check ? t.radio[0] : "") + "" : "" } (), function () { return '" + ('' + (l ? n.spread ? t.branch[1] : t.branch[0] : t.leaf) + "") + ("" + (n.name || "鏈懡鍚�") + "") } (), "
    • "].join("")); l && (s.append(c), i.tree(c, n.children)), e.append(s), "function" == typeof r.click && i.click(s, n), i.spread(s, n), r.drag && i.drag(s, n) }) }, r.prototype.click = function (e, o) { var a = this, i = a.options; e.children("a").on("click", function (e) { layui.stope(e), i.click(o) }) }, r.prototype.spread = function (e, o) { var a = this, i = (a.options, e.children(".layui-tree-spread")), r = e.children("ul"), n = e.children("a"), l = function () { e.data("spread") ? (e.data("spread", null), r.removeClass("layui-show"), i.html(t.arrow[0]), n.find(".layui-icon").html(t.branch[0])) : (e.data("spread", !0), r.addClass("layui-show"), i.html(t.arrow[1]), n.find(".layui-icon").html(t.branch[1])) }; r[0] && (i.on("click", l), n.on("dblclick", l)) }, r.prototype.on = function (e) { var a = this, r = a.options, t = "layui-tree-drag"; e.find("i").on("selectstart", function (e) { return !1 }), r.drag && o(document).on("mousemove", function (e) { var i = a.move; if (i.from) { var r = (i.to, o('
      ')); e.preventDefault(), o("." + t)[0] || o("body").append(r); var n = o("." + t)[0] ? o("." + t) : r; n.addClass("layui-show").html(i.from.elem.children("a").html()), n.css({ left : e.pageX + 10, top : e.pageY + 10 }) } }).on("mouseup", function () { var e = a.move; e.from && (e.from.elem.children("a").removeClass(i), e.to && e.to.elem.children("a").removeClass(i), a.move = {}, o("." + t).remove()) }) }, r.prototype.move = {}, r.prototype.drag = function (e, a) { var r = this, t = (r.options, e.children("a")), n = function () { var t = o(this), n = r.move; n.from && (n.to = { item : a, elem : e }, t.addClass(i)) }; t.on("mousedown", function () { var o = r.move; o.from = { item : a, elem : e } }), t.on("mouseenter", n).on("mousemove", n).on("mouseleave", function () { var e = o(this), a = r.move; a.from && (delete a.to, e.removeClass(i)) }) }, e("tree", function (e) { var i = new r(e = e || {}), t = o(e.elem); return t[0] ? void i.init(t) : a.error("layui.tree 娌℃湁鎵惧埌" + e.elem + "鍏冪礌") }) }); /** @Name锛歭ayui.table 琛ㄦ牸鎿嶄綔 @Author锛氳搐蹇� @License锛歁IT */ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ "use strict"; var $ = layui.$ ,laytpl = layui.laytpl ,laypage = layui.laypage ,layer = layui.layer ,form = layui.form ,util = layui.util ,hint = layui.hint() ,device = layui.device() //澶栭儴鎺ュ彛 ,table = { config: { checkName: 'LAY_CHECKED' //鏄惁閫変腑鐘舵�佺殑瀛楁鍚� ,indexName: 'LAY_TABLE_INDEX' //涓嬫爣绱㈠紩鍚� } //鍏ㄥ眬閰嶇疆椤� ,cache: {} //鏁版嵁缂撳瓨 ,index: layui.table ? (layui.table.index + 10000) : 0 //璁剧疆鍏ㄥ眬椤� ,set: function(options){ var that = this; that.config = $.extend({}, that.config, options); return that; } //浜嬩欢鐩戝惉 ,on: function(events, callback){ return layui.onevent.call(this, MOD_NAME, events, callback); } } //鎿嶄綔褰撳墠瀹炰緥 ,thisTable = function(){ var that = this ,options = that.config ,id = options.id || options.index; id && (thisTable.config[id] = options); return { reload: function(options){ that.reload.call(that, options); } ,setColsWidth: function(){ that.setColsWidth.call(that); } ,config: options } } //瀛楃甯搁噺 ,MOD_NAME = 'table', ELEM = '.layui-table', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'layui-disabled', NONE = 'layui-none' ,ELEM_VIEW = 'layui-table-view', ELEM_TOOL = '.layui-table-tool', ELEM_BOX = '.layui-table-box', ELEM_INIT = '.layui-table-init', ELEM_HEADER = '.layui-table-header', ELEM_BODY = '.layui-table-body', ELEM_MAIN = '.layui-table-main', ELEM_FIXED = '.layui-table-fixed', ELEM_FIXL = '.layui-table-fixed-l', ELEM_FIXR = '.layui-table-fixed-r', ELEM_TOTAL = '.layui-table-total', ELEM_PAGE = '.layui-table-page', ELEM_SORT = '.layui-table-sort', ELEM_EDIT = 'layui-table-edit', ELEM_HOVER = 'layui-table-hover' //thead鍖哄煙妯℃澘 ,TPL_HEADER = function(options){ var rowCols = '{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}'; options = options || {}; return ['
      ' ,'' ,'{{# layui.each(d.data.cols, function(i1, item1){ }}' ,'' ,'{{# layui.each(item1, function(i2, item2){ }}' ,'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}' ,'{{# if(item2.fixed === "right"){ right = true; } }}' ,function(){ if(options.fixed && options.fixed !== 'right'){ return '{{# if(item2.fixed && item2.fixed !== "right"){ }}'; } if(options.fixed === 'right'){ return '{{# if(item2.fixed === "right"){ }}'; } return ''; }() ,'{{# var isSort = !(item2.colGroup) && item2.sort; }}' ,'' ,(options.fixed ? '{{# }; }}' : '') ,'{{# }); }}' ,'' ,'{{# }); }}' ,'' ,'
      ' ,'
      ' ,'{{# if(item2.type === "checkbox"){ }}' //澶嶉�夋 ,'' ,'{{# } else { }}' ,'{{item2.title||""}}' ,'{{# if(isSort){ }}' ,'' ,'{{# } }}' ,'{{# } }}' ,'
      ' ,'
      '].join(''); } //tbody鍖哄煙妯℃澘 ,TPL_BODY = ['' ,'' ,'
      '].join('') //涓绘ā鏉� ,TPL_MAIN = ['
      ' ,'{{# if(d.data.toolbar){ }}' ,'
      ' ,'
      ' ,'
      ' ,'
      ' ,'{{# } }}' ,'
      ' ,'{{# if(d.loading){ }}' ,'
      ' ,'' ,'
      ' ,'{{# } }}' ,'{{# var left, right; }}' ,'
      ' ,TPL_HEADER() ,'
      ' ,'
      ' ,TPL_BODY ,'
      ' ,'{{# if(left){ }}' ,'
      ' ,'
      ' ,TPL_HEADER({fixed: true}) ,'
      ' ,'
      ' ,TPL_BODY ,'
      ' ,'
      ' ,'{{# }; }}' ,'{{# if(right){ }}' ,'
      ' ,'
      ' ,TPL_HEADER({fixed: 'right'}) ,'
      ' ,'
      ' ,'
      ' ,TPL_BODY ,'
      ' ,'
      ' ,'{{# }; }}' ,'
      ' ,'{{# if(d.data.totalRow){ }}' ,'
      ' ,'' ,'' , '
      ' ,'
      ' ,'{{# } }}' ,'{{# if(d.data.page){ }}' ,'
      ' ,'
      ' ,'
      ' ,'{{# } }}' ,'' ,'
      '].join('') ,_WIN = $(window) ,_DOC = $(document) //鏋勯�犲櫒 ,Class = function(options){ var that = this; that.index = ++table.index; that.config = $.extend({}, that.config, table.config, options); that.render(); }; //榛樿閰嶇疆 Class.prototype.config = { limit: 10 //姣忛〉鏄剧ず鐨勬暟閲� ,loading: true //璇锋眰鏁版嵁鏃讹紝鏄惁鏄剧ずloading ,cellMinWidth: 60 //鎵�鏈夊崟鍏冩牸榛樿鏈�灏忓搴� ,defaultToolbar: ['filter', 'exports', 'print'] //宸ュ叿鏍忓彸渚у浘鏍� ,text: { none: '鏃犳暟鎹�' } }; //琛ㄦ牸娓叉煋 Class.prototype.render = function(){ var that = this ,options = that.config; options.elem = $(options.elem); options.where = options.where || {}; options.id = options.id || options.elem.attr('id') || options.index; //璇锋眰鍙傛暟鐨勮嚜瀹氫箟鏍煎紡 options.request = $.extend({ pageName: 'page' ,limitName: 'limit' }, options.request) //鍝嶅簲鏁版嵁鐨勮嚜瀹氫箟鏍煎紡 options.response = $.extend({ statusName: 'code' ,statusCode: 0 ,msgName: 'msg' ,dataName: 'data' ,countName: 'count' }, options.response); //濡傛灉 page 浼犲叆 laypage 瀵硅薄 if(typeof options.page === 'object'){ options.limit = options.page.limit || options.limit; options.limits = options.page.limits || options.limits; that.page = options.page.curr = options.page.curr || 1; delete options.page.elem; delete options.page.jump; } if(!options.elem[0]) return that; //楂樺害閾烘弧锛歠ull-宸窛鍊� if(options.height && /^full-\d+$/.test(options.height)){ that.fullHeightGap = options.height.split('-')[1]; options.height = _WIN.height() - that.fullHeightGap; } //鍒濆鍖栦竴浜涘弬鏁� that.setInit(); //寮�濮嬫彃鍏ユ浛浠e厓绱� var othis = options.elem ,hasRender = othis.next('.' + ELEM_VIEW) //涓诲鍣� ,reElem = that.elem = $(laytpl(TPL_MAIN).render({ VIEW_CLASS: ELEM_VIEW ,data: options ,index: that.index //绱㈠紩 })); options.index = that.index; //鐢熸垚鏇夸唬鍏冪礌 hasRender[0] && hasRender.remove(); //濡傛灉宸茬粡娓叉煋锛屽垯Rerender othis.after(reElem); //鍚勭骇瀹瑰櫒 that.layTool = reElem.find(ELEM_TOOL); that.layBox = reElem.find(ELEM_BOX); that.layHeader = reElem.find(ELEM_HEADER); that.layMain = reElem.find(ELEM_MAIN); that.layBody = reElem.find(ELEM_BODY); that.layFixed = reElem.find(ELEM_FIXED); that.layFixLeft = reElem.find(ELEM_FIXL); that.layFixRight = reElem.find(ELEM_FIXR); that.layTotal = reElem.find(ELEM_TOTAL); that.layPage = reElem.find(ELEM_PAGE); //鍒濆鍖栧伐鍏锋爮 that.renderToolbar(); //璁╄〃鏍煎钩閾� that.fullSize(); //濡傛灉澶氱骇琛ㄥご锛屽垯濉ˉ琛ㄥご楂樺害 if(options.cols.length > 1){ //琛ュ叏楂樺害 var th = that.layFixed.find(ELEM_HEADER).find('th'); th.height(that.layHeader.height() - 1 - parseFloat(th.css('padding-top')) - parseFloat(th.css('padding-bottom'))); } that.pullData(that.page); //璇锋眰鏁版嵁 that.events(); //浜嬩欢 }; //鏍规嵁鍒楃被鍨嬶紝瀹氬埗鍖栧弬鏁� Class.prototype.initOpts = function(item){ var that = this ,options = that.config ,initWidth = { checkbox: 48 ,radio: 48 ,space: 15 ,numbers: 40 }; //璁� type 鍙傛暟鍏煎鏃х増鏈� if(item.checkbox) item.type = "checkbox"; if(item.space) item.type = "space"; if(!item.type) item.type = "normal"; if(item.type !== "normal"){ item.unresize = true; item.width = item.width || initWidth[item.type]; } }; //鍒濆鍖栦竴浜涘弬鏁� Class.prototype.setInit = function(type){ var that = this ,options = that.config; options.clientWidth = options.width || function(){ //鑾峰彇瀹瑰櫒瀹藉害 //濡傛灉鐖跺厓绱犲搴︿负0锛堜竴鑸负闅愯棌鍏冪礌锛夛紝鍒欑户缁煡鎵句笂灞傚厓绱狅紝鐩村埌鎵惧埌鐪熷疄瀹藉害涓烘 var getWidth = function(parent){ var width, isNone; parent = parent || options.elem.parent() width = parent.width(); try { isNone = parent.css('display') === 'none'; } catch(e){} if(parent[0] && (!width || isNone)) return getWidth(parent.parent()); return width; }; return getWidth(); }(); if(type === 'width') return options.clientWidth; //鍒濆鍖栧垪鍙傛暟 layui.each(options.cols, function(i1, item1){ layui.each(item1, function(i2, item2){ //濡傛灉鍒楀弬鏁颁负绌猴紝鍒欑Щ闄� if(!item2){ item1.splice(i2, 1); return; } item2.key = i1 + '-' + i2; item2.hide = item2.hide || false; //璁剧疆鍒楃殑鐖跺垪绱㈠紩 //濡傛灉鏄粍鍚堝垪锛屽垯鎹曡幏瀵瑰簲鐨勫瓙鍒� if(item2.colGroup || item2.colspan > 1){ var childIndex = 0; layui.each(options.cols[i1 + 1], function(i22, item22){ //濡傛灉瀛愬垪宸茬粡琚爣娉ㄤ负{HAS_PARENT}锛屾垨鑰呭瓙鍒楃疮璁� colspan 鏁扮瓑浜庣埗鍒楀畾涔夌殑 colspan锛屽垯璺冲嚭褰撳墠瀛愬垪寰幆 if(item22.HAS_PARENT || (childIndex > 1 && childIndex == item2.colspan)) return; item22.HAS_PARENT = true; item22.parentKey = i1 + '-' + i2; childIndex = childIndex + parseInt(item22.colspan > 1 ? item22.colspan : 1); }); item2.colGroup = true; //鏍囨敞鏄粍鍚堝垪 } //鏍规嵁鍒楃被鍨嬶紝瀹氬埗鍖栧弬鏁� that.initOpts(item2); }); }); }; //鍒濆宸ュ叿鏍� Class.prototype.renderToolbar = function(){ var that = this ,options = that.config //娣诲姞宸ュ叿鏍忓乏渚фā鏉� var leftDefaultTemp = [ '
      ' ,'
      ' ,'
      ' ].join('') ,elemToolTemp = that.layTool.find('.layui-table-tool-temp'); if(options.toolbar === 'default'){ elemToolTemp.html(leftDefaultTemp); } else if(options.toolbar){ var toolbarHtml = $(options.toolbar).html() || ''; toolbarHtml && elemToolTemp.html( laytpl(toolbarHtml).render(options) ); } //娣诲姞宸ュ叿鏍忓彸渚ч潰鏉� var layout = { filter: { title: '绛涢�夊垪' ,layEvent: 'LAYTABLE_COLS' ,icon: 'layui-icon-cols' } ,exports: { title: '瀵煎嚭' ,layEvent: 'LAYTABLE_EXPORT' ,icon: 'layui-icon-export' } ,print: { title: '鎵撳嵃' ,layEvent: 'LAYTABLE_PRINT' ,icon: 'layui-icon-print' }, bexports: { title: "瀵煎嚭", layEvent: "B_LAYTABLE_EXPORT", icon: "layui-icon-export" } }, iconElem = []; if(typeof options.defaultToolbar === 'object'){ layui.each(options.defaultToolbar, function(i, item){ var thisItem = layout[item]; if(thisItem){ iconElem.push('
      ' +'' +'
      '); } }); } that.layTool.find('.layui-table-tool-self').html(iconElem.join('')); } //鍚屾琛ㄥご鐖跺垪鐨勭浉鍏冲�� Class.prototype.setParentCol = function(hide, parentKey){ var that = this ,options = that.config ,parentTh = that.layHeader.find('th[data-key="'+ options.index +'-'+ parentKey +'"]') //鑾峰彇鐖跺垪鍏冪礌 ,parentColspan = parseInt(parentTh.attr('colspan')) || 0; if(parentTh[0]){ var arrParentKey = parentKey.split('-') ,getThisCol = options.cols[arrParentKey[0]][arrParentKey[1]]; hide ? parentColspan-- : parentColspan++; parentTh.attr('colspan', parentColspan); parentTh[parentColspan < 1 ? 'addClass' : 'removeClass'](HIDE); getThisCol.colspan = parentColspan; //鍚屾 colspan 鍙傛暟 getThisCol.hide = parentColspan < 1; //鍚屾 hide 鍙傛暟 //閫掑綊锛岀户缁線涓婃煡璇㈡槸鍚︽湁鐖跺垪 var nextParentKey = parentTh.data('parentkey'); nextParentKey && that.setParentCol(hide, nextParentKey); } }; //澶氱骇琛ㄥご琛ヤ竵 Class.prototype.setColsPatch = function(){ var that = this ,options = that.config //鍚屾琛ㄥご鐖跺垪鐨勭浉鍏冲�� layui.each(options.cols, function(i1, item1){ layui.each(item1, function(i2, item2){ if(item2.hide){ that.setParentCol(item2.hide, item2.parentKey); } }); }); }; //鍔ㄦ�佸垎閰嶅垪瀹� Class.prototype.setColsWidth = function(){ var that = this ,options = that.config ,colNums = 0 //鍒椾釜鏁� ,autoColNums = 0 //鑷姩鍒楀鐨勫垪涓暟 ,autoWidth = 0 //鑷姩鍒楀垎閰嶇殑瀹藉害 ,countWidth = 0 //鎵�鏈夊垪鎬诲搴﹀拰 ,cntrWidth = that.setInit('width'); //缁熻鍒椾釜鏁� that.eachCols(function(i, item){ item.hide || colNums++; }); //鍑忓幓杈规宸拰婊氬姩鏉″ cntrWidth = cntrWidth - function(){ return (options.skin === 'line' || options.skin === 'nob') ? 2 : colNums + 1; }() - that.getScrollWidth(that.layMain[0]) - 1; //璁$畻鑷姩鍒嗛厤鐨勫搴� var getAutoWidth = function(back){ //閬嶅巻鎵�鏈夊垪 layui.each(options.cols, function(i1, item1){ layui.each(item1, function(i2, item2){ var width = 0 ,minWidth = item2.minWidth || options.cellMinWidth; //鏈�灏忓搴� if(!item2){ item1.splice(i2, 1); return; } if(item2.colGroup || item2.hide) return; if(!back){ width = item2.width || 0; if(/\d+%$/.test(width)){ //鍒楀涓虹櫨鍒嗘瘮 width = Math.floor((parseFloat(width) / 100) * cntrWidth); width < minWidth && (width = minWidth); } else if(!width){ //鍒楀鏈~鍐� item2.width = width = 0; autoColNums++; } } else if(autoWidth && autoWidth < minWidth){ autoColNums--; width = minWidth; } if(item2.hide) width = 0; countWidth = countWidth + new Number(width); }); }); //濡傛灉鏈~鍏呮弧锛屽垯灏嗗墿浣欏搴﹀钩鍒� (cntrWidth > countWidth && autoColNums) && ( autoWidth = (cntrWidth - countWidth) / autoColNums ); } getAutoWidth(); getAutoWidth(true); //閲嶆柊妫�娴嬪垎閰嶇殑瀹藉害鏄惁浣庝簬鏈�灏忓垪瀹� //璁板綍鑷姩鍒楁暟 that.autoColNums = autoColNums; //璁剧疆鍒楀 that.eachCols(function(i3, item3){ var minWidth = item3.minWidth || options.cellMinWidth; if(item3.colGroup || item3.hide) return; //缁欎綅鍒嗛厤瀹界殑鍒楀钩鍧囧垎閰嶅 if(item3.width === 0){ that.getCssRule(options.index +'-'+ item3.key, function(item){ item.style.width = Math.floor(autoWidth >= minWidth ? autoWidth : minWidth) + 'px'; }); } //缁欒瀹氱櫨鍒嗘瘮鐨勫垪鍒嗛厤鍒楀 else if(/\d+%$/.test(item3.width)){ that.getCssRule(options.index +'-'+ item3.key, function(item){ item.style.width = Math.floor((parseFloat(item3.width) / 100) * cntrWidth) + 'px'; }); } }); //濉ˉ Math.floor 閫犳垚鐨勬暟宸� var patchNums = that.layMain.width() - that.getScrollWidth(that.layMain[0]) - that.layMain.children('table').outerWidth(); if(that.autoColNums && patchNums >= -colNums && patchNums <= colNums){ var getEndTh = function(th){ var field; th = th || that.layHeader.eq(0).find('thead th:last-child') field = th.data('field'); if(!field && th.prev()[0]){ return getEndTh(th.prev()) } return th } ,th = getEndTh() ,key = th.data('key'); that.getCssRule(key, function(item){ var width = item.style.width || th.outerWidth(); item.style.width = (parseFloat(width) + patchNums) + 'px'; //浜屾鏍¢獙锛屽鏋滀粛鐒跺嚭鐜版í鍚戞粴鍔ㄦ潯锛堥�氬父鏄� 1px 鐨勮宸鑷达級 if(that.layMain.height() - that.layMain.prop('clientHeight') > 0){ item.style.width = (parseFloat(item.style.width) - 1) + 'px'; } }); } that.loading(!0); }; //琛ㄦ牸閲嶈浇 Class.prototype.reload = function(options){ var that = this; if(that.config.data && that.config.data.constructor === Array) delete that.config.data; that.config = $.extend({}, that.config, options); that.render(); }; //椤电爜 Class.prototype.page = 1; //鑾峰緱鏁版嵁 Class.prototype.pullData = function(curr){ var that = this ,options = that.config ,request = options.request ,response = options.response ,sort = function(){ if(typeof options.initSort === 'object'){ that.sort(options.initSort.field, options.initSort.type); } }; that.startTime = new Date().getTime(); //娓叉煋寮�濮嬫椂闂� if(options.url){ //Ajax璇锋眰 var params = {}; params[request.pageName] = curr; params[request.limitName] = options.limit; //鍙傛暟 var data = $.extend(params, options.where); if(options.contentType && options.contentType.indexOf("application/json") == 0){ //鎻愪氦 json 鏍煎紡 data = JSON.stringify(data); } $.ajax({ type: options.method || 'get' ,url: options.url ,contentType: options.contentType ,data: data ,dataType: 'json' ,headers: options.headers || {} ,success: function(res){ //濡傛灉鏈夋暟鎹В鏋愮殑鍥炶皟锛屽垯鑾峰緱鍏惰繑鍥炵殑鏁版嵁 if(typeof options.parseData === 'function'){ res = options.parseData(res) || res; } //妫�鏌ユ暟鎹牸寮忔槸鍚︾鍚堣鑼� if(res[response.statusName] != response.statusCode){ that.renderForm(); that.layMain.html('
      '+ ( res[response.msgName] || ('杩斿洖鐨勬暟鎹笉绗﹀悎瑙勮寖锛屾纭殑鎴愬姛鐘舵�佺爜 ('+ response.statusName +') 搴斾负锛�'+ response.statusCode) ) +'
      '); } else { that.renderData(res, curr, res[response.countName]), sort(); options.time = (new Date().getTime() - that.startTime) + ' ms'; //鑰楁椂锛堟帴鍙h姹�+瑙嗗浘娓叉煋锛� } that.setColsWidth(); typeof options.done === 'function' && options.done(res, curr, res[response.countName]); } ,error: function(e, m){ that.layMain.html('
      鏁版嵁鎺ュ彛璇锋眰寮傚父锛�'+ m +'
      '); that.renderForm(); that.setColsWidth(); } }); } else if(options.data && options.data.constructor === Array){ //宸茬煡鏁版嵁 var res = {} ,startLimit = curr*options.limit - options.limit res[response.dataName] = options.data.concat().splice(startLimit, options.limit); res[response.countName] = options.data.length; that.renderData(res, curr, options.data.length), sort(); that.setColsWidth(); typeof options.done === 'function' && options.done(res, curr, res[response.countName]); } }; //閬嶅巻琛ㄥご Class.prototype.eachCols = function(callback){ var that = this; table.eachCols(null, callback, that.config.cols); return that; }; //鏁版嵁娓叉煋 Class.prototype.renderData = function(res, curr, count, sort){ var that = this ,options = that.config ,data = res[options.response.dataName] || [] ,trs = [] ,trs_fixed = [] ,trs_fixed_r = [] //娓叉煋瑙嗗浘 ,render = function(){ //鍚庣画鎬ц兘鎻愬崌鐨勯噸鐐� var thisCheckedRowIndex; if(!sort && that.sortKey){ return that.sort(that.sortKey.field, that.sortKey.sort, true); } //console.log(data); layui.each(data, function(i1, item1){ var tds = [], tds_fixed = [], tds_fixed_r = [] ,numbers = i1 + options.limit*(curr - 1) + 1; //搴忓彿 if(item1.length === 0) return; if(!sort){ item1[table.config.indexName] = i1; } that.eachCols(function(i3, item3){ var field = item3.field || i3 ,key = options.index + '-' + item3.key ,content = item1[field]; if(content === undefined || content === null) content = ''; if(item3.colGroup) return; //td鍐呭 var td = ['' ,'
      ' + function(){ var tplData = $.extend(true, { LAY_INDEX: numbers }, item1) ,checkName = table.config.checkName; //娓叉煋涓嶅悓椋庢牸鐨勫垪 switch(item3.type){ case 'checkbox': return ''; break; case 'radio': if(tplData[checkName]){ thisCheckedRowIndex = i1; } return ''; break; case 'numbers': return numbers; break; }; //瑙f瀽宸ュ叿鍒楁ā鏉� if(item3.toolbar){ return laytpl($(item3.toolbar).html()||'').render(tplData); } return item3.templet ? function(){ return typeof item3.templet === 'function' ? item3.templet(tplData) : laytpl($(item3.templet).html() || String(content)).render(tplData) }() : content; }() ,'
      '].join(''); tds.push(td); if(item3.fixed && item3.fixed !== 'right') tds_fixed.push(td); if(item3.fixed === 'right') tds_fixed_r.push(td); }); trs.push(''+ tds.join('') + ''); trs_fixed.push(''+ tds_fixed.join('') + ''); trs_fixed_r.push(''+ tds_fixed_r.join('') + ''); }); that.layBody.scrollTop(0); that.layMain.find('.'+ NONE).remove(); that.layMain.find('tbody').html(trs.join('')); that.layFixLeft.find('tbody').html(trs_fixed.join('')); that.layFixRight.find('tbody').html(trs_fixed_r.join('')); that.renderForm(); typeof thisCheckedRowIndex === 'number' && that.setThisRowChecked(thisCheckedRowIndex); that.syncCheckAll(); that.scrollPatch(); /* that.haveInit ? that.scrollPatch() : setTimeout(function(){ that.scrollPatch(); }, 50); that.haveInit = true; */ layer.close(that.tipsIndex); //鍚屾琛ㄥご鐖跺垪鐨勭浉鍏冲�� options.HAS_SET_COLS_PATCH || that.setColsPatch(); options.HAS_SET_COLS_PATCH = true; }; that.key = options.id || options.index; table.cache[that.key] = data; //璁板綍鏁版嵁 //鏄剧ず闅愯棌鍒嗛〉鏍� that.layPage[(count == 0 || (data.length === 0 && curr == 1)) ? 'addClass' : 'removeClass'](HIDE); //鎺掑簭 if(sort){ return render(); } if(data.length === 0){ that.renderForm(); that.layFixed.remove(); that.layMain.find('tbody').html(''); that.layMain.find('.'+ NONE).remove(); return that.layMain.append('
      '+ options.text.none +'
      '); } render(); //娓叉煋鏁版嵁 that.renderTotal(data); //鏁版嵁鍚堣 //鍚屾鍒嗛〉鐘舵�� if(options.page){ options.page = $.extend({ elem: 'layui-table-page' + options.index ,count: count ,limit: options.limit ,limits: options.limits || [10,20,30,40,50,60,70,80,90] ,groups: 3 ,layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'] ,prev: '' ,next: '' ,jump: function(obj, first){ if(!first){ //鍒嗛〉鏈韩骞堕潪闇�瑕佸仛浠ヤ笅鏇存柊锛屼笅闈㈠弬鏁扮殑鍚屾锛屼富瑕佹槸鍥犱负鍏跺畠澶勭悊缁熶竴鐢ㄥ埌浜嗗畠浠� //鑰屽苟闈炵敤鐨勬槸 options.page 涓殑鍙傛暟锛堜互纭繚鍒嗛〉鏈紑鍚殑鎯呭喌浠嶈兘姝e父浣跨敤锛� that.page = obj.curr; //鏇存柊椤电爜 options.limit = obj.limit; //鏇存柊姣忛〉鏉℃暟 that.loading(); that.pullData(obj.curr); } } }, options.page); options.page.count = count; //鏇存柊鎬绘潯鏁� laypage.render(options.page); } }; //鏁版嵁鍚堣琛� Class.prototype.renderTotal = function(data){ var that = this ,options = that.config ,totalNums = {}; if(!options.totalRow) return; layui.each(data, function(i1, item1){ if(item1.length === 0) return; that.eachCols(function(i3, item3){ var field = item3.field || i3 ,content = item1[field]; if(item3.totalRow){ totalNums[field] = (totalNums[field] || 0) + (parseFloat(content) || 0); } }); }); var tds = []; that.eachCols(function(i3, item3){ var field = item3.field || i3; if(item3.hide) return; //td鍐呭 var td = ['' ,'
      ' + function(){ var text = item3.totalRowText || ''; return item3.totalRow ? (totalNums[field] || text) : text; }() ,'
      '].join(''); tds.push(td); }); that.layTotal.find('tbody').html('' + tds.join('') + ''); }; //鎵惧埌瀵瑰簲鐨勫垪鍏冪礌 Class.prototype.getColElem = function(parent, key){ var that = this ,options = that.config; return parent.eq(0).find('.laytable-cell-'+ (options.index + '-' + key) + ':eq(0)'); }; //娓叉煋琛ㄥ崟 Class.prototype.renderForm = function(type){ form.render(type, 'LAY-table-'+ this.index); }; //鏍囪褰撳墠琛岄�変腑鐘舵�� Class.prototype.setThisRowChecked = function(index){ var that = this ,options = that.config ,ELEM_CLICK = 'layui-table-click' ,tr = that.layBody.find('tr[data-index="'+ index +'"]'); tr.addClass(ELEM_CLICK).siblings('tr').removeClass(ELEM_CLICK); }; //鏁版嵁鎺掑簭 Class.prototype.sort = function(th, type, pull, formEvent){ var that = this ,field ,res = {} ,options = that.config ,filter = options.elem.attr('lay-filter') ,data = table.cache[that.key], thisData; //瀛楁鍖归厤 if(typeof th === 'string'){ that.layHeader.find('th').each(function(i, item){ var othis = $(this) ,_field = othis.data('field'); if(_field === th){ th = othis; field = _field; return false; } }); } try { var field = field || th.data('field') ,key = th.data('key'); //濡傛灉娆叉墽琛岀殑鎺掑簭宸插湪鐘舵�佷腑锛屽垯涓嶆墽琛屾覆鏌� if(that.sortKey && !pull){ if(field === that.sortKey.field && type === that.sortKey.sort){ return; } } var elemSort = that.layHeader.find('th .laytable-cell-'+ key).find(ELEM_SORT); that.layHeader.find('th').find(ELEM_SORT).removeAttr('lay-sort'); //娓呴櫎鍏跺畠鏍囬鎺掑簭鐘舵�� elemSort.attr('lay-sort', type || null); that.layFixed.find('th') } catch(e){ return hint.error('Table modules: Did not match to field'); } //璁板綍鎺掑簭绱㈠紩鍜岀被鍨� that.sortKey = { field: field ,sort: type }; if(type === 'asc'){ //鍗囧簭 thisData = layui.sort(data, field); } else if(type === 'desc'){ //闄嶅簭 thisData = layui.sort(data, field, true); } else { //娓呴櫎鎺掑簭 thisData = layui.sort(data, table.config.indexName); delete that.sortKey; } res[options.response.dataName] = thisData; that.renderData(res, that.page, that.count, true); if(formEvent){ layui.event.call(th, MOD_NAME, 'sort('+ filter +')', { field: field ,type: type }); } }; //璇锋眰loading Class.prototype.loading = function(hide){ var that = this ,options = that.config; if(options.loading){ if(hide){ that.layInit && that.layInit.remove(); delete that.layInit; that.layBox.find(ELEM_INIT).remove() } else { that.layInit = $(['
      ' ,'' ,'
      '].join('')); that.layBox.append(that.layInit); } } }; //鍚屾閫変腑鍊肩姸鎬� Class.prototype.setCheckData = function(index, checked){ var that = this ,options = that.config ,thisData = table.cache[that.key]; if(!thisData[index]) return; if(thisData[index].constructor === Array) return; thisData[index][options.checkName] = checked; }; //鍚屾鍏ㄩ�夋寜閽姸鎬� Class.prototype.syncCheckAll = function(){ var that = this ,options = that.config ,checkAllElem = that.layHeader.find('input[name="layTableCheckbox"]') ,syncColsCheck = function(checked){ that.eachCols(function(i, item){ if(item.type === 'checkbox'){ item[options.checkName] = checked; } }); return checked; }; if(!checkAllElem[0]) return; if(table.checkStatus(that.key).isAll){ if(!checkAllElem[0].checked){ checkAllElem.prop('checked', true); that.renderForm('checkbox'); } syncColsCheck(true); } else { if(checkAllElem[0].checked){ checkAllElem.prop('checked', false); that.renderForm('checkbox'); } syncColsCheck(false); } }; //鑾峰彇cssRule Class.prototype.getCssRule = function(key, callback){ var that = this ,style = that.elem.find('style')[0] ,sheet = style.sheet || style.styleSheet || {} ,rules = sheet.cssRules || sheet.rules; layui.each(rules, function(i, item){ if(item.selectorText === ('.laytable-cell-'+ key)){ return callback(item), true; } }); }; //璁╄〃鏍奸摵婊� Class.prototype.fullSize = function(){ var that = this ,options = that.config ,height = options.height, bodyHeight; if(that.fullHeightGap){ height = _WIN.height() - that.fullHeightGap; if(height < 135) height = 135; that.elem.css('height', height); } if(!height) return; //鍑忓幓鍒楀ご鍖哄煙鐨勯珮搴� bodyHeight = parseFloat(height) - (that.layHeader.outerHeight() || 38); //姝ゅ鐨勬暟瀛楀父閲忔槸涓轰簡闃叉瀹瑰櫒澶勫湪闅愯棌鍖哄煙鏃犳硶鑾峰緱楂樺害鐨勯棶棰橈紝鏆傛椂鍙榛樿灏哄鐨勮〃鏍煎仛鏀寔銆� //鍑忓幓宸ュ叿鏍忕殑楂樺害 if(options.toolbar){ bodyHeight = bodyHeight - (that.layTool.outerHeight() || 50); } //鍑忓幓缁熻鏈楃殑楂樺害 if(options.totalRow){ bodyHeight = bodyHeight - (that.layTotal.outerHeight() || 40); } //鍑忓幓鍒嗛〉鏍忕殑楂樺害 if(options.page){ bodyHeight = bodyHeight - (that.layPage.outerHeight() || 41) - 2; } that.layMain.css('height', bodyHeight); }; //鑾峰彇婊氬姩鏉″搴� Class.prototype.getScrollWidth = function(elem){ var width = 0; if(elem){ width = elem.offsetWidth - elem.clientWidth; } else { elem = document.createElement('div'); elem.style.width = '100px'; elem.style.height = '100px'; elem.style.overflowY = 'scroll'; document.body.appendChild(elem); width = elem.offsetWidth - elem.clientWidth; document.body.removeChild(elem); } return width; }; //婊氬姩鏉¤ˉ涓� Class.prototype.scrollPatch = function(){ var that = this ,layMainTable = that.layMain.children('table') ,scollWidth = that.layMain.width() - that.layMain.prop('clientWidth') //绾靛悜婊氬姩鏉″搴� ,scollHeight = that.layMain.height() - that.layMain.prop('clientHeight') //妯悜婊氬姩鏉¢珮搴� ,getScrollWidth = that.getScrollWidth(that.layMain[0]) //鑾峰彇涓诲鍣ㄦ粴鍔ㄦ潯瀹藉害锛屽鏋滄湁鐨勮瘽 ,outWidth = layMainTable.outerWidth() - that.layMain.width() //琛ㄦ牸鍐呭鍣ㄧ殑瓒呭嚭瀹藉害 //娣诲姞琛ヤ竵 ,addPatch = function(elem){ if(scollWidth && scollHeight){ elem = elem.eq(0); if(!elem.find('.layui-table-patch')[0]){ var patchElem = $('
      '); //琛ヤ竵鍏冪礌 patchElem.find('div').css({ width: scollWidth }); elem.find('tr').append(patchElem); } } else { elem.find('.layui-table-patch').remove(); } } addPatch(that.layHeader); addPatch(that.layTotal); //鍥哄畾鍒楀尯鍩熼珮搴� var mainHeight = that.layMain.height() ,fixHeight = mainHeight - scollHeight; that.layFixed.find(ELEM_BODY).css('height', layMainTable.height() > fixHeight ? fixHeight : 'auto'); //琛ㄦ牸瀹藉害灏忎簬瀹瑰櫒瀹藉害鏃讹紝闅愯棌鍥哄畾鍒� that.layFixRight[outWidth > 0 ? 'removeClass' : 'addClass'](HIDE); //鎿嶄綔鏍� that.layFixRight.css('right', scollWidth - 1); }; //浜嬩欢澶勭悊 Class.prototype.events = function(){ var that = this ,options = that.config ,_BODY = $('body') ,dict = {} ,th = that.layHeader.find('th') ,resizing ,ELEM_CELL = '.layui-table-cell' ,filter = options.elem.attr('lay-filter'); //宸ュ叿鏍忔搷浣滀簨浠� that.layTool.on('click', '*[lay-event]', function(e){ var othis = $(this) ,events = othis.attr('lay-event') ,openPanel = function(sets){ var list = $(sets.list) ,panel = $(''); panel.html(list); othis.find('.layui-table-tool-panel')[0] || othis.append(panel); that.renderForm(); panel.on('click', function(e){ layui.stope(e); }); sets.done && sets.done(panel, list) }; layui.stope(e); _DOC.trigger('table.tool.panel.remove'); layer.close(that.tipsIndex); switch(events){ case 'LAYTABLE_COLS': //绛涢�夊垪 openPanel({ list: function(){ var lis = []; that.eachCols(function(i, item){ if(item.field && item.type == 'normal'){ lis.push('
    • '); } }); return lis.join(''); }() ,done: function(){ form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(obj){ var othis = $(obj.elem) ,checked = this.checked ,key = othis.data('key') ,parentKey = othis.data('parentkey'); layui.each(options.cols, function(i1, item1){ layui.each(item1, function(i2, item2){ if(i1+ '-'+ i2 === key){ var hide = item2.hide; //鍚屾鍕鹃�夊垪鐨� hide 鍊煎拰闅愯棌鏍峰紡 item2.hide = !checked; that.elem.find('*[data-key="'+ options.index +'-'+ key +'"]') [checked ? 'removeClass' : 'addClass'](HIDE); //鏍规嵁鍒楃殑鏄剧ず闅愯棌锛屽悓姝ュ绾ц〃澶寸殑鐖剁骇鐩稿叧灞炴�у�� if(hide != item2.hide){ that.setParentCol(!checked, parentKey); } //閫傞厤 that.fullSize(); that.scrollPatch(); that.setColsWidth(); } }); }); }); } }); break; case 'LAYTABLE_EXPORT': //瀵煎嚭 if(device.ie){ layer.tips('瀵煎嚭鍔熻兘涓嶆敮鎸� IE锛岃鐢� Chrome 绛夐珮绾ф祻瑙堝櫒瀵煎嚭', this, { tips: 3 }) } else { openPanel({ list: function(){ return [ '
    • 瀵煎嚭鍒� Csv 鏂囦欢
    • ' ,'
    • 瀵煎嚭鍒� Excel 鏂囦欢
    • ' ].join('') }() ,done: function(panel, list){ list.on('click', function(){ var type = $(this).data('type') table.exportFile(options.id, null, type); }); } }); } break; case 'LAYTABLE_PRINT': //鎵撳嵃 var printWin = window.open('鎵撳嵃绐楀彛', '_blank') ,style = [''].join('') ,html = $(that.layHeader.html()); html.append(that.layMain.find('table').html()); html.find('th.layui-table-patch').remove(); html.find('.layui-table-col-special').remove(); printWin.document.write(style + html.prop('outerHTML')); printWin.document.close(); printWin.print(); printWin.close(); break; } layui.event.call(this, MOD_NAME, 'toolbar('+ filter +')', $.extend({ event: events ,config: options },{})); }); //鎷栨嫿璋冩暣瀹藉害 th.on('mousemove', function(e){ var othis = $(this) ,oLeft = othis.offset().left ,pLeft = e.clientX - oLeft; if(othis.data('unresize') || dict.resizeStart){ return; } dict.allowResize = othis.width() - pLeft <= 10; //鏄惁澶勪簬鎷栨嫿鍏佽鍖哄煙 _BODY.css('cursor', (dict.allowResize ? 'col-resize' : '')); }).on('mouseleave', function(){ var othis = $(this); if(dict.resizeStart) return; _BODY.css('cursor', ''); }).on('mousedown', function(e){ var othis = $(this); if(dict.allowResize){ var key = othis.data('key'); e.preventDefault(); dict.resizeStart = true; //寮�濮嬫嫋鎷� dict.offset = [e.clientX, e.clientY]; //璁板綍鍒濆鍧愭爣 that.getCssRule(key, function(item){ var width = item.style.width || othis.outerWidth(); dict.rule = item; dict.ruleWidth = parseFloat(width); dict.minWidth = othis.data('minwidth') || options.cellMinWidth; }); } }); //鎷栨嫿涓� _DOC.on('mousemove', function(e){ if(dict.resizeStart){ e.preventDefault(); if(dict.rule){ var setWidth = dict.ruleWidth + e.clientX - dict.offset[0]; if(setWidth < dict.minWidth) setWidth = dict.minWidth; dict.rule.style.width = setWidth + 'px'; layer.close(that.tipsIndex); } resizing = 1 } }).on('mouseup', function(e){ if(dict.resizeStart){ dict = {}; _BODY.css('cursor', ''); that.scrollPatch(); } if(resizing === 2){ resizing = null; } }); //鎺掑簭 th.on('click', function(e){ var othis = $(this) ,elemSort = othis.find(ELEM_SORT) ,nowType = elemSort.attr('lay-sort') ,type; if(!elemSort[0] || resizing === 1) return resizing = 2; if(nowType === 'asc'){ type = 'desc'; } else if(nowType === 'desc'){ type = null; } else { type = 'asc'; } that.sort(othis, type, null, true); }).find(ELEM_SORT+' .layui-edge ').on('click', function(e){ var othis = $(this) ,index = othis.index() ,field = othis.parents('th').eq(0).data('field') layui.stope(e); if(index === 0){ that.sort(field, 'asc', null, true); } else { that.sort(field, 'desc', null, true); } }); //鏁版嵁琛屼腑鐨勪簨浠剁洃鍚繑鍥炵殑鍏叡瀵硅薄鎴愬憳 var commonMember = function(sets){ var othis = $(this) ,index = othis.parents('tr').eq(0).data('index') ,tr = that.layBody.find('tr[data-index="'+ index +'"]') ,data = table.cache[that.key][index]; return $.extend({ tr: tr //琛屽厓绱� ,data: table.clearCacheKey(data) //褰撳墠琛屾暟鎹� ,del: function(){ //鍒犻櫎琛屾暟鎹� table.cache[that.key][index] = []; tr.remove(); that.scrollPatch(); } ,update: function(fields){ //淇敼琛屾暟鎹� fields = fields || {}; layui.each(fields, function(key, value){ if(key in data){ var templet, td = tr.children('td[data-field="'+ key +'"]'); data[key] = value; that.eachCols(function(i, item2){ if(item2.field == key && item2.templet){ templet = item2.templet; } }); td.children(ELEM_CELL).html(function(){ return templet ? function(){ return typeof templet === 'function' ? templet(data) : laytpl($(templet).html() || value).render(data) }() : value; }()); td.data('content', value); } }); } }, sets); }; //澶嶉�夋閫夋嫨 that.elem.on('click', 'input[name="layTableCheckbox"]+', function(){ //鏇夸唬鍏冪礌鐨� click 浜嬩欢 var checkbox = $(this).prev() ,childs = that.layBody.find('input[name="layTableCheckbox"]') ,index = checkbox.parents('tr').eq(0).data('index') ,checked = checkbox[0].checked ,isAll = checkbox.attr('lay-filter') === 'layTableAllChoose'; //鍏ㄩ�� if(isAll){ childs.each(function(i, item){ item.checked = checked; that.setCheckData(i, checked); }); that.syncCheckAll(); that.renderForm('checkbox'); } else { that.setCheckData(index, checked); that.syncCheckAll(); } layui.event.call(this, MOD_NAME, 'checkbox('+ filter +')', commonMember.call(this, { checked: checked ,type: isAll ? 'all' : 'one' })); }); //鍗曢�夋閫夋嫨 that.elem.on('click', 'input[lay-type="layTableRadio"]+', function(){ var radio = $(this).prev() ,checked = radio[0].checked ,thisData = table.cache[that.key] ,index = radio.parents('tr').eq(0).data('index') //閲嶇疆鏁版嵁鍗曢�夊睘鎬� layui.each(thisData, function(i, item){ if(index === i){ item.LAY_CHECKED = true; } else { delete item.LAY_CHECKED; } }); that.setThisRowChecked(index); layui.event.call(this, MOD_NAME, 'radio('+ filter +')', commonMember.call(this, { checked: checked })); }); //琛屼簨浠� that.layBody.on('mouseenter', 'tr', function(){ //榧犳爣绉诲叆琛� var othis = $(this) ,index = othis.index(); that.layBody.find('tr:eq('+ index +')').addClass(ELEM_HOVER) }).on('mouseleave', 'tr', function(){ //榧犳爣绉诲嚭琛� var othis = $(this) ,index = othis.index(); that.layBody.find('tr:eq('+ index +')').removeClass(ELEM_HOVER) }).on('click', 'tr', function(){ //鍗曞嚮琛� setRowEvent.call(this, 'row'); }).on('dblclick', 'tr', function(){ //鍙屽嚮琛� setRowEvent.call(this, 'rowDouble'); }); //鍒涘缓琛屽崟鍑汇�佸弻鍑讳簨浠剁洃鍚� var setRowEvent = function(eventType){ var othis = $(this); layui.event.call(this, MOD_NAME, eventType + '('+ filter +')' ,commonMember.call(othis.children('td')[0]) ); }; //鍗曞厓鏍肩紪杈� that.layBody.on('change', '.'+ELEM_EDIT, function(){ var othis = $(this) ,value = this.value ,field = othis.parent().data('field') ,index = othis.parents('tr').eq(0).data('index') ,data = table.cache[that.key][index]; data[field] = value; //鏇存柊缂撳瓨涓殑鍊� layui.event.call(this, MOD_NAME, 'edit('+ filter +')', commonMember.call(this, { value: value ,field: field })); }).on('blur', '.'+ELEM_EDIT, function(){ var templet ,othis = $(this) ,field = othis.parent().data('field') ,index = othis.parents('tr').eq(0).data('index') ,data = table.cache[that.key][index]; that.eachCols(function(i, item){ if(item.field == field && item.templet){ templet = item.templet; } }); othis.siblings(ELEM_CELL).html(function(value){ return templet ? function(){ return typeof templet === 'function' ? templet(data) : laytpl($(templet).html() || this.value).render(data) }() : value; }(this.value)); othis.parent().data('content', this.value); othis.remove(); }); //鍗曞厓鏍煎崟鍑讳簨浠� that.layBody.on('click', 'td', function(){ var othis = $(this) ,field = othis.data('field') ,editType = othis.data('edit') ,elemCell = othis.children(ELEM_CELL); if(othis.data('off')) return; //涓嶈Е鍙戜簨浠� //鏄剧ず缂栬緫琛ㄥ崟 if(editType){ var input = $(''); input[0].value = othis.data('content') || elemCell.text(); othis.find('.'+ELEM_EDIT)[0] || othis.append(input); input.focus(); return; } }).on('mouseenter', 'td', function(){ gridExpand.call(this) }).on('mouseleave', 'td', function(){ gridExpand.call(this, 'hide'); }); //鍗曞厓鏍煎睍寮�鍥炬爣 var ELEM_GRID = 'layui-table-grid', ELEM_GRID_DOWN = 'layui-table-grid-down', ELEM_GRID_PANEL = 'layui-table-grid-panel' ,gridExpand = function(hide){ var othis = $(this) ,elemCell = othis.children(ELEM_CELL); if(hide){ othis.find('.layui-table-grid-down').remove(); } else if(elemCell.prop('scrollWidth') > elemCell.outerWidth()){ if(elemCell.find('.'+ ELEM_GRID_DOWN)[0]) return; othis.append('
      '); } }; //鍗曞厓鏍煎睍寮�浜嬩欢 that.layBody.on('click', '.'+ ELEM_GRID_DOWN, function(){ var othis = $(this) ,td = othis.parent() ,elemCell = td.children(ELEM_CELL); that.tipsIndex = layer.tips([ '
      ' ,elemCell.html() ,'
      ' ,'' ].join(''), elemCell[0], { tips: [3, ''] ,time: -1 ,anim: -1 ,maxWidth: (device.ios || device.android) ? 300 : that.elem.width()/2 ,isOutAnim: false ,skin: 'layui-table-tips' ,success: function(layero, index){ layero.find('.layui-table-tips-c').on('click', function(){ layer.close(index); }); } }); }); //琛屽伐鍏锋潯鎿嶄綔浜嬩欢 that.layBody.on('click', '*[lay-event]', function(){ var othis = $(this) ,index = othis.parents('tr').eq(0).data('index'); layui.event.call(this, MOD_NAME, 'tool('+ filter +')', commonMember.call(this, { event: othis.attr('lay-event') })); that.setThisRowChecked(index); }); //鍚屾婊氬姩鏉� that.layMain.on('scroll', function(){ var othis = $(this) ,scrollLeft = othis.scrollLeft() ,scrollTop = othis.scrollTop(); that.layHeader.scrollLeft(scrollLeft); that.layTotal.scrollLeft(scrollLeft); that.layFixed.find(ELEM_BODY).scrollTop(scrollTop); layer.close(that.tipsIndex); }); //鍏ㄥ眬鐐瑰嚮 _DOC.on('click', function(){ _DOC.trigger('table.remove.tool.panel'); }); //宸ュ叿闈㈡澘绉婚櫎浜嬩欢 _DOC.on('table.remove.tool.panel', function(){ $('.layui-table-tool-panel').remove(); }); //鑷�傚簲 iplatform._WIN = _WIN; _WIN.on('resize', function(){ that.fullSize(); that.scrollPatch(); that.setColsWidth(); }); }; //鍒濆鍖� table.init = function(filter, settings){ settings = settings || {}; var that = this ,elemTable = filter ? $('table[lay-filter="'+ filter +'"]') : $(ELEM + '[lay-data]') ,errorTips = 'Table element property lay-data configuration item has a syntax error: '; //閬嶅巻鏁版嵁琛ㄦ牸 elemTable.each(function(){ var othis = $(this), tableData = othis.attr('lay-data'); try{ tableData = new Function('return '+ tableData)(); } catch(e){ hint.error(errorTips + tableData) } var cols = [], options = $.extend({ elem: this ,cols: [] ,data: [] ,skin: othis.attr('lay-skin') //椋庢牸 ,size: othis.attr('lay-size') //灏哄 ,even: typeof othis.attr('lay-even') === 'string' //鍋舵暟琛岃儗鏅� }, table.config, settings, tableData); filter && othis.hide(); //鑾峰彇琛ㄥご鏁版嵁 othis.find('thead>tr').each(function(i){ options.cols[i] = []; $(this).children().each(function(ii){ var th = $(this), itemData = th.attr('lay-data'); try{ itemData = new Function('return '+ itemData)(); } catch(e){ return hint.error(errorTips + itemData) } var row = $.extend({ title: th.text() ,colspan: th.attr('colspan') || 0 //鍒楀崟鍏冩牸 ,rowspan: th.attr('rowspan') || 0 //琛屽崟鍏冩牸 }, itemData); if(row.colspan < 2) cols.push(row); options.cols[i].push(row); }); }); //鑾峰彇琛ㄤ綋鏁版嵁 othis.find('tbody>tr').each(function(i1){ var tr = $(this), row = {}; //濡傛灉瀹氫箟浜嗗瓧娈靛悕 tr.children('td').each(function(i2, item2){ var td = $(this) ,field = td.data('field'); if(field){ return row[field] = td.html(); } }); //濡傛灉鏈畾涔夊瓧娈靛悕 layui.each(cols, function(i3, item3){ var td = tr.children('td').eq(i3); row[item3.field] = td.html(); }); options.data[i1] = row; }); table.render(options); }); return that; }; //璁板綍鎵�鏈夊疄渚嬮厤缃俊鎭� thisTable.config = {}; //閬嶅巻琛ㄥご table.eachCols = function(id, callback, cols){ var config = thisTable.config[id] || {} ,arrs = [], index = 0; cols = $.extend(true, [], cols || config.cols); //閲嶆柊鏁寸悊琛ㄥご缁撴瀯 layui.each(cols, function(i1, item1){ layui.each(item1, function(i2, item2){ //濡傛灉鏄粍鍚堝垪锛屽垯鎹曡幏瀵瑰簲鐨勫瓙鍒� if(item2.colGroup){ var childIndex = 0; index++ item2.CHILD_COLS = []; layui.each(cols[i1 + 1], function(i22, item22){ //濡傛灉瀛愬垪宸茬粡琚爣娉ㄤ负{PARENT_COL_INDEX}锛屾垨鑰呭瓙鍒楃疮璁� colspan 鏁扮瓑浜庣埗鍒楀畾涔夌殑 colspan锛屽垯璺冲嚭褰撳墠瀛愬垪寰幆 if(item22.PARENT_COL_INDEX || (childIndex > 1 && childIndex == item2.colspan)) return; item22.PARENT_COL_INDEX = index; item2.CHILD_COLS.push(item22); childIndex = childIndex + parseInt(item22.colspan > 1 ? item22.colspan : 1); }); } if(item2.PARENT_COL_INDEX) return; //濡傛灉鏄瓙鍒楋紝鍒欎笉杩涜杩藉姞锛屽洜涓哄凡缁忓瓨鍌ㄥ湪鐖跺垪涓� arrs.push(item2) }); }); //閲嶆柊閬嶅巻鍒楋紝濡傛灉鏈夊瓙鍒楋紝鍒欒繘鍏ラ�掑綊 var eachArrs = function(obj){ layui.each(obj || arrs, function(i, item){ if(item.CHILD_COLS) return eachArrs(item.CHILD_COLS); typeof callback === 'function' && callback(i, item); }); }; eachArrs(); }; //琛ㄦ牸閫変腑鐘舵�� table.checkStatus = function(id){ var nums = 0 ,invalidNum = 0 ,arr = [] ,data = table.cache[id] || []; //璁$畻鍏ㄩ�変釜鏁� layui.each(data, function(i, item){ if(item.constructor === Array){ invalidNum++; //鏃犳晥鏁版嵁锛屾垨宸插垹闄ょ殑 return; } if(item[table.config.checkName]){ nums++; arr.push(table.clearCacheKey(item)); } }); return { data: arr //閫変腑鐨勬暟鎹� ,isAll: data.length ? (nums === (data.length - invalidNum)) : false //鏄惁鍏ㄩ�� }; }; //琛ㄦ牸瀵煎嚭 table.exportFile = function(id, data, type){ data = data || table.clearCacheKey(table.cache[id]); type = type || 'csv'; var config = thisTable.config[id] || {} ,textType = ({ csv: 'text/csv' ,xls: 'application/vnd.ms-excel' })[type] ,alink = document.createElement("a"); if(device.ie) return hint.error('IE_NOT_SUPPORT_EXPORTS'); alink.href = 'data:'+ textType +';charset=utf-8,\ufeff'+ encodeURIComponent(function(){ var dataTitle = [], dataMain = []; layui.each(data, function(i1, item1){ var vals = []; if(typeof id === 'object'){ //ID鐩存帴涓鸿〃澶存暟鎹� layui.each(id, function(i, item){ i1 == 0 && dataTitle.push(item || ''); }); layui.each(table.clearCacheKey(item1), function(i2, item2){ vals.push(item2); }); } else { table.eachCols(id, function(i3, item3){ if(item3.field && item3.type == 'normal' && !item3.hide){ i1 == 0 && dataTitle.push(item3.title || ''); vals.push(item1[item3.field]); } }); } dataMain.push(vals.join(',')) }); return dataTitle.join(',') + '\r\n' + dataMain.join('\r\n'); }()); alink.download = (config.title || 'table_'+ (config.index || '')) + '.' + type; document.body.appendChild(alink); alink.click(); document.body.removeChild(alink); }; //琛ㄦ牸閲嶈浇 table.reload = function(id, options){ var config = thisTable.config[id]; options = options || {}; if(!config) return hint.error('The ID option was not found in the table instance'); if(options.data && options.data.constructor === Array) delete config.data; return table.render($.extend(true, {}, config, options)); }; //鏍稿績鍏ュ彛 table.render = function(options){ var inst = new Class(options); return thisTable.call(inst); }; //娓呴櫎涓存椂Key table.clearCacheKey = function(data){ data = $.extend({}, data); delete data[table.config.checkName]; delete data[table.config.indexName]; return data; }; //鑷姩瀹屾垚娓叉煋 table.init(); exports(MOD_NAME, table); }); layui.define("jquery", function (e) { "use strict"; var i = layui.$, n = (layui.hint(), layui.device(), { config : {}, set : function (e) { var n = this; return n.config = i.extend({}, n.config, e), n }, on : function (e, i) { return layui.onevent.call(this, t, e, i) } }), t = "carousel", a = "layui-this", l = ">*[carousel-item]>*", o = "layui-carousel-left", r = "layui-carousel-right", d = "layui-carousel-prev", s = "layui-carousel-next", u = "layui-carousel-arrow", c = "layui-carousel-ind", m = function (e) { var t = this; t.config = i.extend({}, t.config, n.config, e), t.render() }; m.prototype.config = { width : "600px", height : "280px", full : !1, arrow : "hover", indicator : "inside", autoplay : !0, interval : 3e3, anim : "", trigger : "click", index : 0 }, m.prototype.render = function () { var e = this, n = e.config; n.elem = i(n.elem), n.elem[0] && (e.elemItem = n.elem.find(l), n.index < 0 && (n.index = 0), n.index >= e.elemItem.length && (n.index = e.elemItem.length - 1), n.interval < 800 && (n.interval = 800), n.full ? n.elem.css({ position : "fixed", width : "100%", height : "100%", zIndex : 9999 }) : n.elem.css({ width : n.width, height : n.height }), n.elem.attr("lay-anim", n.anim), e.elemItem.eq(n.index).addClass(a), e.elemItem.length <= 1 || (e.indicator(), e.arrow(), e.autoplay(), e.events())) }, m.prototype.reload = function (e) { var n = this; clearInterval(n.timer), n.config = i.extend({}, n.config, e), n.render() }, m.prototype.prevIndex = function () { var e = this, i = e.config, n = i.index - 1; return n < 0 && (n = e.elemItem.length - 1), n }, m.prototype.nextIndex = function () { var e = this, i = e.config, n = i.index + 1; return n >= e.elemItem.length && (n = 0), n }, m.prototype.addIndex = function (e) { var i = this, n = i.config; e = e || 1, n.index = n.index + e, n.index >= i.elemItem.length && (n.index = 0) }, m.prototype.subIndex = function (e) { var i = this, n = i.config; e = e || 1, n.index = n.index - e, n.index < 0 && (n.index = i.elemItem.length - 1) }, m.prototype.autoplay = function () { var e = this, i = e.config; i.autoplay && (e.timer = setInterval(function () { e.slide() }, i.interval)) }, m.prototype.arrow = function () { var e = this, n = e.config, t = i(['", '"].join("")); n.elem.attr("lay-arrow", n.arrow), n.elem.find("." + u)[0] && n.elem.find("." + u).remove(), n.elem.append(t), t.on("click", function () { var n = i(this), t = n.attr("lay-type"); e.slide(t) }) }, m.prototype.indicator = function () { var e = this, n = e.config, t = e.elemInd = i(['
      "].join("")); n.elem.attr("lay-indicator", n.indicator), n.elem.find("." + c)[0] && n.elem.find("." + c).remove(), n.elem.append(t), "updown" === n.anim && t.css("margin-top", - (t.height() / 2)), t.find("li").on("hover" === n.trigger ? "mouseover" : n.trigger, function () { var t = i(this), a = t.index(); a > n.index ? e.slide("add", a - n.index) : a < n.index && e.slide("sub", n.index - a) }) }, m.prototype.slide = function (e, i) { var n = this, l = n.elemItem, u = n.config, c = u.index, m = u.elem.attr("lay-filter"); n.haveSlide || ("sub" === e ? (n.subIndex(i), l.eq(u.index).addClass(d), setTimeout(function () { l.eq(c).addClass(r), l.eq(u.index).addClass(r) }, 50)) : (n.addIndex(i), l.eq(u.index).addClass(s), setTimeout(function () { l.eq(c).addClass(o), l.eq(u.index).addClass(o) }, 50)), setTimeout(function () { l.removeClass(a + " " + d + " " + s + " " + o + " " + r), l.eq(u.index).addClass(a), n.haveSlide = !1 }, 300), n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a), n.haveSlide = !0, layui.event.call(this, t, "change(" + m + ")", { index : u.index, prevIndex : c, item : l.eq(u.index) })) }, m.prototype.events = function () { var e = this, i = e.config; i.elem.data("haveEvents") || (i.elem.on("mouseenter", function () { clearInterval(e.timer) }).on("mouseleave", function () { e.autoplay() }), i.elem.data("haveEvents", !0)) }, n.render = function (e) { var i = new m(e); return i }, e(t, n) }); layui.define("jquery", function (e) { "use strict"; var a = layui.jquery, i = { config : {}, index : layui.rate ? layui.rate.index + 1e4 : 0, set : function (e) { var i = this; return i.config = a.extend({}, i.config, e), i }, on : function (e, a) { return layui.onevent.call(this, n, e, a) } }, l = function () { var e = this, a = e.config; return { setvalue : function (a) { e.setvalue.call(e, a) }, config : a } }, n = "rate", t = "layui-rate", o = "layui-icon-rate", s = "layui-icon-rate-solid", u = "layui-icon-rate-half", r = "layui-icon-rate-solid layui-icon-rate-half", c = "layui-icon-rate-solid layui-icon-rate", f = "layui-icon-rate layui-icon-rate-half", v = function (e) { var l = this; l.index = ++i.index, l.config = a.extend({}, l.config, i.config, e), l.render() }; v.prototype.config = { length : 5, text : !1, readonly : !1, half : !1, value : 0, theme : "" }, v.prototype.render = function () { var e = this, i = e.config, l = i.theme ? 'style="color: ' + i.theme + ';"' : ""; i.elem = a(i.elem), parseInt(i.value) !== i.value && (i.half || (i.value = Math.ceil(i.value) - i.value < .5 ? Math.ceil(i.value) : Math.floor(i.value))); for (var n = '" + (i.text ? '' + i.value + "鏄�" : "") + ""; var c = i.elem, f = c.next("." + t); f[0] && f.remove(), e.elemTemp = a(n), i.span = e.elemTemp.next("span"), i.setText && i.setText(i.value), c.html(e.elemTemp), c.addClass("layui-inline"), i.readonly || e.action() }, v.prototype.setvalue = function (e) { var a = this, i = a.config; i.value = e, a.render() }, v.prototype.action = function () { var e = this, i = e.config, l = e.elemTemp, n = l.find("i").width(); l.children("li").each(function (e) { var t = e + 1, v = a(this); v.on("click", function (e) { if (i.value = t, i.half) { var o = e.pageX - a(this).offset().left; o <= n / 2 && (i.value = i.value - .5) } i.text && l.next("span").text(i.value + "鏄�"), i.choose && i.choose(i.value), i.setText && i.setText(i.value) }), v.on("mousemove", function (e) { if (l.find("i").each(function () { a(this).addClass(o).removeClass(r) }), l.find("i:lt(" + t + ")").each(function () { a(this).addClass(s).removeClass(f) }), i.half) { var c = e.pageX - a(this).offset().left; c <= n / 2 && v.children("i").addClass(u).removeClass(s) } }), v.on("mouseleave", function () { l.find("i").each(function () { a(this).addClass(o).removeClass(r) }), l.find("i:lt(" + Math.floor(i.value) + ")").each(function () { a(this).addClass(s).removeClass(f) }), i.half && parseInt(i.value) !== i.value && l.children("li:eq(" + Math.floor(i.value) + ")").children("i").addClass(u).removeClass(c) }) }) }, v.prototype.events = function () { var e = this; e.config }, i.render = function (e) { var a = new v(e); return l.call(a) }, e(n, i) }); layui.define("jquery", function (t) { "use strict"; var e = layui.$, i = { fixbar : function (t) { var i, a, n = "layui-fixbar", r = "layui-fixbar-top", o = e(document), l = e("body"); t = e.extend({ showHeight : 200 }, t), t.bar1 = t.bar1 === !0 ? "" : t.bar1, t.bar2 = t.bar2 === !0 ? "" : t.bar2, t.bgcolor = t.bgcolor ? "background-color:" + t.bgcolor : ""; var c = [t.bar1, t.bar2, ""], g = e(['"].join("")), s = g.find("." + r), u = function () { var e = o.scrollTop(); e >= t.showHeight ? i || (s.show(), i = 1) : i && (s.hide(), i = 0) }; e("." + n)[0] || ("object" == typeof t.css && g.css(t.css), l.append(g), u(), g.find("li").on("click", function () { var i = e(this), a = i.attr("lay-type"); "top" === a && e("html,body").animate({ scrollTop : 0 }, 200), t.click && t.click.call(this, a) }), o.on("scroll", function () { clearTimeout(a), a = setTimeout(function () { u() }, 100) })) }, countdown : function (t, e, i) { var a = this, n = "function" == typeof e, r = new Date(t).getTime(), o = new Date(!e || n ? (new Date).getTime() : e).getTime(), l = r - o, c = [Math.floor(l / 864e5), Math.floor(l / 36e5) % 24, Math.floor(l / 6e4) % 60, Math.floor(l / 1e3) % 60]; n && (i = e); var g = setTimeout(function () { a.countdown(t, o + 1e3, i) }, 1e3); return i && i(l > 0 ? c : [0, 0, 0, 0], e, g), l <= 0 && clearTimeout(g), g }, timeAgo : function (t, e) { var i = this, a = [[], []], n = (new Date).getTime() - new Date(t).getTime(); return n > 6912e5 ? (n = new Date(t), a[0][0] = i.digit(n.getFullYear(), 4), a[0][1] = i.digit(n.getMonth() + 1), a[0][2] = i.digit(n.getDate()), e || (a[1][0] = i.digit(n.getHours()), a[1][1] = i.digit(n.getMinutes()), a[1][2] = i.digit(n.getSeconds())), a[0].join("-") + " " + a[1].join(":")) : n >= 864e5 ? (n / 1e3 / 60 / 60 / 24 | 0) + "澶╁墠" : n >= 36e5 ? (n / 1e3 / 60 / 60 | 0) + "灏忔椂鍓�" : n >= 12e4 ? (n / 1e3 / 60 | 0) + "鍒嗛挓鍓�" : n < 0 ? "鏈潵" : "鍒氬垰" }, digit : function (t, e) { var i = ""; t = String(t), e = e || 2; for (var a = t.length; a < e; a++) i += "0"; return t < Math.pow(10, e) ? i + (0 | t) : t }, toDateString : function (t, e) { var i = this, a = new Date(t || new Date), n = [i.digit(a.getFullYear(), 4), i.digit(a.getMonth() + 1), i.digit(a.getDate())], r = [i.digit(a.getHours()), i.digit(a.getMinutes()), i.digit(a.getSeconds())]; return e = e || "yyyy-MM-dd HH:mm:ss", e.replace(/yyyy/g, n[0]).replace(/MM/g, n[1]).replace(/dd/g, n[2]).replace(/HH/g, r[0]).replace(/mm/g, r[1]).replace(/ss/g, r[2]) }, escape : function (t) { return String(t || "").replace(/&(?!#?[a-zA-Z0-9]+;)/g, "&").replace(//g, ">").replace(/'/g, "'").replace(/"/g, """) } }; !function (t, e, i) { "$:nomunge"; function a() { n = e[l](function () { r.each(function () { var e = t(this), i = e.width(), a = e.height(), n = t.data(this, g); (i !== n.w || a !== n.h) && e.trigger(c, [n.w = i, n.h = a]) }), a() }, o[s]) } var n, r = t([]), o = t.resize = t.extend(t.resize, {}), l = "setTimeout", c = "resize", g = c + "-special-event", s = "delay", u = "throttleWindow"; o[s] = 250, o[u] = !0, t.event.special[c] = { setup : function () { if (!o[u] && this[l]) return !1; var e = t(this); r = r.add(e), t.data(this, g, { w : e.width(), h : e.height() }), 1 === r.length && a() }, teardown : function () { if (!o[u] && this[l]) return !1; var e = t(this); r = r.not(e), e.removeData(g), r.length || clearTimeout(n) }, add : function (e) { function a(e, a, r) { var o = t(this), l = t.data(this, g) || {}; l.w = a !== i ? a : o.width(), l.h = r !== i ? r : o.height(), n.apply(this, arguments) } if (!o[u] && this[l]) return !1; var n; return t.isFunction(e) ? (n = e, a) : (n = e.handler, void(e.handler = a)) } } } (e, window), t("util", i) }); layui.define("jquery", function (e) { "use strict"; var l = layui.$, o = function (e) {}, t = ''; o.prototype.load = function (e) { var o, i, n, r, a = this, c = 0; e = e || {}; var f = l(e.elem); if (f[0]) { var m = l(e.scrollElem || document), u = e.mb || 50, s = !("isAuto" in e) || e.isAuto, v = e.end || "娌℃湁鏇村浜�", y = e.scrollElem && e.scrollElem !== document, d = "鍔犺浇鏇村", h = l('
      ' + d + "
      "); f.find(".layui-flow-more")[0] || f.append(h); var p = function (e, t) { e = l(e), h.before(e), t = 0 == t || null, t ? h.html(v) : h.find("a").html(d), i = t, o = null, n && n() }, g = function () { o = !0, h.find("a").html(t), "function" == typeof e.done && e.done(++c, p) }; if (g(), h.find("a").on("click", function () { l(this); i || o || g() }), e.isLazyimg) var n = a.lazyimg({ elem : e.elem + " img", scrollElem : e.scrollElem }); return s ? (m.on("scroll", function () { var e = l(this), t = e.scrollTop(); r && clearTimeout(r), i || (r = setTimeout(function () { var i = y ? e.height() : l(window).height(), n = y ? e.prop("scrollHeight") : document.documentElement.scrollHeight; n - t - i <= u && (o || g()) }, 100)) }), a) : a } }, o.prototype.lazyimg = function (e) { var o, t = this, i = 0; e = e || {}; var n = l(e.scrollElem || document), r = e.elem || "img", a = e.scrollElem && e.scrollElem !== document, c = function (e, l) { var o = n.scrollTop(), r = o + l, c = a ? function () { return e.offset().top - n.offset().top + o } () : e.offset().top; if (c >= o && c <= r && !e.attr("src")) { var m = e.attr("lay-src"); layui.img(m, function () { var l = t.lazyimg.elem.eq(i); e.attr("src", m).removeAttr("lay-src"), l[0] && f(l), i++ }) } }, f = function (e, o) { var f = a ? (o || n).height() : l(window).height(), m = n.scrollTop(), u = m + f; if (t.lazyimg.elem = l(r), e) c(e, f); else for (var s = 0; s < t.lazyimg.elem.length; s++) { var v = t.lazyimg.elem.eq(s), y = a ? function () { return v.offset().top - n.offset().top + m } () : v.offset().top; if (c(v, f), i = s, y > u) break } }; if (f(), !o) { var m; n.on("scroll", function () { var e = l(this); m && clearTimeout(m), m = setTimeout(function () { f(null, e) }, 50) }), o = !0 } return f }, e("flow", new o) }); layui.define(["layer", "form"], function (t) { "use strict"; var e = layui.$, i = layui.layer, a = layui.form, l = (layui.hint(), layui.device()), n = "layedit", o = "layui-show", r = "layui-disabled", c = function () { var t = this; t.index = 0, t.config = { tool : ["strong", "italic", "underline", "del", "|", "left", "center", "right", "|", "link", "unlink", "face", "image"], hideTool : [], height : 280 } }; c.prototype.set = function (t) { var i = this; return e.extend(!0, i.config, t), i }, c.prototype.on = function (t, e) { return layui.onevent(n, t, e) }, c.prototype.build = function (t, i) { i = i || {}; var a = this, n = a.config, r = "layui-layedit", c = e("string" == typeof t ? "#" + t : t), u = "LAY_layedit_" + ++a.index, d = c.next("." + r), y = e.extend({}, n, i), f = function () { var t = [], e = {}; return layui.each(y.hideTool, function (t, i) { e[i] = !0 }), layui.each(y.tool, function (i, a) { C[a] && !e[a] && t.push(C[a]) }), t.join("") } (), m = e(['
      ', '
      ' + f + "
      ", '
      ', '', "
      ", "
      "].join("")); return l.ie && l.ie < 8 ? c.removeClass("layui-hide").addClass(o) : (d[0] && d.remove(), s.call(a, m, c[0], y), c.addClass("layui-hide").after(m), a.index) }, c.prototype.getContent = function (t) { var e = u(t); if (e[0]) return d(e[0].document.body.innerHTML) }, c.prototype.getText = function (t) { var i = u(t); if (i[0]) return e(i[0].document.body).text() }, c.prototype.setContent = function (t, i, a) { var l = u(t); l[0] && (a ? e(l[0].document.body).append(i) : e(l[0].document.body).html(i), layedit.sync(t)) }, c.prototype.sync = function (t) { var i = u(t); if (i[0]) { var a = e("#" + i[1].attr("textarea")); a.val(d(i[0].document.body.innerHTML)) } }, c.prototype.getSelection = function (t) { var e = u(t); if (e[0]) { var i = m(e[0].document); return document.selection ? i.text : i.toString() } }; var s = function (t, i, a) { var l = this, n = t.find("iframe"); n.css({ height : a.height }).on("load", function () { var o = n.contents(), r = n.prop("contentWindow"), c = o.find("head"), s = e([""].join("")), u = o.find("body"); c.append(s), u.attr("contenteditable", "true").css({ "min-height" : a.height }).html(i.value || ""), y.apply(l, [r, n, i, a]), g.call(l, r, t, a) }) }, u = function (t) { var i = e("#LAY_layedit_" + t), a = i.prop("contentWindow"); return [a, i] }, d = function (t) { return 8 == l.ie && (t = t.replace(/<.+>/g, function (t) { return t.toLowerCase() })), t }, y = function (t, a, n, o) { var r = t.document, c = e(r.body); c.on("keydown", function (t) { var e = t.keyCode; if (13 === e) { var a = m(r), l = p(a), n = l.parentNode; if ("pre" === n.tagName.toLowerCase()) { if (t.shiftKey) return; return i.msg("璇锋殏鏃剁敤shift+enter"), !1 } r.execCommand("formatBlock", !1, "

      ") } }), e(n).parents("form").on("submit", function () { var t = c.html(); 8 == l.ie && (t = t.replace(/<.+>/g, function (t) { return t.toLowerCase() })), n.value = t }), c.on("paste", function (e) { r.execCommand("formatBlock", !1, "

      "), setTimeout(function () { f.call(t, c), n.value = c.html() }, 100) }) }, f = function (t) { var i = this; i.document; t.find("*[style]").each(function () { var t = this.style.textAlign; this.removeAttribute("style"), e(this).css({ "text-align" : t || "" }) }), t.find("table").addClass("layui-table"), t.find("script,link").remove() }, m = function (t) { return t.selection ? t.selection.createRange() : t.getSelection().getRangeAt(0) }, p = function (t) { return t.endContainer || t.parentElement().childNodes[0] }, v = function (t, i, a) { var l = this.document, n = document.createElement(t); for (var o in i) n.setAttribute(o, i[o]); if (n.removeAttribute("text"), l.selection) { var r = a.text || i.text; if ("a" === t && !r) return; r && (n.innerHTML = r), a.pasteHTML(e(n).prop("outerHTML")), a.select() } else { var r = a.toString() || i.text; if ("a" === t && !r) return; r && (n.innerHTML = r), a.deleteContents(), a.insertNode(n) } }, h = function (t, i) { var a = this.document, l = "layedit-tool-active", n = p(m(a)), o = function (e) { return t.find(".layedit-tool-" + e) }; i && i[i.hasClass(l) ? "removeClass" : "addClass"](l), t.find(">i").removeClass(l), o("unlink").addClass(r), e(n).parents().each(function () { var t = this.tagName.toLowerCase(), e = this.style.textAlign; "b" !== t && "strong" !== t || o("b").addClass(l), "i" !== t && "em" !== t || o("i").addClass(l), "u" === t && o("u").addClass(l), "strike" === t && o("d").addClass(l), "p" === t && ("center" === e ? o("center").addClass(l) : "right" === e ? o("right").addClass(l) : o("left").addClass(l)), "a" === t && (o("link").addClass(l), o("unlink").removeClass(r)) }) }, g = function (t, a, l) { var n = t.document, o = e(n.body), c = { link : function (i) { var a = p(i), l = e(a).parent(); b.call(o, { href : l.attr("href"), target : l.attr("target") }, function (e) { var a = l[0]; "A" === a.tagName ? a.href = e.url : v.call(t, "a", { target : e.target, href : e.url, text : e.url }, i) }) }, unlink : function (t) { n.execCommand("unlink") }, face : function (e) { x.call(this, function (i) { v.call(t, "img", { src : i.src, alt : i.alt }, e) }) }, image : function (a) { var n = this; layui.use("upload", function (o) { var r = l.uploadImage || {}; o.render({ url : r.url, method : r.type, elem : e(n).find("input")[0], done : function (e) { 0 == e.code ? (e.data = e.data || {}, v.call(t, "img", { src : e.data.src, alt : e.data.title }, a)) : i.msg(e.msg || "涓婁紶澶辫触") } }) }) }, code : function (e) { k.call(o, function (i) { v.call(t, "pre", { text : i.code, "lay-lang" : i.lang }, e) }) }, help : function () { i.open({ type : 2, title : "甯姪", area : ["600px", "380px"], shadeClose : !0, shade : .1, skin : "layui-layer-msg", content : ["http://www.layui.com/about/layedit/help.html", "no"] }) } }, s = a.find(".layui-layedit-tool"), u = function () { var i = e(this), a = i.attr("layedit-event"), l = i.attr("lay-command"); if (!i.hasClass(r)) { o.focus(); var u = m(n); u.commonAncestorContainer; l ? (n.execCommand(l), /justifyLeft|justifyCenter|justifyRight/.test(l) && n.execCommand("formatBlock", !1, "

      "), setTimeout(function () { o.focus() }, 10)) : c[a] && c[a].call(this, u), h.call(t, s, i) } }, d = /image/; s.find(">i").on("mousedown", function () { var t = e(this), i = t.attr("layedit-event"); d.test(i) || u.call(this) }).on("click", function () { var t = e(this), i = t.attr("layedit-event"); d.test(i) && u.call(this) }), o.on("click", function () { h.call(t, s), i.close(x.index) }) }, b = function (t, e) { var l = this, n = i.open({ type : 1, id : "LAY_layedit_link", area : "350px", shade : .05, shadeClose : !0, moveType : 1, title : "瓒呴摼鎺�", skin : "layui-layer-msg", content : ['

      "].join(""), success : function (t, n) { var o = "submit(layedit-link-yes)"; a.render("radio"), t.find(".layui-btn-primary").on("click", function () { i.close(n), l.focus() }), a.on(o, function (t) { i.close(b.index), e && e(t.field) }) } }); b.index = n }, x = function (t) { var a = function () { var t = ["[寰瑧]", "[鍢诲樆]", "[鍝堝搱]", "[鍙埍]", "[鍙�淽", "[鎸栭蓟]", "[鍚冩儕]", "[瀹崇緸]", "[鎸ょ溂]", "[闂槾]", "[閯欒]", "[鐖变綘]", "[娉猐", "[鍋风瑧]", "[浜蹭翰]", "[鐢熺梾]", "[澶紑蹇僝", "[鐧界溂]", "[鍙冲摷鍝糫", "[宸﹀摷鍝糫", "[鍢榏", "[琛癩", "[濮斿眻]", "[鍚怾", "[鍝堟瑺]", "[鎶辨姳]", "[鎬抅", "[鐤戦棶]", "[棣嬪槾]", "[鎷滄嫓]", "[鎬濊�僝", "[姹梋", "[鍥癩", "[鐫", "[閽盷", "[澶辨湜]", "[閰穄", "[鑹瞉", "[鍝糫", "[榧撴帉]", "[鏅昡", "[鎮蹭激]", "[鎶撶媯]", "[榛戠嚎]", "[闃撮櫓]", "[鎬掗獋]", "[浜掔矇]", "[蹇僝", "[浼ゅ績]", "[鐚ご]", "[鐔婄尗]", "[鍏斿瓙]", "[ok]", "[鑰禲", "[good]", "[NO]", "[璧瀅", "[鏉", "[寮盷", "[鑽夋偿椹琞", "[绁為┈]", "[鍥", "[娴簯]", "[缁欏姏]", "[鍥磋]", "[濞佹]", "[濂ョ壒鏇糫", "[绀肩墿]", "[閽焆", "[璇濈瓛]", "[铚$儧]", "[铔嬬硶]"], e = {}; return layui.each(t, function (t, i) { e[i] = layui.cache.dir + "images/face/" + t + ".gif" }), e } (); return x.hide = x.hide || function (t) { "face" !== e(t.target).attr("layedit-event") && i.close(x.index) }, x.index = i.tips(function () { var t = []; return layui.each(a, function (e, i) { t.push('
    • ' + e + '
    • ') }), '" } (), this, { tips : 1, time : 0, skin : "layui-box layui-util-face", maxWidth : 500, success : function (l, n) { l.css({ marginTop : -4, marginLeft : -10 }).find(".layui-clear>li").on("click", function () { t && t({ src : a[this.title], alt : this.title }), i.close(n) }), e(document).off("click", x.hide).on("click", x.hide) } }) }, k = function (t) { var e = this, l = i.open({ type : 1, id : "LAY_layedit_code", area : "550px", shade : .05, shadeClose : !0, moveType : 1, title : "鎻掑叆浠g爜", skin : "layui-layer-msg", content : ['"].join(""), success : function (l, n) { var o = "submit(layedit-code-yes)"; a.render("select"), l.find(".layui-btn-primary").on("click", function () { i.close(n), e.focus() }), a.on(o, function (e) { i.close(k.index), t && t(e.field) }) } }); k.index = l }, C = { html : '', strong : '', italic : '', underline : '', del : '', "|" : '', left : '', center : '', right : '', link : '', unlink : '', face : '', image : '', code : '', help : '' }, w = new c; t(n, w) }); layui.define("jquery", function (e) { "use strict"; var a = layui.$, l = "http://www.layui.com/doc/modules/code.html"; e("code", function (e) { var t = []; e = e || {}, e.elem = a(e.elem || ".layui-code"), e.about = !("about" in e) || e.about, e.elem.each(function () { t.push(this) }), layui.each(t.reverse(), function (t, i) { var c = a(i), o = c.html(); (c.attr("lay-encode") || e.encode) && (o = o.replace(/&(?!#?[a-zA-Z0-9]+;)/g, "&").replace(//g, ">").replace(/'/g, "'").replace(/"/g, """)), c.html('
      1. ' + o.replace(/[\r\t\n]+/g, "
      2. ") + "
      "), c.find(">.layui-code-h3")[0] || c.prepend('

      ' + (c.attr("lay-title") || e.title || "code") + (e.about ? 'layui.code' : "") + "

      "); var d = c.find(">.layui-code-ol"); c.addClass("layui-box layui-code-view"), (c.attr("lay-skin") || e.skin) && c.addClass("layui-code-" + (c.attr("lay-skin") || e.skin)), (d.find("li").length / 100 | 0) > 0 && d.css("margin-left", (d.find("li").length / 100 | 0) + "px"), (c.attr("lay-height") || e.height) && d.css("max-height", c.attr("lay-height") || e.height) }) }) }).addcss("modules/code.css", "skincodecss");