/** layui-v2.5.6 MIT License By https://www.layui.com */
; layui.define(["laytpl", "laypage", "layer", "form", "util"], function (e) { "use strict"; var t = layui.$, i = layui.laytpl, a = layui.laypage, l = layui.layer, n = layui.form, o = (layui.util, layui.hint()), r = layui.device(), d = { config: { checkName: "LAY_CHECKED", indexName: "LAY_TABLE_INDEX" }, cache: {}, index: layui.table ? layui.table.index + 1e4 : 0, set: function (e) { var i = this; return i.config = t.extend({}, i.config, e), i }, on: function (e, t) { return layui.onevent.call(this, y, e, t) } }, c = function () { var e = this, t = e.config, i = t.id || t.index; return i && (c.that[i] = e, c.config[i] = t), { config: t, reload: function (t) { e.reload.call(e, t) }, setColsWidth: function () { e.setColsWidth.call(e) }, resize: function () { e.resize.call(e) } } }, s = function (e) { var t = c.config[e]; return t || o.error("The ID option was not found in the table instance"), t || null }, u = function (e, a, l, n) { var o = e.templet ? function () { return "function" == typeof e.templet ? e.templet(l) : i(t(e.templet).html() || String(a)).render(l) }() : a; return n ? t("
" + o + "
").text() : o }, y = "table", h = ".layui-table", f = "layui-hide", p = "layui-none", v = "layui-table-view", m = ".layui-table-tool", g = ".layui-table-box", b = ".layui-table-init", x = ".layui-table-header", k = ".layui-table-body", C = ".layui-table-main", w = ".layui-table-fixed", T = ".layui-table-fixed-l", A = ".layui-table-fixed-r", L = ".layui-table-total", N = ".layui-table-page", S = ".layui-table-sort", R = "layui-table-edit", W = "layui-table-hover", _ = function (e) { var t = '{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}'; return e = e || {}, ['
"].join(""), H = t(window), j = t(document), F = function (e) { var i = this; i.index = ++d.index, i.config = t.extend({}, i.config, d.config, e), i.render() }; F.prototype.config = { limit: 10, loading: !0, cellMinWidth: 60, defaultToolbar: ["filter", "exports", "print"], autoSort: !0, text: { none: "无数据" } }, F.prototype.render = function () { var e = this, a = e.config; if (a.elem = t(a.elem), a.where = a.where || {}, a.id = a.id || a.elem.attr("id") || e.index, a.request = t.extend({ pageName: "page", limitName: "limit" }, a.request), a.response = t.extend({ statusName: "code", statusCode: 0, msgName: "msg", dataName: "data", totalRowName: "totalRow", countName: "count" }, a.response), "object" == typeof a.page && (a.limit = a.page.limit || a.limit, a.limits = a.page.limits || a.limits, e.page = a.page.curr = a.page.curr || 1, delete a.page.elem, delete a.page.jump), !a.elem[0]) return e; a.height && /^full-\d+$/.test(a.height) && (e.fullHeightGap = a.height.split("-")[1], a.height = H.height() - e.fullHeightGap), e.setInit(); var l = a.elem, n = l.next("." + v), o = e.elem = t(i(z).render({ VIEW_CLASS: v, data: a, index: e.index })); if (a.index = e.index, e.key = a.id || a.index, n[0] && n.remove(), l.after(o), e.layTool = o.find(m), e.layBox = o.find(g), e.layHeader = o.find(x), e.layMain = o.find(C), e.layBody = o.find(k), e.layFixed = o.find(w), e.layFixLeft = o.find(T), e.layFixRight = o.find(A), e.layTotal = o.find(L), e.layPage = o.find(N), e.renderToolbar(), e.fullSize(), a.cols.length > 1) { var r = e.layFixed.find(x).find("th"); r.height(e.layHeader.height() - 1 - parseFloat(r.css("padding-top")) - parseFloat(r.css("padding-bottom"))) } e.pullData(e.page), e.events() }, F.prototype.initOpts = function (e) { var t = this, i = (t.config, { checkbox: 48, radio: 48, space: 15, numbers: 40 }); e.checkbox && (e.type = "checkbox"), e.space && (e.type = "space"), e.type || (e.type = "normal"), "normal" !== e.type && (e.unresize = !0, e.width = e.width || i[e.type]) }, F.prototype.setInit = function (e) { var t = this, i = t.config; return i.clientWidth = i.width || function () { var e = function (t) { var a, l; t = t || i.elem.parent(), a = t.width(); try { l = "none" === t.css("display") } catch (n) { } return !t[0] || a && !l ? a : e(t.parent()) }; return e() }(), "width" === e ? i.clientWidth : void layui.each(i.cols, function (e, a) { layui.each(a, function (l, n) { if (!n) return void a.splice(l, 1); if (n.key = e + "-" + l, n.hide = n.hide || !1, n.colGroup || n.colspan > 1) { var o = 0; layui.each(i.cols[e + 1], function (t, i) { i.HAS_PARENT || o > 1 && o == n.colspan || (i.HAS_PARENT = !0, i.parentKey = e + "-" + l, o += parseInt(i.colspan > 1 ? i.colspan : 1)) }), n.colGroup = !0 } t.initOpts(n) }) }) }, F.prototype.renderToolbar = function () { var e = this, a = e.config, l = ['
', '
', '
'].join(""), n = e.layTool.find(".layui-table-tool-temp"); if ("default" === a.toolbar) n.html(l); else if ("string" == typeof a.toolbar) { var o = t(a.toolbar).html() || ""; o && n.html(i(o).render(a)) } var r = { 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" } }, d = []; "object" == typeof a.defaultToolbar && layui.each(a.defaultToolbar, function (e, t) { var i = "string" == typeof t ? r[t] : t; i && d.push('
') }), e.layTool.find(".layui-table-tool-self").html(d.join("")) }, F.prototype.setParentCol = function (e, t) { var i = this, a = i.config, l = i.layHeader.find('th[data-key="' + a.index + "-" + t + '"]'), n = parseInt(l.attr("colspan")) || 0; if (l[0]) { var o = t.split("-"), r = a.cols[o[0]][o[1]]; e ? n-- : n++, l.attr("colspan", n), l[n < 1 ? "addClass" : "removeClass"](f), r.colspan = n, r.hide = n < 1; var d = l.data("parentkey"); d && i.setParentCol(e, d) } }, F.prototype.setColsPatch = function () { var e = this, t = e.config; layui.each(t.cols, function (t, i) { layui.each(i, function (t, i) { i.hide && e.setParentCol(i.hide, i.parentKey) }) }) }, F.prototype.setColsWidth = function () { var e = this, t = e.config, i = 0, a = 0, l = 0, n = 0, o = e.setInit("width"); e.eachCols(function (e, t) { t.hide || i++ }), o = o - function () { return "line" === t.skin || "nob" === t.skin ? 2 : i + 1 }() - e.getScrollWidth(e.layMain[0]) - 1; var r = function (e) { layui.each(t.cols, function (i, r) { layui.each(r, function (i, d) { var c = 0, s = d.minWidth || t.cellMinWidth; return d ? void (d.colGroup || d.hide || (e ? l && l < s && (a--, c = s) : (c = d.width || 0, /\d+%$/.test(c) ? (c = Math.floor(parseFloat(c) / 100 * o), c < s && (c = s)) : c || (d.width = c = 0, a++)), d.hide && (c = 0), n += c)) : void r.splice(i, 1) }) }), o > n && a && (l = (o - n) / a) }; r(), r(!0), e.autoColNums = a, e.eachCols(function (i, a) { var n = a.minWidth || t.cellMinWidth; a.colGroup || a.hide || (0 === a.width ? e.getCssRule(t.index + "-" + a.key, function (e) { e.style.width = Math.floor(l >= n ? l : n) + "px" }) : /\d+%$/.test(a.width) && e.getCssRule(t.index + "-" + a.key, function (e) { e.style.width = Math.floor(parseFloat(a.width) / 100 * o) + "px" })) }); var d = e.layMain.width() - e.getScrollWidth(e.layMain[0]) - e.layMain.children("table").outerWidth(); if (e.autoColNums && d >= -i && d <= i) { var c = function (t) { var i; return t = t || e.layHeader.eq(0).find("thead th:last-child"), i = t.data("field"), !i && t.prev()[0] ? c(t.prev()) : t }, s = c(), u = s.data("key"); e.getCssRule(u, function (t) { var i = t.style.width || s.outerWidth(); t.style.width = parseFloat(i) + d + "px", e.layMain.height() - e.layMain.prop("clientHeight") > 0 && (t.style.width = parseFloat(t.style.width) - 1 + "px") }) } e.loading(!0) }, F.prototype.resize = function () { var e = this; e.fullSize(), e.setColsWidth(), e.scrollPatch() }, F.prototype.reload = function (e) { var i = this; e = e || {}, delete i.haveInit, e.data && e.data.constructor === Array && delete i.config.data, i.config = t.extend(!0, {}, i.config, e), i.render() }, F.prototype.errorView = function (e) { var i = this, a = i.layMain.find("." + p), l = t('
' + (e || "Error") + "
"); a[0] && (i.layNone.remove(), a.remove()), i.layFixed.addClass(f), i.layMain.find("tbody").html(""), i.layMain.append(i.layNone = l), d.cache[i.key] = [] }, F.prototype.page = 1, F.prototype.pullData = function (e) { var i = this, a = i.config, l = a.request, n = a.response, o = function () { "object" == typeof a.initSort && i.sort(a.initSort.field, a.initSort.type) }; if (i.startTime = (new Date).getTime(), a.url) { var r = {}; r[l.pageName] = e, r[l.limitName] = a.limit; var d = t.extend(r, a.where); a.contentType && 0 == a.contentType.indexOf("application/json") && (d = JSON.stringify(d)), i.loading(), t.ajax({ type: a.method || "get", url: a.url, contentType: a.contentType, data: d, dataType: "json", headers: a.headers || {}, success: function (t) { "function" == typeof a.parseData && (t = a.parseData(t) || t), t[n.statusName] != n.statusCode ? (i.renderForm(), i.errorView(t[n.msgName] || '返回的数据不符合规范,正确的成功状态码应为:"' + n.statusName + '": ' + n.statusCode)) : (i.renderData(t, e, t[n.countName]), o(), a.time = (new Date).getTime() - i.startTime + " ms"), i.setColsWidth(), "function" == typeof a.done && a.done(t, e, t[n.countName]) }, error: function (e, t) { i.errorView("数据接口请求异常:" + t), i.renderForm(), i.setColsWidth() } }) } else if (a.data && a.data.constructor === Array) { var c = {}, s = e * a.limit - a.limit; c[n.dataName] = a.data.concat().splice(s, a.limit), c[n.countName] = a.data.length, "object" == typeof a.totalRow && (c[n.totalRowName] = t.extend({}, a.totalRow)), i.renderData(c, e, c[n.countName]), o(), i.setColsWidth(), "function" == typeof a.done && a.done(c, e, c[n.countName]) } }, F.prototype.eachCols = function (e) { var t = this; return d.eachCols(null, e, t.config.cols), t }, F.prototype.renderData = function (e, n, o, r) { var c = this, s = c.config, y = e[s.response.dataName] || [], h = e[s.response.totalRowName], v = [], m = [], g = [], b = function () { var e; return !r && c.sortKey ? c.sort(c.sortKey.field, c.sortKey.sort, !0) : (layui.each(y, function (a, l) { var o = [], y = [], h = [], p = a + s.limit * (n - 1) + 1; 0 !== l.length && (r || (l[d.config.indexName] = a), c.eachCols(function (n, r) { var c = r.field || n, v = s.index + "-" + r.key, m = l[c]; if (void 0 !== m && null !== m || (m = ""), !r.colGroup) { var g = ['