12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685 |
- <script src="/js/jquery.datetimepicker.js"></script>
- <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
- <link rel="stylesheet" href="/css/modelCreatePaper.css" />
- <link rel="stylesheet" href="/css/jquery.datetimepicker.css" />
- <link rel="stylesheet" href="/css/third/base.css" />
- <style>
- #choose-error{color: #FF0000;}
- #examName-error{color: #FF0000;}
- #classIds-error{color: #FF0000;}
- #type-error{color: #FF0000;}
- #markType-error{color: #FF0000;}
- #subject-error{color: #FF0000;}
- #examDate{color: #FF0000;}
- .form {
- font-size: 14px;
- font-weight: bold;
- color: #999999;
- margin: 20px;
- }
- .form-item {
- margin-bottom: 20px;
- white-space: nowrap;
- }
- .form-item-label {
- width: 110px;
- text-align: right;
- display: inline-block;
- margin-right: 5px;
- vertical-align: top;
- }
- .form-item-input {
- width: 230px;
- height: 28px;
- text-indent: 5px;
- border: 1px solid #aeaeae;
- border-radius: 3px;
- outline: none;
- box-sizing: border-box;
- }
- .form-item-con {
- display: inline-block;
- }
- .form-item-con > div {
- margin-bottom: 5px;
- }
- .form-item-con .checkbox {
- display: inline-block;
- margin-right: 5px;
- }
- .form .date {
- display: inline-block;
- width: 100px;
- }
- .form .date span {
- color: #333333;
- }
- .form .classes {
- color: #666;
- }
- button {
- border: none;
- background: #2977ff;
- width: 111px;
- height: 36px;
- border-radius: 3px;
- font-size: 14px;
- color: #fff;
- outline: none;
- cursor: pointer;
- }
- button.save {
- display: block;
- margin: 40px auto;
- width:150px;
- }
- .confirmbox {
- background: #fff;
- border: 1px solid #cccccc;
- border-radius: 3px;
- padding: 40px 40px 30px;
- text-align: center;
- position: fixed;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- z-index: 99;
- }
- .confirmbox-mask {
- background: rgba(0, 0, 0, .7);
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- z-index: 99;
- position: fixed;
- display: none;
- }
- .confirmbox .confirmbox-btns {
- margin-top: 40px;
- }
- .confirmbox .confirmbox-btns button {
- margin-right: 10px;
- }
- .fl {
- float: left;
- }
- .fr {
- float: right;
- }
- .subject-name {
- display: inline-block;
- padding: 3px 8px;
- background: #ff9900;
- border-radius: 3px;
- color: #ffffff;
- font-size: 12px;
- }
- .tag {
- display: inline-block;
- padding: 3px 8px;
- border-radius: 3px;
- color: #ffffff;
- font-size: 12px;
- cursor: pointer;
- }
- .bg-green {
- background: #2977ff;
- }
- .bg-gray {
- background: #999;
- }
- .mt5 {
- margin-top: 5px;
- }
- .icon {
- display: inline-block;
- background: center/contain no-repeat;
- width: 25px;
- height: 25px;
- cursor: pointer;
- vertical-align: middle;
- }
- .icon-question {
- background-image: url("/images/question.png")
- }
- .same_exam_list{position:relative;}
- .close_icon{
- background:url("/images/close_icon.png") left center no-repeat;
- width:20px;
- height:20px;
- display: inline-block;
- position: absolute;
- left:-40px;
- top:5px;
- cursor: pointer;
- }
- .tooltip1{
- display: inline-block;
- position: relative;
- text-decoration: none;
- color: #333333;
- }
- .tooltip1:hover .tooltip-con{
- display: block;
- }
- .tooltip-con{
- display: none;
- border-radius: 3px;
- padding: 15px;
- border: 1px solid #333333;
- position: absolute;
- left: 35px;
- top: 60%;
- transform: translateY(-50%);
- width: 300px;
- background: #ffffff;
- }
- .tooltip-con:before{
- content: '';
- display: block;
- border: 6px solid transparent;
- border-right-color: #333;
- position: absolute;
- left: -13px;
- top: 50%;
- transform: translateY(-50%);
- }
- .tooltip-con:after{
- content: '';
- display: block;
- border: 6px solid transparent;
- border-right-color: #ffffff;
- position: absolute;
- left: -12px;
- top: 50%;
- transform: translateY(-50%);
- }
- .c-red{
- color: #CC3300
- }
- .selectClass{
- color: red;
- font-size:14px;
- width: 50%;
- padding-left:50px;
- }
- .subject_list{
- display:none;
- }
- #trial_begin_time_test{
- margin-left:-10px;
- }
- .mlr5{
- margin: 0 5px;
- }
- .classes{
- vertical-align: text-top;
- white-space: normal;
- }
- .classes div{
- display: inline-block;
- vertical-align: top;
- max-width: 500px;
- }
- .classes span{
- word-break: keep-all;
- display: inline-block;
- }
- .gray{color:#444444}
- .check_subject{margin-right:10px;}
- #a_s{display:none}
- /*修改样式开始*/
- .form-item_name{
- line-height: 28px;
- }
- .form-item-input_name{
- text-indent: 26px;
- }
- .name-tips{
- position: relative;
- left: 18px;
- bottom: 2px;
- }
- .test-type-ties{
- /*display: inline-block;
- margin: 0 12px;*/
- color: red;
- }
- .icon-test-type-ties{
- margin: 0 12px;
- margin-top: -3px;
- vertical-align: middle;
- }
- .form-item-con{
- color: #333;
- }
- .class-tips{
- vertical-align: middle;
- margin: 0 4px;
- }
- .class-box{
- width: 500px;
- }
- .class-box>p{
- margin-bottom: 10px;
- }
- .class-box>ul{
- width: 500px;
- height: 200px;
- padding: 10px 20px;
- background-color: #FAFAFA;
- box-sizing: border-box;
- border:1px solid #ddd;
- }
- .class-box>ul>li{
- float: left;
- margin-right: 15px;
- margin-bottom: 10px;
- cursor: pointer;
- }
- .class-box>ul>li>img{
- vertical-align: middle;
- margin-left: 3px;
- }
- .icon-change{
- margin: 0 37px;
- margin-top: 110px;
- }
- .red-tips{
- color: red;
- }
- button.save {
- height: 40px;
- }
- .selected-box li{
- color:#2977ff;
- }
- /*修改样式结束*/
- </style>
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="page-content">
- <form action="<?php echo $this->createUrl('cylet/save')?>" class="form" method="post">
- <div class="form-item">
- <label class="form-item-label">
- 统考名称
- </label>
- <input type="text" name="title" class="form-item-input" placeholder="必填" value="<?php if(isset($formInfo['title'])) echo $formInfo['title']?>">
- </div>
- <div class="form-item">
- <div class="mcp-form-list clearfix">
- <div class="mcp-form-menu fl">统考日期</div>
- <div class="mcp-form-detail fl clearfix">
- <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/>
- <span class="date_tips"></span>
- </div>
- <div id="examDate"></div>
- </div>
- </div>
- <div class="form-item">
- <label class="form-item-label">
- 选择年级
- </label>
- <div class="form-item-con">
- <?php
- $firstCheck=false;
- foreach (Yii::app()->params['grade_config'] as $id =>$item){
- if(isset($formInfo['grade'])){
- if($formInfo['grade']==$id){
- echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" checked value="'.$id.'">'.$item['grade_name'].'</label>';
- }else{
- echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" value="'.$id.'">'.$item['grade_name'].'</label>';
- }
- }else{
- if(!$firstCheck){
- echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" checked value="'.$id.'">'.$item['grade_name'].'</label>';
- $firstCheck=true;
- }else{
- echo '<label for="g1" class="mlr5"><input type="radio" id="grade" name="grade" value="'.$id.'">'.$item['grade_name'].'</label>';
- }
- }
- }
- ?>
- </div>
- </div>
- <div class="form-item">
- <label class="form-item-label">
- 选择模式
- </label>
- <div class="form-item-con">
- <?php
- if(isset($formInfo['exam_mode'])){
- ?>
- <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>
- <?php if(Yii::app()->params['section']==1):?>
- <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>
- <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>
- <?php
- endif;
- }else{
- ?>
- <label for="g1" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" checked value="0">普通模式</label>
- <?php if(Yii::app()->params['section']==1):?>
- <label for="g2" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" value="1">新高考模式(3+3)</label>
- <label for="g2" class="mlr5"><input type="radio" id="exam_mode" name="exam_mode" value="2">新高考(3+1+2)</label>
- <?php
- endif;
- }
- ?>
- <span class="test-type-ties"><img src="/images/icon-tips.png" alt="" class="icon-test-type-ties">
- 注意:普通模式统考总分为所有选择科目的总和
- <?php if(Yii::app()->params['section']==1):?>
- ,新高考模式(3+3)统考总分为语数英+选修科目6选3的总和(选修科目满分需一致)
- <?php endif;?>
- 。
- </span>
- </div>
- </div>
- <div class="form-item" id="a_s">
- <label class="form-item-label">
- 文理分类
- </label>
- <div class="form-item-con">
- <?php
- if(isset($formInfo['arts_science'])){
- ?>
- <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>
- <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>
- <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>
- <?php
- }else{
- ?>
- <label for="g2" class="mlr5"><input type="radio" id="arts_science" name="arts_science" value="0">不分科(新高考)</label>
- <label for="g2" class="mlr5"><input type="radio" id="arts_science" name="arts_science" value="1">文科</label>
- <label for="g3" class="mlr5"><input type="radio" id="arts_science" name="arts_science" value="2">理科</label>
- <?php
- }
- ?>
- </div>
- </div>
- <div class="form-item">
- <label class="form-item-label">
- 统考类型
- </label>
- <div class="form-item-con">
- <?php
- if(isset($formInfo['cylet_type'])){
- ?>
- <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>
- <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>
- <?php
- }else{
- ?>
- <label class="mlr5"><input type="radio" id="cylet_type" name="cylet_type" value="1">非年级统考</label>
- <label class="mlr5"><input type="radio" id="cylet_type" name="cylet_type" value="2">年级统考</label>
- <?php
- }
- ?>
- <span class="test-type-ties"><img src="/images/icon-tips.png" alt="" class="icon-test-type-ties">注意:只有“年级统考”才作为校长端的考试分析数据</span>
- </div>
- </div>
- <div class="form-item">
- <label class="form-item-label">
- 科目管理
- </label>
- <div class="form-item-con">
- <?php
- if(isset($subject) && $subject){
- foreach($subject as $key=> $val){
- echo '<label for="k1" class="check_subject mlr5"><input type="checkbox" name="subject" id="subject" value="'.$key.'">'.$val.'</label>';
- }
- }
- ?>
- </div>
- </div>
- <?php
- if(isset($subject) && $subject){
- foreach($subject as $key=> $val){
- ?>
- <div class="form-item subject_list" id="subjet_<?php echo $key?>">
- <label class="form-item-label">
- <span class="subject-name"><?php echo $val ?></span>
- </label>
- <div class="form-item-con">
- <div class="exam_area">
- <select name="" class="form-item-input exam_list" id="<?php echo $key?>">
- <option value="">请选择一场考试</option>
- </select>
- <lable class="gray" style="display:none">考试时间:</lable><label class="date"></label>
- <label class="class classes" style="display: inline-block">
- </label>
- </div>
- <div>
- <span class="tag bg-green">匹配统考卷</span>
- <a href="#" class="tooltip1">
- <i class="icon icon-question"></i>
- <div class="tooltip-con">
- 两次考试试卷一样,可点击【匹配统考卷】<br>
- 合并成一次考试,将两次考试的班级当作一<br>
- 次统考来分析
- </div>
- </a>
- </div>
- </div>
- </div>
- <?php
- }
- }
- ?>
- <div class="form-item">
- <label class="form-item-label">
- 成绩对家长可见
- </label>
- <div class="form-item-con">
- <?php
- if(isset($formInfo['push_status'])){
- ?>
- <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>
- <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>
- <?php
- }else{
- ?>
- <label class="mlr5"><input type="radio" id="push_status" name="push_status" checked value="1">是</label>
- <label class="mlr5"><input type="radio" id="push_status" name="push_status" value="0">否</label>
- <?php
- }
- ?>
- </div>
- </div>
- <div class="form-item">
- <label class="form-item-label">
- 教师查看权限
- </label>
- <div class="form-item-con">
- <?php if(isset($formInfo['teacher_view_limit']) && $formInfo['teacher_view_limit'] && count($formInfo['teacher_view_limit'])==5):?>
- <label class="mlr5"><input type="checkbox" id="teacher_view_limit_all" name="teacher_view_limit_all" checked value="1">全选</label>
- <?php else:?>
- <label class="mlr5"><input type="checkbox" id="teacher_view_limit_all" name="teacher_view_limit_all" value="1">全选</label>
- <?php endif;?>
- <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>
- <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>
- <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>
- <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>
- <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>
- </div>
- </div>
- <div class="form-item clearfix">
- <div class="class-box fl" style="margin-left:50px;">
- <p><img src="/images/icon-tips.png" alt="" class="class-tips">此次参加统考分析的班级如下(点击移除)</p>
- <ul class="selected-box">
- </ul>
- </div>
- <img src="/images/icon-change.png" alt="" class="icon-change fl">
- <div class="class-box fl">
- <p><img src="/images/icon-tips.png" alt="" class="class-tips">已移除班级(点击还原)</p>
- <ul class="unchecked-box">
- </ul>
- </div>
- </div>
- <div class="selectClass"></div>
- <button type="button" class="save" id="save">保存</button>
- <input type="hidden" name="subject_ids" value="">
- <input type="hidden" name="class_ids" value="">
- <input type="hidden" name="exam_ids" value="">
- <input type="hidden" name="is_has_time" value="<?php if(isset($formInfo['cylet_id'])) {echo 1;}else{echo 0;} ?>">
- <input type="hidden" name="cylet_id" value="<?php if(isset($formInfo['cylet_id'])) echo $formInfo['cylet_id'];?>">
- <input type="hidden" name="cylet_type_d" value="">
- </form>
- <div class="confirmbox-mask" id="confirmBox" style="display: none">
- <div class="confirmbox">
- <div class="notice_txt">
- 您所选择的各科试卷统考周期超过一周,<br>
- 是否重新编辑?
- </div>
- <div class="confirmbox-btns">
- <button type="button" class="fl" id="edit">重新编辑</button>
- <button type="button" class="fr" id="confirmSave">保存</button>
- </div>
- </div>
- </div>
- </div>
- <script>
- (function () {
- var saveRepeat=false;
- var SubjectLoaded=[]; //学科加载状态
- var SelectClass=[]; //学科对应考试班级Id
- var SelectClassName=[]; //学科对应考试班级名称
- var Subject_Exam=[]; //学科对应考试
- var Subject_Same_Exam= []; //学科匹配相同试卷
- var EditSubjectSameExam=[];
- <?php
- $allSubject=Yii::app()->params['subjectId'];
- unset($allSubject[3]);
- unset($allSubject[51]);
- unset($allSubject[20]);
- foreach ($allSubject as $key =>$val){
- echo 'SubjectLoaded['.$key.']=false;';
- echo 'SelectClass['.$key.']=[];';
- echo 'SelectClassName['.$key.']=[];';
- echo "Subject_Exam[".$key."]='';";
- echo "Subject_Same_Exam[".$key."]=[];";
- echo "EditSubjectSameExam[".$key."]=[];";
- }
- ?>
- <?php
- if(isset($formInfo['examinfo']['same_exam'])):
- foreach ($formInfo['examinfo']['same_exam'] as $k=>$v):
- if($v):
- foreach ($v as $value):
- ?>
- Subject_Same_Exam[<?php echo $k;?>].push('<?php echo $value;?>');
- EditSubjectSameExam[<?php echo $k;?>].push('<?php echo $value;?>');
- <?php
- endforeach;endif;
- endforeach;endif;
- ?>
- //年级分科数据初始化
- var Grade_A_S=[];
- var nowGrade=1;
- <?php
- if(isset($grade)):
- foreach ($grade as $k=>$v):
- ?>
- Grade_A_S[<?php echo $k;?>]=<?php echo $v;?>;
- <?php
- endforeach;endif;
- if(isset($formInfo['grade'])):
- ?>
- nowGrade=<?php echo $formInfo['grade'] ?>;
- <?php
- endif;
- ?>
- //console.log(nowGrade);
- if(Grade_A_S[nowGrade]==2){
- $('#a_s').show();
- }
- var IntersectionClassArray=[]; //选择的考试所有班级的交集
- var IntersectionClassNameArray=[]; //选择的考试所有班级名称的交集
- var UnIntersectionClassArray=[]; //排除选择的考试所有班级的交集
- var UnIntersectionClassNameArray=[]; //排除选择的考试所有班级名称的交集
- var EditClassArray=[]; //编辑状态读取的班级ID
- var EditClassNameArray=[]; //编辑状态读取的班级
- var DeleteClassArray=[]; //手动删除的班级(编辑统考时)
- var DeleteClassNameArray=[]; //手动删除的班级(编辑统考时)
- var grade=''; //选择的年级
- var savedSubjectNumber=0; //保存的学科数量
- //如果是编辑状态,需要校验是否有手动删除的班级
- <?php
- if(isset($formInfo['class_ids']) && $formInfo['class_ids']){
- $classIds=explode(',',$formInfo['class_ids']);
- foreach ($classIds as $cids){
- echo 'EditClassArray.push("'.$cids.'");';
- }
- }
- //保存的学科数量
- if(isset($formInfo['subject_ids']) && $formInfo['subject_ids']){
- $SubjectArr=explode(',',$formInfo['subject_ids']);
- echo 'savedSubjectNumber='.count($SubjectArr).';';
- }
- ?>
- //console.log(EditClassArray);
- var confirmSaveBtn = document.getElementById('confirmSave');
- var saveBtn = document.getElementById('save');
- var editBtn = document.getElementById('edit');
- var confirmBox = document.getElementById('confirmBox');
- function initExamSubject(data){
- $subjectArr=data.split(',');
- for(var i=0;i<$("input[name='subject']").length;i++){
- if($.inArray($("input[name='subject']").eq(i).val(),$subjectArr)!=-1){
- $("input[name='subject']").eq(i).click();
- }
- }
- }
- function SaveCylet(){
- if($("input[name='title']").val()==''){
- layer.msg('请输入统考名称');
- return false;
- }
- if($("input[name='title']").val().length>60){
- layer.msg('统考名称长度不超过60个字符');
- return false;
- }
- if($("input[name='examDate']").val()==''){
- layer.msg('请选择统考时间');
- return false;
- }
- teacher_limit='';
- for(var i=0;i<$(".teacher_view_limit").length;i++){
- if($(".teacher_view_limit").eq(i).is(":checked")){
- if(teacher_limit==''){
- teacher_limit=$(".teacher_view_limit").eq(i).val();
- }else{
- teacher_limit=teacher_limit+','+$(".teacher_view_limit").eq(i).val();
- }
- }
- }
- if(teacher_limit==''){
- layer.msg('请选择统考教师查看权限');
- return false;
- }
- var subject_ids='',exam_ids='',subject_num=0;
- for(var i=0;i<$("input[name='subject']").length;i++){
- if($("input[name='subject']").eq(i).is(":checked")){
- subject_num++;
- if(subject_ids==''){
- subject_ids=$("input[name='subject']").eq(i).val();
- }else{
- subject_ids=subject_ids+','+$("input[name='subject']").eq(i).val();
- }
- }
- }
- /*
- if(subject_num<2){
- layer.msg('请最少选择两个学科!');
- return false;
- }
- */
- for(var i=0;i<$(".exam_list").length;i++){
- if($(".exam_list").eq(i).val()!='' && $(".exam_list").eq(i).val()!=null){
- if(exam_ids==''){
- exam_ids=$(".exam_list").eq(i).val();
- }else{
- exam_ids=exam_ids+','+$(".exam_list").eq(i).val();
- }
- }
- }
- if(subject_ids==''){
- layer.msg('请选择统考科目');
- return false;
- }
- if(exam_ids==''){
- layer.msg('请选择至少一场考试');
- return false;
- }
- if(exam_ids.split(',').length<subject_num){
- layer.msg('部分学科没有考试,请取消勾选!');
- return false;
- }
- var AllExamInfo=new Array();
- AllExamInfo['exam']=Subject_Exam;
- AllExamInfo['same_exam']=Subject_Same_Exam;
- var jsonStr='{';
- jsonStr+='"exam":{';
- tempExamStr='';
- for(var k in Subject_Exam){
- if(Subject_Exam[k]!=''){
- if(tempExamStr==''){
- tempExamStr='"'+k+'":"'+Subject_Exam[k]+'"';
- }else{
- tempExamStr+=',"'+k+'":"'+Subject_Exam[k]+'"';
- }
- }
- }
- jsonStr+=tempExamStr;
- jsonStr+='}';
- jsonStr+=',"same_exam":{';
- $sameStr='';
- tempExamStr='';
- for(var j in Subject_Same_Exam){
- if(Subject_Same_Exam[j].length>0){
- if(tempExamStr==''){
- tempExamStr+='"'+j+'":[';
- }else{
- tempExamStr+=',"'+j+'":[';
- }
- subStr='';
- for(var i=0;i<Subject_Same_Exam[j].length;i++){
- if(subStr==''){
- subStr='"'+Subject_Same_Exam[j][i]+'"';
- }else{
- subStr+=',"'+Subject_Same_Exam[j][i]+'"';
- }
- }
- tempExamStr+=subStr;
- tempExamStr+=']';
- }
- }
- jsonStr+=tempExamStr;
- jsonStr+='}}';
- //选中的班级
- selectClassIds=[];
- $('.selected-box li').each(function(){
- selectClassIds.push($(this).attr('value'))
- });
- $('input[name="subject_ids"]').val(subject_ids);
- $('input[name="class_ids"]').val(selectClassIds.join(','));
- $('input[name="exam_ids"]').val(jsonStr);
- if(IntersectionClassArray.length==0){
- layer.msg('您所选择的各科试卷没有统考班级');
- return false;
- }
- var grade=$('input[name=grade]:checked').val();
- arts_science=$('input[name=arts_science]:checked').val();
- exam_mode=$('input[name=exam_mode]:checked').val();
- if(Grade_A_S[grade]==2 &&arts_science==undefined){
- layer.msg('请选择文理分类');
- return false;
- }
- //验证统考提示
- userSelectType=$('input[name=cylet_type]:checked').val();
- if(userSelectType==undefined){
- layer.msg('请选择统考类型');
- return false;
- }
- sysSelectType=$('input[name=cylet_type_d]').val();
- isDeleteClass=$.trim($('.unchecked-box').html());
- if(userSelectType==1){
- if(sysSelectType==2 && isDeleteClass==''){
- layer.msg("统考班级满足年级统考,<br>是否仍标记为“非年级统考”?", {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
- if(CheckExamDate()>7){
- toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
- }else{
- SubmitForm();
- }
- }
- });
- }else{
- if(CheckExamDate()>7){
- toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
- }else{
- SubmitForm();
- }
- }
- }else{
- if(isDeleteClass!='' || sysSelectType==1){
- layer.msg("统考班级数量不足,<br>是否仍标记为“年级统考”?", {
- time: 0,
- btn: ['确定', '取消'],
- yes: function(index){
- layer.close(index);
- if(CheckExamDate()>7){
- toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
- }else{
- SubmitForm();
- }
- }
- });
- }else{
- if(CheckExamDate()>7){
- toggleConfirm('您所选择的各科试卷统考周期超过一周,<br>是否重新编辑?');
- }else{
- SubmitForm();
- }
- }
- }
- }
- function toggleConfirm(txt) {
- confirmBox.style.display = confirmBox.style.display === 'none' ? 'block' : 'none';
- $('.notice_txt').html(txt);
- return false;
- }
- function SubmitForm(){
- if(!saveRepeat){
- saveRepeat=true;
- $('.form').submit();
- }
- }
- saveBtn.addEventListener('click', SaveCylet, false);
- editBtn.addEventListener('click', toggleConfirm, false);
- confirmSaveBtn.addEventListener('click', SubmitForm, false);
- function CopyArray(arr1,arr2) {
- for(var i in arr1){
- arr2.push(arr1[i])
- }
- }
- /*统计科目班级数组的并集*/
- function Union(){
- var html='';
- $('.selected-box').html('');
- $('.unchecked-box').html('');
- //console.log(SelectClass);
- //console.log(SelectClassName);
- IntersectionClassArray.length=0;
- IntersectionClassNameArray.length=0;
- var allClassArr=[],allClassNameArr=[];
- if(SelectClass.length>0){
- for(var i in SelectClass){
- if(SelectClass[i].length==0){
- continue;
- }
- for(var j in SelectClass[i]){
- if($.inArray(SelectClass[i][j],allClassArr)==-1){
- allClassArr.push(SelectClass[i][j]);
- allClassNameArr.push(SelectClassName[i][j]);
- }
- }
- }
- }
- //编辑状态初次执行,进行校验
- console.log(savedSubjectNumber);
- if(EditClassArray.length>0){
- var TempArr3=[];
- var TempArr4=[];
- for(var i=0;i<allClassArr.length;i++){
- if($.inArray(allClassArr[i],EditClassArray)==-1){
- DeleteClassArray.push(allClassArr[i]);
- DeleteClassNameArray.push(allClassNameArr[i]);
- }else{
- TempArr3.push(allClassArr[i]);
- TempArr4.push(allClassNameArr[i]);
- }
- }
- allClassArr.length=0;
- allClassNameArr.length=0;
- CopyArray(TempArr3,allClassArr);
- CopyArray(TempArr4,allClassNameArr);
- if($("input[name='subject']:checked").length!=savedSubjectNumber){
- EditClassArray.length=0;
- }
- }
- if(DeleteClassArray.length>0 ){
- var deleteHtml='';
- for(var i=0;i<DeleteClassArray.length;i++){
- deleteHtml+='<li value="'+DeleteClassArray[i]+'">'+DeleteClassNameArray[i]+'<img src="/images/icon-add.png" alt=""></li>';
- }
- $('.unchecked-box').html(deleteHtml);
- DeleteClassArray.length=0;
- DeleteClassNameArray.length=0;
- }
- //填充选择区
- var selectedBoxHtml='';
- for(var i=0;i<allClassArr.length;i++){
- selectedBoxHtml+='<li value="'+allClassArr[i]+'">'+allClassNameArr[i]+'<img src="/images/icon-delete.png" alt=""></li>';
- }
- if($.trim($('.selected-box').html())==''){
- $('.selected-box').html(selectedBoxHtml);
- }
- //判断统考类型
- for(var jj=0;jj<$('.class').length;jj++){
- if($('.class').eq(jj).attr('is_all')==0){
- $('input[name=cylet_type_d]').val(1);
- break;
- }
- $('input[name=cylet_type_d]').val(2);
- }
- $('.selectClass').html(html);
- CopyArray(allClassArr,IntersectionClassArray);
- CopyArray(allClassNameArr,IntersectionClassNameArray);
- }
- /*统计科目班级数组的交集*/
- function Intersection(){
- var Temp1=[],Temp2=[];
- var minLengthArrKey=0; //最少班级的科目
- var isFind=true;
- DeleteClassArray.length=0;
- DeleteClassNameArray.length=0;
- UnIntersectionClassNameArray.length=0;
- var AllClassNameArr=[]; //所有班级合并
- for(var i in SelectClass){
- $.merge(AllClassNameArr,SelectClassName[i]);
- if(SelectClass[i].length==0){
- continue;
- }
- if(minLengthArrKey==0 || SelectClass[i].length<SelectClass[minLengthArrKey].length){
- minLengthArrKey=i;
- }
- }
- if(minLengthArrKey==0){
- $('.selectClass').html('');
- return false;
- }
- for(var i=0;i<SelectClass[minLengthArrKey].length;i++){
- isFind=true;
- for(var j in SelectClass){
- if(j==minLengthArrKey || SelectClass[j].length==0){
- continue;
- }
- if($.inArray(SelectClass[minLengthArrKey][i],SelectClass[j])==-1){
- isFind=false;
- }
- }
- if(isFind){
- Temp1.push(SelectClass[minLengthArrKey][i]);
- Temp2.push(SelectClassName[minLengthArrKey][i]);
- }
- }
- $.unique(AllClassNameArr);
- IntersectionClassArray.length=0;
- IntersectionClassNameArray.length=0;
- CopyArray(Temp1,IntersectionClassArray);
- CopyArray(Temp2,IntersectionClassNameArray);
- for(var k=0;k<AllClassNameArr.length;k++){
- if($.inArray(AllClassNameArr[k],IntersectionClassNameArray)==-1){
- UnIntersectionClassNameArray.push(AllClassNameArr[k]);
- }
- }
- //编辑状态初次执行,进行校验
- if(EditClassArray.length>0){
- var TempArr3=[];
- var TempArr4=[];
- for(var i=0;i<IntersectionClassArray.length;i++){
- if($.inArray(IntersectionClassArray[i],EditClassArray)==-1){
- DeleteClassArray.push(IntersectionClassArray[i]);
- DeleteClassNameArray.push(IntersectionClassNameArray[i]);
- }else{
- TempArr3.push(IntersectionClassArray[i]);
- TempArr4.push(IntersectionClassNameArray[i]);
- }
- }
- IntersectionClassArray.length=0;
- IntersectionClassNameArray.length=0;
- CopyArray(TempArr3,IntersectionClassArray);
- CopyArray(TempArr4,IntersectionClassNameArray);
- if($("input[name='subject']:checked").length>=savedSubjectNumber){
- EditClassArray.length=0;
- }
- }
- //console.log(DeleteClassNameArray);
- var html='';
- $('.selected-box').html('');
- $('.unchecked-box').html('');
- if(IntersectionClassNameArray.length>0){
- // html=html+"*此次参加统考分析的班级有 "+IntersectionClassNameArray.join(',')+'。';
- //填充选择区
- var selectedBoxHtml='';
- for(var i=0;i<IntersectionClassNameArray.length;i++){
- selectedBoxHtml+='<li value="'+IntersectionClassArray[i]+'">'+IntersectionClassNameArray[i]+'<img src="/images/icon-delete.png" alt=""></li>';
- }
- if($.trim($('.selected-box').html())==''){
- $('.selected-box').html(selectedBoxHtml);
- }
- }
- if(UnIntersectionClassNameArray.length>0){
- html=html+' <span style="color:#888">'+UnIntersectionClassNameArray.join(',')+' 部分科目没有参加考试,不能参加统考。</span>';
- }
- //console.log(DeleteClassArray);
- if(DeleteClassArray.length>0 ){
- var deleteHtml='';
- for(var i=0;i<DeleteClassArray.length;i++){
- deleteHtml+='<li value="'+DeleteClassArray[i]+'">'+DeleteClassNameArray[i]+'<img src="/images/icon-add.png" alt=""></li>';
- }
- $('.unchecked-box').html(deleteHtml);
- DeleteClassArray.length=0;
- DeleteClassNameArray.length=0;
- }
- //判断统考类型
- for(var jj=0;jj<$('.class').length;jj++){
- if($('.class').eq(jj).attr('is_all')==0){
- $('input[name=cylet_type_d]').val(1);
- break;
- }
- $('input[name=cylet_type_d]').val(2);
- }
- $('.selectClass').html(html);
- }
- /*计算各考试间隔时间*/
- function CheckExamDate(){
- var min=0,max=0;
- var dateObj=$('.date');
- for(var i=0;i<dateObj.length;i++){
- if(dateObj.eq(i).html()==''){
- continue;
- }
- date = new Date(dateObj.eq(i).html());
- time1=date.getTime();
- if(min==0 || time1<min){
- min=time1;
- }
- if(max==0 || time1>max){
- max=time1;
- }
- }
- days=(max-min)/1000/86400;
- return days
- }
- function getExam(subject_id,grade){
- var obj=$('#subjet_'+subject_id);
- var cylet_id=$('input[name="cylet_id"]').val();
- if(Grade_A_S[grade]==2){
- arts_s=$('input[name=arts_science]:checked').val();
- }else{
- arts_s=0;
- }
- $.ajax({
- url:'<?php echo $this->createUrl('cylet/getexambysubject')?>',
- type:"POST",
- data:{'subject_id':subject_id,'grade':grade,'cylet_id':cylet_id,'arts_s':arts_s},
- dataType:'json',
- success:function (res) {
- if(res.status==1){
- var examIdArr=[];
- var Selectval='';
- <?php
- foreach ($allSubject as $key =>$val){
- echo 'examIdArr['.$key.']=[];';
- }
- if(isset($formInfo['examinfo']) && $formInfo['examinfo']['exam']){
- foreach ($formInfo['examinfo']['exam'] as $key=>$val){
- ?>
- examIdArr[<?php echo $key?>].push('<?php echo $val ?>');
- <?php
- }
- }
- ?>
- var html='';
- if(res.data.length==0){
- obj.find('.form-item-input').html('<option value="">请选择一场考试</option>');
- }else{
- obj.find('.form-item-input').html('');
- }
- obj.find('.date').html('');
- obj.find('.class').html('');
- for(var i=0;i<res.data.length;i++){
- if(examIdArr[subject_id].length>0){
- if($.inArray(res.data[i]['exam_id'],examIdArr[subject_id])==-1){
- html+='<option value="'+res.data[i]['exam_id']+'">'+res.data[i]['name']+'</option>';
- }else{
- Selectval=res.data[i]['exam_id'];
- html+='<option value="'+res.data[i]['exam_id']+'" selected>'+res.data[i]['name']+'</option>';
- Subject_Exam[subject_id]=res.data[i]['exam_id'];
- }
- }else{
- if(i==0){
- Selectval=res.data[i]['exam_id'];
- Subject_Exam[subject_id]=res.data[i]['exam_id'];
- html+='<option value="'+res.data[i]['exam_id']+'" selected>'+res.data[i]['name']+'</option>';
- }else{
- html+='<option value="'+res.data[i]['exam_id']+'">'+res.data[i]['name']+'</option>';
- }
- }
- }
- //console.log(Selectval);
- SubjectLoaded[subject_id]=true;
- obj.find('.form-item-input').append(html);
- if(Selectval!=''){
- loadClass(Selectval,subject_id,obj.find('.exam_area'),false);
- if(Subject_Same_Exam[subject_id].length>0){
- obj.find('.bg-green').click();
- }
- }
- }
- }
- });
- }
- /*加载班级*/
- function loadClass(exam_id,subject_id,obj,isSameExam){
- if(!isSameExam){
- SelectClass[subject_id]=[];
- SelectClassName[subject_id]=[];
- }
- grade=$('input[name=grade]:checked').val();
- if(Grade_A_S[grade]==2){
- arts_s=$('input[name=arts_science]:checked').val();
- }else{
- arts_s=0;
- }
- $.ajax({
- url:'<?php echo $this->createUrl('cylet/getclassByexam')?>',
- type:'POST',
- dataType:'json',
- data:{'examId':exam_id,'arts_science':arts_s,'grade':grade},
- success:function(res){
- if(res.status==1){
- obj.find('.date').html(res.create_time);
- obj.find('.gray').show();
- var html='<span class="gray">班级:</span><div>' ;
- var classlist=[];
- for(var i=0;i<res.class.length;i++){
- classlist.push('<span>'+res.class[i]['class_name']+'</span>');
- if($.inArray(res.class[i]['class_id'],SelectClass[subject_id])==-1){
- SelectClass[subject_id].push(res.class[i]['class_id']);
- SelectClassName[subject_id].push(res.class[i]['class_name']);
- }
- }
- if(classlist.length>0){
- html=html+classlist.join(',');
- }
- html+='</div>';
- obj.find('.class').html(html);
- obj.find('.class').attr('is_all',res.is_all);
- //Intersection();
- Union()
- }
- }
- });
- }
- /*重置变量*/
- function resetValue(){
- $('.selectClass').html('');
- $('.unchecked-box').html('');
- $('.selected-box').html('');
- IntersectionClassArray.length=0;
- IntersectionClassNameArray.length=0;
- <?php
- foreach ($allSubject as $key =>$val){
- echo 'SelectClass['.$key.']=[];';
- echo 'SelectClassName['.$key.']=[];';
- echo "Subject_Exam[".$key."]='';";
- echo "Subject_Same_Exam[".$key."]=[];";
- echo "SubjectLoaded[".$key."]=false;";
- }
- ?>
- var obj=$('.exam_list');
- for(var i=0;i<obj.length;i++){
- obj.html('option value="">请选择一场考试</option>');
- obj.closest('.subject_list').find('.date').html('');
- obj.closest('.subject_list').find('.class').html('');
- obj.closest('.subject_list').hide();
- obj.closest('.subject_list').find('.gray').hide();
- obj.closest('.subject_list').find('.same_exam_list').remove();
- obj.closest('.form-item-con').find('.tag').removeClass('bg-gray').addClass('bg-green').html('匹配统考卷');
- }
- for(var i=0;i<$('input[name=subject]').length;i++){
- $('input[name=subject]').eq(i).prop('checked',false);
- $('input[name=subject]').eq(i).prop('disabled',false);
- }
- }
- /*验证考试时间*/
- function checkCreateTime($time,cylet_id){
- if($time==''){
- return false;
- }
- grade='';
- for(var i=0;i<$('input[name="grade"]').length;i++){
- if($('input[name="grade"]').eq(i).is(":checked")){
- if(grade==''){
- grade=$('input[name="grade"]').eq(i).val();
- }else{
- grade=grade+','+$('input[name="grade"]').eq(i).val();
- }
- }
- }
- if(Grade_A_S[grade]==2){
- arts_s=$('input[name=arts_science]:checked').val();
- }else{
- arts_s=0;
- }
- $.ajax({
- url:'<?php echo $this->createUrl('cylet/checktime')?>',
- type:'POST',
- dataType:'json',
- data:{'create_time':$time,'cylet_id':cylet_id,'grade':grade,'arts_s':arts_s},
- success:function(res){
- if(res.status==1){
- $('.date_tips').html('时间可以使用');
- $('input[name="is_has_time"]').val(1);
- }else{
- $('.date_tips').html(res.msg);
- $('input[name="is_has_time"]').val(0);
- }
- }
- });
- }
- /*选择年级*/
- $('input[name=grade]').click(function () {
- grade=$('input[name="grade"]:checked').val();
- if(Grade_A_S[grade]==2){
- $('#a_s').show();
- }else{
- $('#a_s').hide();
- }
- resetValue();
- $time=$('input[name="examDate"]').val();
- cylet_id=$('input[name="cylet_id"]').val();
- if($time!=''){
- select_date=new Date($time);
- var useTime=Math.floor(select_date.getTime()/1000);
- //checkCreateTime(useTime,cylet_id);
- }
- });
- /*选择高考模式*/
- $('input[name=exam_mode]').click(function () {
- if($("input[name=arts_science]").val()!=undefined){
- if($(this).val()==1){
- $('input[name=arts_science]').eq(0).click();
- $('input[name=arts_science]').eq(1).attr('disabled',true);
- $('input[name=arts_science]').eq(2).attr('disabled',true);
- }else{
- $('input[name=arts_science]').eq(1).attr('disabled',false);
- $('input[name=arts_science]').eq(2).attr('disabled',false);
- }
- }
- });
- /*选择文理科*/
- $('input[name=arts_science]').click(function () {
- var selectedSubject='';
- for(var i=0;i<$("input[name='subject']").length;i++){
- if($("input[name='subject']").eq(i).is(':checked')){
- if(selectedSubject==''){
- selectedSubject=$("input[name='subject']").eq(i).val();
- }else{
- selectedSubject=selectedSubject+','+$("input[name='subject']").eq(i).val();
- }
- }
- }
- resetValue();
- $time=$('input[name="examDate"]').val();
- cylet_id=$('input[name="cylet_id"]').val();
- if($time!=''){
- select_date=new Date($time);
- var useTime=Math.floor(select_date.getTime()/1000);
- //checkCreateTime(useTime,cylet_id);
- }
- initExamSubject(selectedSubject);
- });
- /*选择科目*/
- $('body').on('click','#subject',function(){
- var subject_id=$(this).val(),
- obj=$('#subjet_'+subject_id);
- HandleSubject(subject_id);
- if($(this).is(":checked")){
- if(!SubjectLoaded[subject_id]){
- getExam(subject_id,$('input[name=grade]:checked').val());
- }
- obj.show();
- }else{
- Subject_Exam[subject_id]='';
- SubjectLoaded[subject_id]=false;
- SelectClass[subject_id].length=0;
- SelectClassName[subject_id].length=0;
- Subject_Same_Exam[subject_id].length=0;
- obj.find('.same_exam_list').remove();
- obj.find('.date').html('');
- obj.find('.classes').removeAttr('is_all');
- obj.hide();
- //Intersection();
- Union()
- }
- });
- /*选择考试*/
- $('body').on('change','.exam_list',function(){
- var exam_id=$(this).val(),
- obj=$(this).closest('.exam_area'),
- subject_id=$(this).attr('id');
- $(this).closest('.form-item-con').find('.same_exam_list').remove();
- Subject_Exam[subject_id]=exam_id;
- loadClass(exam_id,subject_id,obj,false);
- obj.closest('.form-item-con').find('.tag').removeClass('bg-gray').addClass('bg-green').html('匹配统考卷');
- }).on('click','.bg-green',function () {
- //匹配统考试卷
- var obj=$(this);
- var exam_id=$(this).closest('.form-item-con').find('.exam_list').val();
- var subject_id=$(this).closest('.form-item-con').find('select').eq(0).attr('id');
- if(exam_id==''){
- layer.msg('请选择一场考试');
- return false;
- }
- // console.log(EditSubjectSameExam[subject_id]);
- Subject_Same_Exam[subject_id]=[];
- $.ajax({
- url:'<?php echo $this->createUrl('cylet/findsamepaper')?>',
- type:'POST',
- dataType:'json',
- data:{'examId':exam_id},
- success:function(res){
- if(res.status==1){
- for(var i=0;i<res.data.length;i++){
- if(EditSubjectSameExam[subject_id].length>0){
- if($.inArray(res.data[i]['exam_id'],EditSubjectSameExam[subject_id])!=-1){
- var html='<div class="exam_area same_exam_list">';
- html+='<span class="close_icon"></span>';
- html=html+'<input readonly class="form-item-input " id="'+res.data[i]['exam_id']+'" value="'+res.data[i]['name']+'">';
- html+=' <lable class="gray" style="display:none">考试时间:</lable><label class="date"></label>';
- html+='<label class="class classes" style="display: inline-flex"></label>';
- html+='</div>';
- obj.parent().before(html);
- Subject_Same_Exam[subject_id].push(res.data[i]['exam_id']);
- loadClass(res.data[i]['exam_id'],subject_id,obj.parent().prev(),true);
- }
- }else{
- var html='<div class="exam_area same_exam_list">';
- html+='<span class="close_icon"></span>';
- html=html+'<input readonly class="form-item-input " id="'+res.data[i]['exam_id']+'" value="'+res.data[i]['name']+'">';
- html+=' <lable class="gray" style="display:none">考试时间:</lable><label class="date"></label>';
- html+='<label class="class classes" style="display: inline-flex"></label>';
- html+='</div>';
- obj.parent().before(html);
- Subject_Same_Exam[subject_id].push(res.data[i]['exam_id']);
- loadClass(res.data[i]['exam_id'],subject_id,obj.parent().prev(),true);
- }
- }
- EditSubjectSameExam[subject_id].length=0;
- obj.removeClass('bg-green');
- obj.addClass('bg-gray');
- }else{
- obj.removeClass('bg-green');
- obj.addClass('bg-gray');
- obj.html('无试卷');
- }
- }
- });
- }).on('click','.close_icon',function () {
- var obj=$(this).closest('.same_exam_list');
- // var exam_id=$(this).closest('.form-item-con').find('.exam_list').val();
- var subject_id=$(this).closest('.form-item-con').find('select').eq(0).attr('id');
- var ThisClassListLength=obj.find('.classes div span').length;
- var ThisIndex=obj.index();
- var parent=obj.parent();
- var AllClass=[];
- var ThisExamId=$(this).closest('.same_exam_list').find('.form-item-input ').attr('id');
- for(var ii=0;ii<Subject_Same_Exam[subject_id].length;ii++){
- if($.trim(ThisExamId)==$.trim(Subject_Same_Exam[subject_id][ii])){
- Subject_Same_Exam[subject_id].splice(ii,1);
- }
- }
- //查询兄弟元素所有班级
- for(var k=0; k<parent.find('.exam_area').length;k++){
- if(k==ThisIndex){
- continue;
- }
- for(var i=0;i<parent.find('.exam_area').eq(k).find('.classes div span').length;i++){
- AllClass.push(parent.find('.exam_area').eq(k).find('.classes div span').eq(i).html());
- }
- }
- for(var i=0;i<ThisClassListLength;i++){
- var class_name=obj.find('.classes div span').eq(i).html();
- if($.inArray(class_name,AllClass)!=-1){
- continue;
- }
- for(var j in SelectClassName[subject_id]){
- if($.trim(class_name)==$.trim(SelectClassName[subject_id][j])){
- SelectClassName[subject_id].splice(j,1);
- SelectClass[subject_id].splice(j,1);
- }
- }
- }
- //Intersection();
- Union()
- obj.remove();
- });
- //编辑统考初始化
- <?php
- if(isset($formInfo)){
- echo 'initExamSubject("'.$formInfo['subject_ids'].'");'; //初始化科目
- }
- ?>
- $('.datetimepicker8').datetimepicker({
- onGenerate:function( ct ){
- $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
- $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
- },
- onClose:function(date){
- time=new Date(date);
- var useTime=Math.floor(time.getTime()/1000);
- var cylet_id=$('input[name="cylet_id"]').val();
- //checkCreateTime(useTime,cylet_id);
- },
- format:'Y-m-d',
- formatDate:'Y-m-d',
- //minDate:'-1970/01/2',
- maxDate:'+<?php echo date('Y-m-d')?>',
- todayBtn : true,
- minDate: '',
- timepicker:false,
- scrollMonth:false,
- scrollTime:false,
- scrollInput:false,
- });
-
- //理综,文综科目选择处理
- function HandleSubject(Subject_id) {
- if($.inArray(Subject_id,['12','13','14','15','16','17','18','19'])!=-1){
- var Arts=$('input[name="subject"]').eq(9);
- var Science=$('input[name="subject"]').eq(10);
- var ArtsStatus=Arts.is(':checked') ;
- var ScienceStatus=Science.is(':checked') ;
- var ArtsSubject=['12','13','14'];
- var ScienceSubject=['15','16','17'];
- for(var i in ArtsSubject){
- if($('input[name="subject"][value='+ArtsSubject[i]+']').is(':checked')==true){
- Arts.attr('disabled',true);
- break;
- }
- Arts.attr('disabled',false);
- }
- for(var i in ScienceSubject){
- if($('input[name="subject"][value='+ScienceSubject[i]+']').is(':checked')==true){
- Science.attr('disabled',true);
- break;
- }
- Science.attr('disabled',false);
- }
- if(Subject_id==18){
- var Artsdisabled=ArtsStatus==true?true:false;
- for(var i in ArtsSubject){
- $('input[name="subject"][value='+ArtsSubject[i]+']').attr('disabled',Artsdisabled);
- }
- }
- if(Subject_id==19){
- var Sciencedisabled=ScienceStatus?true:false;
- for(var i in ScienceSubject){
- $('input[name="subject"][value='+ScienceSubject[i]+']').attr('disabled',Sciencedisabled);
- }
- }
- }
- }
- $(".selected-box").on("click", "li", function() {
- var classValue = $(this).attr('value');
- var className = $(this).text();
- $(this).remove();
- $(".unchecked-box").append('<li value="'+classValue+'">'+className+'<img src="/images/icon-add.png" alt=""></li>');
- //处理已选数据IntersectionClassArray
- for(var ii=0;ii<IntersectionClassArray.length;ii++){
- if($.trim(classValue)==$.trim(IntersectionClassArray[ii])){
- //UnIntersectionClassNameArray.push(IntersectionClassNameArray[ii]);
- //UnIntersectionClassArray.push(IntersectionClassArray[ii]);
- DeleteClassNameArray.push(IntersectionClassNameArray[ii]);
- DeleteClassArray.push(IntersectionClassArray[ii]);
- IntersectionClassArray.splice(ii,1);
- IntersectionClassNameArray.splice(ii,1);
- }
- }
- var html='';
- if(IntersectionClassNameArray.length>0){
- html=html+"*此次参加统考分析的班级有 "+IntersectionClassNameArray.join(',')+'。';
- }
- if(UnIntersectionClassNameArray.length>0){
- html=html+' <span style="color:#888">'+UnIntersectionClassNameArray.join(',')+' 部分科目没有参加考试,不能参加统考。</span>';
- }
- $('.selectClass').html(html);
- return false;
- });
- // 添加已选班级
- $(".unchecked-box").on("click", "li", function() {
- var selectedClassValue = $(this).attr('value');
- var selectedClassName = $(this).text();
- $(this).remove();
- $(".selected-box").append('<li value="'+selectedClassValue+'">'+selectedClassName+'<img src="/images/icon-delete.png" alt=""></li>');
- for(var ii=0;ii<DeleteClassArray.length;ii++){
- //console.log(selectedClassValue);
- //console.log(DeleteClassArray[ii]);
- if($.trim(selectedClassValue)==$.trim(DeleteClassArray[ii])){
- IntersectionClassNameArray.push(DeleteClassNameArray[ii]);
- IntersectionClassArray.push(DeleteClassArray[ii]);
- DeleteClassArray.splice(ii,1);
- DeleteClassNameArray.splice(ii,1);
- }
- }
- //console.log(IntersectionClassNameArray);
- //console.log(UnIntersectionClassNameArray);
- var html='';
- if(IntersectionClassNameArray.length>0){
- html=html+"*此次参加统考分析的班级有 "+IntersectionClassNameArray.join(',')+'。';
- }
- if(UnIntersectionClassNameArray.length>0){
- html=html+' <span style="color:#888">'+UnIntersectionClassNameArray.join(',')+' 部分科目没有参加考试,不能参加统考。</span>';
- }
- $('.selectClass').html(html);
- return false;
- });
- //教师权限全选
- $('#teacher_view_limit_all').click(function(){
- if ($(this).prop("checked")) {
- $(".teacher_view_limit").prop("checked",true);
- } else {
- $(".teacher_view_limit").prop("checked",false);
- }
- });
- $(".teacher_view_limit").click(function(){
- console.log($('input[name=teacher_view_limit]:checked').length)
- if($('input[name=teacher_view_limit]:checked').length==5){
- $("#teacher_view_limit_all").prop("checked",true);
- }else{
- $("#teacher_view_limit_all").prop("checked",false);
- }
- });
- <?php if(!isset($formInfo['cylet_id'])) echo "$('#teacher_view_limit_all').click();";?>
- })()
- </script>
|