luohairen
2024-11-01 2088fc58f63e6d72e48ae3fd5da5fa27d12bc0a5
src/views/exam/paper/list.vue
@@ -1,17 +1,17 @@
<template>
  <div class="app-container">
    <el-form :model="queryParam" ref="queryForm" :inline="true">
      <el-form-item label="试卷ID:">
        <el-input v-model="queryParam.id" clearable></el-input>
      <el-form-item label="试卷名称:">
        <el-input v-model="queryParam.name" size="small" clearable @input="search"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">查询</el-button>
        <el-button type="primary" @click="submitForm" size="small">查询</el-button>
        <router-link :to="{ path: '/exam/paper/edit' }" class="link-left">
          <el-button type="primary" >添加</el-button>
          <el-button type="primary" size="small">添加</el-button>
        </router-link>
        <el-button class="link-left" type="danger" @click="downloadImportTemplate">下载模板</el-button>
        <el-button class="link-left" type="danger" @click="downloadImportTemplate" size="small">下载模板</el-button>
        <router-link :to="{ path: '/exam/paper/import' }" class="link-left">
          <el-button type="success">导入</el-button>
          <el-button type="success" size="small">导入</el-button>
        </router-link>
      </el-form-item>
    </el-form>
@@ -35,7 +35,13 @@
      <el-table-column label="操作" align="center" width="160px">
        <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="danger" @click="deletePaper(row)" class="link-left">删除</el-button>
          <el-popconfirm
            style="margin: 0 5px"
            title="确定要删除该试卷吗?"
            @confirm="deletePaper(row)"
          >
            <el-button slot="reference" type="danger" size="mini" class="link-left">删除</el-button>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
@@ -49,13 +55,14 @@
import subjectApi from '@/api/subject'
import examPaperApi from '@/api/examPaper'
import { downloadExcel } from '@/utils/download'
import userApi from "@/api/user";
export default {
  components: { Pagination },
  data() {
    return {
      queryParam: {
        id: null,
        name: null,
        level: null,
        subjectId: null,
        pageIndex: 1,
@@ -92,15 +99,21 @@
        this.listLoading = false
      })
    },
    deletePaper(row) {
      let _this = this
      examPaperApi.deletePaper(row.id).then(re => {
        if (re.code === 1) {
          _this.search()
          _this.$message.success(re.message)
        } else {
          _this.$message.error(re.message)
        }
    deletePaper (row) {
      this.$confirm('此操作将永久删除该试卷, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        let _this = this
        examPaperApi.deletePaper(row.id).then(re => {
          if (re.code === 1) {
            _this.search()
            _this.$message.success(re.message)
          } else {
            _this.$message.error(re.message)
          }
        })
      })
    },
    // 获取科目