index.php 33 KB

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