贾小兵 5 месяцев назад
Родитель
Сommit
1f74e1024c
2 измененных файлов с 183 добавлено и 117 удалено
  1. 57 0
      ruoyi-ui/src/api/sim/exam.js
  2. 126 117
      ruoyi-ui/src/views/peoples/exams/index.vue

+ 57 - 0
ruoyi-ui/src/api/sim/exam.js

@@ -0,0 +1,57 @@
+import request from '@/utils/request'
+import { parseStrEmpty } from "@/utils/ruoyi";
+
+
+// 老师考试相关 start
+// 查询老师考试集合列表
+export function examTearcherList(query) {
+    return request({
+      url: '/sim/real-exam-collection/list',
+      method: 'get',
+      params: query
+    })
+}
+// 查询老师考试集合详细信息
+export function examTearcherGet(examCollectionId) {
+    return request({
+      url: '/sim/real-exam-collection/' + parseStrEmpty(examCollectionId),
+      method: 'get'
+    })
+}
+// 新增老师考试集合
+export function examTearcheradd(data) {
+    return request({
+      url: '/sim/real-exam-collection',
+      method: 'post',
+      data: data
+    })
+}
+// 修改老师考试集合
+export function examTearcherupdate(data) {
+    return request({
+      url: '/sim/real-exam-collection',
+      method: 'put',
+      data: data
+    })
+}
+// 删除考试集合老师考试集合列表
+export function examTearcherdel(examCollectionIds) {
+    return request({
+        url: '/sim/real-exam-collection/' + examCollectionIds,
+        method: 'delete'
+    })
+}
+// 老师考试相关 end
+
+
+
+
+// 学生考试相关 start
+// 查询学生考试集合列表
+export function examStudentList(userId) {
+    return request({
+        url: '/sim/real-exam/student/listByUserId/' + parseStrEmpty(userId),
+        method: 'get'
+    })
+}
+// 学生考试相关 end

+ 126 - 117
ruoyi-ui/src/views/peoples/exams/index.vue

@@ -3,16 +3,16 @@
     <el-row>
       <!--用户数据1-->
         <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
-          <el-form-item label="考试名称" prop="userName">
+          <el-form-item label="考试名称" prop="examCollectionName">
             <el-input
-              v-model="queryParams.userName"
+              v-model="queryParams.examCollectionName"
               placeholder="请输入考试名称"
               clearable
               style="width: 150px"
               @keyup.enter.native="handleQuery"
             />
           </el-form-item>
-          <el-form-item label="状态" prop="status">
+          <!-- <el-form-item label="状态" prop="status">
             <el-select
               v-model="queryParams.status"
               placeholder="用户状态"
@@ -26,7 +26,7 @@
                 :value="dict.value"
               />
             </el-select>
-          </el-form-item>
+          </el-form-item> -->
           <el-form-item label="考试时间">
             <el-date-picker
               v-model="dateRange"
@@ -38,15 +38,15 @@
               end-placeholder="结束日期"
             ></el-date-picker>
           </el-form-item>
-          <el-form-item label="模拟器类型" prop="userName">
+          <el-form-item label="模拟器类型" prop="simType">
             <el-select
-              v-model="queryParams.userName"
+              v-model="queryParams.simType"
               placeholder="模拟器类型"
               clearable
               style="width: 240px"
             >
               <el-option
-                v-for="dict in dict.type.sim_equip_type"
+                v-for="dict in dict.type.sim_sim_type"
                 :key="dict.value"
                 :label="dict.label"
                 :value="dict.value"
@@ -76,6 +76,7 @@
               icon="el-icon-plus"
               size="mini"
               @click="handleAdd"
+              
             >新增</el-button>
           </el-col>
           <el-col :span="1.5">
@@ -113,12 +114,22 @@
 
         <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
           <el-table-column type="selection" width="50" align="center" />
