From d36acc3d1349ee8e720c2e3cd6ccb43693275349 Mon Sep 17 00:00:00 2001 From: cxdbz Date: Sat, 11 May 2019 20:09:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/chengji/controller/Tongji.php | 2 +- application/chengji/view/tongji/tj_banji.html | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/application/chengji/controller/Tongji.php b/application/chengji/controller/Tongji.php index 5eb7856e..eb910d43 100644 --- a/application/chengji/controller/Tongji.php +++ b/application/chengji/controller/Tongji.php @@ -19,7 +19,7 @@ class Tongji extends Base ,'ksSubject'=>function($query){ $query->field('kaoshiid,subjectid') ->with(['subjectName'=>function($q){ - $q->field('id,jiancheng,lieming'); + $q->field('id,title,lieming'); }] ); } diff --git a/application/chengji/view/tongji/tj_banji.html b/application/chengji/view/tongji/tj_banji.html index 54bbb637..bf0f68f6 100644 --- a/application/chengji/view/tongji/tj_banji.html +++ b/application/chengji/view/tongji/tj_banji.html @@ -73,32 +73,36 @@ options.url = "{:url('ajaxBianji')}"; // 设置列 options.cols=[[ //表头 - {type:'numbers',title:'序号'}, - {field: 'school', title: '学校',sort: true}, - {field: 'banji', title: '班级',sort: true}, - ]]; + {type:'numbers',title:'序号',rowspan:2}, + {field: 'school', title: '学校',sort: true,minWidth:80,rowspan:2}, + {field: 'banji', title: '班级',sort: true,minWidth:100,rowspan:2}, + ] + ,[] + ]; // 获取学科 var xk = ''; xk = eval(decodeURIComponent(xk)); var xiangmu = {cnt:'人数',avg:'平均分',youxiu:'优秀率',jige:'及格率'}; // 要显示哪些统计结果 $.each(xk,function(index,value){ + options.cols[0].push({title: xk[index].subject_name.title,colspan:4,align:'center'}); $.each(xiangmu,function(i,val){ var colname = xk[index].subject_name.lieming; // console.log(colname + ' ' + i); var colinfo = { title:val ,sort:true + ,minWidth:100 ,templet:function(d){ var str = d.chengji[colname][i]; return str; } }; - options.cols[0].push(colinfo); + options.cols[1].push(colinfo); }); }); - options.cols[0].push({ title: '总平均分',sort: true,templet:function(d){ + options.cols[0].push({ title: '总平均分',sort: true,minWidth:100,rowspan:2,templet:function(d){ var str = d.chengji.avg; return str; }}); @@ -110,6 +114,8 @@ ,nianji:"{$list.nianji}" } + options.autoSort=true; + // 提交搜索条件后重载表格