123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- <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" />
- <style>
- #choose-error{color: #FF0000;}
- #examName-error{color: #FF0000;}
- #classIds-error{color: #FF0000;}
- #type-error{color: #FF0000;}
- #markType-error{color: #FF0000;}
- #subject-error,#score-error{color: #FF0000;}
- #examDate{color: #FF0000;}
- .check_subject{margin-right:15px;}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="page-content">
- <div class="mcp-title">上传成绩 <a href="<?php echo $this->createUrl('zhiliao/downloadexcel');?>">下载Excel表格示例</a></div>
- <form class="saveForm" action="<?php echo Yii::app()->createUrl('zhiliao/importstore')?>" method="post" enctype="multipart/form-data">
- <div class="mcp-form-list clearfix">
- <input type="file" name="exname">
- </div>
- <div class="mcp-form-list clearfix">
- <input type="hidden" name="exam_group_id" value="<?php if(isset($examGroupId)) echo $examGroupId;?>">
- <input type="submit" value="提交" class="label-primary-s bth-s" >
- <input type="reset" value="重置" class="label-primary-s bth-s">
- </div>
- </form>
- </div>
- </div>
- <script>
- $(document).ready(function(){
- var selectedClassId=[];
- <?php
- if(isset($exam['classes'])){
- foreach ($exam['classes'] as $cid=>$cname){
- echo "selectedClassId.push('".$cid."');";
- }
- }
- ?>
- loadClass();
- $('.datetimepicker8').datetimepicker({
- onGenerate:function( ct ){
- $(this).find('.xdsoft_date').toggleClass('xdsoft_disabled');
- $(this).find('.xdsoft_today').removeClass('xdsoft_disabled');
- },
- format:'Y-m-d',
- formatDate:'Y-m-d',
- //minDate:'-1970/01/2',
- maxDate:'+1970/01/2',
- minDate: '-<?php echo date('Y-m-d', strtotime('Yesterday')); ?>',
- timepicker:false
- });
- //返回
- $('.mcp-back-btn').click(function(){
- location.href="<?php echo Yii::app()->createUrl('zhiliao/index')?>";
- });
-
- $('input[name="examName"]').keydown(function(event){
- $('#examName-error').html("");
- });
- //考试类型
- $('.examType').click(function(){
- var type = $(this).attr('value');
- if(type){
- $('#type-error').html("");
- }
- $('input[name="type"]').val(type);
- });
- //加载班级
- function loadClass(){
- $.post(
- "<?php echo Yii::app()->createUrl('zhiliao/ajaxchangeclasses')?>",
- {'selectedClassId':selectedClassId},
- function(result){
- if(result.error){
- $('#choose-error').html(result.error);
- }else{
- var htmlg1 = "";
- var htmlg2 = "";
- var htmlg3 = "";
- $.each(result.class_arr_select,function(k,v){
- if(v.grade == 1){
- htmlg1+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- }
- if(v.grade == 2){
- htmlg2+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- }
- if(v.grade == 3){
- htmlg3+="<span grade='"+v.grade+"' classid='"+v.class_id+"'>"+v.class_name+"</span>";
- }
- });
- $('.g1').html(htmlg1);
- $('.g2').html(htmlg2);
- $('.g3').html(htmlg3);
- var htmlidg1 = "";
- var htmlidg2 = "";
- var htmlidg3 = "";
- $.each(result.class_arr_noselect,function(k,v){
- if(v.grade == 1){
- htmlidg1 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- if(v.grade == 2){
- htmlidg2 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- if(v.grade == 3){
- htmlidg3 += '<li class="bjs-lis ellipsis" grade="'+v.grade+'" classid="'+v.class_id+'" ><span class="judge-sel"></span>'+v.class_name+'</li>';
- }
- });
- $('#grade1 ul').html(htmlidg1);
- $('#grade2 ul').html(htmlidg2);
- $('#grade3 ul').html(htmlidg3);
- }
- },
- 'json'
- );
- }
- //切换年级
- $('.a-years,.a-province,.paper-type > span, .grade-sel ul li').click(function(){
- if(!$(this).hasClass('active')){
- $(this).addClass('active').siblings().removeClass('active');
- var gradearr=[1,2,3];
- var grade=$(this).attr("grade");
- $('input[name=grade]').val(grade);
- for(var i=0;i<=gradearr.length;i++){
- if(gradearr[i]==grade){
- $("#grade"+grade).show();
- $('.g'+grade).show();
- $('.g'+grade).attr('status',1);
- }else{
- $("#grade"+gradearr[i]).hide();
- $(".g"+gradearr[i]).hide();
- $(".g"+gradearr[i]).attr('status',0);
- }
- }
- }
- });
- //添加班级
- $(".bj-sel ul").on("click","li", function(){
- $('#classIds-error').html("");
- $(this).find('.judge-sel').addClass('active');
- $(this).remove();
- var grade = $(this).attr('grade');
- $('.g'+grade).append('<span grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'">'+$(this).text()+'</span>');
- });
- //移除班级
- $('.sel-classes').delegate('span','click',function(){
- $(this).remove();
- $("#grade"+$(this).attr("grade")).children("ul").append('<li class="bjs-lis" grade="'+$(this).attr("grade")+'" classid="'+$(this).attr("classid")+'"><span class="judge-sel"></span>'+$(this).html()+'</li>');
- });
-
- if ($('.sel-classes > span').length > 0){
- for (var i = 0;i < $('.sel-classes > span').length; i++){
- for (var k = 0;k < $('.bjs-lis').length; k++){
- if ($('.bjs-lis').eq(k).text().trim()==$('.sel-classes > span').eq(i).text().trim()) {
- $('.bjs-lis').eq(k).find('.judge-sel').addClass('active');
- }
- }
- }
- }
- $('.mcp-radio-sel').click(function(){
- if (!$(this).find('.sel-btn').hasClass('select')) {
- $(this).find('.sel-btn').addClass('select');
- $(this).siblings().find('.sel-btn').removeClass('select');
- }
- });
- $('.grade-sel ul li').click(function(){
- $(this).addClass('active').siblings().removeClass('active');
- });
- $('.sel-classes > span').click(function(){
- $(this).remove();
- for (var i = 0;i < $('.bjs-lis').length; i++) {
- if ($('.bjs-lis').eq(i).text().trim()==$(this).text().trim()){
- $('.bjs-lis').eq(i).find('.judge-sel').removeClass('active');
- }
- }
- });
- //选择科目
- $('body').on('click','.subject',function(){
- var subject_id=$(this).val(),
- subject_name=$(this).attr('data');
- if($(this).is(":checked")){
- html='<label for="k1" class="check_subject mlr5">'+subject_name+':<input type="text" style="width:75px;" name="subject_s" id="subject_'+subject_id+'" value=""></label>';
- $('.subject_scores').append(html);
- }else{
- $('#subject_'+subject_id).closest('label').remove();
- }
- });
- // 下拉列表模拟
- $('.inp-text').click(function(){
- if ($(this).next().is(':hidden')){
- $(this).next().show();
- } else {
- $(this).next().hide();
- }
- });
- // 点下拉列表选项
- $('.select-con li').click(function(){
- $(this).closest('.select-con').hide();
- $(this).closest('.mcp-form-detail').find('.inp-text').text($(this).text());
- });
- // 点击空白处下拉列表消失
- $(document).click(function(e){
- var targetNode = $(e.target).closest(".inp-text");
- if (targetNode.length>0){
- return;
- }else{
- $(".select-con").hide();
- }
- });
-
-
- $("body").delegate("#createThird[active='true']", "click", function(e) {
- var classIds='';
- $(".sel-classes[status=1]").children("span").each(function(){
- classIds += $(this).attr('classid')+",";
- });
- $('input[name="classIds"]').val(classIds);
- var error = new Array();
- var classIds = $('input[name="classIds"]').val();
- var examName = $('input[name="examName"]').val();
- var type = $('input[name="type"]').val();
- var examDate = $("input[name='examDate']").val();
- if(examName == "" || examName == null){
- $('#examName-error').html('请指定考试名称');
- error.push('没有指定考试名称');
- }else{
- $('#examName-error').html('');
- }
- if(type == "" || type == null){
- $('#type-error').html('请指定考试类型');
- error.push('没有指定考试类型');
- }else{
- $('#type-error').html('');
- }
- $('#choose-error').html('');
- if(classIds == "" || classIds == null){
- $('#classIds-error').html('请指定考试班级');
- error.push('没有指定考试班级');
- }else{
- $('#classIds-error').html('');
- }
- if (examDate == '') {
- $('#examDate').html('请设置考试日期');
- error.push('请设置考试日期');
- } else if (examDate < '<?php echo date('Y-m-d'); ?>') {
- $('#examDate').html('考试日期设置错误');
- error.push('考试日期设置错误');
- }else{
- $('#examDate').html('');
- }
- //检测科目
- var subjects=[];
- // console.log($('.subject').length);
- for(var i=0;i<$('.subject').length;i++){
- if($('.subject').eq(i).is(":checked")){
- // subjects.push($('input[name=subject]').eq(i).val());
- subject_id=$('.subject').eq(i).val();
- score=$('#subject_'+subject_id).val();
- if(score=='' || isNaN(score)){
- $('#score-error').html('科目分数设置错误');
- error.push('科目分数设置错误');
- break;
- }else{
- subjects.push(subject_id+'///'+score);
- }
- }
- }
- if(subjects.length==0){
- $('#subject-error').html('请选择考试科目');
- error.push('没有指定考试科目');
- }
- $('input[name=subjects]').val(subjects.join(','));
- if(error.length == 0){
- $(this).attr("active","false");
- $(".saveForm").submit();
- }
-
-
-
- });
-
-
-
-
- });
- </script>
|