-          <!-- <el-table-column label="编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> -->
-          <el-table-column label="考试名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="考试时间" align="center" key="kaoshiTime" prop="kaoshiTime" v-if="columns[2].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="模拟器类型" align="center" key="liexing" prop="liexing" v-if="columns[3].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="创建老师" align="center" key="creater" prop="creater" v-if="columns[4].visible" :show-overflow-tooltip="true" />
-          <el-table-column label="考试状态" align="center" key="status" v-if="columns[5].visible">
+          <el-table-column label="编号" align="center" key="examCollectionId" prop="examCollectionId" v-if="columns[0].visible" />
+          <el-table-column label="考试名称" align="center" key="examCollectionName" prop="examCollectionName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="考试时长" align="center" key="limitDuration" prop="limitDuration" v-if="columns[2].visible" :show-overflow-tooltip="true" />
+          <el-table-column label="考试时间" align="center" key="kaoshiTime" prop="kaoshiTime" v-if="columns[3].visible" :show-overflow-tooltip="true" >
+            <template slot-scope="scope">
+              <span>{{scope.row.startTime}}</span> ~  <span>{{scope.row.endTime}}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="模拟器类型" align="center" key="simType" prop="simType" v-if="columns[4].visible" :show-overflow-tooltip="true" >
+            <template slot-scope="scope">
+                <dict-tag class="text-navy" :options="dict.type.sim_sim_type" :value="scope.row.simType"/>
+            </template>
+          </el-table-column>
+
+          <el-table-column label="创建老师" align="center" key="createBy" prop="createBy" v-if="columns[5].visible" :show-overflow-tooltip="true" />
+          <!-- <el-table-column label="考试状态" align="center" key="status" v-if="columns[6].visible">
             <template slot-scope="scope">
               <el-switch
                 v-model="scope.row.status"
@@ -127,8 +138,8 @@
                 @change="handleStatusChange(scope.row)"
               ></el-switch>
             </template>
-          </el-table-column>
-          <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
+          </el-table-column> -->
+          <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[7].visible" width="160">
             <template slot-scope="scope">
               <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
@@ -152,9 +163,7 @@
                 type="text"
                 icon="el-icon-delete"
                 @click="handleDelete(scope.row)"
-                v-hasPermi="['simulator:user:remove']"
               >删除</el-button>
-              
             </template>
           </el-table-column>
         </el-table>
@@ -170,44 +179,40 @@
 
     <!-- 添加或修改用户配置对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="75%" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px" style="display: flex;">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px" >
         <el-row>
-          <el-col :span="6" style="width: 20%;">
-            <el-form-item label="型号">
-              <el-select v-model="selectedEquip"  placeholder="请选择模拟器类型">
-                <el-option
-                  value="请选择"
-                >请选择</el-option>
-                <el-option
-                  v-for="dict in dict.type.sim_equip_type"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                ></el-option>
-              </el-select>
+          <el-col :span="8">
+            <el-form-item label="考试名称" prop="examCollectionName">
+              <el-input  placeholder="请输入考试名称" maxlength="30" v-model="form.examCollectionName"/>
             </el-form-item>
           </el-col>
-          <el-col :span="6">
-            <el-form-item label="考试名称" prop="userName">
-              <el-input  placeholder="请输入考试名称" maxlength="30" />
+          <el-col :span="8">
+            <el-form-item label="考试时长" prop="limitDuration">
+              <el-input  placeholder="请输入考试时长" maxlength="30" v-model="form.limitDuration"/>
             </el-form-item>
           </el-col>
-          <el-col :span="6">
-            <el-form-item label="考试时长" prop="userName">
-              <el-input  placeholder="请输入考试时长" maxlength="30" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="6">
-            <el-form-item label="日期范围" prop="field101">
+          <el-col :span="8">
+            <el-form-item label="考试时间" prop="startTime">
               <el-date-picker type="daterange" format="yyyy-MM-dd"
-                value-format="yyyy-MM-dd" :style="{width: '100%'}" start-placeholder="开始日期" end-placeholder="结束日期"
+                value-format="yyyy-MM-dd" :style="{width: '100%'}" start-placeholder="开始时间" end-placeholder="结束时间"
                 range-separator="至" clearable></el-date-picker>
             </el-form-item>
           </el-col>
