0c90ac4cb577263b5ceb59f732041a3e5b4ddd84.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. var deptName = resolveUrl().dept_id;
  2. function resolveUrl(){
  3. var encondeCondition=window.location.search;
  4. var condition= decodeURI(decodeURI(encondeCondition.substring(1,encondeCondition.length)));
  5. var conditionArr=condition.split("&");
  6. var condJson={};
  7. for(var item in conditionArr){
  8. var temArr=conditionArr[item].split("=");
  9. condJson[temArr[0]]=temArr[1];
  10. }
  11. userInfo = condJson;
  12. return condJson;
  13. };
  14. var myCols1 = [{
  15. display : '0-10kW(台)',
  16. "name" : 'content_min',
  17. minWidth : 60,
  18. width : "12%",render:showMsg
  19. }, {
  20. display : '11-50kW(台)',
  21. "name" : 'content_mid',
  22. minWidth : 60,
  23. width : "12%",render:showMsg
  24. }, {
  25. display : '51kW及以上(台)',
  26. "name" : 'content_max',
  27. minWidth : 60,
  28. width : "12%",render:showMsg
  29. }];
  30. var myCols2 = [{
  31. display : '可调用(台)',
  32. "name" : 'kused',
  33. minWidth : 60,
  34. width : "10%",render:showMsg
  35. }, {
  36. display : '不可调用(台)',
  37. "name" : 'bused',
  38. minWidth : 60,
  39. width : "10%",render:showMsg
  40. }];
  41. var columns = [
  42. { display : '供电局',"name" : 'name',id : 'name',width : "20%",dept_id:'dept_id',align : 'center',render: addStatus , frozen: true},
  43. { display : '按容量分类(台)',columns : myCols1,width : "40%",align : 'center' },
  44. { display : '按可否调用分类(台)',columns : myCols2,width : "40%",align : 'center' },
  45. { display: '总数量(台)', name: 'num', width: "10%", align: 'center' },
  46. { display: '总容量(kW)', name: 'sum', width: "10%", align: 'center' }
  47. ];
  48. var json ="";
  49. var loadData;
  50. /*************************************************** 初始化方法 **********************************************************/
  51. $(function(){
  52. $("body").eq(0).showLoading();
  53. $.post($.pathname()+ "/ws/generator/GeneratorService/getGeneratorStatistics",{id : deptName},function (data){
  54. json = data;
  55. //给表格数据赋值
  56. loadData= data;
  57. //初始化表格
  58. initCompletes(json);
  59. $("body").eq(0).hideLoading();
  60. },"json" );
  61. });
  62. function initCompletes(json){
  63. g = $("#maingrid").quiGrid({
  64. columns: columns,
  65. data:json,
  66. rownumbers : true,
  67. usePager : false
  68. });
  69. //重设高度
  70. // $(parent.document.body).find("iframe").height($(window.document.body).height()+30);
  71. // $(top.document.body).find("iframe").height($(window.document.body).height()+30);
  72. }
  73. function addStatus(rowdata, rowindex, value, column){
  74. var comp_id='"'+rowdata.dept_id+'"';
  75. var name = '"'+value+'"';
  76. return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
  77. }
  78. function newHtml(comp_id,name){
  79. if(name=="总计"){
  80. return;
  81. }else if(deptName==comp_id){
  82. return;
  83. }else{
  84. window.open("/nwyj/page/business/am/resource/ledger/generator-poll1.jsp?"+comp_id);
  85. // window.location.href = "/nwyj/page/business/am/resource/expert/expert-poll.jsp?"+comp_id;
  86. // alert(comp_id);
  87. }
  88. }
  89. function showMsg(rowdata ,rowindex,value,column){
  90. return '<a href="javascript:void(0)" '
  91. + 'onclick=showDetail("'
  92. + rowdata.dept_id
  93. + '",'+'"'+column.name+ '",'+'"'+value+'")>'+value+'</a>';
  94. }
  95. function showDetail(index,name,val){
  96. if(index=="11111"){
  97. return;
  98. }
  99. return top.Dialog.open({URL:"/nwyj/page/business/am/resource/ledger/windowgenerator1.jsp?"+index+"?"+name,ID:"window1",Title:"发电机",ShowMaxButton:true,ShowMinButton:true,Width:1100,Height:500});
  100. }
  101. $.messager=top.Dialog;