/*! * Copyright © 2015-2020 JeePlus All rights reserved. * * 通用公共方法 * @author jeeplus * @version 2014-4-29 */ $(document).ready(function() { try{ // 链接去掉虚框 $("a").bind("focus",function() { if(this.blur) {this.blur()}; }); //所有下拉框使用select2 $("select").select2(); }catch(e){ // blank } }); // 引入js和css文件 function include(id, path, file){ if (document.getElementById(id)==null){ var files = typeof file == "string" ? [file] : file; for (var i = 0; i < files.length; i++){ var name = files[i].replace(/^\s|\s$/g, ""); var att = name.split('.'); var ext = att[att.length - 1].toLowerCase(); var isCSS = ext == "css"; var tag = isCSS ? "link" : "script"; var attr = isCSS ? " type='text/css' rel='stylesheet' " : " type='text/javascript' "; var link = (isCSS ? "href" : "src") + "='" + path + name + "'"; document.write("<" + tag + (i==0?" id="+id:"") + attr + link + ">"); } } } // 获取URL地址参数 function getQueryString(name, url) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); if (!url || url == ""){ url = window.location.search; }else{ url = url.substring(url.indexOf("?")); } r = url.substr(1).match(reg) if (r != null) return unescape(r[2]); return null; } //获取字典标签 function getDictLabel(data, value, defaultValue){ for (var i=0; i (window.innerHeight || document.documentElement.clientHeight)) { var tb1 = document.getElementById("changewidth"); tb1.innerHTML = tb1.innerHTML + ""; } } function addLinkVisied(){ $(this).addClass("a_visited"); } function checkContentKeyUp(id,maxLength) { var content = document.getElementById(id); var length = content.value.replace(/^(\s|\u00A0)+/,'').replace(/(\s|\u00A0)+$/,'').length; var contentMsg = document.getElementById('contentMsg'); contentMsg.innerHTML = "您已输入" + length + "字符,还可输入" + (maxLength - length) + "字符"; } function confirmDelete(mess, href){ top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){ //do something if (typeof href == 'function') { href(); }else{ $.ajax({ url:href, type:"post", success:function(data){ if(data.success){ top.layer.msg("删除成功!", {icon: 1}); sortOrRefresh() } } }); } top.layer.close(index); }); return false; } function confirmDelete(mess, href){ top.layer.confirm(mess, {icon: 3, title:'系统提示'}, function(index){ //do something if (typeof href == 'function') { href(); }else{ $.ajax({ url:href, type:"post", success:function(data){ if(data.success){ top.layer.msg("删除成功!", {icon: 1}); sortOrRefresh() } } }); } top.layer.close(index); }); return false; }