-
-          <el-col :span="6">
-            <el-form-item label="出题方式" prop="userName">
-              <el-select v-model="selectmethod"  placeholder="请选择出题方式">
+          <el-col :span="8" >
+            <el-form-item label="型号" prop="simType">
+              <el-select v-model="form.simType"  placeholder="请选择模拟器类型" style="width: 100%;">
+                <el-option
+                  v-for="dict in dict.type.sim_sim_type"
+                  :key="dict.value"
+                  :label="dict.label"
+                  :value="dict.value"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="出题方式" prop="questionSettingMethod"> 
+              <el-select  v-model="form.questionSettingMethod" placeholder="请选择出题方式" style="width: 100%;" @change="selectmethod">
                 <el-option
                   value="请选择"
                 >请选择</el-option>
@@ -220,7 +225,7 @@
               </el-select>
             </el-form-item>
           </el-col>
-          <el-button type="primary" round @click="handleSelectType" v-show="isShow">自选考题编辑</el-button>
+          <el-button type="primary" round @click="handleSelectType" v-show="isShow" style="margin-left: 15px;">自选考题编辑</el-button>
         </el-row>
       </el-form>
 
@@ -393,21 +398,18 @@
 }
 </style>
 <script>
-import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "@/api/sim/student";
+import { examTearcherList,examTearcherdel,examTearcheradd,examTearcherupdate} from "@/api/sim/exam";
 import { listMajor  } from "@/api/sim/major";
