| | |
| | | async: false, //asyncç¨äºæ§å¶ï¼falseï¼åæ¥åï¼trueï¼å¼æ¥ï¼é»è®¤çæ¯trueï¼å³è¯·æ±é»è®¤çæ¯å¼æ¥è¯·æ± |
| | | data: { "sWhere": sWhere }, |
| | | success: function (data1) { |
| | | if (data1.count == 1) { |
| | | var data = []; |
| | | var col = []; |
| | | //ç»ç©ºçæ°ç»èµå¼ |
| | | for (var key in data1.list) { |
| | | //卿è·åå表ææåå |
| | | data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType }); |
| | | //è·åä¸éè¦æ¾ç¤ºçåï¼Hå¼å¤´çå䏿¾ç¤ºï¼ |
| | | var patrn = new RegExp(/^h/i); |
| | | if (patrn.test(data1.list[key].ColmCols)) { |
| | | titleData[key] = data1.list[key].ColmCols; |
| | | } |
| | | //æ è®ºææ æ°æ®å
å è½½col |
| | | var data = []; |
| | | var col = []; |
| | | //ç»ç©ºçæ°ç»èµå¼ |
| | | for (var key in data1.list) { |
| | | //卿è·åå表ææåå |
| | | data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType }); |
| | | //è·åä¸éè¦æ¾ç¤ºçåï¼Hå¼å¤´çå䏿¾ç¤ºï¼ |
| | | var patrn = new RegExp(/^h/i); |
| | | if (patrn.test(data1.list[key].ColmCols)) { |
| | | titleData[key] = data1.list[key].ColmCols; |
| | | } |
| | | } |
| | | |
| | | //å¨å表左边添å å¾éæ¡ |
| | | col.push({ type: 'checkbox', fixed: 'left', totalRowText: 'å计' }); |
| | | for (var i = 0; i < data.length; i++) { |
| | | if ($.inArray(data[i].name, titleData) > -1) { |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //éèidå |
| | | } |
| | | else { |
| | | switch (data[i].Type) { |
| | | //int |
| | | case 'DateTime': |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 }); |
| | | break; |
| | | case 'long': |
| | | case 'Int32': |
| | | case 'Int64': |
| | | case 'double': |
| | | case 'Decimal': |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120, totalRow: true }); |
| | | break; |
| | | default: |
| | | if (data[i].name == 'æ°é') { |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true }); |
| | | } else { |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | columns = col; |
| | | |
| | | //设置èµå¼å宽 |
| | | var colWidth = getColumnsWidth(); |
| | | if (colWidth == "" || colWidth == []) { |
| | | |
| | | //å¨å表左边添å å¾éæ¡ |
| | | col.push({ type: 'checkbox', fixed: 'left', totalRowText: 'å计' }); |
| | | for (var i = 0; i < data.length; i++) { |
| | | if ($.inArray(data[i].name, titleData) > -1) { |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //éèidå |
| | | } |
| | | else { |
| | | $.each(columns, function (x, m) { |
| | | m["width"] = colWidth[x]; |
| | | }); |
| | | switch (data[i].Type) { |
| | | //int |
| | | case 'DateTime': |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 }); |
| | | break; |
| | | case 'long': |
| | | case 'Int32': |
| | | case 'Int64': |
| | | case 'double': |
| | | case 'Decimal': |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120, totalRow: true }); |
| | | break; |
| | | default: |
| | | if (data[i].name == 'æ°é') { |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true }); |
| | | } else { |
| | | col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true }); |
| | | } |
| | | } |
| | | } |
| | | option.cols = [columns]; |
| | | } |
| | | |
| | | columns = col; |
| | | |
| | | //设置èµå¼å宽 |
| | | var colWidth = getColumnsWidth(); |
| | | if (colWidth == "" || colWidth == []) { |
| | | |
| | | } |
| | | else { |
| | | $.each(columns, function (x, m) { |
| | | m["width"] = colWidth[x]; |
| | | }); |
| | | } |
| | | option.cols = [columns]; |
| | | if (data1.count == 1) { |
| | | option.data = data1.data; |
| | | option.totalRow = true; |
| | | table.render(option); |
| | | ins = table.render(option); |
| | | //å·æ°è¡¨æ ¼æ°æ® |
| | | DisPlay_HideColumn(); |
| | | layer.close(ajaxLoad); |
| | | } else { |
| | | layer.close(ajaxLoad); |