Browse Source

分数段表格数据

gzb
guozhongbo 2 years ago
parent
commit
21319a2d61
1 changed files with 32 additions and 16 deletions
  1. 32
    16
      js/scoreAnalysis/section_2_part.js

+ 32
- 16
js/scoreAnalysis/section_2_part.js View File

108
     //图表数据
108
     //图表数据
109
     var data = JSON.parse(JSON.stringify(obj));
109
     var data = JSON.parse(JSON.stringify(obj));
110
     var calsslist = [];
110
     var calsslist = [];
111
-    var goodTableHeadTr1Html = '<th rowspan="2">班级</th>';
112
-    var goodTableHeadTr2Html = "";
113
-    var goodTableTbodyHtml = "";
111
+    var tableobj = {};
112
+    var num = -1;
114
     $.each(xAxis_data, function (idx, item) {
113
     $.each(xAxis_data, function (idx, item) {
115
-      goodTableHeadTr1Html += '<th colspan="2">' + item + "</th>";
116
-      goodTableHeadTr2Html += "<th>人数</th><th>比例</th>";
114
+      if ((idx + 7) % 7 == 0) {
115
+        num++;
116
+        tableobj[num+"trHtml"] = "";
117
+        tableobj[num + "goodTableHeadTr1Html"] = '<th rowspan="2">班级</th>';
118
+        tableobj[num + "goodTableHeadTr2Html"] = "";
119
+      } 
120
+      tableobj[num + "goodTableHeadTr1Html"] += '<th colspan="2">' + item + "</th>";
121
+      tableobj[num+"goodTableHeadTr2Html"]+= "<th>人数</th><th>比例</th>";
117
     });
122
     });
118
     $.each(data.ranks, function (idx, item) {
123
     $.each(data.ranks, function (idx, item) {
119
       if ($.inArray(item.classname, calsslist) == -1) {
124
       if ($.inArray(item.classname, calsslist) == -1) {
120
         calsslist.push(item.classname);
125
         calsslist.push(item.classname);
121
       }
126
       }
122
     })
127
     })
123
-    $.each(calsslist, function (idx, item) {
124
-      var trHtml = '<td><div class="my_cell">' + item + "</div></td>";
128
+    $.each(calsslist, function (index, items) {
129
+      var num = -1;
125
       var classs = $.grep(data.ranks, function (val) {
130
       var classs = $.grep(data.ranks, function (val) {
126
-        return val.classname == item;
131
+        return val.classname == items;
127
       });
132
       });
128
       $.each(xAxis_data, function (idx, item) {
133
       $.each(xAxis_data, function (idx, item) {
129
         var rank = $.grep(classs, function (val) {
134
         var rank = $.grep(classs, function (val) {
130
           return val.rankname == item;
135
           return val.rankname == item;
131
         })[0];
136
         })[0];
132
-        trHtml +=
137
+        if ((idx + 7) % 7 == 0) {
138
+          num++;
139
+          if (index == 0) {
140
+            tableobj[num + "trHtml"] += "<tr>";
141
+          } else {
142
+            tableobj[num + "trHtml"] += "</tr><tr>";
143
+          }
144
+            tableobj[num+"trHtml"] += '<td><div class="my_cell">' + items + "</div></td>";
145
+       }
146
+        tableobj[num+"trHtml"] +=
133
           '<td><div class="my_cell">' +
147
           '<td><div class="my_cell">' +
134
           rank.stunum +
148
           rank.stunum +
135
           '</div></td><td><div class="my_cell">' +
149
           '</div></td><td><div class="my_cell">' +
136
           rank.sturate +
150
           rank.sturate +
137
           "%</div></td>";
151
           "%</div></td>";
138
       });
152
       });
139
-      goodTableTbodyHtml += "<tr>" + trHtml + "</tr>";
140
        
153
        
141
     })
154
     })
142
-    var table = '  <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
143
-      goodTableHeadTr1Html + '</tr><tr class="goodTableHeadTr2">' +
144
-      goodTableHeadTr2Html + '</tr></thead><tbody class="goodTableTbody">' +
145
-      goodTableTbodyHtml+'</tbody></table>'
155
+    var table = "";
156
+    for (var i = 0; i < num+1; i++){
157
+      table+='  <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
158
+      tableobj[i+"goodTableHeadTr1Html"] + '</tr><tr class="goodTableHeadTr2">' +
159
+      tableobj[i+"goodTableHeadTr2Html"] + '</tr></thead><tbody class="goodTableTbody">' +
160
+      tableobj[i+"trHtml"] + '</tbody></table>'
161
+    }
146
     $(".part_"+ s_index + " .table_"+s_index+" ").html(table);
162
     $(".part_"+ s_index + " .table_"+s_index+" ").html(table);
147
   }
163
   }
148
   var parameter = $(".section_2_html_root .section_2_part_html_root").data(
164
   var parameter = $(".section_2_html_root .section_2_part_html_root").data(
181
       s_item.subjectname +
197
       s_item.subjectname +
182
       '分数段统计</h3><h4 class="section_title_4">3.' +
198
       '分数段统计</h3><h4 class="section_title_4">3.' +
183
       (s_index + 1) +
199
       (s_index + 1) +
184
-      '.1 各分数段分析</h4><div>当前设置分数段:<span class="curscorepart">10</span>分/段</div><div id="classPartEcharts" style="margin: 0 4mm 4mm; height: 80mm"></div><h4 class="section_title_4">3.' +
200
+      '.1 各分数段分析</h4><div>当前设置分数段:<span class="curscorepart">10</span>分/段</div><div id="classPartEcharts" style="margin: 0 4mm 4mm; height: 80mm"></div><h4 h4 class="section_title_4" > 3.' +
185
       (s_index + 1) +
201
       (s_index + 1) +
186
-      '.2 各班等级比例分布</h4><div class="table_'+s_index+'"></div></div > ';
202
+      '.2 各班等级比例分布<z < div class="table_'+s_index+'" ></ ></div > ';
187
     
203
     
188
   });
204
   });
189
   $(".section_2_part_root").html(singleRootHtml);
205
   $(".section_2_part_root").html(singleRootHtml);

Loading…
Cancel
Save