龚焕茏
2024-05-10 b133f992572d5c35687cf9d55a14f4f9fa53f8bc
feat:新增补考按钮
3个文件已修改
78 ■■■■■ 已修改文件
src/api/department.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/examPaper.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/paper/list.vue 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/department.js
@@ -7,6 +7,7 @@
  select: id => post('/api/admin/department/get/' + id),
  selectUser: id => post('/api/admin/department/getUserByDepartment/' + id),
  selectDepartmentUser: id => post('/api/admin/department/getDepartmentUser'),
  getUserByExam: id => post('/api/admin/department/getDepartmentUser?examPaperId=' + id),
  deleteSubject: id => post('/api/admin/education/department/delete/' + id),
  addData: query => post('/api/admin/department/add', query),
  // 获取部门用户下拉列表
src/api/examPaper.js
@@ -4,6 +4,7 @@
  pageList: query => post('/api/admin/exam/paper/page', query),
  taskExamPage: query => post('/api/admin/exam/paper/taskExamPage', query),
  edit: query => post('/api/admin/exam/paper/edit', query),
  missExam: query => post('/api/admin/exam/paper/missExam', query),
  select: id => post('/api/admin/exam/paper/select/' + id),
  deletePaper: id => post('/api/admin/exam/paper/delete/' + id),
  pageselfList: query => get('/api/admin/exam/templates/list', query),
src/views/exam/paper/list.vue
@@ -26,6 +26,7 @@
      <el-table-column  label="操作" align="center"  width="300px">
        <template slot-scope="{row}">
          <el-button size="mini" @click="$router.push({path:'/exam/paper/edit',query:{id:row.id}})" >编辑</el-button>
          <el-button size="mini" type="primary" @click="missExam(row)">补考</el-button>
          <el-button size="mini" type="danger"  @click="deletePaper(row)" class="link-left">删除</el-button>
          <el-button size="mini" type="danger"  @click="handleExport(row)" class="link-left">导出</el-button>
        </template>
@@ -33,6 +34,27 @@
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="queryParam.pageIndex" :limit.sync="queryParam.pageSize"
                @pagination="search"/>
    <el-dialog
      title="补考"
      :visible.sync="dialogVisible"
      width="550px">
      <el-form :model="form" ref="form" :rules="rules">
        <el-form-item label="考生:" prop="menuIds" required>
          <el-cascader v-model="form.menuIds" :options="options" :props="{ multiple: true }" clearable collapse-tags></el-cascader>
        </el-form-item>
        <el-form-item label="时间:" prop="limitDateTime" required v-if="examPaper.paperType === 4">
          <el-date-picker v-model="form.limitDateTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange"
            range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间">
          </el-date-picker>
        </el-form-item>
      </el-form>
        <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitUpdate">确 定</el-button>
        </span>
    </el-dialog>
  </div>
</template>
@@ -40,11 +62,21 @@
import { mapGetters, mapState, mapActions } from 'vuex'
import Pagination from '@/components/Pagination'
import examPaperApi from '@/api/examPaper'
import departmentApi from '@/api/department'
export default {
  components: { Pagination },
  data () {
    return {
      form: {
        menuIds: [],
        userIds: [],
        examPaperId: null,
        limitDateTime: []
      },
      examPaper: {},
      options: [],
      dialogVisible: false,
      queryParam: {
        id: null,
        level: null,
@@ -55,7 +87,15 @@
      subjectFilter: null,
      listLoading: true,
      tableData: [],
      total: 0
      total: 0,
      rules: {
        menuIds: [
          { required: true, message: '请选择考生', trigger: 'change' }
        ],
        limitDateTime: [
          { required: true, message: '请选择补考时间', trigger: 'blur' }
        ]
      },
    }
  },
  created () {
@@ -105,6 +145,40 @@
        }
      })
    },
    missExam(item) {
      this.form = {
        menuIds: [],
        userIds: [],
        examPaperId: null,
        limitDateTime: []
      }
      this.dialogVisible = true;
      this.examPaper = item;
      departmentApi.getUserByExam(item.id).then(res => {
        this.options = res.response.map(x=>{return{value:x.department.id,label:x.department.name,children:x.userList.map(xx=>{return{value: xx.id,label: xx.realName}})}})
      })
    },
    submitUpdate () {
      this.$refs.form.validate((valid) => {
        if (valid) {
          let op = [];
          for(var ele of this.form.menuIds){
            op.push(ele[1])
          };
          this.form.menuIds = JSON.stringify(this.form.menuIds);
          this.form.userIds = op;
          this.form.examPaperId = this.examPaper.id;
          examPaperApi.missExam(this.form).then(re => {
            if (re.code === 1) {
              this.$message.success("操作成功")
              this.dialogVisible = false;
            }
          })
        } else {
          return false
        }
      })
    },
    levelChange () {
      this.queryParam.subjectId = null
      this.subjectFilter = this.subjects