贾小兵 преди 1 седмица
родител
ревизия
041834c71b

+ 4 - 0
application/admin/controller/Simulator.php

@@ -15,6 +15,7 @@ use think\Env;
 class Simulator extends Backend
 {
 
+    protected $noNeedRight = ['readfault'];
     /**
      * 查看
      */
@@ -39,4 +40,7 @@ class Simulator extends Backend
         return $this->view->fetch();
     }
 
+    public function readfault(){
+        $list = Db::name('debug_fault')->select();
+    }
 }

+ 194 - 266
application/admin/controller/student/Collection.php

@@ -197,11 +197,53 @@ class Collection extends Backend
             $fangfa_arr = [];
             $fangfa_content = [];
 
-
             $other_content = [];
+            $content = [];
 
             Db::startTrans();
             try {
+                if(!empty($params['other_report'])){
+                    //获取数组
+                    $other_report = json_decode($params['other_report'],true);
+                    if(count($other_report)==1){
+                        $other_report[1] = [
+                           'xh_id' => 1,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                        $other_report[2] = [
+                           'xh_id' => 2,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                    }else if(count($other_report)==2){
+                        $other_report[2] = [
+                           'xh_id' => 2,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                    }
+                    $params['other_report'] = json_encode($other_report);
+                }
+
                 //更新考试结束时间
                 $row->end_time = date('Y-m-d H:i:s');
                 $row->endtime = time();
@@ -242,7 +284,6 @@ class Collection extends Backend
                         $fault_three_score = 0;
                     }
                 }
-
                 $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
                 //根据故障部位 数组
                 $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
@@ -254,179 +295,185 @@ class Collection extends Backend
                 $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$info['sim_type']])->column('parent_fault_id');
 
                 //根据故障部位查找,匹配可能原因
-                $yy_arr = Fault::where(['parent_fault_id'=>['in',$partent_fault_id],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
-
-                //获取数组
-                $other_report = json_decode($params['other_report'],true);
+                $yy_arr= Fault::where(['parent_fault_id'=>['in',$partent_fault_id],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
+                
                 if(!empty($other_report)){
-                    foreach ($other_report as $key => $em){
-                        //故障现象
-                        $xianxian_arr[] = $em['xx_id'];
-                    }
-                    foreach ($partent_fault_id as $k1 =>$t){
-                        $kscore = 0;
-                        if(!in_array($t,$xianxian_arr)){
-                            $xianxian_score = 5+$xianxian_score;
-                            $xianxian_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_id'=>$t,
-                                'cx_type'=>'故障现象少写',
-                                'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
-                                'cx_score'=>-5,
-                            ];
-
-                            $other_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_score'=>-5,
-                            ];
-                        }else{
-                            // echo "存在里面".$t."###".$k1."<br/>";
-                            $t1= $t;
-                            $jian = '';
-                            foreach ($other_report as $ky => $item) {
-                                if ($item['xx_id'] == $t) {
-                                   $jian = $ky;
+                    foreach ($other_report as $k => $v) {
+                        if(!empty($v['xx_id'])){
+                            if(in_array($v['xx_id'],$partent_fault_id)){
+                                //故障现象正确
+                                
+                                $kscore = 0;
+                                //故障部位 故障部位错误
+                                $buwei_id= '';
+                                $paichu_id= '';
+                                $yy_id = [];
+                                foreach($fault_arr as $kk1 =>$va1){
+                                    $fault_find = Fault::where(['fault_id'=>$va1])->find();
+                                    if($fault_find['parent_fault_id']==$v['xx_id']){
+                                        $buwei_id = $fault_find['fault_id'];
+                                        $paichu_id = $fault_find['ref_type4_fault_id'];
+                                        $yy_id = Fault::where(['parent_fault_id'=>$fault_find['parent_fault_id'],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
+                                    }
                                 }
-                            }
-                            // 故障部位算分 start
-                            //获取故障部位 
-                            $buweiarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>['in',[3,30]],'fault_state'=>0])
-                            ->column('fault_id');
-                            if(!in_array($other_report[$jian]['bw_id'],$buweiarr)){
-                                $buwei_score = 1+$buwei_score;
-                                $kscore = 1+$kscore;
-                                $xianxian_content[] = [
-                                    'gzxz_id'=>$t,
-                                    'cx_id'=>$other_report[$jian]['bw_id'],
-                                    'cx_type'=>'故障部位错写',
-                                    'cx_name'=>Fault::where(['fault_id'=>$other_report[$jian]['bw_id']])->value('name'),
-                                ];
-                            }
-                            //出题故障部位和获取的故障部位里面有重复的
-                            // 获取两个数组的交集
-                            $intersection = array_intersect($buweiarr, $fault_arr);
-                            // halt($intersection);
-                            foreach($intersection as $kk =>$va){
-                                if($other_report[$jian]['bw_id']!=$va){
+
+
+                                if($v['bw_id']!=$buwei_id){
                                     $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va,
-                                        'cx_type'=>'故障部位写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['bw_id'],
+                                        'cx_type'=>'故障部位错写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$v['bw_id']])->value('name'),
                                     ];
                                 }
-                            }
-                            unset($va);
-                            // 故障部位算分 end
-                            
-                            // 排除方法算分 start
-                            $paichuarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>4,'fault_state'=>0])
-                            ->column('fault_id');
-                            if(!in_array($other_report[$jian]['pc_id'],$paichuarr)){
-                                $fangfa_score = 1+$fangfa_score;
-                                $kscore = 1+$kscore;
-                                $xianxian_content[] = [
-                                    'gzxz_id'=>$t,
-                                    'cx_id'=>$other_report[$jian]['pc_id'],
-                                    'cx_type'=>'排除方法错写',
-                                    'cx_name'=>Fault::where(['fault_id'=>$other_report[$jian]['pc_id']])->value('name'),
-                                ];
-                            }
-                            //出题排除方法和获取的排除方法里面有重复的
-                            // 获取两个数组的交集
-                            $intersection1 = array_intersect($paichuarr, $paichu_arr);
-                            foreach($intersection1 as $kk1 =>$va1){
-                                if($other_report[$jian]['pc_id']!=$va1){
-                                    $fangfa_score = 1+$fangfa_score;
+                                //故障部位少写
+                                //获取当前的故障部位
+                                if($buwei_id!=$v['bw_id']){
+                                    $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va1,
-                                        'cx_type'=>'排除方法少写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va1])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$buwei_id,
+                                        'cx_type'=>'故障部位少写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
                                     ];
                                 }
-                            }
-                            unset($va1);
-                            // 排除方法算分 end
                             
-                            // 可能原因算分 start
-                            $yuanyinarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>2,'fault_state'=>0])
-                            ->column('fault_id');
-                            foreach (explode(',',$other_report[$jian]['yy_id']) as $key => $value) {
-                                if(!in_array($value,$yuanyinarr)){
-                                    $yuanyin_socre = 1+$yuanyin_socre;
+                                //排除方法  错写
+                                if($v['pc_id']!=$paichu_id){
+                                    $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$value,
-                                        'cx_type'=>'可能原因错写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['pc_id'],
+                                        'cx_type'=>'排除方法错写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$v['pc_id']])->value('name'),
                                     ];
                                 }
-                            }
-                            //出题可能原因和获取的可能原因里面有重复的
-                            // 获取两个数组的交集
-                            $intersection2 = array_intersect($yy_arr, $yuanyinarr);
-                            $intersection22 = array_intersect($intersection2, explode(',',$other_report[$jian]['yy_id']));
-                            foreach($yuanyinarr as $kk2 =>$va2){
-                                if(!in_array($va2,$intersection22)){
-                                    $yuanyin_socre = 1+$yuanyin_socre;
+                                //排放方法  少写
+                                if($paichu_id!=$v['pc_id']){
+                                    $fangfa_score = 1+$fangfa_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va2,
-                                        'cx_type'=>'可能原因少写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va2])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['pc_id'],
+                                        'cx_type'=>'排除方法少写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
                                     ];
                                 }
+
+
+                                //可能原因 错写
+                                foreach (explode(',',$v['yy_id']) as $key => $value) {
+                                    if(!in_array($value,$yy_id)){
+                                        $yuanyin_socre = 1+$yuanyin_socre;
+                                        $kscore = 1+$kscore;
+                                        $content[] = [
+                                            'gzxz_id'=>$v['xx_id'],
+                                            'cx_id'=>$value,
+                                            'cx_type'=>'可能原因错写',
+                                            'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
+                                        ];
+                                        echo $v['xx_id']."@@@".$value."@@@".$kscore."<br/>";
+                                    }
+                                }
+                                //可能原因 少写
+                                foreach ($yy_id as $key1 => $value1) {
+                                    $yy_id_arr = explode(',',$v['yy_id']);
+                                    if(!in_array($value1,$yy_id_arr)){
+                                        $yuanyin_socre = 1+$yuanyin_socre;
+                                        $kscore = 1+$kscore;
+                                        $content[] = [
+                                            'gzxz_id'=>$v['xx_id'],
+                                            'cx_id'=>$value1,
+                                            'cx_type'=>'可能原因少写',
+                                            'cx_name'=>Fault::where(['fault_id'=>$value1])->value('name'),
+                                        ];
+                                    }
+                                }
                                 
-                            }
-                            unset($va2);
-                            // 可能原因算分 end
-                        
-                            if($kscore>5){
-                               $kscore = '-5';
-                            }else if($kscore>0){
-                                $kscore = '-'.$kscore;
+                                if($kscore>5){
+                                   $kscore = '-5';
+                                }else if($kscore>0){
+                                    $kscore = '-'.$kscore;
+                                }else{
+                                   $kscore=0; 
+                                }
+                                $other_content[$k] = [
+                                    'gzxz_id'=>$v['xx_id'],
+                                    'xh_id' => $k,
+                                    'xx_id' => $v['xx_id'],
+                                    'xx_name' => $v['xx_name'],
+                                    'yy_id' =>$v['yy_id'],
+                                    'yy_name' => $v['yy_name'],
+                                    'bw_id' => $v['bw_id'],
+                                    'bw_name' => $v['bw_name'],
+                                    'pc_id' => $v['pc_id'],
+                                    'pc_name' => $v['pc_name'],
+                                    'cx_type'=>'',
+                                    'cx_name'=>$content,
+                                    'cx_score'=>$kscore,
+                                ];
                             }else{
-                               $kscore=0; 
+                                $xianxian_score = 5+$xianxian_score;
+                                $other_content[$k] = [
+                                    'gzxz_id'=>$v['xx_id'],
+                                    'xh_id' => $k,
+                                    'xx_id' => $v['xx_id'],
+                                    'xx_name' => $v['xx_name'],
+                                    'yy_id' =>$v['yy_id'],
+                                    'yy_name' => $v['yy_name'],
+                                    'bw_id' => $v['bw_id'],
+                                    'bw_name' => $v['bw_name'],
+                                    'pc_id' => $v['pc_id'],
+                                    'pc_name' => $v['pc_name'],
+                                    'cx_type'=>'故障现象错写',
+                                    'cx_name'=>Fault::where(['fault_id'=>$v['xx_id']])->value('name'),
+                                    'cx_score'=>-5,
+                                ];
                             }
-                            // echo $t1."####".$kscore."<br/>";
-                            $other_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_score'=>$kscore,
+                        }else{
+                            $xianxian_score = 5+$xianxian_score;
+                            $other_content[$k] = [
+                                'gzxz_id'=>'',
+                                'xh_id' => $k,
+                                'xx_id' => '',
+                                'xx_name' => '',
+                                'yy_id' => '',
+                                'yy_name' => '',
+                                'bw_id' => '',
+                                'bw_name' => '',
+                                'pc_id' => '',
+                                'pc_name' => '',
+                                'cx_type'=>'未作答',
+                                'cx_name'=>'',
+                                'cx_score'=>-5,
                             ];
                         }
                     }
-                    unset($em);
-
-                    // echo "<pre>";
-                    // print_r($xianxian_content);
-                    
-                    // echo "<pre>";
-                    // print_r($other_content);
-                    // die();
                 }else{
                     foreach ($partent_fault_id as $key => $em){
                         $xianxian_score = 5+$xianxian_score;
-                        $xianxian_content[] = [
+                        $other_content[] = [
                             'gzxz_id'=>$em,
-                            'cx_id'=>$em,
+                            'xh_id' => $key,
+                            'xx_id' => '',
+                            'xx_name' => '',
+                            'yy_id' => '',
+                            'yy_name' => '',
+                            'bw_id' => '',
+                            'bw_name' => '',
+                            'pc_id' => '',
+                            'pc_name' => '',
                             'cx_type'=>'未作答',
-                            // 'cx_name'=>Fault::where(['fault_id'=>$em])->value('name'),
                             'cx_name'=>'',
-                        ];
-                        $other_content[] = [
-                            'gzxz_id'=>$em,
                             'cx_score'=>-5,
                         ];
                     }
                     unset($em);
                 }
-
                 // echo "故障现象得分:".$xianxian_score."<br/>";
                 // echo "故障部位得分:".$buwei_score."<br/>";
                 // echo "排除方法得分:".$fangfa_score."<br/>";
@@ -436,136 +483,12 @@ class Collection extends Backend
                 // echo "<pre>";
                 // print_r($other_content);
                 // die();
-                
-                // $other_report = json_decode($params['other_report'],true);
-                // if(!empty($other_report)){
-                //     foreach ($other_report as $key => $em){
-                //         //故障现象
-                //         $xianxian_arr[] = $em['xx_id'];
-                //         //故障部位
-                //         $buwei_arr[] = $em['bw_id'];
-                //         //可能原因
-                //         foreach(explode(',',$em['yy_id']) as $k3 =>$t13){
-                //             $yuanyin_arr[] = $t13;
-                //         }
-                //         //排除方法
-                //         $fangfa_arr[] = $em['pc_id'];
-                //     }
-                // }
-                // //故障现象 分数 start
-                // foreach ($partent_fault_id as $k1 =>$t){
-                //     if(!in_array($t,$xianxian_arr)){
-                //         $xianxian_score = 1+$xianxian_score;
-                //         $xianxian_content[] = [
-                //             'cx_id'=>$t,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
-                //         ];
-                //     }
-                // }
-                // foreach ($xianxian_arr as $k2 =>$t2){
-                //     if(!in_array($t2,$partent_fault_id)){
-                //         $xianxian_score = 1+$xianxian_score;
-                //         $xianxian_content[] = [
-                //             'cx_id'=>$t2,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t2])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //故障现象 end
-                // //故障部位 start
-                // foreach ($fault_arr as $k11 =>$t11){
-                //     if(!in_array($t11,$buwei_arr)){
-                //         $buwei_score = 1+$buwei_score;
-                //         $buwei_content[] = [
-                //             'cx_id'=>$t11,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t11])->value('name'),
-                //         ];
-                //     }
-                // }
-                // foreach ($buwei_arr as $k12 =>$t12){
-                //     if(!empty($t12) && !in_array($t12,$fault_arr)){
-                //         //错写
-                //         $buwei_score = 1+$buwei_score;
-                //         $buwei_content[] = [
-                //             'cx_id'=>$t12,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t12])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //故障部位 end
-                // //排除方法 start
-                // //循环固定的排除方法,匹配作答的排除方法
-                // foreach ($paichu_arr as $k21 =>$t21){
-                //     if(!in_array($t21,$fangfa_arr)){
-                //         $fangfa_score = 1+$fangfa_score;
-                //         $fangfa_content[] = [
-                //             'cx_id'=>$t21,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t21])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //循环作答的排除方法,,匹配固定的排除方法
-                // foreach ($fangfa_arr as $k22 =>$t22){
-                //     if(!empty($t22) && !in_array($t22,$paichu_arr)){
-                //         $fangfa_score = 1+$fangfa_score;
-                //         $fangfa_content[] = [
-                //             'cx_id'=>$t22,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t22])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //排除方法 end
-                // //可能原因 start
-                // //循环固定的可能原因,匹配作答的可能原因
-                // foreach ($yy_arr as $k31 =>$t31){
-                //     if(!in_array($t31,$yuanyin_arr)){
-                //         // echo $t31."<br/>";
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t31,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t31])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //循环作答的排除方法,匹配固定的排除方法
-                // foreach ($yuanyin_arr as $k32 =>$t32){
-                //     if(!empty($t32) && !in_array($t32,$yy_arr)){
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t32,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t32])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //判断答案是否有重复回答的
-                // $uniqueArray = array_unique($yuanyin_arr);
-                // $diff = array_diff_assoc($yuanyin_arr, $uniqueArray);
-                // if(!empty($diff)){
-                //     foreach ($diff as $k323 =>$t323){
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t323,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t323])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //可能原因 end
                 $weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
                 if($weixiu_score>15){
                     $weixiu_score = 15;
                 }
 
                 //是否超时
