edit.php 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685
  1. <script src="/js/jquery.datetimepicker.js"></script>
  2. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  3. <link rel="stylesheet" href="/css/modelCreatePaper.css" />
  4. <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
  5. <link rel="stylesheet" href="/css/third/base.css" />
  6. <style>
  7. #choose-error{color: #FF0000;}
  8. #examName-error{color: #FF0000;}
  9. #classIds-error{color: #FF0000;}
  10. #type-error{color: #FF0000;}
  11. #markType-error{color: #FF0000;}
  12. #subject-error{color: #FF0000;}
  13. #examDate{color: #FF0000;}
  14. .form {
  15. font-size: 14px;
  16. font-weight: bold;
  17. color: #999999;
  18. margin: 20px;
  19. }
  20. .form-item {
  21. margin-bottom: 20px;
  22. white-space: nowrap;
  23. }
  24. .form-item-label {
  25. width: 110px;
  26. text-align: right;
  27. display: inline-block;
  28. margin-right: 5px;
  29. vertical-align: top;
  30. }
  31. .form-item-input {
  32. width: 230px;
  33. height: 28px;
  34. text-indent: 5px;
  35. border: 1px solid #aeaeae;
  36. border-radius: 3px;
  37. outline: none;
  38. box-sizing: border-box;
  39. }
  40. .form-item-con {
  41. display: inline-block;
  42. }
  43. .form-item-con > div {
  44. margin-bottom: 5px;
  45. }
  46. .form-item-con .checkbox {
  47. display: inline-block;
  48. margin-right: 5px;
  49. }
  50. .form .date {
  51. display: inline-block;
  52. width: 100px;
  53. }
  54. .form .date span {
  55. color: #333333;
  56. }
  57. .form .classes {
  58. color: #666;
  59. }
  60. button {
  61. border: none;
  62. background: #2977ff;
  63. width: 111px;
  64. height: 36px;
  65. border-radius: 3px;
  66. font-size: 14px;
  67. color: #fff;
  68. outline: none;
  69. cursor: pointer;
  70. }
  71. button.save {
  72. display: block;
  73. margin: 40px auto;
  74. width:150px;
  75. }
  76. .confirmbox {
  77. background: #fff;
  78. border: 1px solid #cccccc;
  79. border-radius: 3px;
  80. padding: 40px 40px 30px;
  81. text-align: center;
  82. position: fixed;
  83. left: 50%;
  84. top: 50%;
  85. transform: translate(-50%, -50%);
  86. z-index: 99;
  87. }
  88. .confirmbox-mask {
  89. background: rgba(0, 0, 0, .7);
  90. left: 0;
  91. right: 0;
  92. top: 0;
  93. bottom: 0;
  94. z-index: 99;
  95. position: fixed;
  96. display: none;
  97. }
  98. .confirmbox .confirmbox-btns {
  99. margin-top: 40px;
  100. }
  101. .confirmbox .confirmbox-btns button {
  102. margin-right: 10px;
  103. }
  104. .fl {
  105. float: left;
  106. }
  107. .fr {
  108. float: right;
  109. }
  110. .subject-name {
  111. display: inline-block;
  112. padding: 3px 8px;
  113. background: #ff9900;
  114. border-radius: 3px;
  115. color: #ffffff;
  116. font-size: 12px;
  117. }
  118. .tag {
  119. display: inline-block;
  120. padding: 3px 8px;
  121. border-radius: 3px;
  122. color: #ffffff;
  123. font-size: 12px;
  124. cursor: pointer;
  125. }
  126. .bg-green {
  127. background: #2977ff;
  128. }
  129. .bg-gray {
  130. background: #999;
  131. }
  132. .mt5 {
  133. margin-top: 5px;
  134. }
  135. .icon {
  136. display: inline-block;
  137. background: center/contain no-repeat;
  138. width: 25px;
  139. height: 25px;
  140. cursor: pointer;
  141. vertical-align: middle;
  142. }
  143. .icon-question {
  144. background-image: url("/images/question.png")
  145. }
  146. .same_exam_list{position:relative;}
  147. .close_icon{
  148. background:url("/images/close_icon.png") left center no-repeat;
  149. width:20px;
  150. height:20px;
  151. display: inline-block;
  152. position: absolute;
  153. left:-40px;
  154. top:5px;
  155. cursor: pointer;
  156. }
  157. .tooltip1{
  158. display: inline-block;
  159. position: relative;
  160. text-decoration: none;
  161. color: #333333;
  162. }
  163. .tooltip1:hover .tooltip-con{
  164. display: block;
  165. }
  166. .tooltip-con{
  167. display: none;
  168. border-radius: 3px;
  169. padding: 15px;
  170. border: 1px solid #333333;
  171. position: absolute;
  172. left: 35px;
  173. top: 60%;
  174. transform: translateY(-50%);
  175. width: 300px;
  176. background: #ffffff;
  177. }
  178. .tooltip-con:before{
  179. content: '';
  180. display: block;
  181. border: 6px solid transparent;
  182. border-right-color: #333;
  183. position: absolute;
  184. left: -13px;
  185. top: 50%;
  186. transform: translateY(-50%);
  187. }
  188. .tooltip-con:after{
  189. content: '';
  190. display: block;
  191. border: 6px solid transparent;
  192. border-right-color: #ffffff;
  193. position: absolute;
  194. left: -12px;
  195. top: 50%;
  196. transform: translateY(-50%);
  197. }
  198. .c-red{
  199. color: #CC3300
  200. }
  201. .selectClass{
  202. color: red;
  203. font-size:14px;
  204. width: 50%;
  205. padding-left:50px;
  206. }
  207. .subject_list{
  208. display:none;
  209. }
  210. #trial_begin_time_test{
  211. margin-left:-10px;
  212. }
  213. .mlr5{
  214. margin: 0 5px;
  215. }
  216. .classes{
  217. vertical-align: text-top;
  218. white-space: normal;
  219. }
  220. .classes div{
  221. display: inline-block;
  222. vertical-align: top;
  223. max-width: 500px;
  224. }
  225. .classes span{
  226. word-break: keep-all;
  227. display: inline-block;
  228. }
  229. .gray{color:#444444}
  230. .check_subject{margin-right:10px;}
  231. #a_s{display:none}
  232. /*修改样式开始*/
  233. .form-item_name{
  234. line-height: 28px;
  235. }
  236. .form-item-input_name{
  237. text-indent: 26px;
  238. }
  239. .name-tips{
  240. position: relative;
  241. left: 18px;
  242. bottom: 2px;
  243. }
  244. .test-type-ties{
  245. /*display: inline-block;
  246. margin: 0 12px;*/
  247. color: red;
  248. }
  249. .icon-test-type-ties{
  250. margin: 0 12px;
  251. margin-top: -3px;
  252. vertical-align: middle;
  253. }
  254. .form-item-con{
  255. color: #333;
  256. }
  257. .class-tips{
  258. vertical-align: middle;
  259. margin: 0 4px;
  260. }
  261. .class-box{
  262. width: 500px;
  263. }
  264. .class-box>p{
  265. margin-bottom: 10px;
  266. }
  267. .class-box>ul{
  268. width: 500px;
  269. height: 200px;
  270. padding: 10px 20px;
  271. background-color: #FAFAFA;
  272. box-sizing: border-box;
  273. border:1px solid #ddd;
  274. }
  275. .class-box>ul>li{
  276. float: left;
  277. margin-right: 15px;
  278. margin-bottom: 10px;
  279. cursor: pointer;
  280. }
  281. .class-box>ul>li>img{
  282. vertical-align: middle;
  283. margin-left: 3px;
  284. }
  285. .icon-change{
  286. margin: 0 37px;
  287. margin-top: 110px;
  288. }
  289. .red-tips{
  290. color: red;
  291. }
  292. button.save {
  293. height: 40px;
  294. }
  295. .selected-box li{
  296. color:#2977ff;
  297. }
  298. /*修改样式结束*/
  299. </style>
  300. <!-- 导航栏开始-->
  301. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  302. <!-- 导航栏结束-->
  303. <div class="page-content">
  304. <form action="<?php echo $this->createUrl('cylet/save')?>" class="form" method="post">
  305. <div class="form-item">
  306. <label class="form-item-label">
  307. 统考名称
  308. </label>
  309. <input type="text" name="title" class="form-item-input" placeholder="必填" value="<?php if(isset($formInfo['title'])) echo $formInfo['title']?>">
  310. </div>
  311. <div class="form-item">
  312. <div class="mcp-form-list clearfix">
  313. <div class="mcp-form-menu fl">统考日期</div>
  314. <div class="mcp-form-detail fl clearfix">
  315. <input type="text" class='core datetimepicker8' style="width: 140px;line-height: 27px;padding-left: 5px;" name="examDate" id="trial_begin_time_test" value="<?php if(isset($formInfo['create_time'])) echo date('Y-m-d',$formInfo['create_time']); ?>" readonly/>
  316. <span class="date_tips"></span>
  317. </div>
  318. <div id="examDate"></div>
  319. </div>
  320. </div>
  321. <div class="form-item">
  322. <label class="form-item-label">
  323. 选择年级
  324. </label>
  325. <div class="form-item-con">
  326. <?php
  327. $firstCheck=false;
  328. foreach (Yii::app()->params['grade_config'] as $id =>$item){
  329. if(isset($formInfo['grade'])){
  330. if($formInfo['grade']==$id){
  331. echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" checked value="'.$id.'">'.$item['grade_name'].'</label>';
  332. }else{
  333. echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" value="'.$id.'">'.$item['grade_name'].'</label>';
  334. }
  335. }else{
  336. if(!$firstCheck){
  337. echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" checked value="'.$id.'">'.$item['grade_name'].'</label>';
  338. $firstCheck=true;
  339. }else{
  340. echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" value="'.$id.'">'.$item['grade_name'].'</label>';
  341. }
  342. }
  343. }
  344. ?>
  345. </div>
  346. </div>
  347. <div class="form-item">
  348. <label class="form-item-label">
  349. 选择模式
  350. </label>
  351. <div class="form-item-con">
  352. <?php
  353. if(isset($formInfo['exam_mode'])){
  354. ?>
  355. <label for="g1" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" <?php if(isset($formInfo['exam_mode']) && $formInfo['exam_mode']==0){echo "checked"; }?> value="0">普通模式</label>
  356. <?php if(Yii::app()->params['section']==1):?>
  357. <label for="g2" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" <?php if(isset($formInfo['exam_mode']) && $formInfo['exam_mode']==1){echo "checked"; }?> value="1">新高考模式(3+3)</label>
  358. <label for="g2" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" <?php if(isset($formInfo['exam_mode']) && $formInfo['exam_mode']==2){echo "checked"; }?> value="2">新高考(3+1+2)</label>
  359. <?php
  360. endif;
  361. }else{
  362. ?>
  363. <label for="g1" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" checked value="0">普通模式</label>
  364. <?php if(Yii::app()->params['section']==1):?>
  365. <label for="g2" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" value="1">新高考模式(3+3)</label>
  366. <label for="g2" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" value="2">新高考(3+1+2)</label>
  367. <?php
  368. endif;
  369. }
  370. ?>
  371. <span class="test-type-ties"><img src="/images/icon-tips.png" alt="" class="icon-test-type-ties">
  372. 注意:普通模式统考总分为所有选择科目的总和
  373. <?php if(Yii::app()->params['section']==1):?>
  374. ,新高考模式(3+3)统考总分为语数英+选修科目6选3的总和(选修科目满分需一致)
  375. <?php endif;?>
  376. </span>
  377. </div>
  378. </div>
  379. <div class="form-item" id="a_s">
  380. <label class="form-item-label">
  381. 文理分类
  382. </label>
  383. <div class="form-item-con">
  384. <?php
  385. if(isset($formInfo['arts_science'])){
  386. ?>
  387. <label for="g2" class="mlr5"><input type="radio" id="arts_science" <?php if(isset($formInfo['arts_science']) && $formInfo['arts_science']==0){echo "checked"; }?> name="arts_science" value="0">不分科(新高考)</label>
  388. <label for="g2" class="mlr5"><input type="radio" id="arts_science" <?php if(isset($formInfo['arts_science']) && $formInfo['arts_science']==1){echo "checked"; }?> name="arts_science" value="1">文科</label>
  389. <label for="g3" class="mlr5"><input type="radio" id="arts_science" <?php if(isset($formInfo['arts_science']) && $formInfo['arts_science']==2){echo "checked"; }?> name="arts_science" value="2">理科</label>
  390. <?php
  391. }else{
  392. ?>
  393. <label for="g2" class="mlr5"><input type="radio" id="arts_science" name="arts_science" value="0">不分科(新高考)</label>
  394. <label for="g2" class="mlr5"><input type="radio" id="arts_science" name="arts_science" value="1">文科</label>
  395. <label for="g3" class="mlr5"><input type="radio" id="arts_science" name="arts_science" value="2">理科</label>
  396. <?php
  397. }
  398. ?>
  399. </div>
  400. </div>
  401. <div class="form-item">
  402. <label class="form-item-label">
  403. 统考类型
  404. </label>
  405. <div class="form-item-con">
  406. <?php
  407. if(isset($formInfo['cylet_type'])){
  408. ?>
  409. <label class="mlr5"><input type="radio" id="cylet_type" <?php if(isset($formInfo['cylet_type']) && $formInfo['cylet_type']==1){echo "checked"; }?> name="cylet_type" value="1">非年级统考</label>
  410. <label class="mlr5"><input type="radio" id="cylet_type" <?php if(isset($formInfo['cylet_type']) && $formInfo['cylet_type']==2){echo "checked"; }?> name="cylet_type" value="2">年级统考</label>
  411. <?php
  412. }else{
  413. ?>
  414. <label class="mlr5"><input type="radio" id="cylet_type" name="cylet_type" value="1">非年级统考</label>
  415. <label class="mlr5"><input type="radio" id="cylet_type" name="cylet_type" value="2">年级统考</label>
  416. <?php
  417. }
  418. ?>
  419. <span class="test-type-ties"><img src="/images/icon-tips.png" alt="" class="icon-test-type-ties">注意:只有“年级统考”才作为校长端的考试分析数据</span>
  420. </div>
  421. </div>
  422. <div class="form-item">
  423. <label class="form-item-label">
  424. 科目管理
  425. </label>
  426. <div class="form-item-con">
  427. <?php
  428. if(isset($subject) && $subject){
  429. foreach($subject as $key=> $val){
  430. echo '<label for="k1" class="check_subject mlr5"><input type="checkbox" name="subject" id="subject" value="'.$key.'">'.$val.'</label>';
  431. }
  432. }
  433. ?>
  434. </div>
  435. </div>
  436. <?php
  437. if(isset($subject) && $subject){
  438. foreach($subject as $key=> $val){
  439. ?>
  440. <div class="form-item subject_list" id="subjet_<?php echo $key?>">
  441. <label class="form-item-label">
  442. <span class="subject-name"><?php echo $val ?></span>
  443. </label>
  444. <div class="form-item-con">
  445. <div class="exam_area">
  446. <select name="" class="form-item-input exam_list" id="<?php echo $key?>">
  447. <option value="">请选择一场考试</option>
  448. </select>
  449. <lable class="gray" style="display:none">考试时间:</lable><label class="date"></label>
  450. <label class="class classes" style="display: inline-block">
  451. </label>
  452. </div>
  453. <div>
  454. <span class="tag bg-green">匹配统考卷</span>
  455. <a href="#" class="tooltip1">
  456. <i class="icon icon-question"></i>
  457. <div class="tooltip-con">
  458. 两次考试试卷一样,可点击【匹配统考卷】<br>
  459. 合并成一次考试,将两次考试的班级当作一<br>
  460. 次统考来分析
  461. </div>
  462. </a>
  463. </div>
  464. </div>
  465. </div>
  466. <?php
  467. }
  468. }
  469. ?>
  470. <div class="form-item">
  471. <label class="form-item-label">
  472. 成绩对家长可见
  473. </label>
  474. <div class="form-item-con">
  475. <?php
  476. if(isset($formInfo['push_status'])){
  477. ?>
  478. <label for="g2" class="mlr5"><input type="radio" id="push_status" <?php if(isset($formInfo['push_status']) && $formInfo['push_status']==1){echo "checked"; }?> name="push_status" value="1">是</label>
  479. <label for="g2" class="mlr5"><input type="radio" id="push_status" <?php if(isset($formInfo['push_status']) && $formInfo['push_status']==0){echo "checked"; }?> name="push_status" value="0">否</label>
  480. <?php
  481. }else{
  482. ?>
  483. <label class="mlr5"><input type="radio" id="push_status" name="push_status" checked value="1">是</label>
  484. <label class="mlr5"><input type="radio" id="push_status" name="push_status" value="0">否</label>
  485. <?php
  486. }
  487. ?>
  488. </div>
  489. </div>
  490. <div class="form-item">
  491. <label class="form-item-label">
  492. 教师查看权限
  493. </label>
  494. <div class="form-item-con">
  495. <?php if(isset($formInfo['teacher_view_limit']) && $formInfo['teacher_view_limit'] && count($formInfo['teacher_view_limit'])==5):?>
  496. <label class="mlr5"><input type="checkbox" id="teacher_view_limit_all" name="teacher_view_limit_all" checked value="1">全选</label>
  497. <?php else:?>
  498. <label class="mlr5"><input type="checkbox" id="teacher_view_limit_all" name="teacher_view_limit_all" value="1">全选</label>
  499. <?php endif;?>
  500. <label class="mlr5"><input type="checkbox" class="teacher_view_limit" name="teacher_view_limit[]" <?php if(isset($formInfo['teacher_view_limit']) && in_array(4,$formInfo['teacher_view_limit'])) echo 'checked'?> value="4">任课教师</label>
  501. <label class="mlr5"><input type="checkbox" class="teacher_view_limit" name="teacher_view_limit[]" <?php if(isset($formInfo['teacher_view_limit']) && in_array(1,$formInfo['teacher_view_limit'])) echo 'checked'?> value="1">班主任</label>
  502. <label class="mlr5"><input type="checkbox" class="teacher_view_limit" name="teacher_view_limit[]" <?php if(isset($formInfo['teacher_view_limit']) && in_array(3,$formInfo['teacher_view_limit'])) echo 'checked'?> value="3">年级主任</label>
  503. <label class="mlr5"><input type="checkbox" class="teacher_view_limit" name="teacher_view_limit[]" <?php if(isset($formInfo['teacher_view_limit']) && in_array(2,$formInfo['teacher_view_limit'])) echo 'checked'?> value="2">教研组长</label>
  504. <label class="mlr5"><input type="checkbox" class="teacher_view_limit" name="teacher_view_limit[]" <?php if(isset($formInfo['teacher_view_limit']) && in_array(5,$formInfo['teacher_view_limit'])) echo 'checked'?> value="5">校长</label>
  505. </div>
  506. </div>
  507. <div class="form-item clearfix">
  508. <div class="class-box fl" style="margin-left:50px;">
  509. <p><img src="/images/icon-tips.png" alt="" class="class-tips">此次参加统考分析的班级如下(点击移除)</p>
  510. <ul class="selected-box">
  511. </ul>
  512. </div>
  513. <img src="/images/icon-change.png" alt="" class="icon-change fl">
  514. <div class="class-box fl">
  515. <p><img src="/images/icon-tips.png" alt="" class="class-tips">已移除班级(点击还原)</p>
  516. <ul class="unchecked-box">
  517. </ul>
  518. </div>
  519. </div>
  520. <div class="selectClass"></div>
  521. <button type="button" class="save" id="save">保存</button>
  522. <input type="hidden" name="subject_ids" value="">
  523. <input type="hidden" name="class_ids" value="">
  524. <input type="hidden" name="exam_ids" value="">
  525. <input type="hidden" name="is_has_time" value="<?php if(isset($formInfo['cylet_id'])) {echo 1;}else{echo 0;} ?>">
  526. <input type="hidden" name="cylet_id" value="<?php if(isset($formInfo['cylet_id'])) echo $formInfo['cylet_id'];?>">
  527. <input type="hidden" name="cylet_type_d" value="">
  528. </form>
  529. <div class="confirmbox-mask" id="confirmBox" style="display: none">
  530. <div class="confirmbox">
  531. <div class="notice_txt">
  532. 您所选择的各科试卷统考周期超过一周,<br>
  533. 是否重新编辑?
  534. </div>
  535. <div class="confirmbox-btns">
  536. <button type="button" class="fl" id="edit">重新编辑</button>
  537. <button type="button" class="fr" id="confirmSave">保存</button>
  538. </div>
  539. </div>
  540. </div>
  541. </div>
  542. <script>
  543. (function () {
  544. var saveRepeat=false;
  545. var SubjectLoaded=[]; //学科加载状态
  546. var SelectClass=[]; //学科对应考试班级Id
  547. var SelectClassName=[]; //学科对应考试班级名称
  548. var Subject_Exam=[]; //学科对应考试
  549. var Subject_Same_Exam= []; //学科匹配相同试卷
  550. var EditSubjectSameExam=[];
  551. <?php
  552. $allSubject=Yii::app()->params['subjectId'];
  553. unset($allSubject[3]);
  554. unset($allSubject[51]);
  555. unset($allSubject[20]);
  556. foreach ($allSubject as $key =>$val){
  557. echo 'SubjectLoaded['.$key.']=false;';
  558. echo 'SelectClass['.$key.']=[];';
  559. echo 'SelectClassName['.$key.']=[];';
  560. echo "Subject_Exam[".$key."]='';";
  561. echo "Subject_Same_Exam[".$key."]=[];";
  562. echo "EditSubjectSameExam[".$key."]=[];";
  563. }
  564. ?>
  565. <?php
  566. if(isset($formInfo['examinfo']['same_exam'])):
  567. foreach ($formInfo['examinfo']['same_exam'] as $k=>$v):
  568. if($v):
  569. foreach ($v as $value):
  570. ?>
  571. Subject_Same_Exam[<?php echo $k;?>].push('<?php echo $value;?>');
  572. EditSubjectSameExam[<?php echo $k;?>].push('<?php echo $value;?>');
  573. <?php
  574. endforeach;endif;
  575. endforeach;endif;
  576. ?>
  577. //年级分科数据初始化
  578. var Grade_A_S=[];
  579. var nowGrade=1;
  580. <?php
  581. if(isset($grade)):
  582. foreach ($grade as $k=>$v):
  583. ?>
  584. Grade_A_S[<?php echo $k;?>]=<?php echo $v;?>;
  585. <?php
  586. endforeach;endif;
  587. if(isset($formInfo['grade'])):
  588. ?>
  589. nowGrade=<?php echo $formInfo['grade'] ?>;
  590. <?php
  591. endif;
  592. ?>
  593. //console.log(nowGrade);
  594. if(Grade_A_S[nowGrade]==2){
  595. $('#a_s').show();
  596. }
  597. var IntersectionClassArray=[]; //选择的考试所有班级的交集
  598. var IntersectionClassNameArray=[]; //选择的考试所有班级名称的交集
  599. var UnIntersectionClassArray=[]; //排除选择的考试所有班级的交集
  600. var UnIntersectionClassNameArray=[]; //排除选择的考试所有班级名称的交集
  601. var EditClassArray=[]; //编辑状态读取的班级ID
  602. var EditClassNameArray=[]; //编辑状态读取的班级
  603. var DeleteClassArray=[]; //手动删除的班级(编辑统考时)
  604. var DeleteClassNameArray=[]; //手动删除的班级(编辑统考时)
  605. var grade=''; //选择的年级
  606. var savedSubjectNumber=0; //保存的学科数量
  607. //如果是编辑状态,需要校验是否有手动删除的班级
  608. <?php
  609. if(isset($formInfo['class_ids']) && $formInfo['class_ids']){
  610. $classIds=explode(',',$formInfo['class_ids']);
  611. foreach ($classIds as $cids){
  612. echo 'EditClassArray.push("'.$cids.'");';
  613. }
  614. }
  615. //保存的学科数量
  616. if(isset($formInfo['subject_ids']) && $formInfo['subject_ids']){
  617. $SubjectArr=explode(',',$formInfo['subject_ids']);
  618. echo 'savedSubjectNumber='.count($SubjectArr).';';
  619. }
  620. ?>
  621. //console.log(EditClassArray);
  622. var confirmSaveBtn = document.getElementById('confirmSave');
  623. var saveBtn = document.getElementById('save');
  624. var editBtn = document.getElementById('edit');
  625. var confirmBox = document.getElementById('confirmBox');
  626. function initExamSubject(data){
  627. $subjectArr=data.split(',');
  628. for(var i=0;i<$("input[name='subject']").length;i++){
  629. if($.inArray($("input[name='subject']").eq(i).val(),$subjectArr)!=-1){
  630. $("input[name='subject']").eq(i).click();
  631. }
  632. }
  633. }
  634. function SaveCylet(){
  635. if($("input[name='title']").val()==''){
  636. layer.msg('请输入统考名称');
  637. return false;
  638. }
  639. if($("input[name='title']").val().length>60){
  640. layer.msg('统考名称长度不超过60个字符');
  641. return false;
  642. }
  643. if($("input[name='examDate']").val()==''){
  644. layer.msg('请选择统考时间');
  645. return false;
  646. }
  647. teacher_limit='';
  648. for(var i=0;i<$(".teacher_view_limit").length;i++){
  649. if($(".teacher_view_limit").eq(i).is(":checked")){
  650. if(teacher_limit==''){
  651. teacher_limit=$(".teacher_view_limit").eq(i).val();
  652. }else{
  653. teacher_limit=teacher_limit+','+$(".teacher_view_limit").eq(i).val();
  654. }
  655. }
  656. }
  657. if(teacher_limit==''){
  658. layer.msg('请选择统考教师查看权限');
  659. return false;
  660. }
  661. var subject_ids='',exam_ids='',subject_num=0;
  662. for(var i=0;i<$("input[name='subject']").length;i++){
  663. if($("input[name='subject']").eq(i).is(":checked")){
  664. subject_num++;
  665. if(subject_ids==''){
  666. subject_ids=$("input[name='subject']").eq(i).val();
  667. }else{
  668. subject_ids=subject_ids+','+$("input[name='subject']").eq(i).val();
  669. }
  670. }
  671. }
  672. /*
  673. if(subject_num<2){
  674. layer.msg('请最少选择两个学科!');
  675. return false;
  676. }
  677. */
  678. for(var i=0;i<$(".exam_list").length;i++){
  679. if($(".exam_list").eq(i).val()!='' && $(".exam_list").eq(i).val()!=null){
  680. if(exam_ids==''){
  681. exam_ids=$(".exam_list").eq(i).val();
  682. }else{
  683. exam_ids=exam_ids+','+$(".exam_list").eq(i).val();
  684. }
  685. }
  686. }
  687. if(subject_ids==''){
  688. layer.msg('请选择统考科目');
  689. return false;
  690. }
  691. if(exam_ids==''){
  692. layer.msg('请选择至少一场考试');
  693. return false;
  694. }
  695. if(exam_ids.split(',').length<subject_num){
  696. layer.msg('部分学科没有考试,请取消勾选!');
  697. return false;
  698. }
  699. var AllExamInfo=new Array();
  700. AllExamInfo['exam']=Subject_Exam;
  701. AllExamInfo['same_exam']=Subject_Same_Exam;
  702. var jsonStr='{';
  703. jsonStr+='"exam":{';
  704. tempExamStr='';
  705. for(var k in Subject_Exam){
  706. if(Subject_Exam[k]!=''){
  707. if(tempExamStr==''){
  708. tempExamStr='"'+k+'":"'+Subject_Exam[k]+'"';
  709. }else{
  710. tempExamStr+=',"'+k+'":"'+Subject_Exam[k]+'"';
  711. }
  712. }
  713. }
  714. jsonStr+=tempExamStr;
  715. jsonStr+='}';
  716. jsonStr+=',"same_exam":{';
  717. $sameStr='';
  718. tempExamStr='';
  719. for(var j in Subject_Same_Exam){
  720. if(Subject_Same_Exam[j].length>0){
  721. if(tempExamStr==''){
  722. tempExamStr+='"'+j+'":[';
  723. }else{
  724. tempExamStr+=',"'+j+'":[';
  725. }
  726. subStr='';
  727. for(var i=0;i<Subject_Same_Exam[j].length;i++){
  728. if(subStr==''){
  729. subStr='"'+Subject_Same_Exam[j][i]+'"';
  730. }else{
  731. subStr+=',"'+Subject_Same_Exam[j][i]+'"';
  732. }
  733. }
  734. tempExamStr+=subStr;
  735. tempExamStr+=']';
  736. }
  737. }
  738. jsonStr+=tempExamStr;
  739. jsonStr+='}}';
  740. //选中的班级
  741. selectClassIds=[];
  742. $('.selected-box li').each(function(){
  743. selectClassIds.push($(this).attr('value'))
  744. });
  745. $('input[name="subject_ids"]').val(subject_ids);
  746. $('input[name="class_ids"]').val(selectClassIds.join(','));
  747. $('input[name="exam_ids"]').val(jsonStr);
  748. if(IntersectionClassArray.length==0){
  749. layer.msg('您所选择的各科试卷没有统考班级');
  750. return false;
  751. }
  752. var grade=$('input[name=grade]:checked').val();
  753. arts_science=$('input[name=arts_science]:checked').val();
  754. exam_mode=$('input[name=exam_mode]:checked').val();
  755. if(Grade_A_S[grade]==2 &&arts_science==undefined){
  756. layer.msg('请选择文理分类');
  757. return false;
  758. }
  759. //验证统考提示
  760. userSelectType=$('input[name=cylet_type]:checked').val();
  761. if(userSelectType==undefined){
  762. layer.msg('请选择统考类型');
  763. return false;
  764. }
  765. sysSelectType=$('input[name=cylet_type_d]').val();
  766. isDeleteClass=$.trim($('.unchecked-box').html());
  767. if(userSelectType==1){
  768. if(sysSelectType==2 && isDeleteClass==''){
  769. layer.msg("统考班级满足年级统考,<br>是否仍标记为“非年级统考”?", {
  770. time: 0,
  771. btn: ['确定', '取消'],
  772. yes: function(index){
  773. layer.close(index);
  774. if(CheckExamDate()>7){
  775. toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
  776. }else{
  777. SubmitForm();
  778. }
  779. }
  780. });
  781. }else{
  782. if(CheckExamDate()>7){
  783. toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
  784. }else{
  785. SubmitForm();
  786. }
  787. }
  788. }else{
  789. if(isDeleteClass!='' || sysSelectType==1){
  790. layer.msg("统考班级数量不足,<br>是否仍标记为“年级统考”?", {
  791. time: 0,
  792. btn: ['确定', '取消'],
  793. yes: function(index){
  794. layer.close(index);
  795. if(CheckExamDate()>7){
  796. toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
  797. }else{
  798. SubmitForm();
  799. }
  800. }
  801. });
  802. }else{
  803. if(CheckExamDate()>7){
  804. toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
  805. }else{
  806. SubmitForm();
  807. }
  808. }
  809. }
  810. }
  811. function toggleConfirm(txt) {
  812. confirmBox.style.display = confirmBox.style.display === 'none' ? 'block' : 'none';
  813. $('.notice_txt').html(txt);
  814. return false;
  815. }
  816. function SubmitForm(){
  817. if(!saveRepeat){
  818. saveRepeat=true;
  819. $('.form').submit();
  820. }
  821. }
  822. saveBtn.addEventListener('click', SaveCylet, false);
  823. editBtn.addEventListener('click', toggleConfirm, false);
  824. confirmSaveBtn.addEventListener('click', SubmitForm, false);
  825. function CopyArray(arr1,arr2) {
  826. for(var i in arr1){
  827. arr2.push(arr1[i])
  828. }
  829. }
  830. /*统计科目班级数组的并集*/
  831. function Union(){
  832. var html='';
  833. $('.selected-box').html('');
  834. $('.unchecked-box').html('');
  835. //console.log(SelectClass);
  836. //console.log(SelectClassName);
  837. IntersectionClassArray.length=0;
  838. IntersectionClassNameArray.length=0;
  839. var allClassArr=[],allClassNameArr=[];
  840. if(SelectClass.length>0){
  841. for(var i in SelectClass){
  842. if(SelectClass[i].length==0){
  843. continue;
  844. }
  845. for(var j in SelectClass[i]){
  846. if($.inArray(SelectClass[i][j],allClassArr)==-1){
  847. allClassArr.push(SelectClass[i][j]);
  848. allClassNameArr.push(SelectClassName[i][j]);
  849. }
  850. }
  851. }
  852. }
  853. //编辑状态初次执行,进行校验
  854. console.log(savedSubjectNumber);
  855. if(EditClassArray.length>0){
  856. var TempArr3=[];
  857. var TempArr4=[];
  858. for(var i=0;i<allClassArr.length;i++){
  859. if($.inArray(allClassArr[i],EditClassArray)==-1){
  860. DeleteClassArray.push(allClassArr[i]);
  861. DeleteClassNameArray.push(allClassNameArr[i]);
  862. }else{
  863. TempArr3.push(allClassArr[i]);
  864. TempArr4.push(allClassNameArr[i]);
  865. }
  866. }
  867. allClassArr.length=0;
  868. allClassNameArr.length=0;
  869. CopyArray(TempArr3,allClassArr);
  870. CopyArray(TempArr4,allClassNameArr);
  871. if($("input[name='subject']:checked").length!=savedSubjectNumber){
  872. EditClassArray.length=0;
  873. }
  874. }
  875. if(DeleteClassArray.length>0 ){
  876. var deleteHtml='';
  877. for(var i=0;i<DeleteClassArray.length;i++){
  878. deleteHtml+='<li value="'+DeleteClassArray[i]+'">'+DeleteClassNameArray[i]+'<img src="/images/icon-add.png" alt=""></li>';
  879. }
  880. $('.unchecked-box').html(deleteHtml);
  881. DeleteClassArray.length=0;
  882. DeleteClassNameArray.length=0;
  883. }
  884. //填充选择区
  885. var selectedBoxHtml='';
  886. for(var i=0;i<allClassArr.length;i++){
  887. selectedBoxHtml+='<li value="'+allClassArr[i]+'">'+allClassNameArr[i]+'<img src="/images/icon-delete.png" alt=""></li>';
  888. }
  889. if($.trim($('.selected-box').html())==''){
  890. $('.selected-box').html(selectedBoxHtml);
  891. }
  892. //判断统考类型
  893. for(var jj=0;jj<$('.class').length;jj++){
  894. if($('.class').eq(jj).attr('is_all')==0){
  895. $('input[name=cylet_type_d]').val(1);
  896. break;
  897. }
  898. $('input[name=cylet_type_d]').val(2);
  899. }
  900. $('.selectClass').html(html);
  901. CopyArray(allClassArr,IntersectionClassArray);
  902. CopyArray(allClassNameArr,IntersectionClassNameArray);
  903. }
  904. /*统计科目班级数组的交集*/
  905. function Intersection(){
  906. var Temp1=[],Temp2=[];
  907. var minLengthArrKey=0; //最少班级的科目
  908. var isFind=true;
  909. DeleteClassArray.length=0;
  910. DeleteClassNameArray.length=0;
  911. UnIntersectionClassNameArray.length=0;
  912. var AllClassNameArr=[]; //所有班级合并
  913. for(var i in SelectClass){
  914. $.merge(AllClassNameArr,SelectClassName[i]);
  915. if(SelectClass[i].length==0){
  916. continue;
  917. }
  918. if(minLengthArrKey==0 || SelectClass[i].length<SelectClass[minLengthArrKey].length){
  919. minLengthArrKey=i;
  920. }
  921. }
  922. if(minLengthArrKey==0){
  923. $('.selectClass').html('');
  924. return false;
  925. }
  926. for(var i=0;i<SelectClass[minLengthArrKey].length;i++){
  927. isFind=true;
  928. for(var j in SelectClass){
  929. if(j==minLengthArrKey || SelectClass[j].length==0){
  930. continue;
  931. }
  932. if($.inArray(SelectClass[minLengthArrKey][i],SelectClass[j])==-1){
  933. isFind=false;
  934. }
  935. }
  936. if(isFind){
  937. Temp1.push(SelectClass[minLengthArrKey][i]);
  938. Temp2.push(SelectClassName[minLengthArrKey][i]);
  939. }
  940. }
  941. $.unique(AllClassNameArr);
  942. IntersectionClassArray.length=0;
  943. IntersectionClassNameArray.length=0;
  944. CopyArray(Temp1,IntersectionClassArray);
  945. CopyArray(Temp2,IntersectionClassNameArray);
  946. for(var k=0;k<AllClassNameArr.length;k++){
  947. if($.inArray(AllClassNameArr[k],IntersectionClassNameArray)==-1){
  948. UnIntersectionClassNameArray.push(AllClassNameArr[k]);
  949. }
  950. }
  951. //编辑状态初次执行,进行校验
  952. if(EditClassArray.length>0){
  953. var TempArr3=[];
  954. var TempArr4=[];
  955. for(var i=0;i<IntersectionClassArray.length;i++){
  956. if($.inArray(IntersectionClassArray[i],EditClassArray)==-1){
  957. DeleteClassArray.push(IntersectionClassArray[i]);
  958. DeleteClassNameArray.push(IntersectionClassNameArray[i]);
  959. }else{
  960. TempArr3.push(IntersectionClassArray[i]);
  961. TempArr4.push(IntersectionClassNameArray[i]);
  962. }
  963. }
  964. IntersectionClassArray.length=0;
  965. IntersectionClassNameArray.length=0;
  966. CopyArray(TempArr3,IntersectionClassArray);
  967. CopyArray(TempArr4,IntersectionClassNameArray);
  968. if($("input[name='subject']:checked").length>=savedSubjectNumber){
  969. EditClassArray.length=0;
  970. }
  971. }
  972. //console.log(DeleteClassNameArray);
  973. var html='';
  974. $('.selected-box').html('');
  975. $('.unchecked-box').html('');
  976. if(IntersectionClassNameArray.length>0){
  977. // html=html+"*此次参加统考分析的班级有 "+IntersectionClassNameArray.join(',')+'。';
  978. //填充选择区
  979. var selectedBoxHtml='';
  980. for(var i=0;i<IntersectionClassNameArray.length;i++){
  981. selectedBoxHtml+='<li value="'+IntersectionClassArray[i]+'">'+IntersectionClassNameArray[i]+'<img src="/images/icon-delete.png" alt=""></li>';
  982. }
  983. if($.trim($('.selected-box').html())==''){
  984. $('.selected-box').html(selectedBoxHtml);
  985. }
  986. }
  987. if(UnIntersectionClassNameArray.length>0){
  988. html=html+' <span style="color:#888">'+UnIntersectionClassNameArray.join(',')+' 部分科目没有参加考试,不能参加统考。</span>';
  989. }
  990. //console.log(DeleteClassArray);
  991. if(DeleteClassArray.length>0 ){
  992. var deleteHtml='';
  993. for(var i=0;i<DeleteClassArray.length;i++){
  994. deleteHtml+='<li value="'+DeleteClassArray[i]+'">'+DeleteClassNameArray[i]+'<img src="/images/icon-add.png" alt=""></li>';
  995. }
  996. $('.unchecked-box').html(deleteHtml);
  997. DeleteClassArray.length=0;
  998. DeleteClassNameArray.length=0;
  999. }
  1000. //判断统考类型
  1001. for(var jj=0;jj<$('.class').length;jj++){
  1002. if($('.class').eq(jj).attr('is_all')==0){
  1003. $('input[name=cylet_type_d]').val(1);
  1004. break;
  1005. }
  1006. $('input[name=cylet_type_d]').val(2);
  1007. }
  1008. $('.selectClass').html(html);
  1009. }
  1010. /*计算各考试间隔时间*/
  1011. function CheckExamDate(){
  1012. var min=0,max=0;
  1013. var dateObj=$('.date');
  1014. for(var i=0;i<dateObj.length;i++){
  1015. if(dateObj.eq(i).html()==''){
  1016. continue;
  1017. }
  1018. date = new Date(dateObj.eq(i).html());
  1019. time1=date.getTime();
  1020. if(min==0 || time1<min){
  1021. min=time1;
  1022. }
  1023. if(max==0 || time1>max){
  1024. max=time1;
  1025. }
  1026. }
  1027. days=(max-min)/1000/86400;
  1028. return days
  1029. }
  1030. function getExam(subject_id,grade){
  1031. var obj=$('#subjet_'+subject_id);
  1032. var cylet_id=$('input[name="cylet_id"]').val();
  1033. if(Grade_A_S[grade]==2){
  1034. arts_s=$('input[name=arts_science]:checked').val();
  1035. }else{
  1036. arts_s=0;
  1037. }
  1038. $.ajax({
  1039. url:'<?php echo $this->createUrl('cylet/getexambysubject')?>',
  1040. type:"POST",
  1041. data:{'subject_id':subject_id,'grade':grade,'cylet_id':cylet_id,'arts_s':arts_s},
  1042. dataType:'json',
  1043. success:function (res) {
  1044. if(res.status==1){
  1045. var examIdArr=[];
  1046. var Selectval='';
  1047. <?php
  1048. foreach ($allSubject as $key =>$val){
  1049. echo 'examIdArr['.$key.']=[];';
  1050. }
  1051. if(isset($formInfo['examinfo']) && $formInfo['examinfo']['exam']){
  1052. foreach ($formInfo['examinfo']['exam'] as $key=>$val){
  1053. ?>
  1054. examIdArr[<?php echo $key?>].push('<?php echo $val ?>');
  1055. <?php
  1056. }
  1057. }
  1058. ?>
  1059. var html='';
  1060. if(res.data.length==0){
  1061. obj.find('.form-item-input').html('<option value="">请选择一场考试</option>');
  1062. }else{
  1063. obj.find('.form-item-input').html('');
  1064. }
  1065. obj.find('.date').html('');
  1066. obj.find('.class').html('');
  1067. for(var i=0;i<res.data.length;i++){
  1068. if(examIdArr[subject_id].length>0){
  1069. if($.inArray(res.data[i]['exam_id'],examIdArr[subject_id])==-1){
  1070. html+='<option value="'+res.data[i]['exam_id']+'">'+res.data[i]['name']+'</option>';
  1071. }else{
  1072. Selectval=res.data[i]['exam_id'];
  1073. html+='<option value="'+res.data[i]['exam_id']+'" selected>'+res.data[i]['name']+'</option>';
  1074. Subject_Exam[subject_id]=res.data[i]['exam_id'];
  1075. }
  1076. }else{
  1077. if(i==0){
  1078. Selectval=res.data[i]['exam_id'];
  1079. Subject_Exam[subject_id]=res.data[i]['exam_id'];
  1080. html+='<option value="'+res.data[i]['exam_id']+'" selected>'+res.data[i]['name']+'</option>';
  1081. }else{
  1082. html+='<option value="'+res.data[i]['exam_id']+'">'+res.data[i]['name']+'</option>';
  1083. }
  1084. }
  1085. }
  1086. //console.log(Selectval);
  1087. SubjectLoaded[subject_id]=true;
  1088. obj.find('.form-item-input').append(html);
  1089. if(Selectval!=''){
  1090. loadClass(Selectval,subject_id,obj.find('.exam_area'),false);
  1091. if(Subject_Same_Exam[subject_id].length>0){
  1092. obj.find('.bg-green').click();
  1093. }
  1094. }
  1095. }
  1096. }
  1097. });
  1098. }
  1099. /*加载班级*/
  1100. function loadClass(exam_id,subject_id,obj,isSameExam){
  1101. if(!isSameExam){
  1102. SelectClass[subject_id]=[];
  1103. SelectClassName[subject_id]=[];
  1104. }
  1105. grade=$('input[name=grade]:checked').val();
  1106. if(Grade_A_S[grade]==2){
  1107. arts_s=$('input[name=arts_science]:checked').val();
  1108. }else{
  1109. arts_s=0;
  1110. }
  1111. $.ajax({
  1112. url:'<?php echo $this->createUrl('cylet/getclassByexam')?>',
  1113. type:'POST',
  1114. dataType:'json',
  1115. data:{'examId':exam_id,'arts_science':arts_s,'grade':grade},
  1116. success:function(res){
  1117. if(res.status==1){
  1118. obj.find('.date').html(res.create_time);
  1119. obj.find('.gray').show();
  1120. var html='<span class="gray">班级:</span><div>' ;
  1121. var classlist=[];
  1122. for(var i=0;i<res.class.length;i++){
  1123. classlist.push('<span>'+res.class[i]['class_name']+'</span>');
  1124. if($.inArray(res.class[i]['class_id'],SelectClass[subject_id])==-1){
  1125. SelectClass[subject_id].push(res.class[i]['class_id']);
  1126. SelectClassName[subject_id].push(res.class[i]['class_name']);
  1127. }
  1128. }
  1129. if(classlist.length>0){
  1130. html=html+classlist.join(',');
  1131. }
  1132. html+='</div>';
  1133. obj.find('.class').html(html);
  1134. obj.find('.class').attr('is_all',res.is_all);
  1135. //Intersection();
  1136. Union()
  1137. }
  1138. }
  1139. });
  1140. }
  1141. /*重置变量*/
  1142. function resetValue(){
  1143. $('.selectClass').html('');
  1144. $('.unchecked-box').html('');
  1145. $('.selected-box').html('');
  1146. IntersectionClassArray.length=0;
  1147. IntersectionClassNameArray.length=0;
  1148. <?php
  1149. foreach ($allSubject as $key =>$val){
  1150. echo 'SelectClass['.$key.']=[];';
  1151. echo 'SelectClassName['.$key.']=[];';
  1152. echo "Subject_Exam[".$key."]='';";
  1153. echo "Subject_Same_Exam[".$key."]=[];";
  1154. echo "SubjectLoaded[".$key."]=false;";
  1155. }
  1156. ?>
  1157. var obj=$('.exam_list');
  1158. for(var i=0;i<obj.length;i++){
  1159. obj.html('option value="">请选择一场考试</option>');
  1160. obj.closest('.subject_list').find('.date').html('');
  1161. obj.closest('.subject_list').find('.class').html('');
  1162. obj.closest('.subject_list').hide();
  1163. obj.closest('.subject_list').find('.gray').hide();
  1164. obj.closest('.subject_list').find('.same_exam_list').remove();
  1165. obj.closest('.form-item-con').find('.tag').removeClass('bg-gray').addClass('bg-green').html('匹配统考卷');
  1166. }
  1167. for(var i=0;i<$('input[name=subject]').length;i++){
  1168. $('input[name=subject]').eq(i).prop('checked',false);
  1169. $('input[name=subject]').eq(i).prop('disabled',false);
  1170. }
  1171. }
  1172. /*验证考试时间*/
  1173. function checkCreateTime($time,cylet_id){
  1174. if($time==''){
  1175. return false;
  1176. }
  1177. grade='';
  1178. for(var i=0;i<$('input[name="grade"]').length;i++){
  1179. if($('input[name="grade"]').eq(i).is(":checked")){
  1180. if(grade==''){
  1181. grade=$('input[name="grade"]').eq(i).val();
  1182. }else{
  1183. grade=grade+','+$('input[name="grade"]').eq(i).val();
  1184. }
  1185. }
  1186. }
  1187. if(Grade_A_S[grade]==2){
  1188. arts_s=$('input[name=arts_science]:checked').val();
  1189. }else{
  1190. arts_s=0;
  1191. }
  1192. $.ajax({
  1193. url:'<?php echo $this->createUrl('cylet/checktime')?>',
  1194. type:'POST',
  1195. dataType:'json',
  1196. data:{'create_time':$time,'cylet_id':cylet_id,'grade':grade,'arts_s':arts_s},
  1197. success:function(res){
  1198. if(res.status==1){
  1199. $('.date_tips').html('时间可以使用');
  1200. $('input[name="is_has_time"]').val(1);
  1201. }else{
  1202. $('.date_tips').html(res.msg);
  1203. $('input[name="is_has_time"]').val(0);
  1204. }
  1205. }
  1206. });
  1207. }
  1208. /*选择年级*/
  1209. $('input[name=grade]').click(function () {
  1210. grade=$('input[name="grade"]:checked').val();
  1211. if(Grade_A_S[grade]==2){
  1212. $('#a_s').show();
  1213. }else{
  1214. $('#a_s').hide();
  1215. }
  1216. resetValue();
  1217. $time=$('input[name="examDate"]').val();
  1218. cylet_id=$('input[name="cylet_id"]').val();
  1219. if($time!=''){
  1220. select_date=new Date($time);
  1221. var useTime=Math.floor(select_date.getTime()/1000);
  1222. //checkCreateTime(useTime,cylet_id);
  1223. }
  1224. });
  1225. /*选择高考模式*/
  1226. $('input[name=exam_mode]').click(function () {
  1227. if($("input[name=arts_science]").val()!=undefined){
  1228. if($(this).val()==1){
  1229. $('input[name=arts_science]').eq(0).click();
  1230. $('input[name=arts_science]').eq(1).attr('disabled',true);
  1231. $('input[name=arts_science]').eq(2).attr('disabled',true);
  1232. }else{
  1233. $('input[name=arts_science]').eq(1).attr('disabled',false);
  1234. $('input[name=arts_science]').eq(2).attr('disabled',false);
  1235. }
  1236. }
  1237. });
  1238. /*选择文理科*/
  1239. $('input[name=arts_science]').click(function () {
  1240. var selectedSubject='';
  1241. for(var i=0;i<$("input[name='subject']").length;i++){
  1242. if($("input[name='subject']").eq(i).is(':checked')){
  1243. if(selectedSubject==''){
  1244. selectedSubject=$("input[name='subject']").eq(i).val();
  1245. }else{
  1246. selectedSubject=selectedSubject+','+$("input[name='subject']").eq(i).val();
  1247. }
  1248. }
  1249. }
  1250. resetValue();
  1251. $time=$('input[name="examDate"]').val();
  1252. cylet_id=$('input[name="cylet_id"]').val();
  1253. if($time!=''){
  1254. select_date=new Date($time);
  1255. var useTime=Math.floor(select_date.getTime()/1000);
  1256. //checkCreateTime(useTime,cylet_id);
  1257. }
  1258. initExamSubject(selectedSubject);
  1259. });
  1260. /*选择科目*/
  1261. $('body').on('click','#subject',function(){
  1262. var subject_id=$(this).val(),
  1263. obj=$('#subjet_'+subject_id);
  1264. HandleSubject(subject_id);
  1265. if($(this).is(":checked")){
  1266. if(!SubjectLoaded[subject_id]){
  1267. getExam(subject_id,$('input[name=grade]:checked').val());
  1268. }
  1269. obj.show();
  1270. }else{
  1271. Subject_Exam[subject_id]='';
  1272. SubjectLoaded[subject_id]=false;
  1273. SelectClass[subject_id].length=0;
  1274. SelectClassName[subject_id].length=0;
  1275. Subject_Same_Exam[subject_id].length=0;
  1276. obj.find('.same_exam_list').remove();
  1277. obj.find('.date').html('');
  1278. obj.find('.classes').removeAttr('is_all');
  1279. obj.hide();
  1280. //Intersection();
  1281. Union()
  1282. }
  1283. });
  1284. /*选择考试*/
  1285. $('body').on('change','.exam_list',function(){
  1286. var exam_id=$(this).val(),
  1287. obj=$(this).closest('.exam_area'),
  1288. subject_id=$(this).attr('id');
  1289. $(this).closest('.form-item-con').find('.same_exam_list').remove();
  1290. Subject_Exam[subject_id]=exam_id;
  1291. loadClass(exam_id,subject_id,obj,false);
  1292. obj.closest('.form-item-con').find('.tag').removeClass('bg-gray').addClass('bg-green').html('匹配统考卷');
  1293. }).on('click','.bg-green',function () {
  1294. //匹配统考试卷
  1295. var obj=$(this);
  1296. var exam_id=$(this).closest('.form-item-con').find('.exam_list').val();
  1297. var subject_id=$(this).closest('.form-item-con').find('select').eq(0).attr('id');
  1298. if(exam_id==''){
  1299. layer.msg('请选择一场考试');
  1300. return false;
  1301. }
  1302. // console.log(EditSubjectSameExam[subject_id]);
  1303. Subject_Same_Exam[subject_id]=[];
  1304. $.ajax({
  1305. url:'<?php echo $this->createUrl('cylet/findsamepaper')?>',
  1306. type:'POST',
  1307. dataType:'json',
  1308. data:{'examId':exam_id},
  1309. success:function(res){
  1310. if(res.status==1){
  1311. for(var i=0;i<res.data.length;i++){
  1312. if(EditSubjectSameExam[subject_id].length>0){
  1313. if($.inArray(res.data[i]['exam_id'],EditSubjectSameExam[subject_id])!=-1){
  1314. var html='<div class="exam_area same_exam_list">';
  1315. html+='<span class="close_icon"></span>';
  1316. html=html+'<input readonly class="form-item-input " id="'+res.data[i]['exam_id']+'" value="'+res.data[i]['name']+'">';
  1317. html+=' <lable class="gray" style="display:none">考试时间:</lable><label class="date"></label>';
  1318. html+='<label class="class classes" style="display: inline-flex"></label>';
  1319. html+='</div>';
  1320. obj.parent().before(html);
  1321. Subject_Same_Exam[subject_id].push(res.data[i]['exam_id']);
  1322. loadClass(res.data[i]['exam_id'],subject_id,obj.parent().prev(),true);
  1323. }
  1324. }else{
  1325. var html='<div class="exam_area same_exam_list">';
  1326. html+='<span class="close_icon"></span>';
  1327. html=html+'<input readonly class="form-item-input " id="'+res.data[i]['exam_id']+'" value="'+res.data[i]['name']+'">';
  1328. html+=' <lable class="gray" style="display:none">考试时间:</lable><label class="date"></label>';
  1329. html+='<label class="class classes" style="display: inline-flex"></label>';
  1330. html+='</div>';
  1331. obj.parent().before(html);
  1332. Subject_Same_Exam[subject_id].push(res.data[i]['exam_id']);
  1333. loadClass(res.data[i]['exam_id'],subject_id,obj.parent().prev(),true);
  1334. }
  1335. }
  1336. EditSubjectSameExam[subject_id].length=0;
  1337. obj.removeClass('bg-green');
  1338. obj.addClass('bg-gray');
  1339. }else{
  1340. obj.removeClass('bg-green');
  1341. obj.addClass('bg-gray');
  1342. obj.html('无试卷');
  1343. }
  1344. }
  1345. });
  1346. }).on('click','.close_icon',function () {
  1347. var obj=$(this).closest('.same_exam_list');
  1348. // var exam_id=$(this).closest('.form-item-con').find('.exam_list').val();
  1349. var subject_id=$(this).closest('.form-item-con').find('select').eq(0).attr('id');
  1350. var ThisClassListLength=obj.find('.classes div span').length;
  1351. var ThisIndex=obj.index();
  1352. var parent=obj.parent();
  1353. var AllClass=[];
  1354. var ThisExamId=$(this).closest('.same_exam_list').find('.form-item-input ').attr('id');
  1355. for(var ii=0;ii<Subject_Same_Exam[subject_id].length;ii++){
  1356. if($.trim(ThisExamId)==$.trim(Subject_Same_Exam[subject_id][ii])){
  1357. Subject_Same_Exam[subject_id].splice(ii,1);
  1358. }
  1359. }
  1360. //查询兄弟元素所有班级
  1361. for(var k=0; k<parent.find('.exam_area').length;k++){
  1362. if(k==ThisIndex){
  1363. continue;
  1364. }
  1365. for(var i=0;i<parent.find('.exam_area').eq(k).find('.classes div span').length;i++){
  1366. AllClass.push(parent.find('.exam_area').eq(k).find('.classes div span').eq(i).html());
  1367. }
  1368. }
  1369. for(var i=0;i<ThisClassListLength;i++){
  1370. var class_name=obj.find('.classes div span').eq(i).html();
  1371. if($.inArray(class_name,AllClass)!=-1){
  1372. continue;
  1373. }
  1374. for(var j in SelectClassName[subject_id]){
  1375. if($.trim(class_name)==$.trim(SelectClassName[subject_id][j])){
  1376. SelectClassName[subject_id].splice(j,1);
  1377. SelectClass[subject_id].splice(j,1);
  1378. }
  1379. }
  1380. }
  1381. //Intersection();
  1382. Union()
  1383. obj.remove();
  1384. });
  1385. //编辑统考初始化
  1386. <?php
  1387. if(isset($formInfo)){
  1388. echo 'initExamSubject("'.$formInfo['subject_ids'].'");'; //初始化科目
  1389. }
  1390. ?>
  1391. $('.datetimepicker8').datetimepicker({
  1392. onGenerate:function( ct ){
  1393. $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
  1394. $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
  1395. },
  1396. onClose:function(date){
  1397. time=new Date(date);
  1398. var useTime=Math.floor(time.getTime()/1000);
  1399. var cylet_id=$('input[name="cylet_id"]').val();
  1400. //checkCreateTime(useTime,cylet_id);
  1401. },
  1402. format:'Y-m-d',
  1403. formatDate:'Y-m-d',
  1404. //minDate:'-1970/01/2',
  1405. maxDate:'+<?php echo date('Y-m-d')?>',
  1406. todayBtn : true,
  1407. minDate: '',
  1408. timepicker:false,
  1409. scrollMonth:false,
  1410. scrollTime:false,
  1411. scrollInput:false,
  1412. });
  1413. //理综,文综科目选择处理
  1414. function HandleSubject(Subject_id) {
  1415. if($.inArray(Subject_id,['12','13','14','15','16','17','18','19'])!=-1){
  1416. var Arts=$('input[name="subject"]').eq(9);
  1417. var Science=$('input[name="subject"]').eq(10);
  1418. var ArtsStatus=Arts.is(':checked') ;
  1419. var ScienceStatus=Science.is(':checked') ;
  1420. var ArtsSubject=['12','13','14'];
  1421. var ScienceSubject=['15','16','17'];
  1422. for(var i in ArtsSubject){
  1423. if($('input[name="subject"][value='+ArtsSubject[i]+']').is(':checked')==true){
  1424. Arts.attr('disabled',true);
  1425. break;
  1426. }
  1427. Arts.attr('disabled',false);
  1428. }
  1429. for(var i in ScienceSubject){
  1430. if($('input[name="subject"][value='+ScienceSubject[i]+']').is(':checked')==true){
  1431. Science.attr('disabled',true);
  1432. break;
  1433. }
  1434. Science.attr('disabled',false);
  1435. }
  1436. if(Subject_id==18){
  1437. var Artsdisabled=ArtsStatus==true?true:false;
  1438. for(var i in ArtsSubject){
  1439. $('input[name="subject"][value='+ArtsSubject[i]+']').attr('disabled',Artsdisabled);
  1440. }
  1441. }
  1442. if(Subject_id==19){
  1443. var Sciencedisabled=ScienceStatus?true:false;
  1444. for(var i in ScienceSubject){
  1445. $('input[name="subject"][value='+ScienceSubject[i]+']').attr('disabled',Sciencedisabled);
  1446. }
  1447. }
  1448. }
  1449. }
  1450. $(".selected-box").on("click", "li", function() {
  1451. var classValue = $(this).attr('value');
  1452. var className = $(this).text();
  1453. $(this).remove();
  1454. $(".unchecked-box").append('<li value="'+classValue+'">'+className+'<img src="/images/icon-add.png" alt=""></li>');
  1455. //处理已选数据IntersectionClassArray
  1456. for(var ii=0;ii<IntersectionClassArray.length;ii++){
  1457. if($.trim(classValue)==$.trim(IntersectionClassArray[ii])){
  1458. //UnIntersectionClassNameArray.push(IntersectionClassNameArray[ii]);
  1459. //UnIntersectionClassArray.push(IntersectionClassArray[ii]);
  1460. DeleteClassNameArray.push(IntersectionClassNameArray[ii]);
  1461. DeleteClassArray.push(IntersectionClassArray[ii]);
  1462. IntersectionClassArray.splice(ii,1);
  1463. IntersectionClassNameArray.splice(ii,1);
  1464. }
  1465. }
  1466. var html='';
  1467. if(IntersectionClassNameArray.length>0){
  1468. html=html+"*此次参加统考分析的班级有 "+IntersectionClassNameArray.join(',')+'。';
  1469. }
  1470. if(UnIntersectionClassNameArray.length>0){
  1471. html=html+' <span style="color:#888">'+UnIntersectionClassNameArray.join(',')+' 部分科目没有参加考试,不能参加统考。</span>';
  1472. }
  1473. $('.selectClass').html(html);
  1474. return false;
  1475. });
  1476. // 添加已选班级
  1477. $(".unchecked-box").on("click", "li", function() {
  1478. var selectedClassValue = $(this).attr('value');
  1479. var selectedClassName = $(this).text();
  1480. $(this).remove();
  1481. $(".selected-box").append('<li value="'+selectedClassValue+'">'+selectedClassName+'<img src="/images/icon-delete.png" alt=""></li>');
  1482. for(var ii=0;ii<DeleteClassArray.length;ii++){
  1483. //console.log(selectedClassValue);
  1484. //console.log(DeleteClassArray[ii]);
  1485. if($.trim(selectedClassValue)==$.trim(DeleteClassArray[ii])){
  1486. IntersectionClassNameArray.push(DeleteClassNameArray[ii]);
  1487. IntersectionClassArray.push(DeleteClassArray[ii]);
  1488. DeleteClassArray.splice(ii,1);
  1489. DeleteClassNameArray.splice(ii,1);
  1490. }
  1491. }
  1492. //console.log(IntersectionClassNameArray);
  1493. //console.log(UnIntersectionClassNameArray);
  1494. var html='';
  1495. if(IntersectionClassNameArray.length>0){
  1496. html=html+"*此次参加统考分析的班级有 "+IntersectionClassNameArray.join(',')+'。';
  1497. }
  1498. if(UnIntersectionClassNameArray.length>0){
  1499. html=html+' <span style="color:#888">'+UnIntersectionClassNameArray.join(',')+' 部分科目没有参加考试,不能参加统考。</span>';
  1500. }
  1501. $('.selectClass').html(html);
  1502. return false;
  1503. });
  1504. //教师权限全选
  1505. $('#teacher_view_limit_all').click(function(){
  1506. if ($(this).prop("checked")) {
  1507. $(".teacher_view_limit").prop("checked",true);
  1508. } else {
  1509. $(".teacher_view_limit").prop("checked",false);
  1510. }
  1511. });
  1512. $(".teacher_view_limit").click(function(){
  1513. console.log($('input[name=teacher_view_limit]:checked').length)
  1514. if($('input[name=teacher_view_limit]:checked').length==5){
  1515. $("#teacher_view_limit_all").prop("checked",true);
  1516. }else{
  1517. $("#teacher_view_limit_all").prop("checked",false);
  1518. }
  1519. });
  1520. <?php if(!isset($formInfo['cylet_id'])) echo "$('#teacher_view_limit_all').click();";?>
  1521. })()
  1522. </script>