index.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. <link rel="stylesheet" href="/css/cylet.css" />
  2. <style>
  3. .tab-con-btn{
  4. height: 25px;
  5. width: 60px;
  6. background: #666;
  7. border: 0;
  8. border-radius: 15px;
  9. display: inline-block;
  10. text-align: center;
  11. margin-bottom: -7px;
  12. }
  13. .tab_btn{
  14. display: inline-block;
  15. width:30px;
  16. height:25px;
  17. padding: 0;
  18. border: 0;
  19. outline:none;
  20. margin:0;
  21. background: #F2F2F2;
  22. border-radius: 15px;
  23. float: left;
  24. }
  25. .has-sel-2{
  26. background: #F2F2F2;
  27. }
  28. .has-sel-1{
  29. background: #666;
  30. }
  31. .class-modal-body-1{
  32. height: 650px;
  33. overflow: auto;
  34. position: relative;
  35. }
  36. .stu-btn-area{
  37. margin-left:10px!important;
  38. }
  39. </style>
  40. <script>
  41. function getClassByGrade(gradeId,$classId){
  42. $.ajax({
  43. type:'post',
  44. url:'<?php echo $this->createUrl("cylet/getclassbygrade");?>',
  45. async: true,
  46. dataType: 'json',
  47. data:{'grade':gradeId},
  48. success: function (result) {
  49. if(result.status==1){
  50. $('#class').html('<option value="0">全部班级</option>');
  51. for(var i=0;i<result.data.length;i++){
  52. if($.trim($classId)==$.trim(result.data[i]['class_id'])){
  53. html='<option value="'+result.data[i]['class_id']+'" selected>'+result.data[i]['class_name']+'</option>';
  54. }else{
  55. html='<option value="'+result.data[i]['class_id']+'" >'+result.data[i]['class_name']+'</option>';
  56. }
  57. $('#class').append(html);
  58. }
  59. }
  60. },
  61. error: function () {
  62. return;
  63. }
  64. });
  65. }
  66. function changeDisplay(cid,display){
  67. var showAll=$('#display').is(':checked');
  68. if(parseInt(cid)==0){
  69. return false;
  70. }
  71. $.ajax({
  72. type:'post',
  73. url:'<?php echo $this->createUrl("cylet/changestatus");?>',
  74. async: true,
  75. dataType: 'json',
  76. data:{'cid':cid,'display':display},
  77. success: function (result) {
  78. if(result.status==1){
  79. if(display==1){
  80. if(showAll){
  81. $('#'+cid).find('.icon').eq(2).removeClass('icon-eye-close').addClass('icon-xunhuan');
  82. }else{
  83. $('#'+cid).hide();
  84. }
  85. }else{
  86. $('#'+cid).find('.icon').eq(2).removeClass('icon-xunhuan').addClass('icon-eye-close');
  87. $('#'+cid).hide();
  88. }
  89. }
  90. },
  91. error: function () {
  92. return;
  93. }
  94. });
  95. }
  96. </script>
  97. <!-- 导航栏开始-->
  98. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  99. <!-- 导航栏结束-->
  100. <div class="filter">
  101. <?php
  102. $gradeSelect=array(
  103. 0=>'',
  104. 1=>'',
  105. 2=>'',
  106. 3=>''
  107. );
  108. $arts_scienceSelect=array(
  109. 0=>'',
  110. 1=>'',
  111. 2=>'',
  112. );
  113. $cylet_typeSelect=array(
  114. 0=>'',
  115. 1=>'',
  116. 2=>'',
  117. );
  118. if(isset($arts_science)){
  119. $arts_scienceSelect[$arts_science]='selected';
  120. }
  121. if(isset($cylet_type)){
  122. $cylet_typeSelect[$cylet_type]='selected';
  123. }
  124. if(isset($grade)){
  125. $gradeSelect[$grade]='selected';
  126. if($class){
  127. $class=(string)$class;
  128. echo "<script>getClassByGrade(".$grade.",'".$class."');</script>";
  129. }else{
  130. echo "<script>getClassByGrade(".$grade.",0);</script>";
  131. }
  132. }
  133. ?>
  134. <form action="" method="get" name="cylet" id="cyletForm">
  135. <label for="checkbox"><input type="checkbox" name="display" <?php if($display) echo 'checked'?> id="display" value="1"/>显示隐藏试卷</label>
  136. <select name="grade" id="grade">
  137. <option value="0">年级</option>
  138. <?php
  139. if(Yii::app()->params['grade_config']){
  140. foreach (Yii::app()->params['grade_config'] as $id=> $val){
  141. if($grade==$id){
  142. echo '<option value="'.$id.'" selected >'.$val['grade_name'].'</option>';
  143. }else{
  144. echo '<option value="'.$id.'" >'.$val['grade_name'].'</option>';
  145. }
  146. }
  147. }
  148. ?>
  149. </select>
  150. <select name="classId" id="class">
  151. <option value="0">全部班级</option>
  152. </select>
  153. <?php if(Yii::app()->params['section']==1):?>
  154. <select name="arts_science" >
  155. <option value="0">全部</option>
  156. <option value="1" <?php echo $arts_scienceSelect[1] ?>>文科</option>
  157. <option value="2" <?php echo $arts_scienceSelect[2] ?>>理科</option>
  158. </select>
  159. <?php endif;?>
  160. <select name="cylet_type" >
  161. <option value="0">全部统考</option>
  162. <option value="1" <?php echo $cylet_typeSelect[1] ?>>非年级统考</option>
  163. <option value="2" <?php echo $cylet_typeSelect[2] ?>>年级统考</option>
  164. </select>
  165. <button type="button" name="search_btn">搜索</button>
  166. <button type="button" class="fr add_exam" style="margin-right:10px;">
  167. <i class="icon icon-add"></i>
  168. <span style="display: inline-block;vertical-align: middle">添加统考</span>
  169. </button>
  170. </form>
  171. </div>
  172. <div class="list">
  173. <table cellspacing="0" cellpadding="0" >
  174. <thead>
  175. <tr>
  176. <th >序号</th>
  177. <th >年级</th>
  178. <th >统考日期</th>
  179. <th >模式</th>
  180. <?php if(Yii::app()->params['section']==1):?>
  181. <th >科目</th>
  182. <?php endif;?>
  183. <th width="12%">名称</th>
  184. <th >学科</th>
  185. <th>统考类型</th>
  186. <th >已生成班级</th>
  187. <th width="12%">操作</th>
  188. </tr>
  189. </thead>
  190. <tbody>
  191. <?php
  192. if(isset($dataList) && !empty($dataList)):
  193. $i=0;
  194. foreach ($dataList as $val):
  195. $i++;
  196. ?>
  197. <tr id="<?php echo $val['cylet_id']; ?>">
  198. <td><?php echo $i;?></td>
  199. <td class="tl"><?php echo isset(Yii::app()->params['grade_list'][$val['grade']])?Yii::app()->params['grade_list'][$val['grade']]['grade_name']:''?></td>
  200. <td><?php echo date('Y-m-d',$val['create_time'])?></td>
  201. <td><?php
  202. if($val['exam_mode']==1){
  203. echo '新高考3+3';
  204. }elseif($val['exam_mode']==2){
  205. echo ' 新高考3+1+2';
  206. }else{
  207. echo '普通模式';
  208. }
  209. ?></td>
  210. <?php if(Yii::app()->params['section']==1):?>
  211. <td class="tl"><?php echo $val['arts_science']==1?'文科':($val['arts_science']==2?'理科':'不分科')?></td>
  212. <?php endif;?>
  213. <td class="tl"><?php echo $val['title']?></td>
  214. <td>
  215. <div class="tl subjects">
  216. <?php
  217. if($val['SubjectName']):
  218. foreach ($val['SubjectName'] as $v):
  219. ?>
  220. <span><?php echo $v?></span>
  221. <?php endforeach;endif;?>
  222. </div>
  223. </td>
  224. <td class="tl"><?php echo $val['cylet_type']==1?'非年级统考':'<span class="red">年级统考</span>'?></td>
  225. <td class="showClassInfo">
  226. <?php
  227. if($val['classComplete']==$val['classCount']){
  228. echo '<span style="color:green">'.$val['classComplete'].'</span>';
  229. }else{
  230. echo '<span style="color:red">'.$val['classComplete'].'</span>';
  231. }
  232. ?>/<?php echo $val['classCount']?>
  233. </td>
  234. <td>
  235. <i class="icon icon-edit" title="编辑"></i>
  236. <?php if(!$display){?>
  237. <i class="icon icon-download-setting" download="<?php echo $val['downloadBtn']?>" title="报表下载设置"></i>
  238. <?php
  239. }
  240. ?>
  241. <?php
  242. if($val['report_url']){
  243. $report=json_decode($val['report_url'],true);
  244. if(isset($report['errCode']) && $report['errCode']=='00'){
  245. echo '<a href="'.$report['data'].'" ><i class="icon icon-download-file" title="下载"></i></a>';
  246. }else{
  247. echo '<a href="#" ><i class="icon icon-no-download-file" title="'.$report['errMsg'].'"></i></a>';
  248. }
  249. }else{
  250. echo '<i class="icon icon-no-download-file" title="下载"></i>';
  251. }
  252. if($val['is_display']){
  253. echo '<i class="icon icon-xunhuan" title="显示"></i>';
  254. }else{
  255. echo '<i class="icon icon-eye-close" title="隐藏"></i>';
  256. }
  257. ?>
  258. </td>
  259. </tr>
  260. <?php endforeach;endif;?>
  261. <tr>
  262. <td colspan="10" class="page">
  263. <?php
  264. if(isset($pageTotal) && $pageTotal>1){
  265. $StartPage=$page-5;
  266. $EndPage=$page+5;
  267. if($StartPage<1){
  268. $StartPage=1;
  269. }
  270. if($EndPage>$pageTotal){
  271. $EndPage=$pageTotal;
  272. }
  273. ?>
  274. <div class="row" style="padding-top:10px;">
  275. <div class="col-xs-7">
  276. &nbsp;
  277. </div>
  278. <div class="col-xs-5" style="font-size: 16px">
  279. <div class="dataTables_paginate paging_simple_numbers" style="vertical-align:sub;">
  280. <ul id="yw0" class="yiiPager">
  281. <?php
  282. if($page>1){
  283. echo '<li class="previous"><a href="'.$this->createUrl('cylet/index').'?page='.($page-1).'&grade='.$grade.'&classId='.$class.'&arts_science='.$arts_science.'&cylet_type='.$cylet_type.'">上一页</a></li>';
  284. }
  285. for($i=$StartPage;$i<=$EndPage;$i++){
  286. $url=$this->createUrl('cylet/index')."?page=".$i."&grade=".$grade."&classId=".$class.'&arts_science='.$arts_science.'&cylet_type='.$cylet_type;
  287. if($page==$i){
  288. echo '<li class="page selected"><a href="#">'.$i.'</a></li>';
  289. }else{
  290. echo '<li class="page"><a href="'.$url.'">'.$i.'</a></li>';
  291. }
  292. }
  293. if($page<$pageTotal){
  294. echo '<li class="next"><a href="'.$this->createUrl('cylet/index').'?page='.($page+1).'&grade='.$grade.'&classId='.$class.'&arts_science='.$arts_science.'&cylet_type='.$cylet_type.'">下一页</a></li>';
  295. }
  296. }
  297. ?>
  298. </td>
  299. </tr>
  300. </tbody>
  301. </table>
  302. <div class="confirmbox-mask" style="display: none" id="classModal">
  303. <div class="class-modal">
  304. </div>
  305. </div>
  306. <div class="confirmbox-mask" style="display: none" id="classModal-1">
  307. <form name="table_set">
  308. <div class="class-modal-1">
  309. <i class="icon icon-close-1"></i><div class="class-modal-head-1">下载报表</div>
  310. <div class="class-modal-body-1">
  311. <h2>选择下载的报表   <input name="isNative" id="isNative" type="checkbox" checked="checked" value="1" /><span class="red"> 只显示在籍学生</span></h2>
  312. <div class="table_area">
  313. <label><input class="table_1" name="table[]" type="checkbox" checked="checked" value="8" />学科分析表</label>
  314. <label><input class="table_2" name="table[]" type="checkbox" checked="checked" value="9" />总分段人数分析表<span class="c-red-1"></span></label>
  315. <label><input class="table_3" name="table[]" type="checkbox" checked="checked" value="10" />排名段人数分析表<span class="c-red-1"></span></label>
  316. <label><input class="table_4" name="table[]" type="checkbox" checked="checked" value="11" />班级对比分析表</label>
  317. <label><input class="table_5" name="table[]" type="checkbox" checked="checked" value="5" />年级成绩分析表</label>
  318. <label><input class="table_6" name="table[]" type="checkbox" checked="checked" value="7" />班级成绩分析表</label>
  319. <label><input class="table_7" name="table[]" type="checkbox" value="13" />赋分规则表</label>
  320. </div>
  321. <label class="checkAll"><input class="select_all" type="checkbox" checked="checked" />全选</label>
  322. <div class="class_area">
  323. </div>
  324. <h2>报表下载设置</h2>
  325. <h3 class="tit-sub-intro">总分段人数分析表(请按分数进行分段):<span class="fr">注:分段包含右边界值</span></h3>
  326. <div class="clearfix">
  327. <div class="fl">
  328. <div class="dib vtm table_set_1">
  329. <input type="hidden" name="max_score" value="">
  330. <span class="score-inp-list"><input type="text" class="subsection" name="score_0" srcvalue="" value="">-</span>
  331. <span class="score-inp-list"><input type="text" class="subsection" name="score_1" srcvalue="" value="">-</span>
  332. <span class="score-inp-list"><input type="text" class="subsection" name="score_2" srcvalue="" value="">-</span>
  333. <span class="score-inp-list"><input type="text" class="subsection" name="score_3" srcvalue="" value="">-</span>
  334. <span class="score-inp-list"><input type="text" class="subsection" name="score_4" srcvalue="" value="">-</span>
  335. <span class="score-inp-list"><input type="text" class="subsection" name="score_5" srcvalue="" value="">-</span>
  336. <span class="score-inp-list"><input type="text" class="subsection" name="score_6" srcvalue="" value="">-</span>
  337. <span class="score-inp-list"><input type="text" class="subsection" name="score_7" srcvalue="" value="">-</span>
  338. <span class="score-inp-list"><input type="text" class="subsection" name="score_8" srcvalue="" value="">-</span>
  339. <span class="score-inp-list"><input type="text" class="subsection" name="score_9" srcvalue="" value="">-</span>
  340. </div>
  341. 0<input type="hidden" name="score_10" value="0">
  342. </div>
  343. <div class="fr">
  344. <span class="dib pointer vtm reduce-btn">-</span>
  345. <span class="dib pointer vtm add-btn">+</span>
  346. <img src="/images/del-icon.png" alt="" class="del-icon pointer vtm">
  347. </div>
  348. </div>
  349. <h3 class="table_set_2">排名段人数分析表(请按名次进行分段):<span class="fr">注:分段包含右边界值</span></h3>
  350. <div class="table_set_2">
  351. 1-
  352. <input type="hidden" name="count_10" value="1">
  353. <input type="text" class="subsection" name="count_9" srcvalue="" value="">-
  354. <input type="text" class="subsection" name="count_8" srcvalue="" value="">-
  355. <input type="text" class="subsection" name="count_7" srcvalue="" value="">-
  356. <input type="text" class="subsection" name="count_6" srcvalue="" value="">-
  357. <input type="text" class="subsection" name="count_5" srcvalue="" value="">-
  358. <input type="text" class="subsection" name="count_4" srcvalue="" value="">-
  359. <input type="text" class="subsection" name="count_3" srcvalue="" value="">-
  360. <input type="text" class="subsection" name="count_2" srcvalue="" value="">-
  361. <input type="text" class="subsection" name="count_1" srcvalue="" value="">-
  362. <input type="hidden" name="count_0" srcvalue="" value="0">
  363. <span class="max_count"></span>
  364. </div>
  365. <div class="btn_area">
  366. 过滤0分考生
  367. <input type="radio" name="removeZeroStudent" value="1">是
  368. <input type="radio" name="removeZeroStudent" value="0" checked>否
  369. </div>
  370. <div class="btn_area">
  371. 班级分析模式
  372. <input type="radio" name="clazzAnalysisMode" value="1" checked>行政班
  373. <?php if( Yii::app()->params['section']==1):?>
  374. <input type="radio" name="clazzAnalysisMode" value="2" >教学班
  375. <?php endif;?>
  376. </div>
  377. <div class="waiyu_data">
  378. </div>
  379. <div class="btn_area">
  380. <p>学生信息显示:</p>
  381. <input type="checkbox" name='hasStudentNo' class='stu-btn-area'value='0'>学号
  382. <input type="checkbox" name='hasStudentSystemCard' class='stu-btn-area' value='0'>系统准考证号
  383. <input type="checkbox" name='hasStudentSchoolCard' class='stu-btn-area' value='0'>学校准考证号
  384. <input type="checkbox" name='hasIdNumber' class='stu-btn-area' value='0'>身份证号码
  385. </div>
  386. <div class="btn_area">
  387. <p>*下载表格较多时,可能会受到网络影响导致下载较慢,请耐心等待</p>
  388. <button class="cancel">取消</button>
  389. <button class="download">发送设置</button>
  390. <input type="hidden" name="cylet_id" value="">
  391. </div>
  392. </div>
  393. </div>
  394. </form>
  395. </div>
  396. </div>
  397. <script>
  398. $(function(){
  399. if ($('.table_set_1').find('.subsection').length==10) {
  400. // 如果输入框是10个,添加按钮禁用
  401. $('.add-btn').addClass('forbidden');
  402. }
  403. // 减少按钮
  404. $('.reduce-btn').click(function(){
  405. var inpLength = $('.table_set_1').find('.score-inp-list').length;
  406. if (inpLength==2) {
  407. return;
  408. }
  409. $('.table_set_1').find('.score-inp-list').eq(inpLength-1).remove();
  410. $('.add-btn').removeClass('forbidden');
  411. if ($('.table_set_1').find('.score-inp-list').length==2) {
  412. $(this).addClass('forbidden');
  413. }
  414. })
  415. // 添加按钮
  416. $('.add-btn').click(function(){
  417. var inpLength = $('.table_set_1').find('.score-inp-list').length,pendStr = '<span class="score-inp-list"><input type="text" class="subsection" name="score_'+inpLength+'" value="">-</span>';
  418. if (inpLength==10) {
  419. return;
  420. }
  421. $('.table_set_1').append(pendStr);
  422. $('.reduce-btn').removeClass('forbidden');
  423. if ($('.table_set_1').find('.score-inp-list').length==10) {
  424. $(this).addClass('forbidden');
  425. }
  426. })
  427. // 删除按钮
  428. $('.del-icon').click(function(){
  429. $('.table_set_1').find('input').val('')
  430. })
  431. $('select[name="grade"]').change(function(){
  432. var grade=$(this).val();
  433. getClassByGrade(grade,0);
  434. });
  435. $('button[name="search_btn"]').click(function(){
  436. var grade_id=$('#grade').val(),
  437. class_id=$('#class').val();
  438. /*
  439. if(grade_id==0){
  440. layer.msg('请选择年级!', {
  441. icon: 2,
  442. time: 2000 //2秒关闭(如果不配置,默认是3秒)
  443. });
  444. return false;
  445. }
  446. */
  447. $('#cyletForm').submit();
  448. });
  449. $('.list').on('click','.icon-xunhuan',function (){
  450. var cylet_id=$(this).closest('tr').attr('id');
  451. layer.msg('您确定恢复这次统考吗?', {
  452. time: 0,
  453. btn: ['确定', '取消'],
  454. yes: function(index){
  455. layer.close(index);
  456. changeDisplay(cylet_id,0);
  457. }
  458. });
  459. }).on('click','.icon-eye-close',function(){
  460. var cylet_id=$(this).closest('tr').attr('id');
  461. layer.msg('您确定隐藏这次统考吗?', {
  462. time: 0,
  463. btn: ['确定', '取消'],
  464. yes: function(index){
  465. layer.close(index);
  466. changeDisplay(cylet_id,1);
  467. }
  468. });
  469. }).on('click','.showClassInfo',function(){
  470. var cylet_id=$(this).closest('tr').attr('id');
  471. $.ajax({
  472. url:'<?php echo $this->createUrl('cylet/getclassinfo')?>',
  473. type:'POST',
  474. dataType:'json',
  475. data:{'cid':cylet_id},
  476. success:function(res){
  477. if(res.status==1){
  478. $('.class-modal').html(res.html);
  479. classModal.style.display = 'block';
  480. }
  481. }
  482. });
  483. }).on('click','.icon-close',function(){
  484. classModal.style.display = 'none';
  485. });
  486. $('.icon-edit').click(function () {
  487. var id=$(this).closest('tr').attr('id');
  488. window.location.href="<?php echo $this->createUrl('cylet/edit')?>?cid="+id;
  489. });
  490. $('.add_exam').click(function(){
  491. window.location.href="<?php echo $this->createUrl('cylet/edit')?>";
  492. });
  493. $('.icon-close-1,.cancel').click(function(){
  494. resetTable();
  495. $('.table_2').parent().removeClass('disabled');
  496. $('.table_2').parent().find('span').html('');
  497. $('.table_2').attr('disabled',false);
  498. $('.table_2').prop('checked',true);
  499. $('.table_set_1').removeClass('disabled');
  500. $('.table_set_1 input').attr('readonly',false);
  501. $('.table_set_1 input').val('');
  502. $('.table_3').parent().removeClass('disabled');
  503. $('.table_3').prop('checked',true);
  504. $('.table_3').parent().find('span').html('');
  505. $('.table_3').attr('disabled',false);
  506. $('.table_set_2').removeClass('disabled');
  507. $('.table_set_2 input').attr('readonly',false);
  508. $('.table_set_2 input').val('');
  509. $('#classModal-1').hide();
  510. return false;
  511. });
  512. $('.select_all').click(function(){
  513. if($(this).is(':checked')) {
  514. $(".classlist").prop("checked", true);
  515. $('.table_6').prop('checked',true);
  516. }else {
  517. $(".classlist").prop("checked", false);
  518. $('.table_6').prop('checked',false);
  519. }
  520. });
  521. $('.icon-download-setting').click(function(){
  522. var cylet_id=$(this).closest('tr').attr('id');
  523. var compete=$(this).closest('tr').find('.showClassInfo span').eq(0).html();
  524. var download=$(this).attr('download');
  525. if(download==0){
  526. layer.msg('暂时还没有可以生成报告的班级');
  527. return false;
  528. }
  529. var ii=layer.msg('正在加载统考数据,请稍候......',{time:0});
  530. $.ajax({
  531. url:'<?php echo $this->createUrl('cylet/loadcyletinfo')?>',
  532. type:'POST',
  533. dataType:'json',
  534. data:{'cylet_id':cylet_id},
  535. success:function(res){
  536. layer.close(ii);
  537. $('.select_all').prop('checked',true);
  538. $('#classModal-1').show();
  539. $('#classModal-1').find('.total_score').html(res.score);
  540. $('input[name=score_0]').val(res.score);
  541. $('input[name=score_0]').attr('srcvalue',res.score);
  542. $('input[name=max_score]').val(res.score);
  543. $('#classModal-1').find('.max_count').html(res.student_count);
  544. $('input[name=count_0]').val(res.student_count);
  545. $('input[name=score_10]').val(0);
  546. $('input[name=count_10]').val(1);
  547. for(var i=0;i<res.score_section.length;i++){
  548. $('input[name=score_'+(i+1)+']').val(res.score_section[i]);
  549. $('input[name=score_'+(i+1)+']').attr('srcvalue',res.score_section[i]);
  550. }
  551. for(var i=0;i<res.count_section.length;i++){
  552. $('input[name=count_'+(i+1)+']').val(res.count_section[i]);
  553. $('input[name=count_'+(i+1)+']').attr('srcvalue',res.count_section[i]);
  554. }
  555. class_area_html='';
  556. for(var i=0;i<res.class.length;i++){
  557. class_area_html+='<label><input class="classlist" name="classlist[]" type="checkbox" checked="checked" value="'+res.class[i]['class_id']+'" />'+res.class[i]['class_name']+'</label>';
  558. }
  559. $('.class_area').html(class_area_html);
  560. if(res.score_section.length==0){
  561. //$('.table_2').click();
  562. $('.table_2').attr('checked',false);
  563. $('.table_2').parent().addClass('disabled');
  564. $('.table_2').parent().find('span').html('分数太小,不可分段');
  565. $('.table_2').attr('disabled',true);
  566. $('.table_set_1').addClass('disabled');
  567. $('.table_set_1 input').attr('readonly',true);
  568. }
  569. if(res.count_section.length==0){
  570. // $('.table_3').click();
  571. $('.table_3').attr('checked',false);
  572. $('.table_3').parent().addClass('disabled');
  573. $('.table_3').parent().find('span').html('名次太少,不可分段');
  574. $('.table_3').attr('disabled',true);
  575. $('.table_set_2').addClass('disabled');
  576. $('.table_set_2 input').attr('readonly',true);
  577. }
  578. if(res.is_has_english==1){
  579. $('.english_ratio').show();
  580. }else{
  581. $('.english_ratio').hide();
  582. $('input[name=ratio_switch]').val(0);
  583. }
  584. if(res.score_report==1){
  585. $('.table_7').parent().show();
  586. }else{
  587. $('.table_7').parent().hide();
  588. }
  589. $('input[name=cylet_id]').val(cylet_id);
  590. //展示外语学科
  591. if(res.waiData){
  592. var wai_html='';
  593. $.each(res.waiData,function(k,v){
  594. wai_html += '<div class="btn_area english_ratio">';
  595. wai_html += v.subject_name+'系数';
  596. wai_html += ' <div class="tab-con-btn">';
  597. wai_html += ' <div class="tab_btn has-sel-2" ></div>';
  598. wai_html += ' <div class="tab_btn has-sel-1" ></div>';
  599. wai_html += ' </div>';
  600. wai_html += ' <input type="text" value="1.25" name="ratio[]" disabled style="width: 40px">';
  601. wai_html =wai_html+ ' <input type="radio" value="1" class="decimal" checked name="decimal'+v.subject_id+'" disabled >保留小数';
  602. wai_html =wai_html+ ' <input type="radio" value="0" class="decimal" name="decimal'+v.subject_id+'" disabled >保留整数';
  603. wai_html += ' <input type="hidden" name="ratio_switch[]" value="0">';
  604. wai_html += ' <input type="hidden" name="subject_id[]" disabled value="'+v.subject_id+'">';
  605. wai_html += '</div>';
  606. });
  607. wai_html+='<div class="btn_area">&nbsp;&nbsp;&nbsp;&nbsp;启用系数后,外语学科会另外提供换算后的总分成绩(原始分×系数)</div>';
  608. $(".waiyu_data").html(wai_html);
  609. }
  610. }
  611. });
  612. });
  613. $('.download').click(function(){
  614. var selectTableNum=0,selectClassNum=0;
  615. //var table=$('form[name=table_set]').serializeArray();
  616. for(var i=0;i<$('.table_area input').length;i++){
  617. if($('.table_area input').eq(i).is(':Checked')==true){
  618. selectTableNum++;
  619. }
  620. }
  621. if(selectTableNum==0){
  622. layer.msg('请选择下载的报表类型');
  623. return false;
  624. }
  625. if($('.table_6').is(':checked')){
  626. for(var i=0;i<$('.classlist').length;i++){
  627. if($('.classlist').eq(i).is(':Checked')==true){
  628. selectClassNum++;
  629. }
  630. }
  631. if(selectClassNum==0){
  632. layer.msg('请选择班级成绩分析表对应的班级');
  633. return false;
  634. }
  635. }
  636. //验证分数段
  637. var inpLength = $('.table_set_1').find('.score-inp-list').length;
  638. for(var i=0;i<inpLength;i++){
  639. if($('.table_set_1').find('.score-inp-list').eq(i).find('input').val()==''){
  640. layer.msg('分数段设置不正确');
  641. return false;
  642. }
  643. }
  644. //校验系数
  645. var ratio_switch=$('input[name=ratio_switch]').val();
  646. if(ratio_switch==1){
  647. var ratio=parseFloat($('input[name=ratio]').val());
  648. if(ratio<=0){
  649. layer.msg('英语系数值不正确');
  650. return false;
  651. }
  652. }
  653. var ii=layer.msg('报告设置保存中,请稍候。。。。。',{time:0});
  654. $.ajax({
  655. url:'<?php echo $this->createUrl('cylet/downloadtable')?>',
  656. type:'POST',
  657. dataType:'json',
  658. data:$('form[name=table_set]').serializeArray(),
  659. success:function(res){
  660. if(res.status==1){
  661. $('.icon-close-1,.cancel').click();
  662. layer.close(ii)
  663. layer.msg("报告已转入后台生成,请稍后刷新页面下载",{time:3000})
  664. }else{
  665. layer.msg(res.result);
  666. }
  667. }
  668. });
  669. return false;
  670. });
  671. $('.table_2').click(function(){
  672. if($(this).is(':Checked')==false){
  673. $('.table_set_1').addClass('disabled');
  674. $('.table_set_1 input').attr('readonly',true);
  675. }else{
  676. $('.table_set_1').removeClass('disabled');
  677. $('.table_set_1 input').attr('readonly',false);
  678. }
  679. });
  680. $('.table_3').click(function(){
  681. if($(this).is(':Checked')==false){
  682. $('.table_set_2').addClass('disabled');
  683. $('.table_set_2 input').attr('readonly',true);
  684. }else{
  685. $('.table_set_2').removeClass('disabled');
  686. $('.table_set_2 input').attr('readonly',false);
  687. }
  688. });
  689. $('.table_6').click(function(){
  690. if($(this).is(':Checked')==false){
  691. $('.class_area').addClass('disabled');
  692. $('.class_area input').attr('disabled',true);
  693. $('.checkAll').addClass('disabled');
  694. $('.checkAll input').attr('disabled',true);
  695. }else{
  696. $('.class_area').removeClass('disabled');
  697. $('.class_area input').attr('disabled',false);
  698. $('.checkAll').removeClass('disabled');
  699. $('.checkAll input').attr('disabled',false);
  700. }
  701. });
  702. $('.class_area').on('click','.classlist',function(){
  703. var selectNum=0,noSelectNum=0;
  704. for(var i=0;i<$('.classlist').length;i++){
  705. if($('.classlist').eq(i).is(':Checked')==true){
  706. selectNum++;
  707. }else{
  708. noSelectNum++;
  709. }
  710. }
  711. if(selectNum>0){
  712. $('.table_6').prop('checked',true);
  713. }
  714. if(selectNum==$('.classlist').length){
  715. $('.select_all').prop('checked',true);
  716. }
  717. if(noSelectNum==$('.classlist').length){
  718. $('.select_all').prop('checked',false);
  719. }
  720. });
  721. $('.table_area').on('click','input',function(){
  722. var selectNum=0,noSelectNum=0;
  723. for(var i=0;i<$('.table_area input').length;i++){
  724. if($('.table_area input').eq(i).is(':Checked')==true){
  725. selectNum++;
  726. }else{
  727. noSelectNum++;
  728. }
  729. }
  730. if(noSelectNum==$('.table_area input').length){
  731. $('.download').prop('disabled',true);
  732. $('.download').addClass('disabled');
  733. }else{
  734. $('.download').prop('disabled',false);
  735. $('.download').removeClass('disabled');
  736. }
  737. });
  738. $(document).on('change','.table_set_1 input',function() {
  739. var prev_value=parseInt($(this).closest('span').prev('span').find('input').val()),this_value=parseInt($(this).val());
  740. var next_value=parseInt($(this).closest('span').next('span').find('input').val());
  741. var max_score=parseInt($('input[name=max_score]').val());
  742. if(this_value=='' || this_value==0 || isNaN(this_value)){
  743. layer.msg('分段数值设置不正确,请重新输入');
  744. $(this).val($(this).attr('srcvalue'));
  745. $(this).focus();
  746. return false;
  747. }
  748. if((!isNaN(prev_value) && this_value>=prev_value) || this_value>max_score){
  749. layer.msg('分段数值设置不正确,请重新输入');
  750. $(this).val($(this).attr('srcvalue'));
  751. $(this).focus();
  752. }else if(this_value<=next_value){
  753. layer.msg('分段数值设置不正确,请重新输入');
  754. $(this).val($(this).attr('srcvalue'));
  755. $(this).focus();
  756. }else{
  757. $(this).attr('srcvalue',this_value);
  758. }
  759. });
  760. //获取下一组数值
  761. function getNextValue(obj){
  762. var index=$('.score-inp-list').index(obj.closest('.score-inp-list'));
  763. var length=$('.score-inp-list').length;
  764. while (index<length){
  765. index++;
  766. value=$('.score-inp-list').eq(index).find('input').val();
  767. if(value!=''){
  768. return value;
  769. }
  770. }
  771. return 0;
  772. }
  773. //获取前一组数值
  774. function getPrevValue(obj){
  775. var index=$('.score-inp-list').index(obj.closest('.score-inp-list'));
  776. while (index>0){
  777. index--;
  778. value=$('.score-inp-list').eq(index).find('input').val();
  779. if(value!=''){
  780. return value;
  781. }
  782. }
  783. return 0;
  784. }
  785. $('.table_set_2').find('input').change(function(){
  786. var prev_value=parseInt($(this).prev('input').val()),this_value=parseInt($(this).val());
  787. var next_value=parseInt($(this).next('input').val());
  788. if(this_value<=prev_value || $(this).val()==''){
  789. layer.msg('排名段数值设置不正确,请重新输入');
  790. $(this).val($(this).attr('srcvalue'));
  791. $(this).focus();
  792. }else if(this_value>=next_value){
  793. layer.msg('排名数值设置不正确,请重新输入');
  794. $(this).val($(this).attr('srcvalue'));
  795. $(this).focus();
  796. }else{
  797. $(this).attr('srcvalue',this_value);
  798. }
  799. });
  800. function resetTable(){
  801. $('.table_area').find('input').prop('checked',true);
  802. $('.class_area').html('');
  803. $('.class_area').removeClass('disabled');
  804. $('.checkAll').removeClass('disabled');
  805. $('.checkAll input').attr('disabled',false);
  806. $('.download').removeClass('disabled');
  807. $('.download').prop('disabled',false);
  808. $('.has-sel-2').click();
  809. $('input[name=ratio]').val(1.25);
  810. }
  811. $("body").on("click",".has-sel-1",function(){
  812. // $('.has-sel-1').click(function(){ //开 #01B677
  813. $(this).parent().find('.has-sel-2').css('background','#01B677');
  814. $(this).parent().css('background','#01B677');
  815. $(this).css('background','#F2F2F2');
  816. $(this).parent().parent().find('input[name="ratio[]"]').attr('disabled',false);
  817. $(this).parent().parent().find('input[name="ratio_switch[]"]').val(1);
  818. $(this).parent().parent().find('input[name="subject_id[]"]').attr('disabled',false);
  819. $(this).closest('.english_ratio').find('.decimal').attr('disabled',false);
  820. });
  821. $("body").on("click",".has-sel-2",function(){
  822. // $('.has-sel-2').click(function(){ //关
  823. $(this).parent().find('.has-sel-1').css('background','#666');
  824. $(this).parent().css('background','#666');
  825. $(this).css('background','#F2F2F2');
  826. $(this).parent().parent().find('input[name="ratio[]"]').attr('disabled',true);
  827. $(this).parent().parent().find('input[name="ratio_switch[]"]').val(0);
  828. $(this).parent().parent().find('input[name="subject_id[]"]').attr('disabled',true);
  829. $(this).closest('.english_ratio').find('.decimal').attr('disabled',true);
  830. });
  831. $("body").on("click",".stu-btn-area",function(){
  832. if($(this).is(":checked")){
  833. $(this).val(1);
  834. }else{
  835. $(this).val(0);
  836. }
  837. });
  838. });
  839. </script>