-                
                 $overtime_fen = intval((time()-$info['countdown_time']) / 60);
                 if($overtime_fen>=10){
                     $overtime_score = 10;
@@ -854,6 +777,7 @@ class Collection extends Backend
         $this->view->assign('paichu', $paichu);
 
         $row->other_report_text = [];
+        $xxid = [];
         if(!empty($row->other_report)){
             $other_report = json_decode($row->other_report,true);
             foreach ($other_report as $k  =>$item){
@@ -865,9 +789,13 @@ class Collection extends Backend
                         'pc_id'=>$item['pc_id'],
                         'xh_id'=>$item['xh_id']
                     ];
+                }else{
+                    array_push($xxid,$item['xx_id']);
                 }
             }
         }
+        $row->xxid = $xxid;
+
         $this->view->assign('row', $row);
         return $this->view->fetch();
     }

+ 1 - 39
application/admin/controller/student/Exam.php

@@ -71,49 +71,11 @@ class Exam extends Backend
 
         $report_score = 15-$row['xianxian_score']-$row['yuanyin_socre']-$row['buwei_score']-$row['fangfa_score'];
         $row['report_score'] = $report_score>0?$report_score:0; 
-
         $row['weixiu_score'] = 10-$row['overtime_score']??0; 
 
-        $row['xianxian_content_name'] = '';
-        if(!empty($row['xianxian_content']))
-        {
-            $row['xianxian_content_name'] = json_decode($row['xianxian_content'],true);
-        }
-        $row['yuanyin_content_name'] = '';
-        if(!empty($row['yuanyin_content']))
-        {
-            $row['yuanyin_content_name'] = json_decode($row['yuanyin_content'],true);
-        }
-        $row['buwei_content_name'] = '';
-        if(!empty($row['buwei_content']))
-        {
-            $row['buwei_content_name'] = json_decode($row['buwei_content'],true);
-        }
-        $row['fangfa_content_name'] = '';
-        if(!empty($row['fangfa_content']))
-        {
-            $row['fangfa_content_name'] = json_decode($row['fangfa_content'],true);
-        }
-        $other_report = !empty($row['other_report']) ? json_decode($row['other_report'],true):[];
         $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];
-        
-        $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
-        //根据故障部位 数组
-        $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
 
-        //查找故障现象 数组
-        $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$rows['sim_type']])->column('parent_fault_id');
-        $arr1= [];
-        foreach ($partent_fault_id as $key => $value) {
-            $arr1[] = [
-                'gzxz_id' => $value,
-                'xianxian_content' => $row['xianxian_content_name'],
-                'other_report' => $other_report,
-                'other_jielun' => $other_jielun,
-            ];
-        }
-        $this->view->assign('other_report', $other_report);
-        $this->view->assign('partent_fault_id', $arr1);
+        $this->view->assign('other_jielun', $other_jielun);
         $this->view->assign('row', $row);
         return $this->view->fetch();
     }

+ 189 - 306
application/admin/controller/student/Exercise.php

@@ -182,10 +182,53 @@ class Exercise extends Backend
             $fangfa_content = [];
 
             $other_content = [];
