From 2fe250ece8de95b3f70172fe5b45793ab6a3084a Mon Sep 17 00:00:00 2001 From: D:/workspace/chenjingjing/git/gx_tieta/gx_tieta/.gitignore <chenjingjing@LAPTOP-E51P2139> Date: 星期五, 18 一月 2019 17:30:50 +0800 Subject: [PATCH] 未审批可更改 --- gx_tieta/WebRoot/pages/js/common.js | 78 +++++++++++++++++++++++++++++++++++++- 1 files changed, 75 insertions(+), 3 deletions(-) diff --git a/gx_tieta/WebRoot/pages/js/common.js b/gx_tieta/WebRoot/pages/js/common.js index 5a80746..4d4234a 100644 --- a/gx_tieta/WebRoot/pages/js/common.js +++ b/gx_tieta/WebRoot/pages/js/common.js @@ -472,6 +472,43 @@ gl.CMD.batt.set = 0x37; // 璁剧疆鐢垫睜鍙傛暟 })(jQuery, window, document, GLOBAL); +// 闂绫诲瀷 +;(function($, window, document, gl, undefined) { + // HomeQues鐨勫懡鍚嶇┖闂� + gl.namespace('HomeQues'); + var lists = ['鐢垫睜闂', '鐢垫簮闂', '绌鸿皟闂', '婕忔按闂', 'BTS璁惧闂', 'GPRS妯″潡闂', '鏂藉伐瀹夎闂', '閾侀攤鐢垫睜闂', '鍏朵粬闂']; + + // 灏唓uestions缁戝畾鍒癏omeQues涓� + gl.HomeQues.lists = lists; + + // 鑾峰彇option鍒楄〃 + function getOptions(bool) { + var options = ''; + // 鏄惁娣诲姞鍏ㄩ儴閫夐」 + if(bool) { + options += '<option value="-1">鍏ㄩ儴</option>'; + } + // 閬嶅巻lists杩斿洖鎵�鏈夌殑option + for(var i=0; i<lists.length; i++) { + options += '<option value="'+i+'">'+lists[i]+'</option>'; + } + return options; + } + + // 灏唃etOptions缁戝畾鍒癏omeQues涓� + gl.HomeQues.getOptions = getOptions; + + // 鑾峰彇鏁呴殰绫诲瀷layuiBtn + function getLayuiBtn(num) { + var txt = lists[num]; + return '<a href="javascript:;" class="layui-btn layui-btn-xs">'+txt+'</a>'; + } + + // 灏唃etLayuiBtn缁戝畾鍒癏omeQues涓� + gl.HomeQues.getLayuiBtn = getLayuiBtn; + +})(jQuery, window, document, GLOBAL); + // 鍦板浘淇℃伅 ;(function($, window, document, gl, undefined) { // 瀹氫箟BMap鐨勫懡鍚嶇┖闂� @@ -549,7 +586,7 @@ // 瀵煎嚭鎶ヨ〃 ;(function($, window, document, gl, undefined) { // 瀹氫箟testVal鐨勫懡鍚嶇┖闂� - gl.namespace('expExcel'); + gl.namespace('Table'); var ExpExcel = function() { this.thead = ''; // 琛ㄦ牸鐨勫ご閮� this.tbody = ''; // 琛ㄦ牸鐨勫唴瀹� @@ -678,9 +715,44 @@ var expExcel = new ExpExcel(); - console.log(expExcel); + //console.log(expExcel); // 缁戝畾瀵煎嚭鏁版嵁瀵硅薄 - GLOBAL.expExcel = expExcel; + GLOBAL.Table.expExcel = expExcel; + + + //鏋勯�犲鍑鸿〃鏍煎璞� + function createTableData(tOptions){ + var thead_arr = new Array(); //琛ㄥご鏁版嵁鏁扮粍 + var thody_arr = new Array(); //琛ㄦ牸鏁版嵁鏁扮粍 + var proname_arr = new Array(); //灞炴�у悕鏁扮粍 + //console.info(tOptions); + if(tOptions != undefined){ + //鏋勯�犺〃澶存暟缁� + for(var i = 0;i< tOptions.cols.length;i++){ + var _th = tOptions.cols[i]; + for(var k=0;k<_th.length;k++){ + if(_th[k].field != undefined){ + proname_arr.push(_th[k].field); + thead_arr.push(_th[k].title); + } + } + } + //鏋勯�犺〃鏍煎唴閮ㄦ暟鎹暟缁� + for(var j = 0;j < tOptions.data.length;j++){ + var _data = tOptions.data[j]; + for(var k=0;k<proname_arr.length;k++){ + thody_arr.push(_data[proname_arr[k]]); + } + } + } + return { + thead: [thead_arr], + tbody:[thody_arr] + }; + } + + // 缁戝畾瀵煎嚭鏁版嵁瀵硅薄 + GLOBAL.Table.cTblData = createTableData; })(jQuery, window, document, GLOBAL); // 鐢熸垚闃块噷鍥炬爣鐨勫厓绱� -- Gitblit v1.9.1