-import { getToken } from "@/utils/auth";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
 
 export default {
-  name: "Task",
-  dicts: ['sim_equip_type','sys_topic_way','sys_normal_disable'],
-  components: { Treeselect },
+  name: "Exam",
+  dicts: ['sim_sim_type','sys_topic_way','sys_normal_disable',],
   data() {
     return {
       multipleSelection: [],
       selectedEquip: '',
-      selectmethod:'',
+      // selectmethod:'',
       isShow:false,
       selectedZjEquip: '',
       tableData_tm: [
@@ -605,27 +607,13 @@ export default {
       roleOptions: [],
       // 表单参数
       form: {
-        field101: null,
+        simType:'',
+        questionSettingMethod:'',
       },
       defaultProps: {
         children: "children",
         label: "label"
       },
-      // 用户导入参数
-      upload: {
-        // 是否显示弹出层(用户导入)
-        open: false,
-        // 弹出层标题(用户导入)
-        title: "",
-        // 是否禁用上传
-        isUploading: false,
-        // 是否更新已经存在的用户数据
-        updateSupport: 0,
-        // 设置上传的请求头部
-        headers: { Authorization: "Bearer " + getToken() },
-        // 上传的地址
-        url: process.env.VUE_APP_BASE_API + "/simulator/user/importData"
-      },
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -639,26 +627,34 @@ export default {
       columns: [
         { key: 0, label: `编号`, visible: true },
         { key: 1, label: `考试名称`, visible: true },
-        { key: 2, label: `考试时间`, visible: true },
-        { key: 3, label: `模拟器类型`, visible: true },
-        { key: 4, label: `考试状态`, visible: true },
-        { key: 5, label: `创建老师`, visible: true },
-        { key: 6, label: `创建时间`, visible: true }
+        { key: 2, label: `考试时长`, visible: true },
+        { key: 3, label: `考试时间`, visible: true },
+        { key: 4, label: `模拟器类型`, visible: true },
+        { key: 5, label: `考试状态`, visible: false },
+        { key: 6, label: `创建老师`, visible: true },
+        { key: 7, label: `创建时间`, visible: true }
       ],
       // 表单校验
       rules: {
+        examCollectionName: [
+          { required: true, message: "考试名称不能为空", trigger: "blur" },
+        ],
+        limitDuration:[
+          { required: true, message: "考试时长不能为空", trigger: "blur" },
+        ],
+        simType: [
+          { required: true, message: "模拟器型号不能为空", trigger: "change"}
+        ],
+
+        questionSettingMethod: [
+          { required: true, message: "出题方式不能为空", trigger: "change"}
+        ],
+
+
       }
     };
   },
   watch: {
-    selectmethod(Value){
-      console.log('出题方式:'+Value)
-      if(Value==2){
-        this.isShow = true;
-      }else{
-        this.isShow = false;
-      }
-    },
     selectedEquip(newValue) {
       // console.log(newValue);
       // 根据newValue更新tableData
@@ -834,6 +830,14 @@ export default {
     });
   },
   methods: {
+    selectmethod(value){
+      console.log('出题方式:'+value)
+      if(value==2){
+        this.isShow = true;
+      }else{
+        this.isShow = false;
+      }
+    },
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
       // console.log(this.selectedEquip+'@@@')
       //第一列型号
@@ -931,10 +935,10 @@ export default {
     handleSelectionRow(val) {
       this.multipleSelection = val;
     },
-    /** 查询用户列表 */
+    /** 查询考试列表 */
     getList() {
       this.loading = true;
-      listStudent(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      examTearcherList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
           //将返回值注释
           this.userList = response.rows;
           this.total = response.total;
@@ -969,16 +973,16 @@ export default {
       this.handleQuery();
     },
     // 用户状态修改
-    handleStatusChange(row) {
-      let text = row.status === "0" ? "启用" : "停用";
-      this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
-        return changeUserStatus(row.userId, row.status);
-      }).then(() => {
-        this.$modal.msgSuccess(text + "成功");
-      }).catch(function() {
-        row.status = row.status === "0" ? "1" : "0";
-      });
-    },
+    // handleStatusChange(row) {
+    //   let text = row.status === "0" ? "启用" : "停用";
+    //   this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
+    //     return changeUserStatus(row.userId, row.status);
+    //   }).then(() => {
+    //     this.$modal.msgSuccess(text + "成功");
+    //   }).catch(function() {
+    //     row.status = row.status === "0" ? "1" : "0";
+    //   });
+    // },
     // 取消按钮
     cancel() {
       this.open = false;
@@ -989,17 +993,17 @@ export default {
     // 表单重置
     reset() {
       this.form = {
-        userId: undefined,
-        deptId: undefined,
-        userName: undefined,
-        password: undefined,
-        phonenumber: undefined,
-        email: undefined,
-        sex: undefined,
-        status: "0",
-        remark: undefined,
-        postIds: [],
-        roleIds: []
+        examCollectionId: undefined,
+        // deptId: undefined,
+        // userName: undefined,
+        // password: undefined,
+        // phonenumber: undefined,
+        // email: undefined,
+        // sex: undefined,
+        // status: "0",
+        // remark: undefined,
+        // postIds: [],
+        // roleIds: []
       };
       this.resetForm("form");
     },
@@ -1012,13 +1016,13 @@ export default {
     resetQuery() {
       this.dateRange = [];
       this.resetForm("queryForm");
-      this.queryParams.deptId = undefined;
-      this.$refs.tree.setCurrentKey(null);
+      // this.queryParams.deptId = undefined;
+      // this.$refs.tree.setCurrentKey(null);
       this.handleQuery();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.userId);
+      this.ids = selection.map(item => item.examCollectionId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
     },
@@ -1037,7 +1041,7 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const userId = row.userId || this.ids;
+      const examCollectionId = row.examCollectionId || this.ids;
       // getUser(userId).then(response => {
         // this.form = response.data;
         // this.postOptions = response.posts;
@@ -1072,14 +1076,17 @@ export default {
     submitForm: function() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          if (this.form.userId != undefined) {
-            updateUser(this.form).then(response => {
+          if (this.form.examCollectionId != undefined) {
+            examTearcherupdate(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
             });
           } else {
-            addUser(this.form).then(response => {
+            console.log(this.form)
+            console.log('this.form')
+            return ;
+            examTearcheradd(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
@@ -1088,11 +1095,13 @@ export default {
         }
       });
     },
+
+
     /** 删除按钮操作 */
     handleDelete(row) {
-      const userIds = row.userId || this.ids;
-      this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
-        return delUser(userIds);
+      const examCollectionIds = row.examCollectionId || this.ids;
+      this.$modal.confirm('是否确认删除编号为"' + examCollectionIds + '"的数据项?').then(function() {
+        return examTearcherdel(examCollectionIds);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");