Jelajahi Sumber

20250311 修正优化

贾小兵 1 bulan lalu
induk
melakukan
a8742f3720

+ 14 - 1
application/admin/controller/student/Collection.php

@@ -626,11 +626,24 @@ class Collection extends Backend
             $params = $this->request->post('other_replace','');
             $other_report = $this->request->post('other_report','');
             $param = json_decode($params,true);
+            $faultid_arr = [];
+            foreach ($param as $it) {
+                if(!empty($it['fault_id'])){
+                    $faultid_arr[] = $it['fault_id'];
+                }
+            }
+            $row = $this->exam_model->get($ids);
+            $rowinfo = $this->model->get($row->exam_collection_id);
+            $uniqueArray = array_unique($faultid_arr);
+            //考试 判断
+            if (count($faultid_arr) != count($uniqueArray) && $rowinfo['exam_collection_type']==3) {
+                $this->error('存在相同可更换件,不允许重复申请。');
+            }
             if(!empty($param)){
                 $faultid_arr = [];
                 foreach ($param as $key=>$item){
                     if(!empty($item['fault_id'])){
-                        $isreplace = Db::name('real_exam_comp_request')->where(['exam_id'=>$ids,'fault_id'=>$item['fault_id']])->find();
+                        $isreplace = Db::name('real_exam_comp_request')->where(['exam_id'=>$ids,'fault_id'=>$item['fault_id'],'sim_type'=>$row->sim_type])->find();
                         if(empty($isreplace)){
                             $add = [
                                 'exam_id'=>$ids,

+ 10 - 3
application/admin/controller/student/Practice.php

@@ -281,17 +281,23 @@ class Practice extends Backend
                     if($fault_right_list[0]['answer_right']==1){
                         $fault_one_score = 0;
                     }
-                    if($fault_right_list[1]['answer_right']==1){
+                    if(!empty($fault_right_list[1]['answer_right']) && $fault_right_list[1]['answer_right']==1){
                         $fault_two_score = 0;
                     }
-                    if($fault_right_list[2]['answer_right']==1){
+                    if(!empty($fault_right_list[2]['answer_right']) &&  $fault_right_list[2]['answer_right']==1){
                         $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']];
+                if($row['fault_total']==1){
+                    $fault_arr = [$fault_right_list[0]['fault_id']];
+                }else if($row['fault_total']==2){
+                    $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id']];
+                }else if($row['fault_total']==3){
+                    $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
+                }
                 
                 //根据故障部位查找,匹配的排除方法
                 $paichu_arr = Report::where(['bw_id'=>['in',$fault_arr],'sim_type'=>$info['sim_type']])->column('pc_id');
@@ -603,6 +609,7 @@ class Practice extends Backend
             $this->error(__('No Results were found'));
         }
         $rows = $this->exam_model->get($ids);
+        $row['fault_total'] = $rows->fault_total;
         $row['seat_id'] = $rows->seat_id;
         $row['user_nickname'] = $rows->user_nickname;
         $row['user_username'] = $rows->user_username;

+ 43 - 12
application/admin/controller/teacher/Collection.php

@@ -55,6 +55,7 @@ class Collection extends Backend
     {
         if (false === $this->request->isPost()) {
             $this->assignConfig('user_ids',[]);
+            $this->assign('examid',$ids);
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');
@@ -122,16 +123,38 @@ class Collection extends Backend
                     //匹配的学员自动加入  mx_real_exam_fault 考试故障关联表
                     $fault_list = Fault::where(['sim_type' => $params['sim_type'], 'fault_state' => 0,'fault_type'=>3])->select();
                     if($params['question_setting_method']==1){ //系统随机
-                        if($params['sim_type']=='0002'){
+                        if($params['sim_type']=='0001'){
+                            $fault_key1 = rand(0,1);
+                            $fault_key2 = rand(2,3);
+                            $fault_key3 = rand(4,5);
+                            $fault_key4 = rand(6,7);
+                            $fault_key5 = rand(8,9);
+                        }else if($params['sim_type']=='0002'){
                             $fault_key1 = 1;
-                            $fault_key2 = 5;
-                            $fault_key3 = rand(10,11);
-                        }else{
-                            $fault_key1 = rand(0, 1);
-                            $fault_key2 = rand(2, 3);
-                            $fault_key3 = 9;
+                            $fault_key2 = 3;
+                            $fault_key3 = 5;
+                            $fault_key4 = rand(6,7);
+                            $fault_key5 = rand(9,10);
+                        }else if($params['sim_type']=='0003'){
+                            $fault_key1 = rand(0,1);
+                            $fault_key2 = rand(2,3);
+                            $fault_key3 = rand(8,10);
+                            $fault_key4 = rand(11,12);
+                            $fault_key5 = rand(13,14);
                         }
-                        $fault_key = [$fault_key1,$fault_key2,$fault_key3];
+                        $fault_key_arr = [$fault_key1,$fault_key2,$fault_key3,$fault_key4,$fault_key5];
+                        $keys = array_rand($fault_key_arr, 3); // 随机取出3个元素
+                        $fault_key = array_intersect_key($fault_key_arr, array_flip($keys));
+//                        if($params['sim_type']=='0002'){
+//                            $fault_key1 = 1;
+//                            $fault_key2 = 5;
+//                            $fault_key3 = rand(10,11);
+//                        }else{
+//                            $fault_key1 = rand(0, 1);
+//                            $fault_key2 = rand(2, 3);
+//                            $fault_key3 = 9;
+//                        }
+//                        $fault_key = [$fault_key1,$fault_key2,$fault_key3];
                     }else if($params['question_setting_method']==2){//教师自选
                         $question_ids = $params['question_ids'];
                     }else if($params['question_setting_method']==3){ //任务自选
@@ -335,12 +358,14 @@ class Collection extends Backend
     }
 
     //选择考题
-    public function faults($type = null)
+    public function faults($type = null,$ids = null)
     {
+        $row = $this->model->where(['exam_collection_id'=>$ids])->find();
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
         if (false === $this->request->isAjax()) {
             $this->assignConfig('sim_type', $type);
+            $this->assignConfig('rowinfo', $row);
             return $this->view->fetch();
         }
         //如果发送的来源是 Selectpage,则转发到 Selectpage
@@ -370,21 +395,27 @@ class Collection extends Backend
         return json($result);
     }
     //选择任务
-    public function task($type= null)
+    public function task($type= null,$ids = null)
     {
-
+        $row = $this->model->where(['exam_collection_id'=>$ids])->find();
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
         if (false === $this->request->isAjax()) {
             $this->assignConfig('sim_type', $type);
+            $this->assignConfig('ids', $ids);
             return $this->view->fetch();
         }
         //如果发送的来源是 Selectpage,则转发到 Selectpage
         if ($this->request->request('keyField')) {
             return $this->selectpage();
         }
+        $task_where = [];
+        // 如果是考试
+        if($row['exam_collection_type']==3){
+            $task_where['fault_total'] = 3;
+        }
         [$where, $sort, $order, $offset, $limit] = $this->buildparams();
-        $list = Task::where($where)->where('sim_type',$type)
+        $list = Task::where($where)->where('sim_type',$type)->where($task_where)
             ->order($sort, $order)
             ->paginate($limit);
         unset($v);

+ 13 - 4
application/admin/controller/teacher/Exams.php

@@ -200,6 +200,7 @@ class Exams extends Backend
             $this->error(__('No Results were found'));
         }
         $rows = $this->model->get($ids);
+        $row['fault_total'] = $rows->fault_total;
         $row['seat_id'] = $rows->seat_id;
         $row['user_nickname'] = $rows->user_nickname;
         $row['user_username'] = $rows->user_username;
@@ -211,12 +212,20 @@ class Exams extends Backend
 
         $fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
         $row['fault_name_one'] = Fault::where('fault_id',$fault_list[0]['fault_id'])->value('name');
-        $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');
-
+        if($rows['fault_total']>0){
+            if($rows['fault_total']==2){
+                $row['fault_name_two'] = Fault::where('fault_id',$fault_list[1]['fault_id'])->value('name');
+            }
+            if($rows['fault_total']==3){
+                $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');
+            }
+        }else{
+            $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['fault_score'] = 75-$row['fault_one_score']-$row['fault_two_score']-$row['fault_three_score'];
 
-        
 
         $row['weixiu_score'] = 10-$row['overtime_score']??0; 
         $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];

+ 41 - 8
application/admin/controller/teacher/Practice.php

@@ -56,6 +56,7 @@ class Practice extends Backend
     {
         if (false === $this->request->isPost()) {
             $this->assignConfig('user_ids',[]);
+            $this->assign('examid',$ids);
             return $this->view->fetch();
         }
         $params = $this->request->post('row/a');
@@ -106,6 +107,7 @@ class Practice extends Backend
                         'user_nickname' => $admin['nickname'],
                         'user_id' => $item,
                         'seat_id'=>0,
+                        'fault_total'=>$params['fault_total']??0,
                         'task_id'=>$params['task_id'],
                         'question_ids'=>$params['question_ids'],
                         'question_name'=>$params['question_name'],
@@ -120,21 +122,52 @@ class Practice extends Backend
                     //匹配的学员自动加入  mx_real_exam_fault 考试故障关联表
                     $fault_list = Fault::where(['sim_type' => $params['sim_type'], 'fault_state' => 0,'fault_type'=>3])->select();
                     if($params['question_setting_method']==1){ //系统随机
-                        if($params['sim_type']=='0002'){
+//                        if($params['sim_type']=='0002'){
+//                            $fault_key1 = 1;
+//                            $fault_key2 = 5;
+//                            $fault_key3 = rand(10,11);
+//                        }else{
+//                            $fault_key1 = rand(0, 1);
+//                            $fault_key2 = rand(2, 3);
+//                            $fault_key3 = 9;
+//                        }
+                        $fault_key_arr = [1,4,5];
+                        if($params['sim_type']=='0001'){
+                            $fault_key1 = rand(0,1);
+                            $fault_key2 = rand(2,3);
+                            $fault_key3 = rand(4,5);
+                            $fault_key4 = rand(6,7);
+                            $fault_key5 = rand(8,9);
+                        }else if($params['sim_type']=='0002'){
                             $fault_key1 = 1;
-                            $fault_key2 = 5;
-                            $fault_key3 = rand(10,11);
-                        }else{
-                            $fault_key1 = rand(0, 1);
-                            $fault_key2 = rand(2, 3);
-                            $fault_key3 = 9;
+                            $fault_key2 = 3;
+                            $fault_key3 = 5;
+                            $fault_key4 = rand(6,7);
+                            $fault_key5 = rand(9,10);
+                        }else if($params['sim_type']=='0003'){
+                            $fault_key1 = rand(0,1);
+                            $fault_key2 = rand(2,3);
+                            $fault_key3 = rand(8,10);
+                            $fault_key4 = rand(11,12);
+                            $fault_key5 = rand(13,14);
+                        }
+                        $fault_key_arr = [$fault_key1,$fault_key2,$fault_key3,$fault_key4,$fault_key5];
+                        if($params['fault_total']==1){
+                            $keys = array_rand($fault_key_arr);
+                            $fault_key = [$fault_key_arr[$keys]];
+                        }else if($params['fault_total']==2){
+                            $keys = array_rand($fault_key_arr, 2); // 随机取出2个元素
+                            $fault_key = array_intersect_key($fault_key_arr, array_flip($keys));
+                        }else if($params['fault_total']==3){
+                            $keys = array_rand($fault_key_arr, 3); // 随机取出3个元素
+                            $fault_key = array_intersect_key($fault_key_arr, array_flip($keys));
                         }
-                        $fault_key = [$fault_key1,$fault_key2,$fault_key3];
                     }else if($params['question_setting_method']==2){//教师自选
                         $question_ids = $params['question_ids'];
                     }else if($params['question_setting_method']==3){ //任务自选
                         $task_ids = Db::name('task_fault')->where(['task_id'=>['in',$params['task_id']]])->column('fault_id');
                     }
+
                     foreach ($fault_list as $key=> $item1){
                         $flag = 0;
                         if(!empty($fault_key) && in_array($key,$fault_key)){

+ 6 - 4
application/admin/controller/teacher/Task.php

@@ -55,9 +55,10 @@ class Task extends Backend
         if(empty($params['fault_id'])){
             $this->error('请选择任务故障');
         }
-        if(count(explode(',',$params['fault_id']))!=3){
-            $this->error('故障部位必须为3个');
+        if(count(explode(',',$params['fault_id']))>3){
+            $this->error('故障部位最多为3个');
         }
+        $params['fault_total'] = count(explode(',',$params['fault_id']));
         $params = $this->preExcludeFields($params);
         if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
             $params[$this->dataLimitField] = $this->auth->id;
@@ -129,9 +130,10 @@ class Task extends Backend
         if(empty($params['fault_id'])){
             $this->error('请选择任务故障');
         }
-        if(count(explode(',',$params['fault_id']))!=3){
-            $this->error('故障部位必须为3个');
+        if(count(explode(',',$params['fault_id']))>3){
+            $this->error('故障部位必须最多为3个');
         }
+        $params['fault_total'] = count(explode(',',$params['fault_id']));
         $params = $this->preExcludeFields($params);
         $result = false;
         Db::startTrans();

+ 1 - 0
application/admin/library/Auth.php

@@ -58,6 +58,7 @@ class Auth extends \fast\Auth
             $this->setError('Password is incorrect');
             return false;
         }
+        //判断学员是否存在已经开始考试的项目
         $admin->loginfailure = 0;
         $admin->logintime = time();
         $admin->loginip = request()->ip();

+ 1 - 1
application/admin/view/student/exercise/analysis.html

@@ -89,7 +89,7 @@
                             <td>{$row.fault_name_two|htmlentities}</td>
                         </tr>
                         <tr>
-                            <td>2</td>
+                            <td>3</td>
                             <td>故障三未排除扣25分</td>
                             <td>{$row.fault_three_score|htmlentities}</td>
                             <td>{if $row.fault_three_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>

+ 18 - 11
application/admin/view/student/practice/analysis.html

@@ -67,7 +67,7 @@
                         <tr>
                             <td style="width:5%">序号</td>
                             <td style="width:25%">评分标准</td>
-                            <td style="width:10%">扣分</td>
+<!--                            <td style="width:10%">扣分</td>-->
                             <td style="width:10%">维修情况</td>
                             <td style="width:45%">题目</td>
                         </tr>
@@ -77,24 +77,31 @@
                         <tr>
                             <td>1</td>
                             <td>故障一未排除扣25分</td>
-                            <td>{$row.fault_one_score|htmlentities}</td>
                             <td>{if $row.fault_one_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
                             <td>{$row.fault_name_one|htmlentities}</td>
                         </tr>
+                        {if $row.fault_total eq 2}
                         <tr>
                             <td>2</td>
                             <td>故障二未排除扣25分</td>
-                            <td>{$row.fault_two_score|htmlentities}</td>
                             <td>{if $row.fault_two_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
                             <td>{$row.fault_name_two|htmlentities}</td>
                         </tr>
+                        {/if}
+                        {if $row.fault_total eq 3}
                         <tr>
                             <td>2</td>
+                            <td>故障二未排除扣25分</td>
+                            <td>{if $row.fault_two_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
+                            <td>{$row.fault_name_two|htmlentities}</td>
+                        </tr>
+                        <tr>
+                            <td>3</td>
                             <td>故障三未排除扣25分</td>
-                            <td>{$row.fault_three_score|htmlentities}</td>
                             <td>{if $row.fault_three_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
                             <td>{$row.fault_name_three|htmlentities}</td>
                         </tr>
+                        {/if}
                         <tr>
                             <td colspan="5" style="text-align: left;padding-left: 1%">二.修理报告表(15分)(本题得分:{$row.report_score??0})</td>
                         </tr>
@@ -110,7 +117,7 @@
                             <td>故障部位</td>
                             <td>排除方法</td>  
                             <td style="width:20%">扣分原因</td>  
-                            <td>扣分情况</td> 
+<!--                            <td>扣分情况</td> -->
                         </tr>
                                                 {volist name="other_jielun" id="vo2"}
                         <tr style="height: 60px">    
@@ -139,14 +146,14 @@
                                 <span class="text-danger">{$vo2.cx_type}</span><br/>
                                 {/if}
                             </td>
-                            <td>
-                                {$vo2.cx_score??''}<br/>
-                            </td>
+<!--                            <td>-->
+<!--                                {$vo2.cx_score??''}<br/>-->
+<!--                            </td>-->
                         </tr>
                         {/volist}
-                        <tr>
-                            <td colspan="7" style="text-align:left;padding-left:1%;font-weight:600;">故障现象少写或错写1条扣5分;可能原因少写或错写1条扣1分;故障部位少写或错写1条扣1分;排除方法少写或错写1条扣1分。</td>
-                        </tr>
+<!--                        <tr>-->
+<!--                            <td colspan="7" style="text-align:left;padding-left:1%;font-weight:600;">故障现象少写或错写1条扣5分;可能原因少写或错写1条扣1分;故障部位少写或错写1条扣1分;排除方法少写或错写1条扣1分。</td>-->
+<!--                        </tr>-->
                         </table>
                         <table class="new_table">
                         <tr>

+ 1 - 1
application/admin/view/teacher/collection/add.html

@@ -16,7 +16,7 @@
             <label class="control-label col-xs-12 col-sm-3 addRedStar">{:__('Limit_duration')}:</label>
             <div class="col-xs-12 col-sm-7">
                 <div class="input-group input-groupp-sm">
-                    <input id="c-limit_duration" class="form-control"  type="number"  name="row[limit_duration]" type="number" min="0">
+                    <input id="c-limit_duration" class="form-control"  type="number"  name="row[limit_duration]" type="number" min="15" max="300" data-rule="range(15~300)">
                     <span class="input-group-addon">分钟</span>
                 </div>
             </div>

+ 1 - 0
application/admin/view/teacher/collection/adduser.html

@@ -4,6 +4,7 @@
         <input class="form-control depart_ids" name="row[depart_ids]" type="hidden" value="">
         <input class="form-control question_ids" name="row[question_ids]" type="hidden" value="0">
         <input class="form-control task_id" name="row[task_id]" type="hidden" value="0">
+        <input class="form-control examid"  type="hidden" value="{$examid}">
 
         <div class="form-group col-sm-6">
             <label class="control-label col-xs-12 col-sm-3 addRedStar">{:__('Sim_type')}:</label>

+ 1 - 1
application/admin/view/teacher/collection/edit.html

@@ -12,7 +12,7 @@
             <label class="control-label col-xs-12 col-sm-3 addRedStar">{:__('Limit_duration')}:</label>
             <div class="col-xs-12 col-sm-7">
                 <div class="input-group input-groupp-sm">
-                    <input id="c-limit_duration" class="form-control" min="0" {if $row.starttime>0} readonly {/if} type="number" name="row[limit_duration]" type="number" value="{$row.limit_duration|htmlentities}">
+                    <input id="c-limit_duration" class="form-control" min="15" max="300" data-rule="range(15~300)" {if $row.starttime>0} readonly {/if} type="number" name="row[limit_duration]" type="number" value="{$row.limit_duration|htmlentities}">
                     <span class="input-group-addon">分钟</span>
                 </div>
             </div>

+ 11 - 1
application/admin/view/teacher/exams/view.html

@@ -89,6 +89,7 @@
                         <td>{if $row.fault_one_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
                         <td>{$row.fault_name_one|htmlentities}</td>
                     </tr>
+                    {if $row.fault_total eq 2}
                     <tr>
                         <td>2</td>
                         <td>故障二未排除扣25分</td>
@@ -96,14 +97,23 @@
                         <td>{if $row.fault_two_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
                         <td>{$row.fault_name_two|htmlentities}</td>
                     </tr>
+                    {/if}
+                    {if $row.fault_total eq 3 or  $row.fault_total eq 0}
                     <tr>
                         <td>2</td>
+                        <td>故障二未排除扣25分</td>
+                        <td>{$row.fault_two_score|htmlentities}</td>
+                        <td>{if $row.fault_two_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
+                        <td>{$row.fault_name_two|htmlentities}</td>
+                    </tr>
+                    <tr>
+                        <td>3</td>
                         <td>故障三未排除扣25分</td>
                         <td>{$row.fault_three_score|htmlentities}</td>
                         <td>{if $row.fault_three_score eq 0 }<span class="text-success">已排除</span> {else} <span class="text-danger">未排除</span>{/if}</td>
                         <td>{$row.fault_name_three|htmlentities}</td>
                     </tr>
-                    
+                    {/if}
                     <tr>
                         <td colspan="5" style="text-align: left;padding-left: 1%">二.修理报告表(15分)(本题得分:{$row.report_score??0})</td>
                     </tr>

+ 13 - 0
application/admin/view/teacher/practice/adduser.html

@@ -3,6 +3,7 @@
         <input class="form-control depart_ids" name="row[depart_ids]" type="hidden" value="">
         <input class="form-control question_ids" name="row[question_ids]" type="hidden" value="0">
         <input class="form-control task_id" name="row[task_id]" type="hidden" value="0">
+        <input class="form-control examid"  type="hidden" value="{$examid}">
 
 
 
@@ -40,6 +41,18 @@
             </div>
         </div>
 
+        <div class="form-group col-sm-6 fault_total" style="display: none">
+            <label class="control-label col-xs-12 col-sm-3 addRedStar">{:__('故障数量')}:</label>
+            <div class="col-xs-12 col-sm-7">
+                <select id="c-fault_total" class="form-control" name="row[fault_total]">
+                    <option value="">请选择</option>
+                    <option value="1">1</option>
+                    <option value="2">2</option>
+                    <option value="3">3</option>
+                </select>
+            </div>
+        </div>
+
         <div class="form-group col-sm-6 questions" style="display:none;left: 48%">
             <label class="control-label col-xs-12 col-sm-3 addRedStar">{:__('故障名称')}:</label>
             <div class="col-xs-12 col-sm-7">

+ 1 - 1
application/admin/view/teacher/task/add.html

@@ -70,7 +70,7 @@
     <div class="col-lg-12" style="margin: 20px 10px 0px">
         <div class="tab-content">
             <div class="tab-pane tab_log1" style="display: block">
-                <span class="text-danger" style="margin-left:40px;">各模拟器类型的故障有且只允许选择3个</span>
+                <span class="text-danger" style="margin-left:40px;">各模拟器类型的故障最多只允许选择3个</span>
                 <table class="new_table">
                     <thead>
                         <tr style="height: 3.5rem">

+ 1 - 1
application/admin/view/teacher/task/edit.html

@@ -64,7 +64,7 @@
     <div class="col-lg-12" style="margin: 20px 10px">
         <div class="tab-content">
             <div class="tab-pane tab_log1" style="display: block">
-                <span class="text-danger" style="margin-left:40px;">各模拟器类型的故障有且只允许选择3个</span>
+                <span class="text-danger" style="margin-left:40px;">各模拟器类型的故障最多只允许选择3个</span>
                 <table class="new_table">
                     <thead>
                     <tr style="height: 3.5rem">

+ 0 - 2
public/assets/js/backend/student/practice.js

@@ -131,8 +131,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     // seconds = seconds < 10 ? "0" + seconds : seconds;
 
                     display.text(minutes + "分" + seconds+'秒');
-
-                    // console.log(minutes.replace("0-",''));
                     // console.log(parseInt(minutes.replace("0-",'')));
                     if (--countdownTime < 0) {
                         $.ajax({

+ 15 - 5
public/assets/js/backend/teacher/collection.js

@@ -206,7 +206,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 初始化表格参数配置
             Table.api.init({
                 extend: {
-                    index_url: 'teacher/collection/task/type/' +Config.sim_type+ location.search,
+                    index_url: 'teacher/collection/task/type/' +Config.sim_type+'/ids/'+Config.ids+ location.search,
                 }
             });
 
@@ -225,7 +225,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'task_id', title: __('Task_id'),operate: false},
+                        // {field: 'task_id', title: __('Task_id'),operate: false},
                         {field: 'name', title: __('任务名称'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
                         {field: 'fault_name', title: __('故障内容'),formatter: Table.api.formatter.faultname},
@@ -290,11 +290,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
             // 选中多个
             $(document).on("click", ".btn-choose-multi", function () {
+                var exam_collection_type  = Config.rowinfo.exam_collection_type;
                 var ids = Table.api.selectedids(table);
-                if(ids.length!=3){
+                if(ids.length!=3 && exam_collection_type==3){
                     Layer.alert('故障内容只允许选择3个');
                     return false
                 }
+                if(exam_collection_type==1 && ids.length>3){
+                    Layer.alert('故障内容最多允许选择3个');
+                    return false
+                }
                 console.log(ids)
 
                 var taskname = [];
@@ -398,6 +403,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     }
                 });
                 var table = $("#table1");
+                table.on('post-body.bs.table', function (e, data) {
+                    $('#table1').bootstrapTable('expandAllRows');
+                });
                 // var oInit = new Object();
                 // 初始化表格
                 table.bootstrapTable({
@@ -459,8 +467,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         Layer.alert('请选择模拟器类型');
                         return false
                     }
+                    var examid = $(".examid").val();
                     var title = '选择考题';
-                    Fast.api.open(Fast.api.fixurl("teacher/collection/faults/type/"+simtype), title, {
+                    Fast.api.open(Fast.api.fixurl("teacher/collection/faults/type/"+simtype+"/ids/"+examid), title, {
                         area: ["85%", "85%"],
                         maxmin: true,
                         moveOut: false,
@@ -485,8 +494,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         Layer.alert('请选择模拟器类型');
                         return false;
                     }
+                    var examid = $(".examid").val();
                     var title = '选择任务';
-                    parent.Fast.api.open(Fast.api.fixurl("teacher/collection/task/type/"+simtype), title, {
+                    parent.Fast.api.open(Fast.api.fixurl("teacher/collection/task/type/"+simtype+"/ids/"+examid), title, {
                         area: ["65%", "70%"],
                         maxmin: true,
                         moveOut: false,

+ 15 - 2
public/assets/js/backend/teacher/exams.js

@@ -98,7 +98,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                         // },
                         {field: 'total_score', title: __('Total_score'),operate:false},
                         // {field: 'deduction_total_score', title: __('Deduction_total_score')},
-                        {field: 'starttime', title: __('考试时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        {field: 'starttime', title: __('开始考试时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        {field: 'endtime', title: __('交卷时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                         // {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
                         // {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
                         // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
@@ -354,7 +355,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                             ],
                         }
                     ]
-                ]
+                ],
+                onEditableSave: function (field, row, oldValue, $el) {
+                    var data = {};  //组合更新数据
+                    // data["row[field]"] = field;  //字段名
+                    data["row[" + field + "]"] = row[field];    //字段值
+                    // data["row[id]"] = row['id'];    //主键
+                    Fast.api.ajax({
+                        url:  "teacher/exams/editscore/ids/" + row[this.pk],
+                        data: data
+                    }, function () {
+                        $(".btn-refresh").trigger("click");
+                    });
+                },
             });
 
             // 为表格绑定事件

+ 21 - 6
public/assets/js/backend/teacher/practice.js

@@ -475,7 +475,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                         index_url: 'department/admin/departadmintotal' + location.search,
                     }
                 });
-                var table = $("#table1");
+                var table = $("#table1");//当内容渲染完成后展开详细
+                table.on('post-body.bs.table', function (e, data) {
+                    $('#table1').bootstrapTable('expandAllRows');
+                });
                 // 初始化表格
                 table.bootstrapTable({
                     url: $.fn.bootstrapTable.defaults.extend.index_url,
@@ -515,11 +518,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                 $(document).on('change', '#c-question_setting_method', function () {
                     if($(this).val()==1){
                         $(".btn-sm,.btn-task").css('display','none');
+                        $(".fault_total").css('display','block');
+                        $('form[role=form]').validator("setField", {
+                            "row[fault_total]": "required",
+                        });
                     }else if($(this).val()==2){
                         $(".btn-sm").show();
-                        $(".btn-task").css('display','none');
+                        $(".btn-task,.fault_total").css('display','none');
+                        $('form[role=form]').validator("setField", {
+                            "row[fault_total]":null,
+                        });
                     }else if($(this).val()==3){
-                        $(".btn-sm").css('display','none');
+                        $(".btn-sm,.fault_total").css('display','none');
+                        $('form[role=form]').validator("setField", {
+                            "row[fault_total]": null,
+                        });
                         $(".btn-task").show();
                     }
                     $(".question_ids").val(0);
@@ -527,7 +540,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                     $("#c-task_name").val('');
                     $("#c-fault_name").val('');
                     $("#c-question_name").val('');
-                    $(".tasks,.questions").css('display','none')
+                    $(".tasks,.questions").css('display','none');
                 });
                 //考题
                 $(document).on('click', '.btn-sm', function () {
@@ -536,8 +549,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                         Layer.alert('请选择模拟器类型');
                         return false
                     }
+                    var examid = $(".examid").val();
                     var title = '选择考题';
-                    Fast.api.open(Fast.api.fixurl("teacher/collection/faults/type/"+simtype), title, {
+                    Fast.api.open(Fast.api.fixurl("teacher/collection/faults/type/"+simtype+"/ids/"+examid), title, {
                         area: ["85%", "85%"],
                         maxmin: true,
                         moveOut: false,
@@ -562,8 +576,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
                         Layer.alert('请选择模拟器类型');
                         return false;
                     }
+                    var examid = $(".examid").val();
                     var title = '选择任务';
-                    parent.Fast.api.open(Fast.api.fixurl("teacher/collection/task/type/"+simtype), title, {
+                    parent.Fast.api.open(Fast.api.fixurl("teacher/collection/task/type/"+simtype+"/ids/"+examid), title, {
                         area: ["65%", "70%"],
                         maxmin: true,
                         moveOut: false,

+ 1 - 1
public/assets/js/backend/teacher/task.js

@@ -204,7 +204,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         $(this).removeAttr("checked");
                     } else {
                         if(rel_Ids.length>2){
-                            Layer.alert('故障内容允许选择3个');
+                            Layer.alert('故障内容最多允许选择3个');
                             return false
                         }
                         var pfault_id = $(this).attr('pvalue');