//var IP = "http://47.104.149.73:1991";//接å£IP // var IP = "http://172.16.71.101:8082/";//接å£IP //var IP = "http://localhost:13243/api"; var IP = "http://localhost:50515/api"; //本地 // var IP = "http://localhost:44318/api"; //var IP = "http://192.168.1.6:8017"; //var IP = "http://192.168.1.226:8086"; // var IP = "http://192.168.62.200:8888/api"; //bklæœåС噍 var pageCnt = 15; var pageLimits = [10, 15, 20, 30, 50, 70, 100]; function pageCntFirst() { sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun013", {}, 'get', function (res) { console.log(res.data.SetValue) if (res.code == 0) { //æˆåŠŸ if(res.data.IsEnable == 'NO') { pageCnt = parseInt(res.data.SetValue); // console.log(pageLimits.indexOf(pageCnt) == '-1') if (pageLimits.indexOf(pageCnt) == '-1') { pageLimits.push(pageCnt); pageLimits.sort(function(a,b){   return a - b; }) } } } }); } function sendData(url, data, type, callbackFun) { var deferred = $.Deferred(); if (type != "get") { data = JSON.stringify(data); } if (url!=IP+"/WeatherForecast/Login") { if (!$.cookie('token')) { callbackFun("登录人信æ¯å·²å¤±æ•ˆ"); } } $.ajax({ url: url, data: data, type: type, headers: { "Content-Type": "application/json; charset=UTF-8", "ToKen":$.cookie('token') }, timeout: 45000, async: true, cache: false, beforeSend: function (xhr, settings) {}, success: function (res, status, xhr) { // console.log(res); // console.log(status); callbackFun(res); }, error: function (res, status, error) { // console.log(res); // console.log(status); callbackFun(res, status, error); // layer.msg(res.statusText, { // icon: 2, // time: 2000 //2ç§’å…³é—(如果ä¸é…置,默认是3秒) // }, function() {}); }, }); } function synData(url, data, type, callbackFun) { var deferred = $.Deferred(); if (type != "get") { data = JSON.stringify(data); } if (url!=IP+"/WeatherForecast/Login") { if (!$.cookie('token')) { callbackFun("登录人信æ¯å·²å¤±æ•ˆ"); } } $.ajax({ url: url, data: data, type: type, headers: { "Content-Type": "application/json; charset=UTF-8", "ToKen":$.cookie('token') }, timeout: 45000, async: false, cache: false, beforeSend: function (xhr, settings) {}, success: function (res, status, xhr) { callbackFun(res); }, error: function (res, status, error) { callbackFun(res, status, error); // layer.msg(res.statusText, { // icon: 2, // time: 2000 //2ç§’å…³é—(如果ä¸é…置,默认是3秒) // }, function() {}); }, }); } // æ ¹æ®æ—¶é—´æˆ³è½¬æ¢ä¸ºæ—¶é—´æ ¼å¼ function formatDate(str) { if (str == null || str == "" || str == undefined) { return ""; } else { var date = new Date(str //parseInt(str.replace("/Date(", "").replace(")/", ""), 10) ); Y = date.getFullYear(); M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1); D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()); h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()); m = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); return Y +"-"+ M +"-" +D+" " + h+":" + m + ":" + s; } } // æ ¹æ®æ—¶é—´æˆ³è½¬æ¢ä¸ºæ—¶é—´æ ¼å¼:å¹´-月-æ—¥ function formatDate2(str) { if (str == null || str == "" || str == undefined) { return ""; } else { var date = new Date(str // parseInt(str.replace("/Date(", "").replace(")/", ""), 10) ); Y = date.getFullYear() + "-"; M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-"; D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " "; h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":"; m = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); return Y + M + D; } } //èŽ·å–æµè§ˆå™¨å‚æ•° function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } // åŒæ¥æ–¹æ³• function sendDataAsync(url, data, type, callbackFun) { var deferred = $.Deferred(); data = JSON.stringify(data); $.ajax({ url: url, data: data, type: type, headers: { "Content-Type": "application/json", }, timeout: 45000, async: false, cache: false, beforeSend: function (xhr, settings) {}, success: function (res, status, xhr) { callbackFun(res); }, error: function (xhr, status, error) { console.log("失败了"); console.log(xhr); }, }); } //获å–除æœç´¢æ¡ä»¶å¤–高度 function GetTableHeight() { var bodyHeight = $("#body").outerHeight(); var topHeight = $("#top").outerHeight(); var centerHeight = $("#center").outerHeight(); // console.log(bodyHeight); // console.log(topHeight); // console.log(centerHeight); var hh = bodyHeight - topHeight-centerHeight - 26 ;//6是bodyä¸Šå†…è¾¹è· return hh; } //获å–除æœç´¢æ¡ä»¶å¤–60%高度 function GetTableTopHeight() { var bodyHeight = $("#body").outerHeight(); var topHeight = $("#top").outerHeight(); var centerHeight = $("#center").outerHeight(); // console.log(bodyHeight); // console.log(topHeight); // console.log(centerHeight); var hh = bodyHeight - topHeight -centerHeight - 26 ;//6是body上内边è·ã€20是layui-card-bodyä¸Šä¸‹å†…è¾¹è· var h1 = parseInt(hh*0.6) return h1; } //获å–除æœç´¢æ¡ä»¶å¤–40%高度 function GetTableBottomHeight() { var bodyHeight = $("#body").outerHeight(); var topHeight = $("#top").outerHeight(); var centerHeight = $("#center").outerHeight(); var hh = bodyHeight - topHeight-centerHeight - 26 ;//6是bodyä¸Šå†…è¾¹è· var h2 = parseInt(hh*0.4) return h2; } //获å–除æœç´¢æ¡ä»¶ä»¥åŠé¡µç¾å¤–高度 function GetTableTabHeight() { var bodyHeight = $("#body").outerHeight(); var topHeight = $("#top").outerHeight(); var centerHeight = $("#center").outerHeight(); var tabHeight = $("#tab").outerHeight(); // console.log(bodyHeight); // console.log(topHeight); // console.log(centerHeight); // console.log(tabHeight); var hh = bodyHeight - topHeight-centerHeight-tabHeight - 57 ;//6是bodyä¸Šå†…è¾¹è· return hh; } //åˆ¤æ–æ˜¯å¦æ£æ•´æ•° true æ£æ•´æ•° false å…¶ä»– function isIntNum(val){ var regPos = /^\d+$/; //var regNeg = /^\-[1-9][0-9]"*$/; if (regPos.test(val))//&®Neg.test(val)) { return true; } else { return false; } } //åˆ¤æ–æ˜¯å¦å¼€å¯table列表列宽调整功能。 var isSetColW=false; function GetIsSetColW() { sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun014", {}, 'get', function (res) { if (res.code == 0) { //æˆåŠŸ if(res.data.IsEnable == 'NO') { isSetColW=true; } } }); } //自定义列宽功能,tableIdï¼šè¡¨æ ¼id,Hrefï¼šè¡¨æ ¼èŽ·å–æ•°æ®æ–¹æ³•,ColsSysArr:自定列表头urlç¼–ç åŽæ•°æ® function SetTableColW(tableId,Href,ColsSysArr){ if(isSetColW){ //é€šè¿‡è¡¨æ ¼id获å–è¡¨æ ¼è¡¨å¤´çš„ç‚¹å‡»äº‹ä»¶ var target= $('#'+tableId+'').next().find('.layui-table-header'); target.on('click', '.layui-table-cell', function(){ var that=this; var colText=that.innerText;//找到所点击列的列å if(colText==''){ return; } var colWidth=that.clientWidth+"";//找到所点击列的列宽 ColsSysArr = decodeURIComponent(decodeURIComponent(ColsSysArr)); var param5={ Href:Href, ColsJson:'', ColsSysArr:ColsSysArr, ColText:colText, ColWidth:colWidth }; sendData(IP + "/Sys/SaveClosUser", param5, 'post', function(res){ if(res.code === 0){ }else { //䏿ˆåŠŸ } }); }); } }