Kaynağa Gözat

第四章完结

gzb
guozhongbo 1 yıl önce
ebeveyn
işleme
6e18093b0d
2 değiştirilmiş dosya ile 71 ekleme ve 48 silme
  1. 71
    42
      js/section_4.js
  2. 0
    6
      sections/section_4.html

+ 71
- 42
js/section_4.js Dosyayı Görüntüle

@@ -25,7 +25,7 @@ $(function () {
25 25
       num.push(item.num);
26 26
       xAxis_data.push(item.subjectname);
27 27
     });
28
-      $(".section_4 .subjectviolationMaxNum").text(curclass.classname);
28
+    $(".section_4 .subjectviolationMaxNum").text(curclass.classname);
29 29
     var curseries = [
30 30
       {
31 31
         name: "违纪人数",
@@ -126,79 +126,108 @@ $(function () {
126 126
         '">科目信息</th>',
127 127
       goodTableHeadTr2Html = "<th>姓名</th><th>账号</th>",
128 128
       trHtml = "";
129
-    var surplusheight = pageheight - ($(".section_4 .violationheight").height()); //本页剩余高度
130
-    var henght = 62.5; //表头62.5 一行高27.5
129
+    var surplusheight = pageheight - $(".section_4 .violationheight").height(); //本页剩余高度
130
+    var henght = 62.46,
131
+      row = 27.42; //表头62.46 一行高27.42
131 132
     var pagedaba = {
132
-      0: ""
133
-    }, page = 0;
133
+        0: ""
134
+      },
135
+      page = 0;
134 136
     var maxstu = {
135 137
       num: 0,
136
-      username:""
137
-    }
138
+      username: ""
139
+    };
138 140
     var pagesheight = {
139
-      0:0
140
-    }
141
+      0: 0
142
+    };
141 143
     $.each(list.wjkm, function (idx, item) {
142 144
       goodTableHeadTr2Html += "<th>" + item.subjectname + "</th>";
143 145
     });
144 146
     $.each(list.wjfx, function (idx, item) {
145
-      henght += 27.5;
146
-      pagesheight[page] = 62.5+henght;
147
-      if (page == 0 && (henght > surplusheight || surplusheight - henght < 27.5)) {
147
+      if (
148
+        page == 0 &&
149
+        (henght >= surplusheight || surplusheight - henght <= row)
150
+      ) {
148 151
         // 加第一页
149
-        page++
150
-        henght = 0;
152
+        page++;
153
+        henght = 62.46;
151 154
         pagedaba[page] = "";
152 155
       }
153
-      if (henght > pageheight && surplusheight - henght < 27.5) {
154
-        page++
155
-        henght = 0;
156
+      if (page != 0 && (henght >= pageheight || pageheight - henght <= row)) {
157
+        page++;
158
+        henght = 62.46;
156 159
         pagedaba[page] = "";
157
-        console.log(page);
158 160
       }
161
+      henght += row;
162
+      pagesheight[page] = henght;
159 163
       item.subjectjson = item.subjectjson ? JSON.parse(item.subjectjson) : [];
160 164
       var subject_num = {};
161
-      pagedaba[page] += "<tr><td>" + item.username + "</td><td>" + item.loginname + "</td>";
165
+      pagedaba[page] +=
166
+        "<tr><td>" + item.username + "</td><td>" + item.loginname + "</td>";
162 167
       var num = 0;
163 168
       $.each(item.subjectjson, function (idx, item) {
164 169
         num += item.num;
165 170
         subject_num[item.subjectid] = item.num || 0;
166
-      })
171
+      });
167 172
       if (num > maxstu.num) {
168 173
         maxstu = {
169 174
           num: num,
170
-          username:item.username 
171
-        }
172
-      } else  if (num == maxstu.num){
173
-        maxstu.username+='、'+item.username 
175
+          username: item.username
176
+        };
177
+      } else if (num == maxstu.num) {
178
+        maxstu.username += "、" + item.username;
174 179
       }
175
-      $.each(list.wjkm,function (idx, item){
176
-        pagedaba[page] += "<td>" + (subject_num[item.subjectid]|| 0) + "</td>";
177
-      })
180
+      $.each(list.wjkm, function (idx, item) {
181
+        pagedaba[page] += "<td>" + (subject_num[item.subjectid] || 0) + "</td>";
182
+      });
178 183
     });
