/*! * Copyright (c) 2013-Now 华夏ERP All rights reserved. * * 通用公共JavaScript,注意:项目请不要修改公共CSS样式,若需要新增或调整,请在common.js中覆盖 * @author jishenghua * @version 2019-9-14 */ if (typeof jQuery === "undefined") { throw new Error("JSHERP's JavaScript requires jQuery") } (function($, window, undefined) { parent.$("iframe.ui-layout-content").each(function() { if (document.body.ownerDocument === this.contentWindow.document) { $("body").addClass("ui-layout-content"); return } }); $(function() { if ($.fn.iCheck !== undefined) { $("input[type=checkbox].form-control:not(.noicheck),input[type=radio].form-control:not(.noicheck)").each(function() { $(this).iCheck({ checkboxClass: "icheckbox_" + ($(this).data("style") || "minimal-grey"), radioClass: "iradio_" + ($(this).data("style") || "minimal-grey") }).on("ifChanged", function() { try { $(this).resetValid() } catch (e) {} }) }) } if ($.fn.select2 !== undefined) { $("select.form-control:not(.noselect2)").each(function() { $(this).select2({ minimumResultsForSearch: 10, templateResult: function(result, container) { var element = $(result.element) , parent = $(container) , style = element.attr("style") , clazz = element.attr("class"); if (style && style != "") { parent.attr("style", style) } if (clazz && clazz != "") { parent.addClass(clazz) } return result.text } }).on("change", function() { try { $(this).resetValid() } catch (e) {} }) }) } if (js.ie) { $("a").bind("focus", function() { if (this.blur) { this.blur() } }) } $("#inputForm input[type=text]:not([readonly]):not([disabled]):not(.nofocus):eq(0)").focus(); $("textarea.autoHeight").textareaAutoHieght(); $(document).on("click", ".addTabPage", function(e) { var $this = $(this) , href = $this.data("href") || $this.attr("href") , title = $this.data("title") || $this.attr("title") || $this.text(); if (href && href != "" && href != "blank") { js.addTabPage($this, $.trim(title || js.text("tabpanel.newTabPage")), href); if ($this.parent().hasClass("treeview")) { window.funId = $this.data("code"); //功能id top.window.isMenuClickFlag = true; top.window.location.hash = href.replace("#", "") } return false } return true }); if (js.ie && js.ie <= 9) { setTimeout(function() { $("input[placeholder],textarea[placeholder]").placeholder() }, 500) } if ($("#scroll-up").length > 0) { var btnScrollTop = $("#scroll-up") , isVisible = false; $(window).on("scroll.btnScrollTop", function() { var scroll = $(document).scrollTop() , h = $(window).height() , sh = document.body.scrollHeight; if (scroll > parseInt(h / 4) || (scroll > 0 && sh >= h && h + scroll >= sh - 1)) { if (!isVisible) { btnScrollTop.addClass("display"); isVisible = true } } else { if (isVisible) { btnScrollTop.removeClass("display"); isVisible = false } } }).triggerHandler("scroll.btnScrollTop"); btnScrollTop.on("click", function() { $("html,body").animate({ scrollTop: 0 }, 500); return false }) } if (typeof FastClick != "undefined") { FastClick.attach(document.body) } }); var js = { log: function(msg) { if (typeof (console) !== "undefined") { console.log(msg) } }, error: function(msg) { if (typeof (console) !== "undefined") { console.error(msg) } }, encodeUrl: function(url) { return encodeURIComponent(url) }, decodeUrl: function(url) { return decodeURIComponent(url) }, ie: function() { var agent = navigator.userAgent.toLowerCase(); return (!!window.ActiveXObject || "ActiveXObject"in window) ? ((agent.match(/msie\s(\d+)/) || [])[1] || (agent.match(/Trident/i) && agent.match(/rv:(\d+)/) || [])[1] || false) : false }(), val: function(jsonObj, attrName) { if (jsonObj === undefined) { return "" } if (attrName === undefined || attrName == "") { return typeof jsonObj === "string" ? jsonObj : "" } var ret = jsonObj[attrName], prm = [], p, i; if (ret === undefined) { try { if (typeof attrName === "string") { prm = attrName.split(".") } i = prm.length; if (i) { ret = jsonObj; while (ret && i--) { p = prm.shift(); ret = ret[p] } } } catch (e) {} } if (ret === undefined) { return "" } return ret }, hashCode: function(str, caseSensitive) { if (caseSensitive != true) { str = str.toLowerCase() } var hash = 1315423911, i, ch; for (i = str.length - 1; i >= 0; i--) { ch = str.charCodeAt(i); hash ^= ((hash << 5) + ch + (hash >> 2)) } return (hash & 2147483647) }, loadFile: function(file, callback, error) { callback = callback || function() {} ; error = error || function(data) { js.showMessage(data) } ; var files = typeof file == "string" ? [file] : file; var htmlDoc = document.getElementsByTagName("head")[0], okCounts = 0, fileCounts = files.length, i, loadFilePath = null; for (i = 0; i < fileCounts; i++) { var includeFile = null, att = null, ext, hash; loadFilePath = files[i]; hash = js.hashCode(loadFilePath); if (document.getElementById("loadHash_" + hash)) { okCounts += 1; if (okCounts == fileCounts) { callback(); return true } continue } att = loadFilePath.split("?")[0].split("."); ext = att[att.length - 1].toLowerCase(); switch (ext) { case "css": includeFile = document.createElement("link"); includeFile.setAttribute("rel", "stylesheet"); includeFile.setAttribute("type", "text/css"); includeFile.setAttribute("href", loadFilePath); break; case "js": includeFile = document.createElement("script"); includeFile.setAttribute("type", "text/javascript"); includeFile.setAttribute("src", loadFilePath); break; case "jpg": case "jpeg": case "png": case "gif": includeFile = document.createElement("img"); includeFile.setAttribute("src", loadFilePath); break; default: error("载入的格式不支持:" + loadFilePath); return false } if (typeof includeFile != "undefined") { includeFile.setAttribute("id", "loadHash_" + hash); htmlDoc.appendChild(includeFile); includeFile.onreadystatechange = function() { if (includeFile.readyState == "loaded" || includeFile.readyState == "complete") { okCounts += 1; if (okCounts == fileCounts) { callback(); return true } } } ; includeFile.onload = function() { okCounts += 1; if (okCounts == fileCounts) { callback(); return true } } ; includeFile.onerror = function() { $("#loadhash_" + hash).remove(); return false } } } }, windowOpen: function(url, name, width, height) { if (!(width && height)) { width = window.screen.width - 200; height = window.screen.height - 150 } var top = parseInt((window.screen.height - height) / 2 - 20, 10) , left = parseInt((window.screen.width - width) / 2, 10) , options = "location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left; window.open(url, name, options) }, windowClose: function() { setTimeout(function() { window.opener = null; window.open("", "_self"); window.close() }, 100) }, addParam: function(url, params) { if (params != "") { url += (url.indexOf("?") == -1 ? "?" : "&"); url += params } return url }, getParam: function(paramName, url) { var reg = new RegExp("(^|&)" + paramName + "=([^&]*)(&|$)","i"); if (!url || url == "") { url = window.location.search } else { url = url.substring(url.indexOf("?")) } var val = url.substr(1).match(reg); if (val != null) { return unescape(val[2]) } return null }, removeParam: function(paramName, url) { var reg = new RegExp("(^|&)" + paramName + "=([^&]*)(&|$)","i"), params; if (!url || url == "") { params = window.location.search } else { params = url.substring(url.indexOf("?")) } if (params != "") { if (js.startsWith(params, "?") || js.startsWith(params, "&")) { params = params.substr(1) } url = url.substring(0, url.indexOf("?") + 1) + params.replace(reg, "$1"); if (js.endsWith(url, "?") || js.endsWith(url, "&")) { return url.substring(0, url.length - 1) } } return url }, alertObj: function(obj) { var ob = eval(obj); var index = 1 , property = ""; for (var p in ob) { property += (index++) + "、" + p + " = " + ob[p] + "\n" } alert(property) }, text: function(code, params) { if (code) { js.i18n = js.i18n || {}; var text = js.i18n[code]; if (!(text && text != "")) { text = code } if (params) { for (var i = 1; i < arguments.length; i++) { var re = new RegExp("\\{" + (i - 1) + "\\}","gm"); text = text.replace(re, arguments[i]) } } return text } return code }, getDictLabel: function(dictListJson, value, defaultValue, inCss) { var result = []; for (var i = 0; i < dictListJson.length; i++) { var row = dictListJson[i]; if (("," + value + ",").indexOf("," + row.dictValue + ",") != -1) { var str = ""; if (inCss && (row.cssClass || row.cssStyle)) { str += "" + row.dictLabel + "") } else { result.push(row.dictLabel) } } } return result.length > 0 ? result.join(",") : defaultValue }, loading: function(message, ignoreMessageIfExists) { var topJs; try { top.loadingFlag = true; topJs = top.js || parent.parent.js || parent.js } catch (e) {} if (typeof loadingFlag == "undefined" && topJs) { if (typeof topJs.loading == "function") { topJs.loading(message); return } } if (message == undefined || message == "") { message = js.text("loading.message") } if (message == "none") { return } setTimeout(function() { if (!js.pageLoadingNum) { js.pageLoadingNum = 0 } if (!js.pageLoadingStyle) { if ($("body").hasClass("loading-topline")) { js.pageLoadingStyle = 2 } else { js.pageLoadingStyle = 1 } } if (js.pageLoadingStyle == 1) { message += '×'; if ($("#page-loading").length == 0) { $("body").append('
' + message + "
") } else { if (!(ignoreMessageIfExists == true)) { $("#page-loading").html(message) } } } else { if (js.pageLoadingStyle == 2) { if ($("#page-loading-top").length == 0) { $("body").append('
'); $("#page-loading-top").animate({ width: "65%" }, 2000, function() { $(this).animate({ width: "85%" }, 8000) }) } } } js.pageLoadingNum++ }, 0) }, closeLoading: function(timeout, forceClose) { var topJs; try { top.loadingFlag = true; topJs = top.js || parent.parent.js || parent.js } catch (e) {} if (typeof loadingFlag == "undefined" && topJs) { if (typeof topJs.closeLoading == "function") { topJs.closeLoading(timeout, forceClose); return } } setTimeout(function() { if (!js.pageLoadingNum) { js.pageLoadingNum = 0 } js.pageLoadingNum--; if (forceClose || js.pageLoadingNum <= 0) { if (js.pageLoadingStyle == 1) { $("#page-loading").remove() } else { if (js.pageLoadingStyle == 2) { $("#page-loading-top").stop().animate({ width: "100%" }, 200, function() { $(this).fadeOut(300, function() { $(this).remove() }) }) } } js.pageLoadingNum = 0 } }, timeout == undefined ? 0 : timeout) }, layer: function() { try { if (top.layer && top.layer.window) { return top.layer } if (parent.parent.layer && parent.parent.layer.window) { return parent.parent.layer } if (parent.layer && parent.layer.window) { return parent.layer } } catch (e) {} if (window.layer) { return layer } return null }(), showMessage: function(message, title, type, timeout) { var msgType, layerIcon, msg = String(message), msgTimeout = timeout == undefined ? 4000 : timeout; var contains = function(str, searchs) { if (searchs) { var ss = searchs.split(","); for (var i = 0; i < ss.length; i++) { if (msg.indexOf(ss[i]) >= 0) { return true } } } return false }; if (type == "error" || contains(msg, js.text("showMessage.error"))) { msgType = "error"; layerIcon = 2 } else { if (type == "warning" || contains(msg, js.text("showMessage.warning"))) { msgType = "warning"; layerIcon = 5 } else { if (type == "success" || contains(msg, js.text("showMessage.success"))) { msgType = "success"; layerIcon = 1 } else { msgType = "info"; layerIcon = 6 } } } try { if (top.toastr) { var positionClass = "toast-bottom-right"; if (msg && msg.length >= 8 && msg.indexOf("posfull:") >= 0) { if (timeout == undefined) { msgTimeout = 0 } positionClass = "toast-top-full-width"; msg = msg.substring(8); js.log(msg) } top.toastr.options = { closeButton: true, positionClass: positionClass, timeOut: msgTimeout }; top.toastr[msgType](msg, title); return } } catch (e) {} if (!js.layer) { alert(msg); return } if (layerIcon) { js.layer.msg(msg, { icon: layerIcon, time: msgTimeout }) } else { js.layer.msg(msg, { time: msgTimeout }) } }, showErrorMessage: function(responseText) { if (responseText && responseText != "") { js.error(js.abbr(responseText, 500)); if (responseText.indexOf(")/g, "") , data = data || []; if (typeof callback == "function") { laytpl(tpl).render(data || [], function(render) { callback(render) }); return null } return laytpl(tpl).render(data || []) }, ajaxSubmit: function(url, data, callback, dataType, async, message) { $(".btn").attr("disabled", true); if (typeof data == "function") { message = async; async = dataType; dataType = callback; callback = data; data = undefined } var options = {}; if (typeof callback == "object") { options = callback; callback = options.callback; dataType = options.dataType; async = options.async; message = options.message } js.loading(message == undefined ? js.text("loading.submitMessage") : message); $.ajax($.extend(true, { type: "POST", url: url, data: data, dataType: dataType == undefined ? "json" : dataType, async: async == undefined ? true : async, error: function(data) { $(".btn").attr("disabled", false); js.showErrorMessage(data.responseText); js.closeLoading(0, true) }, success: function(data, status, xhr) { $(".btn").attr("disabled", false); js.closeLoading(); if (typeof callback == "function") { callback(data, status, xhr) } else { js.log(data) } } }, options)) }, ajaxSubmitForm: function(formJqueryObj, callback, dataType, async, message) { $(".btn").attr("disabled", true); var options = {}; if (typeof callback == "object") { options = callback; callback = options.callback; dataType = options.dataType; async = options.async; message = options.message } js.loading(message == undefined ? js.text("loading.submitMessage") : message); if (options.downloadFile === true) { options.iframe = true } formJqueryObj.ajaxSubmit($.extend(true, { type: "POST", xhrFields: { withCredentials: true }, url: formJqueryObj.attr("action"), dataType: dataType == undefined ? "json" : dataType, async: async == undefined ? true : async, error: function(data) { $(".btn").attr("disabled", false); js.showErrorMessage(data.responseText); js.closeLoading(0, true) }, success: function(data, status, xhr) { $(".btn").attr("disabled", false); js.closeLoading(); if (typeof callback == "function") { callback(data, status, xhr) } else { js.log(data) } } }, options)); if (options.downloadFile === true) { $(".btn").attr("disabled", false); js.closeLoading() } }, trim: function(str) { return jQuery.trim(str) }, startWith: function(str, start) { var reg = new RegExp("^" + start); return reg.test(str) }, startsWith: function(str, prefix) { if (!str || !prefix || str.length < prefix.length) { return false } return str.slice(0, prefix.length) === prefix }, endWith: function(str, end) { var reg = new RegExp(end + "$"); return reg.test(str) }, endsWith: function(str, suffix) { if (!str || !suffix || str.length < suffix.length) { return false } return str.indexOf(suffix, str.length - suffix.length) !== -1 }, abbr: function(name, maxLength) { if (!maxLength) { maxLength = 20 } if (name == null || name.length < 1) { return "" } var w = 0; var s = 0; var p = false; var b = false; var nameSub; for (var i = 0; i < name.length; i++) { if (i > 1 && b == false) { p = false } if (i > 1 && b == true) { p = true } var c = name.charCodeAt(i); if ((c >= 1 && c <= 126) || (65376 <= c && c <= 65439)) { w++; b = false } else { w += 2; s++; b = true } if (w > maxLength && i <= name.length - 1) { if (b == true && p == true) { nameSub = name.substring(0, i - 2) + "..." } if (b == false && p == false) { nameSub = name.substring(0, i - 3) + "..." } if (b == true && p == false) { nameSub = name.substring(0, i - 2) + "..." } if (p == true) { nameSub = name.substring(0, i - 2) + "..." } break } } if (w <= maxLength) { return name } return nameSub }, formatNumber: function(num, cent, isThousand, defaultValue) { if (typeof num == "undefined" || num == null || num === "") { return defaultValue || "" } num = String(num).replace(/\$|\,/g, ""); if (isNaN(num)) { num = "0" } var sign = (num == (num = Math.abs(num))); num = Math.floor(num * Math.pow(10, cent) + 0.50000000001); var cents = num % Math.pow(10, cent); num = Math.floor(num / Math.pow(10, cent)).toString(); cents = cents.toString(); while (cents.length < cent) { cents = "0" + cents } if (isThousand) { for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) { num = num.substring(0, num.length - (4 * i + 3)) + "," + num.substring(num.length - (4 * i + 3)) } } if (cent > 0) { return (((sign) ? "" : "-") + num + "." + cents) } else { return (((sign) ? "" : "-") + num) } }, formatMoney: function(s, n) { if (s == undefined || s == "") { return "0.00" } n = n >= 0 && n <= 20 ? n : 2; s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + ""; var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1], i, t = ""; for (i = 0; i < l.length; i++) { t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "") } return t.split("").reverse().join("") + (r ? "." + r : "") }, numberPad: function(num, n) { var len = num.toString().length; while (len < n) { num = "0" + num; len++ } return num }, formatDate: function(date, f) { if (date == undefined) { return "" } if (f == undefined) { f = "yyyy-MM-dd HH:mm" } var o = { "M+": date.getMonth() + 1, "d+": date.getDate(), "H+": date.getHours(), "m+": date.getMinutes(), "s+": date.getSeconds(), "q+": Math.floor((date.getMonth() + 3) / 3), S: date.getMilliseconds() }; if (/(y+)/.test(f)) { f = f.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)) } for (var k in o) { if (new RegExp("(" + k + ")").test(f)) { f = f.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)) } } return f }, parseDate: function(date) { if (date == undefined) { return null } return new Date(date.replace(/-/g, "/")) }, addDate: function(date, dadd) { date = date.valueOf(); date = date + dadd * 24 * 60 * 60 * 1000; return new Date(date) }, quickSelectDate: function(type, beginDateId, endDateId) { var now = new Date() , nowYear = now.getFullYear() , nowMonth = now.getMonth() , nowDay = now.getDate() , nowDayOfWeek = now.getDay() , beginDate = $("#" + beginDateId) , endDate = $("#" + endDateId) , formatDate = function(date) { return js.formatDate(date, "yyyy-MM-dd") } , getMonthDays = function(myMonth) { var monthStartDate = new Date(nowYear,myMonth,1); var monthEndDate = new Date(nowYear,myMonth + 1,1); var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24); return days }; if (type == "1") { beginDate.val(formatDate(now)); endDate.val(beginDate.val()) } else { if (type == "2") { nowDayOfWeek = nowDayOfWeek == 0 ? 6 : nowDayOfWeek - 1; var weekStartDate = new Date(nowYear,nowMonth,nowDay - nowDayOfWeek); var weekEndDate = new Date(nowYear,nowMonth,nowDay + (6 - nowDayOfWeek)); beginDate.val(formatDate(weekStartDate)); endDate.val(formatDate(weekEndDate)) } else { if (type == "3") { var monthStartDate = new Date(nowYear,nowMonth,1); var monthEndDate = new Date(nowYear,nowMonth,getMonthDays(nowMonth)); beginDate.val(formatDate(monthStartDate)); endDate.val(formatDate(monthEndDate)) } else { if (type == "4") { var quarterStartMonth = 0; if (nowMonth < 3) { quarterStartMonth = 0 } if (2 < nowMonth && nowMonth < 6) { quarterStartMonth = 3 } if (5 < nowMonth && nowMonth < 9) { quarterStartMonth = 6 } if (nowMonth > 8) { quarterStartMonth = 9 } var quarterEndMonth = quarterStartMonth + 2; var quarterStartDate = new Date(nowYear,quarterStartMonth,1); var quarterEndDate = new Date(nowYear,quarterEndMonth,getMonthDays(quarterEndMonth)); beginDate.val(formatDate(quarterStartDate)); endDate.val(formatDate(quarterEndDate)) } else { if (type == "5") { var lastMonthDate = new Date(); lastMonthDate.setDate(1); lastMonthDate.setMonth(lastMonthDate.getMonth() - 1); var lastYear = lastMonthDate.getYear(); var lastMonth = lastMonthDate.getMonth(); var lastMonthStartDate = new Date(nowYear,lastMonth,1); var lastMonthEndDate = new Date(nowYear,lastMonth,getMonthDays(lastMonth)); beginDate.val(formatDate(lastMonthStartDate)); endDate.val(formatDate(lastMonthEndDate)) } } } } } beginDate.change(); endDate.change() }, cookie: function(name, value, options) { if (typeof value != "undefined") { options = options || {}; if (value === null) { value = ""; options.expires = -1 } var expires = ""; if (options.expires && (typeof options.expires == "number" || options.expires.toUTCString)) { var date; if (typeof options.expires == "number") { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)) } else { date = options.expires } expires = "; expires=" + date.toUTCString() } var path = "; path=" + (options.path ? options.path : (window.ctxPath ? window.ctxPath : "/")); var domain = options.domain ? "; domain=" + options.domain : ""; var secure = options.secure ? "; secure" : ""; document.cookie = [name, "=", encodeURIComponent(value), expires, path, domain, secure].join("") } else { var cookieValue = null; if (document.cookie && document.cookie != "") { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + "=")) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break } } } return cookieValue } }, tabPage: function() { if (window.tabPage) { return tabPage } try { if (parent.tabPage) { return parent.tabPage } if (parent.parent.tabPage) { return parent.parent.tabPage } if (top.tabPage) { return top.tabPage } } catch (e) {} return null }(), initTabPage: function(id, options) { if (js.cookie("tabPageModel") == "true") { options.maxLength = 1 } var tabPage = window.tabPage; return tabPage.initTabPage(id, options) }, addTabPage: function($this, title, url, closeable, refresh) { top.prevWindow = window; var tabPage = js.tabPage; if (!tabPage || typeof tabPage.addTabPage != "function" || (js.cookie("formLayerModel") == "true" && $this && $this.data("layer") != false && ($this.hasClass("btnTool") || $this.hasClass("btnList"))) || ($this && $this.data("layer") == true)) { if (js.layer) { var layerWidth, layerHeight, layerLeft, layerTop; if ($this) { layerWidth = $this.data("layerWidth"); layerHeight = $this.data("layerHeight"); layerLeft = $this.data("layerLeft"); layerTop = $this.data("layerTop") } if (layerWidth == null || layerWidth == "") { layerWidth = $(top.window).width(); if (layerLeft != null && layerLeft != "") { layerWidth -= parseInt(layerLeft) * 2 } else { layerWidth -= 100 * 2 } } if (layerHeight == null || layerHeight == "") { layerHeight = $(top.window).height(); if (layerTop != null && layerTop != "") { layerHeight -= parseInt(layerTop) * 2 } else { layerHeight -= 50 * 2 } } js.layer.open({ type: 2, maxmin: true, shadeClose: false, title: title, area: [layerWidth + "px", layerHeight + "px"], content: url, contentFormData: { __layer: true }, success: function(layero, index) { if ($(js.layer.window).width() < layerWidth || $(js.layer.window).height() < layerHeight) { js.layer.full(index) } } }) } else { js.windowOpen(url, title, "auto", "auto") } return } return tabPage.addTabPage($this, title, url, closeable, refresh) }, getCurrentTabPage: function(currentTabCallback) { var tabPage = js.tabPage; if (!tabPage || typeof tabPage.getCurrentTabPage != "function") { return } tabPage.getCurrentTabPage(currentTabCallback) }, getPrevTabPage: function(preTabCallback, isCloseCurrentTab) { var tabPage = js.tabPage; if (!tabPage || typeof tabPage.getPrevTabPage != "function") { return } tabPage.getPrevTabPage(preTabCallback, isCloseCurrentTab) }, closeCurrentTabPage: function(preTabCallback) { var tabPage = js.tabPage; if (!tabPage || typeof tabPage.closeCurrentTabPage != "function" || window.name.indexOf("layui-layer") != -1) { var layerIndex; if (js.layer) { layerIndex = js.layer.getFrameIndex(window.name) } if (layerIndex) { js.layer.close(layerIndex) } else { js.windowClose() } if (typeof preTabCallback == "function") { try { preTabCallback(top.prevWindow) } catch (e) { js.error(e) } } return } tabPage.closeCurrentTabPage(preTabCallback) } }; window.js = js; window.log = js.log; window.error = js.error; window.lang = window.lang || "zh_CN"; window.text = js.text } )(window.jQuery, window); +function(d) { var b = "lte.boxwidget"; var g = { animationSpeed: 500, collapseTrigger: '[data-widget="collapse"]', removeTrigger: '[data-widget="remove"]', collapseIcon: "fa-minus", expandIcon: "fa-plus", removeIcon: "fa-times" }; var a = { data: ".box", collapsed: ".collapsed-box", body: ".box-body", footer: ".box-footer", tools: ".box-tools" }; var i = { collapsed: "collapsed-box" }; var j = { collapsed: "collapsed.boxwidget", expanded: "expanded.boxwidget", removed: "removed.boxwidget" }; var f = function(l, k) { this.element = l; this.options = k; this._setUpListeners() }; f.prototype.toggle = function() { var k = !d(this.element).is(a.collapsed); if (k) { this.collapse() } else { this.expand() } } ; f.prototype.expand = function() { var m = d.Event(j.expanded); var l = this.options.collapseIcon; var k = this.options.expandIcon; d(this.element).removeClass(i.collapsed); d(this.element).find(a.tools).find("." + k).removeClass(k).addClass(l); d(this.element).find(a.body + ", " + a.footer).slideDown(this.options.animationSpeed, function() { d(this.element).trigger(m) } .bind(this)) } ; f.prototype.collapse = function() { var l = d.Event(j.collapsed); var m = this.options.collapseIcon; var k = this.options.expandIcon; d(this.element).find(a.tools).find("." + m).removeClass(m).addClass(k); d(this.element).find(a.body + ", " + a.footer).slideUp(this.options.animationSpeed, function() { d(this.element).addClass(i.collapsed); d(this.element).trigger(l) } .bind(this)) } ; f.prototype.remove = function() { var k = d.Event(j.removed); d(this.element).slideUp(this.options.animationSpeed, function() { d(this.element).trigger(k); d(this.element).remove() } .bind(this)) } ; f.prototype._setUpListeners = function() { var k = this; d(this.element).on("click", this.options.collapseTrigger, function(l) { if (l) { l.preventDefault() } k.toggle() }); d(this.element).on("click", this.options.removeTrigger, function(l) { if (l) { l.preventDefault() } k.remove() }); d(this.options.collapseTrigger).css({ cursor: "pointer" }); d(this.options.removeTrigger).css({ cursor: "pointer" }) } ; function h(k) { return this.each(function() { var n = d(this); var m = n.data(b); if (!m) { var l = d.extend({}, g, n.data(), typeof k == "object" && k); n.data(b, (m = new f(n,l))) } if (typeof k == "string") { if (typeof m[k] == "undefined") { throw new Error("No method named " + k) } m[k]() } }) } var c = d.fn.boxWidget; d.fn.boxWidget = h; d.fn.boxWidget.Constructor = f; d.fn.boxWidget.noConflict = function() { d.fn.boxWidget = c; return this } ; d(function() { d(a.data).each(function() { h.call(d(this)) }); d(".box-child").boxWidget({ collapseTrigger: '[data-widget="collapse-child"]', removeTrigger: '[data-widget="remove-child"]' }) }) }(jQuery); !(function(a) { a.fn.extend({ placeholder: function(b) { b = a.extend({ placeholderColor: "#ACA899", isUseSpan: true, onInput: true, noFixClass: "placeholder-no-fix" }, b); a(this).each(function() { var h = this; var c = "placeholder"in document.createElement("input"); if (!c) { if (a(h).hasClass(b.noFixClass)) { return } var i = a(h).attr("placeholder"); var d = a(h).css("color"); if (b.isUseSpan == false) { a(h).focus(function() { var n = new RegExp("^" + i + "$|^$"); n.test(a(h).val()) && a(h).val("").css("color", d) }).blur(function() { if (a(h).val() == i) { a(h).css("color", d) } else { if (a(h).val().length == 0) { a(h).val(i).css("color", b.placeholderColor) } } }).trigger("blur") } else { var f = ""; if (a(h).parent().hasClass("input-group")) { f = "left:" + a(h).position().left + "px;" } var k = a(h).width() == 0 ? 150 : a(h).width(); var l = a(h).hasClass("input-sm") ? a(h).height() : a(h).outerHeight(); var m = a('' + i + ""); m.css({ "margin-left": a(h).css("margin-left"), "margin-top": a(h).css("margin-top"), "font-size": a(h).css("font-size"), "font-family": a(h).css("font-family"), "font-weight": a(h).css("font-weight"), "line-height": h.nodeName.toLowerCase() == "textarea" ? a(h).css("line-weight") : l + "px", "padding-left": parseInt(a(h).css("padding-left")) + 2 + "px", "padding-top": h.nodeName.toLowerCase() == "textarea" ? parseInt(a(h).css("padding-top")) + 2 : 0 }); var g = a(h).prev(); if (g.hasClass("wrap-placeholder")) { g.remove() } a(h).before(m.click(function() { a(h).trigger("focus") })); a(h).val().length != 0 && m.hide(); if (b.onInput) { var j = typeof (h.oninput) == "object" ? "input" : "propertychange"; a(h).bind(j, function() { m[0].style.display = a(h).val().length != 0 ? "none" : "inline-block" }) } else { a(h).focus(function() { m.hide() }).blur(function() { /^$/.test(a(h).val()) && m.show() }) } } } }); return this } }) } )(jQuery); (function(a) { a.fn.textareaAutoHieght = function(b) { var d = { maxHeight: null, minHeight: a(this).attr("rows") * 18 }; var c = a.extend({}, d, b); return a(this).each(function() { a(this).bind("paste cut keydown keyup focus blur", function() { var f, g = this.style; this.style.height = c.minHeight + "px"; if (this.scrollHeight > c.minHeight) { if (c.maxHeight && this.scrollHeight > c.maxHeight) { f = c.maxHeight; g.overflowY = "scroll" } else { f = this.scrollHeight; g.overflowY = "hidden" } g.height = f + "px" } }).trigger("blur") }) } } )(jQuery); (function(a) { a.fn.iframeWindow = function() { var b = a(this).find("iframe"); if (b.length > 0) { return b[0].contentWindow } return null } } )(jQuery); (function(W) { function B(k, h, n) { var p = k[0] , m = /er/.test(n) ? T : /bl/.test(n) ? O : U , l = n == j ? { checked: p[U], disabled: p[O], indeterminate: "true" == k.attr(T) || "false" == k.attr(o) } : p[m]; if (/^(ch|di|in)/.test(n) && !l) { P(k, m) } else { if (/^(un|en|de)/.test(n) && l) { N(k, m) } else { if (n == j) { for (m in l) { l[m] ? P(k, m, !0) : N(k, m, !0) } } else { if (!h || "toggle" == n) { if (!h) { k[R]("ifClicked") } l ? p[S] !== C && N(k, m) : P(k, m) } } } } } function P(y, x, u) { var v = y[0] , t = y.parent() , q = x == U , n = x == T , m = x == O , w = n ? o : q ? K : "enabled" , l = V(y, w + i(v[S])) , s = V(y, x + i(v[S])); if (!0 !== v[x]) { if (!u && x == U && v[S] == C && v.name) { var k = y.closest("form") , h = 'input[name="' + v.name + '"]' , h = k.length ? k.find(h) : W(h); h.each(function() { this !== v && W(this).data(Q) && N(W(this), x) }) } n ? (v[x] = !0, v[U] && N(y, U, "force")) : (u || (v[x] = !0), q && v[T] && N(y, T, !1)); b(y, q, x, u) } v[O] && V(y, f, !0) && t.find("." + g).css(f, "default"); t[A](s || V(y, x) || ""); m ? t.attr("aria-disabled", "true") : t.attr("aria-checked", n ? "mixed" : "true"); t[c](l || V(y, w) || "") } function N(y, x, v) { var w = y[0] , s = y.parent() , n = x == U , m = x == T , k = x == O , l = m ? o : n ? K : "enabled" , D = V(y, l + i(w[S])) , z = V(y, x + i(w[S])); if (!1 !== w[x]) { if (m || !v || "force" == v) { w[x] = !1 } b(y, n, l, v) } !w[O] && V(y, f, !0) && s.find("." + g).css(f, "pointer"); s[c](z || V(y, x) || ""); k ? s.attr("aria-disabled", "false") : s.attr("aria-checked", "false"); s[A](D || V(y, l) || "") } function a(k, h) { if (k.data(Q)) { k.parent().html(k.attr("style", k.data(Q).s || "")); if (h) { k[R](h) } k.off(".i").unwrap(); W(r + '[for="' + k[0].id + '"]').add(k.closest(r)).off(".i") } } function V(k, h, l) { if (k.data(Q)) { return k.data(Q).o[h + (l ? "" : "Class")] } } function i(h) { return h.charAt(0).toUpperCase() + h.slice(1) } function b(k, h, l, m) { if (!m) { if (h) { k[R]("ifToggled") } k[R]("ifChanged")[R]("if" + i(l)) } } var Q = "iCheck" , g = Q + "-helper" , C = "radio" , U = "checked" , K = "un" + U , O = "disabled" , o = "determinate" , T = "in" + o , j = "update" , S = "type" , A = "addClass" , c = "removeClass" , R = "trigger" , r = "label" , f = "cursor" , d = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent); W.fn[Q] = function(D, v) { var s = 'input[type="checkbox"], input[type="' + C + '"]' , t = W() , q = function(k) { k.each(function() { var w = W(this); t = w.is(s) ? t.add(w) : t.add(w.find(s)) }) }; if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(D)) { return D = D.toLowerCase(), q(this), t.each(function() { var k = W(this); "destroy" == D ? a(k, "ifDestroyed") : B(k, !0, D); W.isFunction(v) && v() }) } if ("object" != typeof D && D) { return this } var p = W.extend({ checkedClass: U, disabledClass: O, indeterminateClass: T, checkboxClass: "icheckbox_minimal-grey", radioClass: "iradio_minimal-grey", labelHover: !0, aria: !1 }, D) , n = p.handle , m = p.hoverClass || "hover" , z = p.focusClass || "focus" , E = p.activeClass || "active" , u = !!p.labelHover , l = p.labelHoverClass || "hover" , h = ("" + p.increaseArea).replace("%", "") | 0; if ("checkbox" == n || n == C) { s = 'input[type="' + n + '"]' } -50 > h && (h = -50); q(this); return t.each(function() { var L = W(this); a(L); var I = this , J = I.id , G = -h + "%" , H = 100 + 2 * h + "%" , H = { position: "absolute", top: G, left: G, display: "block", width: H, height: H, margin: 0, padding: 0, background: "#fff", border: 0, opacity: 0 } , G = d ? { position: "absolute", visibility: "hidden" } : h ? H : { position: "absolute", opacity: 0 } , y = "checkbox" == I[S] ? p.checkboxClass || "icheckbox" : p.radioClass || "i" + C , x = W(r + '[for="' + J + '"]').add(L.closest(r)) , w = !!p.aria , M = Q + "-" + Math.random().toString(36).replace("0.", "") , F = '
")[R]("ifCreated").parent().append(p.insert); H = W('').css(H).appendTo(F); L.data(Q, { o: p, s: L.attr("style") }).css(G); p.inheritClass && F[A](I.className || ""); p.inheritID && J && F.attr("id", Q + "-" + J); "static" == F.css("position") && F.css("position", "relative"); B(L, !0, j); if (x.length) { x.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i", function(k) { var Y = k[S] , X = W(this); if (!I[O]) { if ("click" == Y) { if (W(k.target).is("a")) { return } B(L, !1, !0) } else { u && (/ut|nd/.test(Y) ? (F[c](m), X[c](l)) : (F[A](m), X[A](l))) } if (d) { k.stopPropagation() } else { return !1 } } }) } L.on("click.i focus.i blur.i keyup.i keydown.i keypress.i", function(k) { var X = k[S]; k = k.keyCode; if ("click" == X) { return !1 } if ("keydown" == X && 32 == k) { return I[S] == C && I[U] || (I[U] ? N(L, U) : P(L, U)), !1 } if ("keyup" == X && I[S] == C) { !I[U] && P(L, U) } else { if (/us|ur/.test(X)) { F["blur" == X ? c : A](z) } } }); H.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i", function(k) { var Y = k[S] , X = /wn|up/.test(Y) ? E : m; if (!I[O]) { if ("click" == Y) { B(L, !1, !0) } else { if (/wn|er|in/.test(Y)) { F[A](X) } else { F[c](X + " " + E) } if (x.length && u && X == m) { x[/ut|nd/.test(Y) ? c : A](l) } } if (d) { k.stopPropagation() } else { return !1 } } }) }) } } )(window.jQuery || window.Zepto); (function(f, d, a) { var b, g, c; c = "resizeEnd"; g = { delay: 150 }; b = function(i, h, j) { if (typeof h === "function") { j = h; h = {} } j = j || null; this.element = i; this.settings = f.extend({}, g, h); this._defaults = g; this._name = c; this._timeout = false; this._callback = j; return this.init() } ; b.prototype = { init: function() { var h, i; i = this; h = f(this.element); return h.on("resize", function() { return i.initResize() }) }, getUTCDate: function(i) { var h; i = i || new Date(); h = Date.UTC(i.getUTCFullYear(), i.getUTCMonth(), i.getUTCDate(), i.getUTCHours(), i.getUTCMinutes(), i.getUTCSeconds(), i.getUTCMilliseconds()); return h }, initResize: function() { var h; h = this; h.controlTime = h.getUTCDate(); if (h._timeout === false) { h._timeout = true; return setTimeout(function() { return h.runCallback(h) }, h.settings.delay) } }, runCallback: function(i) { var h; h = i.getUTCDate(); if (h - i.controlTime < i.settings.delay) { return setTimeout(function() { return i.runCallback(i) }, i.settings.delay) } else { i._timeout = false; return i._callback() } } }; return f.fn[c] = function(h, i) { return this.each(function() { if (!f.data(this, "plugin_" + c)) { return f.data(this, "plugin_" + c, new b(this,h,i)) } }) } } )(jQuery, window, document); !function(a) { "function" == typeof define && define.amd ? define(["jquery"], a) : a("undefined" != typeof jQuery ? jQuery : window.Zepto) }(function(e) { function t(t) { var r = t.data; t.isDefaultPrevented() || (t.preventDefault(), e(t.target).ajaxSubmit(r)) } function r(t) { var r = t.target , a = e(r); if (!a.is("[type=submit],[type=image]")) { var n = a.closest("[type=submit]"); if (0 === n.length) { return } r = n[0] } var i = this; if (i.clk = r, "image" == r.type) { if (void 0 !== t.offsetX) { i.clk_x = t.offsetX, i.clk_y = t.offsetY } else { if ("function" == typeof e.fn.offset) { var o = a.offset(); i.clk_x = t.pageX - o.left, i.clk_y = t.pageY - o.top } else { i.clk_x = t.pageX - r.offsetLeft, i.clk_y = t.pageY - r.offsetTop } } } setTimeout(function() { i.clk = i.clk_x = i.clk_y = null }, 100) } function a() { if (e.fn.ajaxSubmit.debug) { var t = "[jquery.form] " + Array.prototype.join.call(arguments, ""); window.console && window.console.log ? window.console.log(t) : window.opera && window.opera.postError && window.opera.postError(t) } } var n = {}; n.fileapi = void 0 !== e("").get(0).files, n.formdata = void 0 !== window.FormData; var i = !!e.fn.prop; e.fn.attr2 = function() { if (!i) { return this.attr.apply(this, arguments) } var e = this.prop.apply(this, arguments); return e && e.jquery || "string" == typeof e ? e : this.attr.apply(this, arguments) } , e.fn.ajaxSubmit = function(t) { function r(r) { var a, n, i = e.param(r, t.traditional).split("&"), o = i.length, s = []; for (a = 0; o > a; a++) { i[a] = i[a].replace(/\+/g, " "), n = i[a].split("="), s.push([decodeURIComponent(n[0]), decodeURIComponent(n[1])]) } return s } function o(a) { for (var n = new FormData, i = 0; i < a.length; i++) { n.append(a[i].name, a[i].value) } if (t.extraData) { var o = r(t.extraData); for (i = 0; i < o.length; i++) { o[i] && n.append(o[i][0], o[i][1]) } } t.data = null; var s = e.extend(!0, {}, e.ajaxSettings, t, { contentType: !1, processData: !1, cache: !1, type: u || "POST" }); t.uploadProgress && (s.xhr = function() { var r = e.ajaxSettings.xhr(); return r.upload && r.upload.addEventListener("progress", function(e) { var r = 0 , a = e.loaded || e.position , n = e.total; e.lengthComputable && (r = Math.ceil(a / n * 100)), t.uploadProgress(e, a, n, r) }, !1), r } ), s.data = null; var c = s.beforeSend; return s.beforeSend = function(e, r) { r.data = t.formData ? t.formData : n, c && c.call(this, e, r) } , e.ajax(s) } function s(r) { function n(e) { var t = null; try { e.contentWindow && (t = e.contentWindow.document) } catch (r) { a("cannot get iframe.contentWindow document: " + r) } if (t) { return t } try { t = e.contentDocument ? e.contentDocument : e.document } catch (r) { a("cannot get iframe.contentDocument: " + r), t = e.document } return t } function o() { function t() { try { var e = n(g).readyState; a("state = " + e), e && "uninitialized" == e.toLowerCase() && setTimeout(t, 50) } catch (r) { a("Server abort: ", r, " (", r.name, ")"), s(k), j && clearTimeout(j), j = void 0 } } var r = f.attr2("target") , i = f.attr2("action") , o = "multipart/form-data" , c = f.attr("enctype") || f.attr("encoding") || o; w.setAttribute("target", p), (!u || /post/i.test(u)) && w.setAttribute("method", "POST"), i != m.url && w.setAttribute("action", m.url), m.skipEncodingOverride || u && !/post/i.test(u) || f.attr({ encoding: "multipart/form-data", enctype: "multipart/form-data" }), m.timeout && (j = setTimeout(function() { T = !0, s(D) }, m.timeout)); var l = []; try { if (m.extraData) { for (var d in m.extraData) { m.extraData.hasOwnProperty(d) && l.push(e.isPlainObject(m.extraData[d]) && m.extraData[d].hasOwnProperty("name") && m.extraData[d].hasOwnProperty("value") ? e('').val(m.extraData[d].value).appendTo(w)[0] : e('').val(m.extraData[d]).appendTo(w)[0]) } } m.iframeTarget || v.appendTo("body"), g.attachEvent ? g.attachEvent("onload", s) : g.addEventListener("load", s, !1), setTimeout(t, 15); try { w.submit() } catch (h) { var x = document.createElement("form").submit; x.apply(w) } } finally { w.setAttribute("action", i), w.setAttribute("enctype", c), r ? w.setAttribute("target", r) : f.removeAttr("target"), e(l).remove() } } function s(t) { if (!x.aborted && !F) { if (M = n(g), M || (a("cannot access response document"), t = k), t === D && x) { return x.abort("timeout"), void S.reject(x, "timeout") } if (t == k && x) { return x.abort("server abort"), void S.reject(x, "error", "server abort") } if (M && M.location.href != m.iframeSrc || T) { g.detachEvent ? g.detachEvent("onload", s) : g.removeEventListener("load", s, !1); var r, i = "success"; try { if (T) { throw "timeout" } var o = "xml" == m.dataType || M.XMLDocument || e.isXMLDoc(M); if (a("isXml=" + o), !o && window.opera && (null === M.body || !M.body.innerHTML) && --O) { return a("requeing onLoad callback, DOM not available"), void setTimeout(s, 250) } var u = M.body ? M.body : M.documentElement; x.responseText = u ? u.innerHTML : null, x.responseXML = M.XMLDocument ? M.XMLDocument : M, o && (m.dataType = "xml"), x.getResponseHeader = function(e) { var t = { "content-type": m.dataType }; return t[e.toLowerCase()] } , u && (x.status = Number(u.getAttribute("status")) || x.status, x.statusText = u.getAttribute("statusText") || x.statusText); var c = (m.dataType || "").toLowerCase() , l = /(json|script|text)/.test(c); if (l || m.textarea) { var f = M.getElementsByTagName("textarea")[0]; if (f) { x.responseText = f.value, x.status = Number(f.getAttribute("status")) || x.status, x.statusText = f.getAttribute("statusText") || x.statusText } else { if (l) { var p = M.getElementsByTagName("pre")[0] , h = M.getElementsByTagName("body")[0]; p ? x.responseText = p.textContent ? p.textContent : p.innerText : h && (x.responseText = h.textContent ? h.textContent : h.innerText) } } } else { "xml" == c && !x.responseXML && x.responseText && (x.responseXML = X(x.responseText)) } try { E = _(x, c, m) } catch (y) { i = "parsererror", x.error = r = y || i } } catch (y) { a("error caught: ", y), i = "error", x.error = r = y || i } x.aborted && (a("upload aborted"), i = null), x.status && (i = x.status >= 200 && x.status < 300 || 304 === x.status ? "success" : "error"), "success" === i ? (m.success && m.success.call(m.context, E, "success", x), S.resolve(x.responseText, "success", x), d && e.event.trigger("ajaxSuccess", [x, m])) : i && (void 0 === r && (r = x.statusText), m.error && m.error.call(m.context, x, i, r), S.reject(x, "error", r), d && e.event.trigger("ajaxError", [x, m, r])), d && e.event.trigger("ajaxComplete", [x, m]), d && !--e.active && e.event.trigger("ajaxStop"), m.complete && m.complete.call(m.context, x, i), F = !0, m.timeout && clearTimeout(j), setTimeout(function() { m.iframeTarget ? v.attr("src", m.iframeSrc) : v.remove(), x.responseXML = null }, 100) } } } var c, l, m, d, p, v, g, x, y, b, T, j, w = f[0], S = e.Deferred(); if (S.abort = function(e) { x.abort(e) } , r) { for (l = 0; l < h.length; l++) { c = e(h[l]), i ? c.prop("disabled", !1) : c.removeAttr("disabled") } } if (m = e.extend(!0, {}, e.ajaxSettings, t), m.context = m.context || m, p = "jqFormIO" + (new Date).getTime(), m.iframeTarget ? (v = e(m.iframeTarget), b = v.attr2("name"), b ? p = b : v.attr2("name", p)) : (v = e('