龚焕茏
2024-05-17 513882a845100035ecb374a46ea6a85081ec16f6
取消重复判断
2个文件已修改
76 ■■■■ 已修改文件
src/views/exam/paper/edit.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/personalRandomTemplate/edit.vue 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/exam/paper/edit.vue
@@ -175,7 +175,7 @@
      studentDialog: false,
      student: {
        pageIndex: 1,
        pageSize: 100,
        pageSize: 5,
        listLoading: true,
        multipleSelection: []
      },
@@ -423,9 +423,7 @@
    },
    confirmStudentSelect () {
      this.student.multipleSelection.forEach(q => {
        if(this.form.menuIds.some(obj => obj !== q.id)) {
          this.form.menuIds.push(q.id)
        }
      })
      this.studentDialog = false
    },
src/views/exam/personalRandomTemplate/edit.vue
@@ -2,12 +2,7 @@
  <div class="app-container">
    <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules">
      <el-form-item label="考生:" prop="menuIds" required>
<!--        <el-cascader v-model="form.menuIds"   :options="options" @change="cascaderChangeFun" :props="props" clearable collapse-tags>-->
<!--        </el-cascader>-->
        <all-cascader :options="options"
                      :optionsData = "optionsData"
                      @change="cascaderChangeFun"
                      :width="200"></all-cascader>
        <el-select v-model="form.menuIds" :collapse-tags="true" multiple placeholder="请选择" @focus="selectStudent"></el-select>
      </el-form-item>
      <el-form-item label="课目:" prop="subjectId" required >
        <el-select ref="subjectIdRef" v-model="form.subjectId" placeholder="课目" multiple
@@ -130,6 +125,35 @@
          <el-button type="primary" @click="confirmQuestionSelect">确定</el-button>
     </span>
    </el-dialog>
    <el-dialog :visible.sync="studentDialog"  width="70%">
      <el-form :model="student" ref="queryForm" :inline="true">
        <el-form-item label="标签:">
          <el-select v-model="student.tagId" clearable>
            <el-option v-for="item in tags" :key="item.id" :value="item.id" :label="item.name"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="部门:">
          <el-select v-model="student.deptId" clearable>
            <el-option v-for="item in depts" :key="item.id" :value="item.id" :label="item.name"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="selectStudent">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="student.listLoading" :data="tableData" border fit highlight-current-row style="width: 100%" @selection-change="handleSelection">
        <el-table-column type="selection"></el-table-column>
        <el-table-column prop="realName" label="用户"/>
      </el-table>
      <pagination v-show="total > 0" :total="total"
                  :page.sync="student.pageIndex" :limit.sync="student.pageSize"
                  @pagination="selectStudent"/>
      <span slot="footer" class="dialog-footer">
          <el-button @click="studentDialog = false">取 消</el-button>
          <el-button type="primary" @click="confirmStudentSelect">确定</el-button>
     </span>
    </el-dialog>
  </div>
</template>
@@ -139,6 +163,7 @@
import Pagination from '@/components/Pagination'
import QuestionShow from '../question/components/Show'
import examPaperApi from '@/api/examPaper'
import userApi from '@/api/user'
import questionApi from '@/api/question'
import departmentApi from '@/api/department'
import allCascader from '@/components/Cascader'
@@ -147,6 +172,18 @@
  data () {
    return {
      tags: [],
      depts: [],
      student: {},
      studentDialog: false,
      student: {
        pageIndex: 1,
        pageSize: 5,
        listLoading: true,
        multipleSelection: []
      },
      tableData: [],
      total: 0,
      props: {
        multiple: true
        // lazy: true,
@@ -262,6 +299,29 @@
     // this.subjectIdEvent(false)
   },
  methods: {
    handleSelection (val) {
      this.student.multipleSelection = val
    },
    confirmStudentSelect () {
      this.student.multipleSelection.forEach(q => {
          this.form.menuIds.push(q.id)
      })
      this.studentDialog = false
    },
    getTags () {
      userApi.tagList(null).then(data => {
        this.tags = data.response
      })
    },
    selectStudent() {
     this.getTags();
      this.studentDialog = true;
      examPaperApi.selectStudent(this.student).then(res => {
        this.tableData = res.response.list
        this.total = res.response.total
        this.student.listLoading = false
      })
    },
    cascaderChangeFun(event){
      console.log(event)
      this.form.menuIds = event