+            $content = [];
 
             Db::startTrans();
             try {
 
+                if(!empty($params['other_report'])){
+                    //获取数组
+                    $other_report = json_decode($params['other_report'],true);
+                    if(count($other_report)==1){
+                        $other_report[1] = [
+                           'xh_id' => 1,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                        $other_report[2] = [
+                           'xh_id' => 2,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                    }else if(count($other_report)==2){
+                        $other_report[2] = [
+                           'xh_id' => 2,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                    }
+                    $params['other_report'] = json_encode($other_report);
+                }
+
                 //更新考试结束时间
                 $row->end_time = date('Y-m-d H:i:s');
                 $row->endtime = time();
@@ -245,304 +288,183 @@ class Exercise extends Backend
                 //根据故障部位查找,匹配可能原因
                 $yy_arr = Fault::where(['parent_fault_id'=>['in',$partent_fault_id],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
 
-                //获取数组
-                $other_report = json_decode($params['other_report'],true);
                 if(!empty($other_report)){
-                    foreach ($other_report as $key => $em){
-                        //故障现象
-                        $xianxian_arr[] = $em['xx_id'];
-                    }
-                    foreach ($partent_fault_id as $k1 =>$t){
-                        $kscore = 0;
-                        if(!in_array($t,$xianxian_arr)){
-                            $xianxian_score = 5+$xianxian_score;
-                            $xianxian_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_id'=>$t,
-                                'cx_type'=>'故障现象少写',
-                                'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
-                                'cx_score'=>-5,
-                            ];
-
-                            $other_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_score'=>-5,
-                            ];
-                        }else{
-                            // echo "存在里面".$t."###".$k1."<br/>";
-                            $t1= $t;
-                            $jian = '';
-                            foreach ($other_report as $ky => $item) {
-                                if ($item['xx_id'] == $t) {
-                                   $jian = $ky;
+                    foreach ($other_report as $k => $v) {
+                        if(!empty($v['xx_id'])){
+                            if(in_array($v['xx_id'],$partent_fault_id)){
+                                //故障现象正确
+                                
+                                $kscore = 0;
+                                //故障部位 故障部位错误
+                                $buwei_id= '';
+                                $paichu_id= '';
+                                $yy_id = [];
+                                foreach($fault_arr as $kk1 =>$va1){
+                                    $fault_find = Fault::where(['fault_id'=>$va1])->find();
+                                    if($fault_find['parent_fault_id']==$v['xx_id']){
+                                        $buwei_id = $fault_find['fault_id'];
+                                        $paichu_id = $fault_find['ref_type4_fault_id'];
+                                        $yy_id = Fault::where(['parent_fault_id'=>$fault_find['parent_fault_id'],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
+                                    }
                                 }
-                            }
-                            // 故障部位算分 start
-                            //获取故障部位 
-                            $buweiarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>['in',[3,30]],'fault_state'=>0])
-                            ->column('fault_id');
-                            if(!in_array($other_report[$jian]['bw_id'],$buweiarr)){
-                                $buwei_score = 1+$buwei_score;
-                                $kscore = 1+$kscore;
-                                $xianxian_content[] = [
-                                    'gzxz_id'=>$t,
-                                    'cx_id'=>$other_report[$jian]['bw_id'],
-                                    'cx_type'=>'故障部位错写',
-                                    'cx_name'=>Fault::where(['fault_id'=>$other_report[$jian]['bw_id']])->value('name'),
-                                ];
-                            }
-                            //出题故障部位和获取的故障部位里面有重复的
-                            // 获取两个数组的交集
-                            $intersection = array_intersect($buweiarr, $fault_arr);
-                            // halt($intersection);
-                            foreach($intersection as $kk =>$va){
-                                if($other_report[$jian]['bw_id']!=$va){
+
+
+                                if($v['bw_id']!=$buwei_id){
                                     $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va,
-                                        'cx_type'=>'故障部位写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['bw_id'],
+                                        'cx_type'=>'故障部位错写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$v['bw_id']])->value('name'),
                                     ];
                                 }
-                            }
-                            unset($va);
-                            // 故障部位算分 end
-                            
-                            // 排除方法算分 start
-                            $paichuarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>4,'fault_state'=>0])
-                            ->column('fault_id');
-                            if(!in_array($other_report[$jian]['pc_id'],$paichuarr)){
-                                $fangfa_score = 1+$fangfa_score;
-                                $kscore = 1+$kscore;
-                                $xianxian_content[] = [
-                                    'gzxz_id'=>$t,
-                                    'cx_id'=>$other_report[$jian]['pc_id'],
-                                    'cx_type'=>'排除方法错写',
-                                    'cx_name'=>Fault::where(['fault_id'=>$other_report[$jian]['pc_id']])->value('name'),
-                                ];
-                            }
-                            //出题排除方法和获取的排除方法里面有重复的
-                            // 获取两个数组的交集
-                            $intersection1 = array_intersect($paichuarr, $paichu_arr);
-                            foreach($intersection1 as $kk1 =>$va1){
-                                if($other_report[$jian]['pc_id']!=$va1){
-                                    $fangfa_score = 1+$fangfa_score;
+                                //故障部位少写
+                                //获取当前的故障部位
+                                if($buwei_id!=$v['bw_id']){
+                                    $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va1,
-                                        'cx_type'=>'排除方法少写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va1])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$buwei_id,
+                                        'cx_type'=>'故障部位少写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
                                     ];
                                 }
-                            }
-                            unset($va1);
-                            // 排除方法算分 end
                             
-                            // 可能原因算分 start
-                            $yuanyinarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>2,'fault_state'=>0])
-                            ->column('fault_id');
-                            foreach (explode(',',$other_report[$jian]['yy_id']) as $key => $value) {
-                                if(!in_array($value,$yuanyinarr)){
-                                    $yuanyin_socre = 1+$yuanyin_socre;
+                                //排除方法  错写
+                                if($v['pc_id']!=$paichu_id){
+                                    $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$value,
-                                        'cx_type'=>'可能原因错写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['pc_id'],
+                                        'cx_type'=>'排除方法错写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$v['pc_id']])->value('name'),
                                     ];
                                 }
-                            }
-                            //出题可能原因和获取的可能原因里面有重复的
-                            // 获取两个数组的交集
-                            $intersection2 = array_intersect($yy_arr, $yuanyinarr);
-                            $intersection22 = array_intersect($intersection2, explode(',',$other_report[$jian]['yy_id']));
-                            foreach($yuanyinarr as $kk2 =>$va2){
-                                if(!in_array($va2,$intersection22)){
-                                    $yuanyin_socre = 1+$yuanyin_socre;
+                                //排放方法  少写
+                                if($paichu_id!=$v['pc_id']){
+                                    $fangfa_score = 1+$fangfa_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va2,
-                                        'cx_type'=>'可能原因少写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va2])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['pc_id'],
+                                        'cx_type'=>'排除方法少写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
                                     ];
                                 }
+
+
+                                //可能原因 错写
+                                foreach (explode(',',$v['yy_id']) as $key => $value) {
+                                    if(!in_array($value,$yy_id)){
+                                        $yuanyin_socre = 1+$yuanyin_socre;
+                                        $kscore = 1+$kscore;
+                                        $content[] = [
+                                            'gzxz_id'=>$v['xx_id'],
+                                            'cx_id'=>$value,
+                                            'cx_type'=>'可能原因错写',
+                                            'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
+                                        ];
+                                        echo $v['xx_id']."@@@".$value."@@@".$kscore."<br/>";
+                                    }
+                                }
+                                //可能原因 少写
+                                foreach ($yy_id as $key1 => $value1) {
+                                    $yy_id_arr = explode(',',$v['yy_id']);
+                                    if(!in_array($value1,$yy_id_arr)){
+                                        $yuanyin_socre = 1+$yuanyin_socre;
+                                        $kscore = 1+$kscore;
+                                        $content[] = [
+                                            'gzxz_id'=>$v['xx_id'],
+                                            'cx_id'=>$value1,
+                                            'cx_type'=>'可能原因少写',
+                                            'cx_name'=>Fault::where(['fault_id'=>$value1])->value('name'),
+                                        ];
+                                    }
+                                }
                                 
-                            }
-                            unset($va2);
-                            // 可能原因算分 end
-                        
-                            if($kscore>5){
-                               $kscore = '-5';
-                            }else if($kscore>0){
-                                $kscore = '-'.$kscore;
+                                if($kscore>5){
+                                   $kscore = '-5';
+                                }else if($kscore>0){
+                                    $kscore = '-'.$kscore;
+                                }else{
+                                   $kscore=0; 
+                                }
+                                $other_content[$k] = [
+                                    'gzxz_id'=>$v['xx_id'],
+                                    'xh_id' => $k,
+                                    'xx_id' => $v['xx_id'],
+                                    'xx_name' => $v['xx_name'],
+                                    'yy_id' =>$v['yy_id'],
+                                    'yy_name' => $v['yy_name'],
+                                    'bw_id' => $v['bw_id'],
+                                    'bw_name' => $v['bw_name'],
+                                    'pc_id' => $v['pc_id'],
+                                    'pc_name' => $v['pc_name'],
+                                    'cx_type'=>'',
+                                    'cx_name'=>$content,
+                                    'cx_score'=>$kscore,
+                                ];
                             }else{
-                               $kscore=0; 
+                                $xianxian_score = 5+$xianxian_score;
+                                $other_content[$k] = [
+                                    'gzxz_id'=>$v['xx_id'],
+                                    'xh_id' => $k,
+                                    'xx_id' => $v['xx_id'],
+                                    'xx_name' => $v['xx_name'],
+                                    'yy_id' =>$v['yy_id'],
+                                    'yy_name' => $v['yy_name'],
+                                    'bw_id' => $v['bw_id'],
+                                    'bw_name' => $v['bw_name'],
+                                    'pc_id' => $v['pc_id'],
+                                    'pc_name' => $v['pc_name'],
+                                    'cx_type'=>'故障现象错写',
+                                    'cx_name'=>Fault::where(['fault_id'=>$v['xx_id']])->value('name'),
+                                    'cx_score'=>-5,
+                                ];
                             }
-                            // echo $t1."####".$kscore."<br/>";
-                            $other_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_score'=>$kscore,
+                        }else{
+                            $xianxian_score = 5+$xianxian_score;
+                            $other_content[$k] = [
+                                'gzxz_id'=>'',
+                                'xh_id' => $k,
+                                'xx_id' => '',
+                                'xx_name' => '',
+                                'yy_id' => '',
+                                'yy_name' => '',
+                                'bw_id' => '',
+                                'bw_name' => '',
+                                'pc_id' => '',
+                                'pc_name' => '',
+                                'cx_type'=>'未作答',
+                                'cx_name'=>'',
+                                'cx_score'=>-5,
                             ];
                         }
                     }
-                    unset($em);
-
-                    // echo "<pre>";
-                    // print_r($xianxian_content);
-                    
-                    // echo "<pre>";
-                    // print_r($other_content);
-                    // die();
                 }else{
                     foreach ($partent_fault_id as $key => $em){
                         $xianxian_score = 5+$xianxian_score;
-                        $xianxian_content[] = [
+                        $other_content[] = [
                             'gzxz_id'=>$em,
-                            'cx_id'=>$em,
+                            'xh_id' => $key,
+                            'xx_id' => '',
+                            'xx_name' => '',
+                            'yy_id' => '',
+                            'yy_name' => '',
+                            'bw_id' => '',
+                            'bw_name' => '',
+                            'pc_id' => '',
+                            'pc_name' => '',
                             'cx_type'=>'未作答',
-                            // 'cx_name'=>Fault::where(['fault_id'=>$em])->value('name'),
                             'cx_name'=>'',
-                        ];
-                        $other_content[] = [
-                            'gzxz_id'=>$em,
                             'cx_score'=>-5,
                         ];
                     }
                     unset($em);
                 }
-
-                // //获取数组
-                // $other_report = json_decode($params['other_report'],true);
-                // if(!empty($other_report)){
-                //     foreach ($other_report as $key => $em){
-                //         //故障现象
-                //         $xianxian_arr[] = $em['xx_id'];
-                //         //故障部位
-                //         $buwei_arr[] = $em['bw_id'];
-                //         //可能原因
-                //         foreach(explode(',',$em['yy_id']) as $k3 =>$t13){
-                //             $yuanyin_arr[] = $t13;
-                //         }
-                //         //排除方法
-                //         $fangfa_arr[] = $em['pc_id'];
-                //     }
-                // }
-                
-                // //故障现象 分数 start
-                // foreach ($partent_fault_id as $k1 =>$t){
-                //     if(!in_array($t,$xianxian_arr)){
-                //         $xianxian_score = 1+$xianxian_score;
-                //         $xianxian_content[] = [
-                //             'cx_id'=>$t,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
-                //         ];
-                //     }
-                // }
-                // foreach ($xianxian_arr as $k2 =>$t2){
-                //     if(!in_array($t2,$partent_fault_id)){
-                //         $xianxian_score = 1+$xianxian_score;
-                //         $xianxian_content[] = [
-                //             'cx_id'=>$t2,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t2])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //故障现象 end
-              
-                
-                // //故障部位 start
-                // foreach ($fault_arr as $k11 =>$t11){
-                //     if(!in_array($t11,$buwei_arr)){
-                //         $buwei_score = 1+$buwei_score;
-                //         $buwei_content[] = [
-                //             'cx_id'=>$t11,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t11])->value('name'),
-                //         ];
-                //     }
-                // }
-                // foreach ($buwei_arr as $k12 =>$t12){
-                //     if(!empty($t12) && !in_array($t12,$fault_arr)){
-                //         //错写
-                //         $buwei_score = 1+$buwei_score;
-                //         $buwei_content[] = [
-                //             'cx_id'=>$t12,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t12])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //故障部位 end
-                
-                // //排除方法 start
-                // //循环固定的排除方法,匹配作答的排除方法
-                // foreach ($paichu_arr as $k21 =>$t21){
-                //     if(!in_array($t21,$fangfa_arr)){
-                //         $fangfa_score = 1+$fangfa_score;
-                //         $fangfa_content[] = [
-                //             'cx_id'=>$t21,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t21])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //循环作答的排除方法,,匹配固定的排除方法
-                // foreach ($fangfa_arr as $k22 =>$t22){
-                //     if(!empty($t22) && !in_array($t22,$paichu_arr)){
-                //         $fangfa_score = 1+$fangfa_score;
-                //         $fangfa_content[] = [
-                //             'cx_id'=>$t22,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t22])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //排除方法 end
-
-                // //可能原因 start
-                // //循环固定的可能原因,匹配作答的可能原因
-                // foreach ($yy_arr as $k31 =>$t31){
-                //     if(!in_array($t31,$yuanyin_arr)){
-                //         // echo $t31."<br/>";
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t31,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t31])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //循环作答的排除方法,,匹配固定的排除方法
-                // foreach ($yuanyin_arr as $k32 =>$t32){
-                //     if(!empty($t32) && !in_array($t32,$yy_arr)){
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t32,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t32])->value('name'),
-                //         ];
-                //     }
-                // }
-                // $uniqueArray = array_unique($yuanyin_arr);
-                // $diff = array_diff_assoc($yuanyin_arr, $uniqueArray);
-                // if(!empty($diff)){
-                //     foreach ($diff as $k323 =>$t323){
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t323,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t323])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //可能原因 end
                 
                 
                 $weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
@@ -667,48 +589,9 @@ class Exercise extends Backend
 
         $row['weixiu_score'] = 10-$row['overtime_score']??0; 
 
-        $row['xianxian_content_name'] = '';
-        if(!empty($row['xianxian_content']))
-        {
-            $row['xianxian_content_name'] = json_decode($row['xianxian_content'],true);
-        }
-        $row['yuanyin_content_name'] = '';
-        if(!empty($row['yuanyin_content']))
-        {
-            $row['yuanyin_content_name'] = json_decode($row['yuanyin_content'],true);
-        }
-        $row['buwei_content_name'] = '';
-        if(!empty($row['buwei_content']))
-        {
-            $row['buwei_content_name'] = json_decode($row['buwei_content'],true);
-        }
-        $row['fangfa_content_name'] = '';
-        if(!empty($row['fangfa_content']))
-        {
-            $row['fangfa_content_name'] = json_decode($row['fangfa_content'],true);
-        }
-
-        $other_report = !empty($row['other_report']) ? json_decode($row['other_report'],true):[];
+        
         $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];
