Ver Fonte

20250103 调整

贾小兵 há 3 meses atrás
pai
commit
dad935ef67

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

@@ -65,22 +65,11 @@ class Collection extends Backend
                 $this->error('出题方式为任务自选,请选择任务');
             }
         }
-
         $params = $this->preExcludeFields($params);
-
-        if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
-            $params[$this->dataLimitField] = $this->auth->id;
-        }
         $result = false;
         Db::startTrans();
         try {
             $depart_ids = $params['depart_ids'];
-            //是否采用模型验证
-            if ($this->modelValidate) {
-                $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
-                $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
-                $this->model->validateFailException()->validate($validate);
-            }
             $result = $this->model->allowField(true)->save($params);
             foreach(explode(',',$depart_ids) as $item){
                 if(!empty($item)){
@@ -92,6 +81,11 @@ class Collection extends Backend
                     Db::name('real_exam_collection_dept')->insert($arr);
                 }
             }
+
+            //匹配的学员自动加入  mx_real_exam 考试表  总分
+
+            //匹配的学员自动加入  mx_real_exam_fault 考试故障关联表
+
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {
             Db::rollback();
@@ -255,4 +249,11 @@ class Collection extends Backend
         $result = ['total' => $list->total(), 'rows' => $list->items()];
         return json($result);
     }
+
+    /**
+    老师开启考试
+     */
+    public function start($ids = null){
+        $this->success();
+    }
 }

+ 1 - 2
application/admin/view/teacher/collection/index.html

@@ -10,9 +10,8 @@
                         <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('teacher/collection/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('teacher/collection/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('teacher/collection/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-                        
+                        <a href="javascript:;" class="btn btn-warning btn-start btn-disabled disabled {:$auth->check('teacher/collection/start')?'':'hide'}" title="{:__('开始考试')}" ><i class="fa fa-play-circle"></i> {:__('开始考试')}</a>
 
-                        
 
                         
                     </div>

+ 27 - 2
public/assets/js/backend/teacher/collection.js

@@ -1,7 +1,5 @@
 define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
     var Controller = {
-
         index: function () {
             $('.btn-add').data('area',['85%','85%']);
             $('.btn-edit').data('area',['85%','85%']);
@@ -27,7 +25,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 sortName: 'exam_collection_id',
                 fixedColumns: true,
                 fixedRightNumber: 1,
+                singleSelect : true, //
                 searchFormVisible:true,
+                search:false,
                 columns: [
                     [
                         {checkbox: true},
@@ -70,6 +70,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     extend: 'data-area=\'["85%","85%"]\'',
                                     url: 'teacher/collection/edit',
                                 },
+                                {
+                                    name: 'dispatch',
+                                    text: '',
+                                    icon: 'fa fa-hand-pointer-o',
+                                    title: '进入考试',
+                                    visible: function (rr) {
+                                        if(rr.exam_collection_state == 2){
+                                            return true;
+                                        }
+                                        return false;
+                                    },
+                                    classname: 'btn btn-info btn-xs btn-magic btn-addtabs',
+                                    url: 'teacher/exams/persent',
+                                },
                                 // {
                                 //     name: 'dispatch',
                                 //     text: '',
@@ -94,6 +108,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
             // 为表格绑定事件
             Table.api.bindevent(table);
+
+            $(document).on('click', '.btn-start', function () {
+                var ids = Table.api.selectedids(table);
+                Fast.api.ajax({
+                    url: "teacher/collection/start/ids/"+ids,
+                    type: "post",
+                }, function () {
+                    table.bootstrapTable('refresh', {});
+                    Layer.close(index);
+                });
+            });
         },
         task: function () {
             // 初始化表格参数配置