179
-    console.log(pagesheight);
180
-    console.log(maxstu);
181
-    var maxstuhtml = '<div class="echarts_result"><div>上图统计结果表示:</div><div class="echarts_result_content"><span class="dot bg_5699FF"></span>违纪行为最多的学生:'+maxstu.username +'</div></div>';
182
-    for (var i = 0; i <= page; i++){
183
-       table[i] = '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
184
-      goodTableHeadTr1Html +
185
-      '</tr><tr class="goodTableHeadTr2">' +
186
-      goodTableHeadTr2Html +
187
-      '</tr></thead><tbody class="goodTableTbody">' +
188
-      pagedaba[i] +
184
+    //高度 89
185
+    var isadd = true;
186
+    var maxstuhtml =
187
+      '<div class="echarts_result"><div>上图统计结果表示:</div><div class="echarts_result_content"><span class="dot bg_5699FF"></span>违纪行为最多的学生:' +
188
+      maxstu.username +
189
+      "</div></div>";
190
+    for (var i = 0; i <= page; i++) {
191
+      table[i] =
192
+        '<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
193
+        goodTableHeadTr1Html +
194
+        '</tr><tr class="goodTableHeadTr2">' +
195
+        goodTableHeadTr2Html +
196
+        '</tr></thead><tbody class="goodTableTbody">' +
197
+        pagedaba[i] +
189 198
         "</tbody></table>";
190 199
       if (i != 0) {
191
-         //添加分页
192
-        $(".page_"+ (i-1)+".section_4").after(
193
-        '<div class="page_root section_4'+' page_'+i+'"></div>'
200
+        //添加分页
201
+        $(".page_" + (i - 1) + ".section_4").after(
202
+          '<div class="page_root section_4' + " page_" + i + '"></div>'
194 203
         );
195
-      $(".page_root.section_4"+'.page_'+i).html(table[i]); 
204
+        $(".page_root.section_4" + ".page_" + i).html(table[i]);
205
+      }
206
+      //添加表格结果数据
207
+      if (i == 0 && surplusheight - pagesheight[i] >= 89) {
208
+        isadd = false;
209
+        $(".section_4 .stuViolationtable").after(
210
+          '<div class="echarts_result resultdata"></div>'
211
+        );
212
+        $(".echarts_result.resultdata").html(maxstuhtml);
213
+      } else if (i != 0 && pageheight - pagesheight[i] >= 89) {
214
+        isadd = false;
215
+        $(".page_" + i + ".section_4 .my_table").after(
216
+          '<div class="page_' + (i + 1) + ' my_result"></div>'
217
+        );
218
+        $(".page_" + (i + 1) + ".my_result").html(maxstuhtml);
196 219
       }
197 220
     }
198 221
     $(".section_4 .stuViolationtable").html(table[0]);
222
+    //添加至新页
223
+    if (isadd) {
224
+      $(".page_" + page).after(
225
+        '<div class="page_root section_4 page_' + (page + 1) + '"></div>'
226
+      );
227
+      $(".page_" + (page + 1) + "").html(maxstuhtml);
228
+    }
199 229
   }
200 230
   var parameter = $(".section_4_html_root").data("page-params");
201 231
   parameter = JSON.parse(parameter);
202 232
   initviolationEcharts(parameter);
203
-  console.log(parameter);
204 233
 });

+ 0
- 6
sections/section_4.html Dosyayı Görüntüle

@@ -39,12 +39,6 @@
39 39
         <h2 class="section_title_2">2. 学生违纪行为统计</h2>
40 40
       </div>
41 41
       <div class="stuViolationtable"></div>
42
-      <!-- <div class="echarts_result">
43
-        <div>上图统计结果表示:</div>
44
-        <div class="echarts_result_content">
45
-          <span class="dot bg_5699FF"></span>违纪行为最多的学生:
46
-        </div>
47
-      </div> -->
48 42
     </div>
49 43
     <script src="../js/section_4.js"></script>
50 44
   </body>

Loading…
İptal
Kaydet