-
-        $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
-        //根据故障部位 数组
-        $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
-
-        //查找故障现象 数组
-        $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$rows['sim_type']])->column('parent_fault_id');
-        $arr1= [];
-        foreach ($partent_fault_id as $key => $value) {
-            $arr1[] = [
-                'gzxz_id' => $value,
-                'xianxian_content' => $row['xianxian_content_name'],
-                'other_report' => $other_report,
-                'other_jielun' => $other_jielun,
-
-            ];
-        }
-        $this->view->assign('other_report', $other_report);
-        $this->view->assign('partent_fault_id', $arr1);
+        $this->view->assign('other_jielun', $other_jielun);
         $this->view->assign('row', $row);
         return $this->view->fetch();
     }

+ 192 - 319
application/admin/controller/student/Practice.php

@@ -97,21 +97,6 @@ class Practice extends Backend
             $this->error('未找到记录');
         }
         $info = $this->exam_model->where(['user_id'=>$this->auth->id,'exam_collection_id'=>$ids])->find();
-        // if(empty($info)){
-        //     $arr = [
-        //         'exam_collection_id' => $ids,
-        //         'user_id' => $this->auth->id,
-        //         'user_username' => $this->auth->username,
-        //         'user_nickname' => $this->auth->nickname,
-        //         'user_depart_id' => $this->auth->depart_id,
-        //         'exam_collection_name' => $row->exam_collection_name,
-        //         'exam_collection_type' =>1,
-        //         'sim_type' => $row->sim_type,
-        //         'seat_id' => 1,
-        //         'sim_id' => 12,
-        //     ];
-        //     $this->exam_model->save($arr);
-        // }
         if(!empty($info)){
             if(!empty($this->auth->seat_id) && !empty($info['seat_id']) && $this->auth->seat_id!=$info['seat_id']){
                 $this->error('已在其他座号有开始的练习,不允许换座号');
@@ -209,9 +194,51 @@ class Practice extends Backend
             $fangfa_content = [];
 
             $other_content = [];
+            $content = [];
 
             Db::startTrans();
             try {
+                if(!empty($params['other_report'])){
+                    //获取数组
+                    $other_report = json_decode($params['other_report'],true);
+                    if(count($other_report)==1){
+                        $other_report[1] = [
+                           'xh_id' => 1,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                        $other_report[2] = [
+                           'xh_id' => 2,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                    }else if(count($other_report)==2){
+                        $other_report[2] = [
+                           'xh_id' => 2,
+                           'xx_id' => '',
+                           'xx_name' => '',
+                           'yy_id' => '',
+                           'yy_name' => '',
+                           'bw_id' => '',
+                           'bw_name' => '',
+                           'pc_id' => '',
+                           'pc_name' => ''
+                        ];
+                    }
+                    $params['other_report'] = json_encode($other_report);
+                }
 
                 //更新考试结束时间
                 $row->end_time = date('Y-m-d H:i:s');
@@ -270,304 +297,188 @@ class Practice extends Backend
                 //根据故障部位查找,匹配可能原因
                 $yy_arr = Fault::where(['parent_fault_id'=>['in',$partent_fault_id],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
 
-                //获取数组
-                $other_report = json_decode($params['other_report'],true);
                 if(!empty($other_report)){
-                    foreach ($other_report as $key => $em){
-                        //故障现象
-                        $xianxian_arr[] = $em['xx_id'];
-                    }
-                    foreach ($partent_fault_id as $k1 =>$t){
-                        $kscore = 0;
-                        if(!in_array($t,$xianxian_arr)){
-                            $xianxian_score = 5+$xianxian_score;
-                            $xianxian_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_id'=>$t,
-                                'cx_type'=>'故障现象少写',
-                                'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
-                                'cx_score'=>-5,
-                            ];
-
-                            $other_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_score'=>-5,
-                            ];
-                        }else{
-                            // echo "存在里面".$t."###".$k1."<br/>";
-                            $t1= $t;
-                            $jian = '';
-                            foreach ($other_report as $ky => $item) {
-                                if ($item['xx_id'] == $t) {
-                                   $jian = $ky;
+                    foreach ($other_report as $k => $v) {
+                        if(!empty($v['xx_id'])){
+                            if(in_array($v['xx_id'],$partent_fault_id)){
+                                //故障现象正确
+                                
+                                $kscore = 0;
+                                //故障部位 故障部位错误
+                                $buwei_id= '';
+                                $paichu_id= '';
+                                $yy_id = [];
+                                foreach($fault_arr as $kk1 =>$va1){
+                                    $fault_find = Fault::where(['fault_id'=>$va1])->find();
+                                    if($fault_find['parent_fault_id']==$v['xx_id']){
+                                        $buwei_id = $fault_find['fault_id'];
+                                        $paichu_id = $fault_find['ref_type4_fault_id'];
+                                        $yy_id = Fault::where(['parent_fault_id'=>$fault_find['parent_fault_id'],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
+                                    }
                                 }
-                            }
-                            // 故障部位算分 start
-                            //获取故障部位 
-                            $buweiarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>['in',[3,30]],'fault_state'=>0])
-                            ->column('fault_id');
-                            if(!in_array($other_report[$jian]['bw_id'],$buweiarr)){
-                                $buwei_score = 1+$buwei_score;
-                                $kscore = 1+$kscore;
-                                $xianxian_content[] = [
-                                    'gzxz_id'=>$t,
-                                    'cx_id'=>$other_report[$jian]['bw_id'],
-                                    'cx_type'=>'故障部位错写',
-                                    'cx_name'=>Fault::where(['fault_id'=>$other_report[$jian]['bw_id']])->value('name'),
-                                ];
-                            }
-                            //出题故障部位和获取的故障部位里面有重复的
-                            // 获取两个数组的交集
-                            $intersection = array_intersect($buweiarr, $fault_arr);
-                            // halt($intersection);
-                            foreach($intersection as $kk =>$va){
-                                if($other_report[$jian]['bw_id']!=$va){
+
+
+                                if($v['bw_id']!=$buwei_id){
                                     $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va,
-                                        'cx_type'=>'故障部位写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['bw_id'],
+                                        'cx_type'=>'故障部位错写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$v['bw_id']])->value('name'),
                                     ];
                                 }
-                            }
-                            unset($va);
-                            // 故障部位算分 end
-                            
-                            // 排除方法算分 start
-                            $paichuarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>4,'fault_state'=>0])
-                            ->column('fault_id');
-                            if(!in_array($other_report[$jian]['pc_id'],$paichuarr)){
-                                $fangfa_score = 1+$fangfa_score;
-                                $kscore = 1+$kscore;
-                                $xianxian_content[] = [
-                                    'gzxz_id'=>$t,
-                                    'cx_id'=>$other_report[$jian]['pc_id'],
-                                    'cx_type'=>'排除方法错写',
-                                    'cx_name'=>Fault::where(['fault_id'=>$other_report[$jian]['pc_id']])->value('name'),
-                                ];
-                            }
-                            //出题排除方法和获取的排除方法里面有重复的
-                            // 获取两个数组的交集
-                            $intersection1 = array_intersect($paichuarr, $paichu_arr);
-                            foreach($intersection1 as $kk1 =>$va1){
-                                if($other_report[$jian]['pc_id']!=$va1){
-                                    $fangfa_score = 1+$fangfa_score;
+                                //故障部位少写
+                                //获取当前的故障部位
+                                if($buwei_id!=$v['bw_id']){
+                                    $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va1,
-                                        'cx_type'=>'排除方法少写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va1])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$buwei_id,
+                                        'cx_type'=>'故障部位少写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
                                     ];
                                 }
-                            }
-                            unset($va1);
-                            // 排除方法算分 end
                             
-                            // 可能原因算分 start
-                            $yuanyinarr = Fault::where(['parent_fault_id'=>$t,'sim_type'=>$info['sim_type'],'fault_type'=>2,'fault_state'=>0])
-                            ->column('fault_id');
-                            foreach (explode(',',$other_report[$jian]['yy_id']) as $key => $value) {
-                                if(!in_array($value,$yuanyinarr)){
-                                    $yuanyin_socre = 1+$yuanyin_socre;
+                                //排除方法  错写
+                                if($v['pc_id']!=$paichu_id){
+                                    $buwei_score = 1+$buwei_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$value,
-                                        'cx_type'=>'可能原因错写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['pc_id'],
+                                        'cx_type'=>'排除方法错写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$v['pc_id']])->value('name'),
                                     ];
                                 }
-                            }
-                            //出题可能原因和获取的可能原因里面有重复的
-                            // 获取两个数组的交集
-                            $intersection2 = array_intersect($yy_arr, $yuanyinarr);
-                            $intersection22 = array_intersect($intersection2, explode(',',$other_report[$jian]['yy_id']));
-                            foreach($yuanyinarr as $kk2 =>$va2){
-                                if(!in_array($va2,$intersection22)){
-                                    $yuanyin_socre = 1+$yuanyin_socre;
+                                //排放方法  少写
+                                if($paichu_id!=$v['pc_id']){
+                                    $fangfa_score = 1+$fangfa_score;
                                     $kscore = 1+$kscore;
-                                    $xianxian_content[] = [
-                                        'gzxz_id'=>$t,
-                                        'cx_id'=>$va2,
-                                        'cx_type'=>'可能原因少写',
-                                        'cx_name'=>Fault::where(['fault_id'=>$va2])->value('name'),
+                                    $content[] = [
+                                        'gzxz_id'=>$v['xx_id'],
+                                        'cx_id'=>$v['pc_id'],
+                                        'cx_type'=>'排除方法少写',
+                                        'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
                                     ];
                                 }
+
+
+                                //可能原因 错写
+                                foreach (explode(',',$v['yy_id']) as $key => $value) {
+                                    if(!in_array($value,$yy_id)){
+                                        $yuanyin_socre = 1+$yuanyin_socre;
+                                        $kscore = 1+$kscore;
+                                        $content[] = [
+                                            'gzxz_id'=>$v['xx_id'],
+                                            'cx_id'=>$value,
+                                            'cx_type'=>'可能原因错写',
+                                            'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
+                                        ];
+                                        echo $v['xx_id']."@@@".$value."@@@".$kscore."<br/>";
+                                    }
+                                }
+                                //可能原因 少写
+                                foreach ($yy_id as $key1 => $value1) {
+                                    $yy_id_arr = explode(',',$v['yy_id']);
+                                    if(!in_array($value1,$yy_id_arr)){
+                                        $yuanyin_socre = 1+$yuanyin_socre;
+                                        $kscore = 1+$kscore;
+                                        $content[] = [
+                                            'gzxz_id'=>$v['xx_id'],
+                                            'cx_id'=>$value1,
+                                            'cx_type'=>'可能原因少写',
+                                            'cx_name'=>Fault::where(['fault_id'=>$value1])->value('name'),
+                                        ];
+                                    }
+                                }
                                 
-                            }
-                            unset($va2);
-                            // 可能原因算分 end
-                        
-                            if($kscore>5){
-                               $kscore = '-5';
-                            }else if($kscore>0){
-                                $kscore = '-'.$kscore;
+                                if($kscore>5){
+                                   $kscore = '-5';
+                                }else if($kscore>0){
+                                    $kscore = '-'.$kscore;
+                                }else{
+                                   $kscore=0; 
+                                }
+                                $other_content[$k] = [
+                                    'gzxz_id'=>$v['xx_id'],
+                                    'xh_id' => $k,
+                                    'xx_id' => $v['xx_id'],
+                                    'xx_name' => $v['xx_name'],
+                                    'yy_id' =>$v['yy_id'],
+                                    'yy_name' => $v['yy_name'],
+                                    'bw_id' => $v['bw_id'],
+                                    'bw_name' => $v['bw_name'],
+                                    'pc_id' => $v['pc_id'],
+                                    'pc_name' => $v['pc_name'],
+                                    'cx_type'=>'',
+                                    'cx_name'=>$content,
+                                    'cx_score'=>$kscore,
+                                ];
                             }else{
-                               $kscore=0; 
+                                $xianxian_score = 5+$xianxian_score;
+                                $other_content[$k] = [
+                                    'gzxz_id'=>$v['xx_id'],
+                                    'xh_id' => $k,
+                                    'xx_id' => $v['xx_id'],
+                                    'xx_name' => $v['xx_name'],
+                                    'yy_id' =>$v['yy_id'],
+                                    'yy_name' => $v['yy_name'],
+                                    'bw_id' => $v['bw_id'],
+                                    'bw_name' => $v['bw_name'],
+                                    'pc_id' => $v['pc_id'],
+                                    'pc_name' => $v['pc_name'],
+                                    'cx_type'=>'故障现象错写',
+                                    'cx_name'=>Fault::where(['fault_id'=>$v['xx_id']])->value('name'),
+                                    'cx_score'=>-5,
+                                ];
                             }
-                            // echo $t1."####".$kscore."<br/>";
-                            $other_content[] = [
-                                'gzxz_id'=>$t,
-                                'cx_score'=>$kscore,
+                        }else{
+                            $xianxian_score = 5+$xianxian_score;
+                            $other_content[$k] = [
+                                'gzxz_id'=>'',
+                                'xh_id' => $k,
+                                'xx_id' => '',
+                                'xx_name' => '',
+                                'yy_id' => '',
+                                'yy_name' => '',
+                                'bw_id' => '',
+                                'bw_name' => '',
+                                'pc_id' => '',
+                                'pc_name' => '',
+                                'cx_type'=>'未作答',
+                                'cx_name'=>'',
+                                'cx_score'=>-5,
                             ];
                         }
                     }
-                    unset($em);
-
-                    // echo "<pre>";
-                    // print_r($xianxian_content);
-                    
-                    // echo "<pre>";
-                    // print_r($other_content);
-                    // die();
                 }else{
                     foreach ($partent_fault_id as $key => $em){
                         $xianxian_score = 5+$xianxian_score;
-                        $xianxian_content[] = [
+                        $other_content[] = [
                             'gzxz_id'=>$em,
-                            'cx_id'=>$em,
+                            'xh_id' => $key,
+                            'xx_id' => '',
+                            'xx_name' => '',
+                            'yy_id' => '',
+                            'yy_name' => '',
+                            'bw_id' => '',
+                            'bw_name' => '',
+                            'pc_id' => '',
+                            'pc_name' => '',
                             'cx_type'=>'未作答',
-                            // 'cx_name'=>Fault::where(['fault_id'=>$em])->value('name'),
                             'cx_name'=>'',
-                        ];
-                        $other_content[] = [
-                            'gzxz_id'=>$em,
                             'cx_score'=>-5,
                         ];
                     }
                     unset($em);
                 }
-                
-                // //获取数组
-                // $other_report = json_decode($params['other_report'],true);
-                // if(!empty($other_report)){
-                //     foreach ($other_report as $key => $em){
-                //         //故障现象
-                //         $xianxian_arr[] = $em['xx_id'];
-                //         //故障部位
-                //         $buwei_arr[] = $em['bw_id'];
-                //         //可能原因
-                //         foreach(explode(',',$em['yy_id']) as $k3 =>$t13){
-                //             $yuanyin_arr[] = $t13;
-                //         }
-                //         //排除方法
-                //         $fangfa_arr[] = $em['pc_id'];
-                //     }
-                // }
-                
-                // //故障现象 分数 start
-                // foreach ($partent_fault_id as $k1 =>$t){
-                //     if(!in_array($t,$xianxian_arr)){
-                //         $xianxian_score = 1+$xianxian_score;
-                //         $xianxian_content[] = [
-                //             'cx_id'=>$t,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
-                //         ];
-                //     }
-                // }
-                // foreach ($xianxian_arr as $k2 =>$t2){
-                //     if(!in_array($t2,$partent_fault_id)){
-                //         $xianxian_score = 1+$xianxian_score;
-                //         $xianxian_content[] = [
-                //             'cx_id'=>$t2,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t2])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //故障现象 end
-              
-                
-                // //故障部位 start
-                // foreach ($fault_arr as $k11 =>$t11){
-                //     if(!in_array($t11,$buwei_arr)){
-                //         $buwei_score = 1+$buwei_score;
-                //         $buwei_content[] = [
-                //             'cx_id'=>$t11,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t11])->value('name'),
-                //         ];
-                //     }
-                // }
-                // foreach ($buwei_arr as $k12 =>$t12){
-                //     if(!empty($t12) && !in_array($t12,$fault_arr)){
-                //         //错写
-                //         $buwei_score = 1+$buwei_score;
-                //         $buwei_content[] = [
-                //             'cx_id'=>$t12,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t12])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //故障部位 end
-                
-                // //排除方法 start
-                // //循环固定的排除方法,匹配作答的排除方法
-                // foreach ($paichu_arr as $k21 =>$t21){
-                //     if(!in_array($t21,$fangfa_arr)){
-                //         $fangfa_score = 1+$fangfa_score;
-                //         $fangfa_content[] = [
-                //             'cx_id'=>$t21,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t21])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //循环作答的排除方法,,匹配固定的排除方法
-                // foreach ($fangfa_arr as $k22 =>$t22){
-                //     if(!empty($t22) && !in_array($t22,$paichu_arr)){
-                //         $fangfa_score = 1+$fangfa_score;
-                //         $fangfa_content[] = [
-                //             'cx_id'=>$t22,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t22])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //排除方法 end
-
-                // //可能原因 start
-                // //循环固定的可能原因,匹配作答的可能原因
-                // foreach ($yy_arr as $k31 =>$t31){
-                //     if(!in_array($t31,$yuanyin_arr)){
-                //         // echo $t31."<br/>";
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t31,
-                //             'cx_type'=>'少写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t31])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //循环作答的排除方法,,匹配固定的排除方法
-                // foreach ($yuanyin_arr as $k32 =>$t32){
-                //     if(!empty($t32) && !in_array($t32,$yy_arr)){
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t32,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t32])->value('name'),
-                //         ];
-                //     }
-                // }
-                // $uniqueArray = array_unique($yuanyin_arr);
-                // $diff = array_diff_assoc($yuanyin_arr, $uniqueArray);
-                // if(!empty($diff)){
-                //     foreach ($diff as $k323 =>$t323){
-                //         $yuanyin_socre = 1+$yuanyin_socre;
-                //         $yuanyin_content[] = [
-                //             'cx_id'=>$t323,
-                //             'cx_type'=>'错写',
-                //             'cx_name'=>Fault::where(['fault_id'=>$t323])->value('name'),
-                //         ];
-                //     }
-                // }
-                // //可能原因 end
+                // echo "故障现象得分:".$xianxian_score."<br/>";
+                // echo "故障部位得分:".$buwei_score."<br/>";
+                // echo "排除方法得分:".$fangfa_score."<br/>";
+                // echo "可能原因得分:".$yuanyin_socre."<br/>";
+                // die();
                 
                 $weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
                 if($weixiu_score>15){
@@ -701,46 +612,8 @@ class Practice extends Backend
         $report_score = 15-$row['xianxian_score']-$row['yuanyin_socre']-$row['buwei_score']-$row['fangfa_score'];
         $row['report_score'] = $report_score>0?$report_score:0; 
 
-        $row['xianxian_content_name'] = '';
-        if(!empty($row['xianxian_content']))
-        {
-            $row['xianxian_content_name'] = json_decode($row['xianxian_content'],true);
-        }
-        $row['yuanyin_content_name'] = '';
-        if(!empty($row['yuanyin_content']))
-        {
-            $row['yuanyin_content_name'] = json_decode($row['yuanyin_content'],true);
-        }
-        $row['buwei_content_name'] = '';
-        if(!empty($row['buwei_content']))
-        {
-            $row['buwei_content_name'] = json_decode($row['buwei_content'],true);
-        }
-        $row['fangfa_content_name'] = '';
-        if(!empty($row['fangfa_content']))
-        {
-            $row['fangfa_content_name'] = json_decode($row['fangfa_content'],true);
-        }
-        $other_report = !empty($row['other_report']) ? json_decode($row['other_report'],true):[];
         $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];
-        
-        $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
-        //根据故障部位 数组
-        $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
-
-        //查找故障现象 数组
-        $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$rows['sim_type']])->column('parent_fault_id');
-        $arr1= [];
-        foreach ($partent_fault_id as $key => $value) {
-            $arr1[] = [
-                'gzxz_id' => $value,
-                'xianxian_content' => $row['xianxian_content_name'],
-                'other_report' => $other_report,
-                'other_jielun' => $other_jielun,
-            ];
-        }
-        $this->view->assign('other_report', $other_report);
-        $this->view->assign('partent_fault_id', $arr1);
+        $this->view->assign('other_jielun', $other_jielun);
 
         $this->view->assign('row', $row);
         return $this->view->fetch();

+ 3 - 78
application/admin/controller/teacher/Exams.php

@@ -149,46 +149,10 @@ class Exams extends Backend
         $row['fault_name_two'] = Fault::where('fault_id',$fault_list[1]['fault_id'])->value('name');
         $row['fault_name_three'] = Fault::where('fault_id',$fault_list[2]['fault_id'])->value('name');
 
-        $row['xianxian_content_name'] = '';
-        if(!empty($row['xianxian_content']))
-        {
-            $row['xianxian_content_name'] = json_decode($row['xianxian_content'],true);
-        }
-        $row['yuanyin_content_name'] = '';
-        if(!empty($row['yuanyin_content']))
-        {
-            $row['yuanyin_content_name'] = json_decode($row['yuanyin_content'],true);
-        }
-        $row['buwei_content_name'] = '';
-        if(!empty($row['buwei_content']))
-        {
-            $row['buwei_content_name'] = json_decode($row['buwei_content'],true);
-        }
-        $row['fangfa_content_name'] = '';
-        if(!empty($row['fangfa_content']))
-        {
-            $row['fangfa_content_name'] = json_decode($row['fangfa_content'],true);
-        }
+        $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];
 
-        $other_report = !empty($row['other_report']) ? json_decode($row['other_report'],true):[];
-
-        $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
-        //根据故障部位 数组
-        $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
-
-        //查找故障现象 数组
-        $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$rows['sim_type']])->column('parent_fault_id');
-        $arr1= [];
-        foreach ($partent_fault_id as $key => $value) {
-            $arr1[] = [
-                'gzxz_id' => $value,
-                'xianxian_content' => $row['xianxian_content_name'],
-                'other_report' => $other_report
-            ];
-        }
         if (false === $this->request->isPost()) {
-            $this->view->assign('partent_fault_id', $arr1);
-            $this->view->assign('other_report', $other_report);
+            $this->view->assign('other_jielun', $other_jielun);
             $this->view->assign('row', $row);
             return $this->view->fetch();
         }
@@ -245,47 +209,8 @@ class Exams extends Backend
         $row['report_score'] = $report_score>0?$report_score:0; 
 
         $row['weixiu_score'] = 10-$row['overtime_score']??0; 
-
-        $row['xianxian_content_name'] = '';
-        if(!empty($row['xianxian_content']))
-        {
-            $row['xianxian_content_name'] = json_decode($row['xianxian_content'],true);
-        }
-        $row['yuanyin_content_name'] = '';
-        if(!empty($row['yuanyin_content']))
-        {
-            $row['yuanyin_content_name'] = json_decode($row['yuanyin_content'],true);
-        }
-        $row['buwei_content_name'] = '';
-        if(!empty($row['buwei_content']))
-        {
-            $row['buwei_content_name'] = json_decode($row['buwei_content'],true);
-        }
-        $row['fangfa_content_name'] = '';
-        if(!empty($row['fangfa_content']))
-        {
-            $row['fangfa_content_name'] = json_decode($row['fangfa_content'],true);
-        }
-        $other_report = !empty($row['other_report']) ? json_decode($row['other_report'],true):[];
         $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];
-        
-        $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
-        //根据故障部位 数组
-        $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
-
-        //查找故障现象 数组
-        $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$rows['sim_type']])->column('parent_fault_id');
-        $arr1= [];
-        foreach ($partent_fault_id as $key => $value) {
-            $arr1[] = [
-                'gzxz_id' => $value,
-                'xianxian_content' => $row['xianxian_content_name'],
-                'other_report' => $other_report,
-                'other_jielun' => $other_jielun,
-            ];
-        }
-        $this->view->assign('other_report', $other_report);
-        $this->view->assign('partent_fault_id', $arr1);
+        $this->view->assign('other_jielun', $other_jielun);
         
         $this->view->assign('row', $row);
         return $this->view->fetch();

+ 79 - 2
application/admin/controller/teacher/Practice.php

@@ -10,6 +10,7 @@ use think\Env;
 use think\exception\PDOException;
 use think\exception\ValidateException;
 use app\admin\model\teacher\Exams;
+use app\admin\model\teacher\ExamsScore;
 /**
  * sim-练习集合管理
  *
@@ -18,6 +19,7 @@ use app\admin\model\teacher\Exams;
 class Practice extends Backend
 {
 
+    protected $noNeedRight = ['score'];
     /**
      * Collection模型对象
      * @var \app\admin\model\teacher\Collection
@@ -449,14 +451,89 @@ class Practice extends Backend
             return $this->selectpage();
         }
         [$where, $sort, $order, $offset, $limit] = $this->buildparams();
-        $list = $this->exam_model
-            ->where($where)->where($this->whereExtend)->where(['starttime'=>['>',0],'endtime'=>['>',0]])
+        $sim_type = Db::name('real_exam_collection')->where('exam_collection_id',$ids)->value('sim_type');
+        $list = Db::name('seat')->select();
+        foreach ($list as $key => $value) {
+            $sim = Db::name('sim')->where('seat_id',$value['seat_id'])->where('sim_type',$sim_type)->find();
+            if(!empty($sim['sim_state'])){
+                switch ($sim['sim_state']) {
+                    case '1':
+                        $sim_state = '在线';
+                        break;
+                    case '2':
+                        $sim_state = '离线';
+                        break;
+                    default:
+                        $sim_state = '';
+                        break;
+                }
+            }else{
+                $sim_state = '';
+            }
+            $exam = $this->exam_model->where('exam_collection_id',$ids)->order('exam_id desc')->where('seat_id',$value['seat_id'])->find();
+            $user_username = '';
+            $user_nickname = '';
+            $exam_status = '未登录';
+            $total_score = 0;
+            $fault_names = '';
+            $exam_id = 0;
+            if(!empty($exam)){
+                $user_username = $exam['user_username']??'';
+                $user_nickname = $exam['user_nickname']??'';
+                if($exam['exam_status']==1){
+                    $exam_status= '已登录未开始考试';
+                }else if($exam['exam_status']==4){
+                    $exam_status= '已开始考试';
+                }else if($exam['exam_status']==5){
+                    $exam_status= '已交卷';
+                }
+                $total_score = $exam['total_score']??'';
+                $fault_names = $exam['fault_names']??'';
+                $exam_id = $exam['exam_id']??0;
+            }
+            $list[$key]['user_username'] = $user_username;
+            $list[$key]['user_nickname'] = $user_nickname;
+            $list[$key]['exam_status'] = $exam_status;
+            $list[$key]['total_score'] = $total_score;
+            $list[$key]['fault_names'] = $fault_names;
+            $list[$key]['exam_id'] = $exam_id;
+            $list[$key]['sim_state'] = $sim_state;
+        }
+        $result = ['total' => count($list), 'rows' => $list];
+        return json($result);
+    }
+
+    public function score($ids = null)
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            $this->assignConfig('ids', $ids);
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        $exam_ids = $this->exam_model->where('exam_collection_id',$ids)->column('exam_id');
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = ExamsScore::where($where)->where('exam_id','in',$exam_ids)
             ->order($sort, $order)
             ->paginate($limit);
+        foreach ($list as $k => $v){
+            $exam =  $this->exam_model->where(['exam_id'=>$v['exam_id']])->find();
+            if($exam){
+                $v->seat_id = $exam['seat_id'];
+                $v->user_username = $exam['user_username'];
+                $v->user_nickname = $exam['user_nickname'];
+            }
+        }
+        unset($v);
         $result = ['total' => $list->total(), 'rows' => $list->items()];
         return json($result);
     }
 
+
     public function rand_fault($fault_list = null){
 
         // $fault_key = array_rand($fault_list,3);

+ 1 - 7
application/admin/view/simulator/index.html

@@ -99,14 +99,8 @@
                             </thead>
                             <tbody class="task_list1">
                                 <tr>
-                                    <td>名称</td>
-                                    <td>未修复</td>
-                                </tr>
-                                <tr>
-                                    <td>名称</td>
-                                    <td>已修复</td>
+                                    <td colspan="2">暂无记录</td>
                                 </tr>
-                                
                             </tbody>
                         </table>
                     </div>

+ 1 - 26
application/admin/view/student/collection/editreport.html

@@ -35,20 +35,10 @@
                         </tr>
                     </thead>
                     <tbody>
-<!--                    <tr>-->
-<!--                        <td>-->
-<!--                            <select class="form-control" name="unwin[xx_id]">-->
-<!--                                <option value="" >请选择</option>-->
-<!--                                {foreach name="xianxiang" item="vo"}-->
-<!--                                <option value="{$vo.fault_id}" {if $row.other_report_text.xx_id eq $vo.fault_id} selected {/if}>{$vo.name}</option>-->
-<!--                                {/foreach}-->
-<!--                            </select>-->
-<!--                        </td>-->
-<!--                    </tr>-->
                     {foreach name="xianxiang" item="vo"}
                     <tr>
                         <td>
-                            <input {if $row.other_report_text.xx_id eq $vo.fault_id} checked {/if} id="row[xx_id]" name="unwin[xx_id]" type="radio" value="{$vo.fault_id}">&nbsp;&nbsp;&nbsp;{$vo.name}<br/>
+                            <input {if in_array($vo.fault_id,$row.xxid)} disabled {/if}  {if $row.other_report_text.xx_id eq $vo.fault_id} checked {/if} id="row[xx_id]" name="unwin[xx_id]" type="radio" value="{$vo.fault_id}">&nbsp;&nbsp;&nbsp;{$vo.name}<br/>
                         </td>
                     </tr>
                     {/foreach}
@@ -61,11 +51,6 @@
                     </tr>
                     </thead>
                     <tbody>
-<!--                    <tr>-->
-<!--                        <td>-->
-<!--                            {:build_select('unwin[yy_id][]', $yuanyin, $row.other_report_text.yy_id, ['class'=>'form-control selectpicker','multiple'=>''])}-->
-<!--                        </td>-->
-<!--                    </tr>-->
                     {foreach name="yuanyin" item="vv"}
                     <tr>
                         <td>
@@ -82,11 +67,6 @@
                     </tr>
                     </thead>
                     <tbody>
-<!--                    <tr>-->
-<!--                        <td>-->
-<!--                            {:build_select('unwin[bw_id][]', $buwei, $row.other_report_text.bw_id, ['class'=>'form-control selectpicker','multiple'=>''])}-->
-<!--                        </td>-->
-<!--                    </tr>-->
                     {foreach name="buwei" item="vv"}
                     <tr>
                         <td>
@@ -104,11 +84,6 @@
                     </tr>
                     </thead>
                     <tbody>
-<!--                    <tr>-->
-<!--                        <td>-->
-<!--                            {:build_select('unwin[pc_id][]', $paichu, $row.other_report_text.pc_id, ['class'=>'form-control selectpicker','multiple'=>''])}-->
-<!--                        </td>-->
-<!--                    </tr>-->
                     {foreach name="paichu" item="v2"}
                     <tr>
                         <td>

+ 2 - 0
application/admin/view/student/collection/examing.html

@@ -152,6 +152,7 @@
                                     <tbody>
                                     {if $row.other_report_text}
                                     {foreach name="row.other_report_text" item="vo"}
+                                    {if $vo.xx_name}
                                     <tr>
                                         <td>{$vo.xx_name}</td>
                                         <td>{$vo.yy_name}</td>
@@ -162,6 +163,7 @@
                                             <span class="btn btn-xs btn-danger btnmove" title="移除" xh_id="{$vo.xh_id}"><i class="fa fa-times"></i> 移除</span>
                                         </td>
                                     </tr>
+                                    {/if}
                                     {/foreach}
                                     {else/}
                                     <tr>

+ 15 - 92
application/admin/view/student/exam/view.html

@@ -112,6 +112,7 @@
                     </tr>
                     </table>
 
+
                     <table class="new_table1">
                         <tr>
                             <td>序号</td>
@@ -122,50 +123,33 @@
                             <td style="width:20%">扣分原因</td> 
                             <td>扣分情况</td>  
                         </tr>
-                        {volist name="partent_fault_id" id="vo2"}
+                        {volist name="other_jielun" id="vo2"}
                         <tr style="height: 60px">    
-                            <td>{++$key}</td>
+                            <td>{++$vo2.xh_id}</td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.xx_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.xx_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.yy_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.yy_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.bw_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.bw_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.pc_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.pc_name|htmlentities}
                             </td>
                             <td>
-                            {volist name="vo2.xianxian_content" id="vo22"}
-                                {if $vo2.gzxz_id eq $vo22.gzxz_id}
-                                    <span class="text-danger">{$vo22.cx_type}&nbsp;&nbsp;&nbsp;{$vo22.cx_name}</span><br/>
+                                {if !empty($vo2.cx_name)}
+                                {volist name="vo2.cx_name" id="vo22"}
+                                    <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
+                                {/volist}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
+                                {else}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
                                 {/if}
-                            {/volist}
                             </td>
                             <td>
-                            {volist name="vo2.other_jielun" id="vo23"}
-                                {if $vo2.gzxz_id eq $vo23.gzxz_id}
-                                    {$vo23.cx_score??''}<br/>
-                                {/if}
-                            {/volist}
+                                {$vo2.cx_score??''}<br/>
                             </td>
                         </tr>
                         {/volist}
@@ -175,67 +159,6 @@
                     </table>
 
                     <table class="new_table">
-                    {if false}
-                    <tr>
-                        <td style="width:5%">序号</td>
-                        <td style="width:25%">评分标准</td>
-                        <td style="width:10%">扣分</td>
-                        <!-- <td style="width:10%">报告情况</td> -->
-                        <td style="width:45%">扣分原因</td>
-                    </tr>
-                    <tr>
-                        <td>1</td>
-                        <td>故障现象少写或错写1条扣1分</td>
-                        <td>{$row.xianxian_score|htmlentities}</td>
-                        <!-- <td>{if $row.xianxian_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.xianxian_content_name}
-                            {volist name="row.xianxian_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>2</td>
-                        <td>可能原因少写或错写1条扣1分</td>
-                        <td>{$row.yuanyin_socre|htmlentities}</td>
-                        <!-- <td>{if $row.yuanyin_socre eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.yuanyin_content_name}
-                            {volist name="row.yuanyin_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>3</td>
-                        <td>故障部位少写或错写1条扣1分</td>
-                        <td>{$row.buwei_score|htmlentities}</td>
-                        <!-- <td>{if $row.buwei_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.buwei_content_name}
-                            {volist name="row.buwei_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>4</td>
-                        <td>排除方法少写或错写1条扣1分</td>
-                        <td>{$row.fangfa_score|htmlentities}</td>
-                        <!-- <td>{if $row.fangfa_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.fangfa_content_name}
-                            {volist name="row.fangfa_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    {/if}
                     <tr>
                         <td colspan="5" style="text-align: left;padding-left: 1%">三.维修时间(10分)(本题得分:{$row.weixiu_score??0})</td>
                     </tr>

+ 14 - 92
application/admin/view/student/exercise/analysis.html

@@ -112,51 +112,34 @@
                             <td style="width:20%">扣分原因</td>  
                             <td>扣分情况</td> 
                         </tr>
-                        {volist name="partent_fault_id" id="vo2"}
+                        {volist name="other_jielun" id="vo2"}
                         <tr style="height: 60px">    
-                            <td>{++$key}</td>
+                            <td>{++$vo2.xh_id}</td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.xx_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.xx_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.yy_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.yy_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.bw_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.bw_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.pc_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.pc_name|htmlentities}
                             </td>
                             <td>
-                            {volist name="vo2.xianxian_content" id="vo22"}
-                                {if $vo2.gzxz_id eq $vo22.gzxz_id}
+                                {if !empty($vo2.cx_name)}
+                                {volist name="vo2.cx_name" id="vo22"}
                                     <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
+                                {/volist}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
+                                {else}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
                                 {/if}
-                            {/volist}
                             </td>
                             <td>
-                            {volist name="vo2.other_jielun" id="vo23"}
-                                {if $vo2.gzxz_id eq $vo23.gzxz_id}
-                                    {$vo23.cx_score??''}<br/>
-                                {/if}
-                            {/volist}
-                            </td>                            
+                                {$vo2.cx_score??''}<br/>
+                            </td>
                         </tr>
                         {/volist}
                         <tr>
@@ -164,67 +147,6 @@
                         </tr>
                         </table>
                         <table class="new_table">
-                        {if false}
-                        <tr>
-                            <td style="width:5%">序号</td>
-                            <td style="width:25%">评分标准</td>
-                            <td style="width:10%">扣分</td>
-                            <!-- <td style="width:10%">报告情况</td> -->
-                            <td style="width:45%">扣分原因</td>
-                        </tr>
-                        <tr>
-                            <td>1</td>
-                            <td>故障现象少写或错写1条扣1分</td>
-                            <td>{$row.xianxian_score|htmlentities}</td>
-                            <!-- <td>{if $row.xianxian_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.xianxian_content_name}
-                                {volist name="row.xianxian_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>2</td>
-                            <td>可能原因少写或错写1条扣1分</td>
-                            <td>{$row.yuanyin_socre|htmlentities}</td>
-                            <!-- <td>{if $row.yuanyin_socre eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.yuanyin_content_name}
-                                {volist name="row.yuanyin_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>3</td>
-                            <td>故障部位少写或错写1条扣1分</td>
-                            <td>{$row.buwei_score|htmlentities}</td>
-                            <!-- <td>{if $row.buwei_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.buwei_content_name}
-                                {volist name="row.buwei_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>4</td>
-                            <td>排除方法少写或错写1条扣1分</td>
-                            <td>{$row.fangfa_score|htmlentities}</td>
-                            <!-- <td>{if $row.fangfa_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.fangfa_content_name}
-                                {volist name="row.fangfa_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        {/if}
                         <tr>
                             <td colspan="5" style="text-align: left;padding-left: 1%">三.维修时间(10分)(本题得分:{$row.weixiu_score??0})</td>
                         </tr>

+ 2 - 0
application/admin/view/student/exercise/examing.html

@@ -153,6 +153,7 @@
                                         <tbody>
                                         {if $row.other_report_text}
                                         {foreach name="row.other_report_text" item="vo"}
+                                        {if $vo.xx_name}
                                         <tr>
                                             <td>{$vo.xx_name}</td>
                                             <td>{$vo.yy_name}</td>
@@ -163,6 +164,7 @@
                                                 <span class="btn btn-xs btn-danger btnmove" title="移除" xh_id="{$vo.xh_id}"><i class="fa fa-times"></i> 移除</span>
                                             </td>
                                         </tr>
+                                        {/if}
                                         {/foreach}
                                         {else/}
                                         <tr>

+ 14 - 92
application/admin/view/student/practice/analysis.html

@@ -112,51 +112,34 @@
                             <td style="width:20%">扣分原因</td>  
                             <td>扣分情况</td> 
                         </tr>
-                        {volist name="partent_fault_id" id="vo2"}
+                                                {volist name="other_jielun" id="vo2"}
                         <tr style="height: 60px">    
-                            <td>{++$key}</td>
+                            <td>{++$vo2.xh_id}</td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.xx_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.xx_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.yy_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.yy_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.bw_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.bw_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.pc_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.pc_name|htmlentities}
                             </td>
                             <td>
-                            {volist name="vo2.xianxian_content" id="vo22"}
-                                {if $vo2.gzxz_id eq $vo22.gzxz_id}
+                                {if !empty($vo2.cx_name)}
+                                {volist name="vo2.cx_name" id="vo22"}
                                     <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
+                                {/volist}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
+                                {else}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
                                 {/if}
-                            {/volist}
                             </td>
                             <td>
-                            {volist name="vo2.other_jielun" id="vo23"}
-                                {if $vo2.gzxz_id eq $vo23.gzxz_id}
-                                    {$vo23.cx_score??''}<br/>
-                                {/if}
-                            {/volist}
-                            </td>                            
+                                {$vo2.cx_score??''}<br/>
+                            </td>
                         </tr>
                         {/volist}
                         <tr>
@@ -164,67 +147,6 @@
                         </tr>
                         </table>
                         <table class="new_table">
-                        {if false}
-                        <tr>
-                            <td style="width:5%">序号</td>
-                            <td style="width:25%">评分标准</td>
-                            <td style="width:10%">扣分</td>
-                            <!-- <td style="width:10%">报告情况</td> -->
-                            <td style="width:45%">扣分原因</td>
-                        </tr>
-                        <tr>
-                            <td>1</td>
-                            <td>故障现象少写或错写1条扣1分</td>
-                            <td>{$row.xianxian_score|htmlentities}</td>
-                            <!-- <td>{if $row.xianxian_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.xianxian_content_name}
-                                {volist name="row.xianxian_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>2</td>
-                            <td>可能原因少写或错写1条扣1分</td>
-                            <td>{$row.yuanyin_socre|htmlentities}</td>
-                            <!-- <td>{if $row.yuanyin_socre eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.yuanyin_content_name}
-                                {volist name="row.yuanyin_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>3</td>
-                            <td>故障部位少写或错写1条扣1分</td>
-                            <td>{$row.buwei_score|htmlentities}</td>
-                            <!-- <td>{if $row.buwei_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.buwei_content_name}
-                                {volist name="row.buwei_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>4</td>
-                            <td>排除方法少写或错写1条扣1分</td>
-                            <td>{$row.fangfa_score|htmlentities}</td>
-                            <!-- <td>{if $row.fangfa_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                            <td>
-                                {if $row.fangfa_content_name}
-                                {volist name="row.fangfa_content_name" id="vo" }
-                                <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span>&nbsp;&nbsp;&nbsp;<br/>
-                                {/volist}
-                                {/if}
-                            </td>
-                        </tr>
-                        {/if}
                         <tr>
                             <td colspan="5" style="text-align: left;padding-left: 1%">三.维修时间(10分)(本题得分:{$row.weixiu_score??0})</td>
                         </tr>

+ 2 - 0
application/admin/view/student/practice/examing.html

@@ -151,6 +151,7 @@
                                         <tbody>
                                         {if $row.other_report_text}
                                         {foreach name="row.other_report_text" item="vo"}
+                                        {if $vo.xx_name}
                                         <tr>
                                             <td>{$vo.xx_name}</td>
                                             <td>{$vo.yy_name}</td>
@@ -161,6 +162,7 @@
                                                 <span class="btn btn-xs btn-danger btnmove" title="移除" xh_id="{$vo.xh_id}"><i class="fa fa-times"></i> 移除</span>
                                             </td>
                                         </tr>
+                                        {/if}
                                         {/foreach}
                                         {else/}
                                         <tr>

+ 30 - 91
application/admin/view/teacher/exams/edit.html

@@ -116,53 +116,38 @@
                         <td style="width:20%">扣分原因</td>  
                         <td>扣分情况</td>  
                     </tr>
-                    {volist name="partent_fault_id" id="vo2"}
-                    <tr style="height: 60px">    
-                        <td>{++$key}</td>
-                        <td>
-                            {volist name="vo2.other_report" id="vo21"}
-                                {if $vo2.gzxz_id eq $vo21.xx_id}
-                                    {$vo21.xx_name|htmlentities}
+                     {volist name="other_jielun" id="vo2"}
+                        <tr style="height: 60px">    
+                            <td>{++$vo2.xh_id}</td>
+                            <td>
+                                {$vo2.xx_name|htmlentities}
+                            </td>
+                            <td>
+                                {$vo2.yy_name|htmlentities}
+                            </td>
+                            <td>
+                                {$vo2.bw_name|htmlentities}
+                            </td>
+                            <td>
+                                {$vo2.pc_name|htmlentities}
+                            </td>
+                            <td>
+                                {if !empty($vo2.cx_name)}
+                                {volist name="vo2.cx_name" id="vo22"}
+                                    {if $vo2.gzxz_id eq $vo22.gzxz_id}
+                                        <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
+                                    {/if}
+                                {/volist}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
+                                {else}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
                                 {/if}
-                            {/volist}
-                        </td>
-                        <td>
-                            {volist name="vo2.other_report" id="vo21"}
-                                {if $vo2.gzxz_id eq $vo21.xx_id}
-                                    {$vo21.yy_name|htmlentities}
-                                {/if}
-                            {/volist}
-                        </td>
-                        <td>
-                            {volist name="vo2.other_report" id="vo21"}
-                                {if $vo2.gzxz_id eq $vo21.xx_id}
-                                    {$vo21.bw_name|htmlentities}
-                                {/if}
-                            {/volist}
-                        </td>
-                        <td>
-                            {volist name="vo2.other_report" id="vo21"}
-                                {if $vo2.gzxz_id eq $vo21.xx_id}
-                                    {$vo21.pc_name|htmlentities}
-                                {/if}
-                            {/volist}
-                        </td>
-                        <td>
-                        {volist name="vo2.xianxian_content" id="vo22"}
-                            {if $vo2.gzxz_id eq $vo22.gzxz_id}
-                                <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
-                            {/if}
+                            </td>
+                            <td>
+                                {$vo2.cx_score??''}<br/>
+                            </td>
+                        </tr>
                         {/volist}
-                        </td>
-                        <td>
-                        {volist name="vo2.other_jielun" id="vo23"}
-                                {if $vo2.gzxz_id eq $vo23.gzxz_id}
-                                    {$vo23.cx_score??''}<br/>
-                                {/if}
-                            {/volist}
-                        </td>
-                    </tr>
-                    {/volist}
                     <tr>
                         <td colspan="6" style="text-align:left;padding-left:1%;font-weight:600;">故障现象少写或错写1条扣5分;可能原因少写或错写1条扣1分;故障部位少写或错写1条扣1分;排除方法少写或错写1条扣1分。</td>
                     </tr>
@@ -170,52 +155,6 @@
 
                 <table class="new_table"> 
                     <tbody class="task_list">
-                    {if false}
-                    <tr>
-                        <td>故障现象少写或错写1条扣1分</td>
-                        <td><input type="text" name="row[xianxian_score]" value="{$row.xianxian_score|htmlentities}"></td>
-                        <td>
-                            {if $row.xianxian_content_name}
-                            {volist name="row.xianxian_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>可能原因少写或错写1条扣1分</td>
-                        <td><input type="text" name="row[yuanyin_socre]" value="{$row.yuanyin_socre|htmlentities}"></td>
-                        <td>
-                            {if $row.yuanyin_content_name}
-                            {volist name="row.yuanyin_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>故障部位少写或错写1条扣1分</td>
-                        <td><input type="text" name="row[buwei_score]" value="{$row.buwei_score|htmlentities}"></td>
-                        <td>
-                            {if $row.buwei_content_name}
-                            {volist name="row.buwei_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>排除方法少写或错写1条扣1分</td>
-                        <td><input type="text" name="row[fangfa_score]" value="{$row.fangfa_score|htmlentities}"></td>
-                        <td>
-                            {if $row.fangfa_content_name}
-                            {volist name="row.fangfa_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    {/if}
                     <tr>
                         <td colspan="3">三.维修时间(10分)</td>
                     </tr>

+ 16 - 92
application/admin/view/teacher/exams/view.html

@@ -122,50 +122,35 @@
                             <td style="width:20%">扣分原因</td>  
                             <td>扣分情况</td>  
                         </tr>
-                        {volist name="partent_fault_id" id="vo2"}
+                        {volist name="other_jielun" id="vo2"}
                         <tr style="height: 60px">    
-                            <td>{++$key}</td>
+                            <td>{++$vo2.xh_id}</td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.xx_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.xx_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.yy_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.yy_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.bw_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.bw_name|htmlentities}
                             </td>
                             <td>
-                                {volist name="vo2.other_report" id="vo21"}
-                                    {if $vo2.gzxz_id eq $vo21.xx_id}
-                                        {$vo21.pc_name|htmlentities}
-                                    {/if}
-                                {/volist}
+                                {$vo2.pc_name|htmlentities}
                             </td>
                             <td>
-                            {volist name="vo2.xianxian_content" id="vo22"}
-                                {if $vo2.gzxz_id eq $vo22.gzxz_id}
-                                    <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
+                                {if !empty($vo2.cx_name)}
+                                {volist name="vo2.cx_name" id="vo22"}
+                                    {if $vo2.gzxz_id eq $vo22.gzxz_id}
+                                        <span class="text-danger">{$vo22.cx_type}:{$vo22.cx_name}</span><br/>
+                                    {/if}
+                                {/volist}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
+                                {else}
+                                <span class="text-danger">{$vo2.cx_type}</span><br/>
                                 {/if}
-                            {/volist}
                             </td>
                             <td>
-                            {volist name="vo2.other_jielun" id="vo23"}
-                                {if $vo2.gzxz_id eq $vo23.gzxz_id}
-                                    {$vo23.cx_score??''}<br/>
-                                {/if}
-                            {/volist}
+                                {$vo2.cx_score??''}<br/>
                             </td>
                         </tr>
                         {/volist}
@@ -175,67 +160,6 @@
                     </table>
 
                     <table class="new_table"> 
-                    {if false}
-                    <tr>
-                        <td style="width:5%">序号</td>
-                        <td style="width:25%">评分标准</td>
-                        <td style="width:10%">扣分</td>
-                        <!-- <td style="width:10%">报告情况</td> -->
-                        <td style="width:45%">扣分原因</td>
-                    </tr>
-                    <tr style="height: 60px">
-                        <td>1</td>
-                        <td>故障现象少写或错写1条扣1分</td>
-                        <td>{$row.xianxian_score|htmlentities}</td>
-                        <!-- <td>{if $row.xianxian_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.xianxian_content_name}
-                            {volist name="row.xianxian_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>2</td>
-                        <td>可能原因少写或错写1条扣1分</td>
-                        <td>{$row.yuanyin_socre|htmlentities}</td>
-                        <!-- <td>{if $row.yuanyin_socre eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.yuanyin_content_name}
-                            {volist name="row.yuanyin_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>3</td>
-                        <td>故障部位少写或错写1条扣1分</td>
-                        <td>{$row.buwei_score|htmlentities}</td>
-                        <!-- <td>{if $row.buwei_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.buwei_content_name}
-                            {volist name="row.buwei_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    <tr>
-                        <td>4</td>
-                        <td>排除方法少写或错写1条扣1分</td>
-                        <td>{$row.fangfa_score|htmlentities}</td>
-                        <!-- <td>{if $row.fangfa_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td> -->
-                        <td>
-                            {if $row.fangfa_content_name}
-                            {volist name="row.fangfa_content_name" id="vo" }
-                            <span class="text-danger">{$vo.cx_type}:{$vo.cx_name}</span><br/>
-                            {/volist}
-                            {/if}
-                        </td>
-                    </tr>
-                    {/if}
                     <tr>
                         <td colspan="5" style="text-align: left;padding-left: 1%">三.维修时间(10分)(本题得分:{$row.weixiu_score??0})</td>
                     </tr>

+ 16 - 0
application/admin/view/teacher/practice/persent.html

@@ -59,6 +59,22 @@
                 </div>
             </div>
 
+            <div id="" class="tab-content">
+                <div class="tab-pane fade active in" id="three">
+                    <div class="tableTitle" style="font-size: 16px;margin: 10px 0">得分情况</div>
+                    <div class="widget-body no-padding">
+                        <div id="toolbar2" class="toolbar">
+                            <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        </div>
+                        <table id="table2" class="table table-striped table-bordered table-hover table-nowrap"
+                               data-operate-edit="{:$auth->check('teacher/exams/edit')}"
+                               data-operate-del="{:$auth->check('teacher/exams/del')}"
+                               width="100%">
+                        </table>
+                    </div>
+                </div>
+            </div>
+            
         </div>
     </div>
     <div class="col-lg-12" style="margin: 10px 10px 0 10px">

+ 16 - 1
public/assets/js/backend/simulator.js

@@ -111,7 +111,22 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart
 
             //读取当前状态
             $(document).on("click", ".btn-read-fault", function () {
-                Layer.alert('读取当前状态');
+                $.ajax({
+                    url: 'simulator/readfault',
+                    type: 'get',
+                    success: function (data) {
+                        console.log(data.code);
+                        var task_tr = '';
+                        var ret = data.data;
+                        for (var i = 0; i < ret.length; i++) {
+                            task_tr += '<tr>';
+                            task_tr += '    <td><input type="checkbox" name="checkbox" value="'+ret[i].faultId+'"></td>';
+                            task_tr += '    <td>'+ret[i].name+'</td>';
+                            task_tr += '</tr>';
+                        }
+                        $(".task_list1").html(task_tr)
+                    }
+                });
             });
 
         }

+ 108 - 12
public/assets/js/backend/teacher/practice.js

@@ -1,4 +1,4 @@
-define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function ($, undefined, Backend, Table, Form,editable) {
 
     var Controller = {
 
@@ -129,6 +129,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 extend: {
                     index_url: 'teacher/practice/persent/ids/'+Config.ids + location.search,
                     indexed_url: 'teacher/practice/examing/ids/'+ Config.ids+ location.search,
+                    score_url: 'teacher/practice/score/ids/'+Config.ids  + location.search,
                     table: 'teacher_exams',
                 }
             });
@@ -215,34 +216,69 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 初始化表格
             table1.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.indexed_url,
-                pk: 'exam_collection_id',
-                sortName: 'exam_collection_id',
+                pk: 'exam_id',
+                sortName: 'exam_id',
                 toolbar: '#toolbar1',
                 fixedColumns: true,
                 fixedRightNumber: 1,
                 searchFormVisible:false,
+                showExport:false,
+                search:false,
+                pagination:false,
                 columns: [
                     [
                         // {checkbox: true},
                         {field: 'seat_id', title: __('座号')},
-                        {field: '', title: __('模拟器状态'),
+                        {field: 'seat_id', title: __('座号')},
+                        {field: 'sim_state', title: __('模拟器状态'),
                             formatter: function(value, row,index) {
-                                return '<span class="text-success">就绪</span>';
+                                if(value=='在线'){
+                                    return '<span class="text-success">'+value+'</span>';
+                                }
+                                if(value=='离线'){
+                                    return '<span class="text-danger">'+value+'</span>';
+                                }
                             }
                         },
                         {field: 'user_username', title: __('学员学号')},
                         {field: 'user_nickname', title: __('学员姓名')},
-                        {field: '', title: __('考试状态'),
+                        {field: 'exam_status', title: __('考试状态'),
                             formatter: function(value, row,index) {
-                                return '<span class="text-success">已交卷</span>';
+                                if(value=='未登录'){
+                                    return '<span class="text-danger">'+value+'</span>';
+                                }else if(value=='已登录未开始考试'){
+                                    return '<span class="text-warning">'+value+'</span>';
+                                }else if(value=='已开始考试'){
+                                    return '<span class="text-info">'+value+'</span>';
+                                }else if(value=='已交卷'){
+                                    return '<span class="text-success">'+value+'</span>';
+                                }
                             }
                         },
                         {field: 'total_score', title: __('考试成绩')},
-                        // {field: 'fault_names', title: __('出题题目'),formatter: Table.api.formatter.faultname},
-                        // {field: 'xianxiang_names', title: __('故障现象'),formatter: Table.api.formatter.faultname},
-                        // {field: 'yuanyin_names', title: __('可能原因'),formatter: Table.api.formatter.faultname},
-                        // {field: 'buwei_names', title: __('故障部位'),formatter: Table.api.formatter.faultname},
-                        // {field: 'fangfa_names', title: __('排除方法'),formatter: Table.api.formatter.faultname},
+                        {field: 'fault_names', title: __('出题题目'),formatter: Table.api.formatter.faultname},
+                        {field: 'operate', title: __('Operate'), table: table1,
+                            events: Table.api.events.operate,
+                            // formatter: Table.api.formatter.operate
+                            formatter: Table.api.formatter.buttons,
+                            buttons: [
+                                {
+                                    name: 'dispatch',
+                                    text: '成绩详情',
+                                    icon: 'fa fa-eye',
+                                    title: '成绩详情',
+                                    classname: 'btn btn-info btn-xs btn-magic btn-dialog',
+                                    extend: 'data-area=\'["75%","95%"]\'',
+                                    visible: function (row) {
+                                        if(row.total_score>0){
+                                            return true;
+                                        }
+                                        return false;
+                                    },
+                                    url: 'teacher/exams/view',
+                                }
+                            ],
+                        }
                     ]
                 ]
             });
@@ -250,6 +286,58 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table1);
 
+             var table2 = $("#table2");
+            // 初始化表格
+            table2.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.score_url,
+                pk: 'exam_id',
+                sortName: 'exam_id',
+                toolbar: '#toolbar2',
+                fixedColumns: true,
+                pageSize: 10,
+                pagination:false,
+                fixedLeftNumber: 4,
+                searchFormVisible:false,
+                showExport:false,
+                search:false,
+                columns: [
+                    [
+                        // {checkbox: true},
+                        {field: 'seat_id', title: __('座号')},
+                        {field: 'user_username', title: __('学员学号')},
+                        {field: 'user_nickname', title: __('学员姓名')},
+                        {field: 'total', title: __('考试成绩')},
+                        {field: 'fault_one_score', title: __('故障一扣分'),editable:true},
+                        {field: 'fault_two_score', title: __('故障二扣分'),editable:true},
+                        {field: 'fault_three_score', title: __('故障三扣分'),editable:true},
+                        {field: 'xianxian_score', title: __('故障现象扣分'),editable:true},
+                        {field: 'yuanyin_socre', title: __('可能原因扣分'),editable:true},
+                        {field: 'buwei_score', title: __('故障部位扣分'),editable:true},
+                        {field: 'fangfa_score', title: __('排除方法扣分'),editable:true},
+                        {field: 'overtime_score', title: __('超时扣分'),editable:true},
+                        {field: 'operate', title: __('Operate'), table: table1,
+                            events: Table.api.events.operate,
+                            // formatter: Table.api.formatter.operate
+                            formatter: Table.api.formatter.buttons,
+                            buttons: [
+                                {
+                                    name: 'dispatch',
+                                    text: '成绩详情',
+                                    icon: 'fa fa-eye',
+                                    title: '成绩详情',
+                                    classname: 'btn btn-info btn-xs btn-magic btn-dialog',
+                                    extend: 'data-area=\'["75%","95%"]\'',
+                                    url: 'teacher/exams/view',
+                                }
+                            ],
+                        }
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table2);
+
 
             //关闭考试 并且
             $(document).on('click', '.btn-closes', function () {
@@ -272,6 +360,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 //     }
                 // })
             });
+            $("button[name=commonSearch]").css('display','none');
+
+            //定时刷新
+            setInterval(function() {
+                table.bootstrapTable('refresh');
+                table1.bootstrapTable('refresh');
+                table2.bootstrapTable('refresh');
+            }, 30000);
 
 
         },