ZhangXianQiang
2024-05-16 70370be9f2d6a45c5752e18b7e9b127174f7e3c6
src/views/exam/paper/edit.vue
@@ -1,8 +1,8 @@
<template>
  <div class="app-container">
    <el-form :model="form" ref="form" label-width="200px" v-loading="formLoading" :rules="rules">
      <el-form-item label="考生:" prop="userIds" required>
        <el-cascader v-model="form.userIds" :options="options" :props="props" clearable collapse-tags>
      <el-form-item label="考生:" prop="menuIds" required>
        <el-cascader v-model="form.menuIds" :options="options" :props="props" @change="handleChange" clearable collapse-tags>
        </el-cascader>
      </el-form-item>
      <el-form-item label="课目:" prop="subjectId" required>
@@ -135,7 +135,7 @@
  components: { Pagination, QuestionShow },
  data () {
    return {
      props: {
      props: {
        multiple: true
        // lazy: true,
        // lazyLoad (node, resolve) {
@@ -172,7 +172,7 @@
      subjectFilter: null,
      formLoading: false,
      rules: {
        userIds: [
        menuIds: [
          { required: true, message: '请选择', trigger: 'change' }
        ],
        subjectId: [
@@ -215,7 +215,7 @@
      _this.formLoading = true
      examPaperApi.select(id).then(re => {
        _this.form = re.response
        _this.form.userIds = re.response.userId
        _this.form.menuIds = JSON.parse(re.response.menuIds)
        console.log(_this.form)
        _this.formLoading = false
      })
@@ -227,6 +227,9 @@
    })
  },
  methods: {
    handleChange(val){
      console.log(val)
    },
    titlejs(val){
      console.log(val)
      let str = ''
@@ -290,13 +293,12 @@
      }else {
        this.form.subjectSource={}
        this.subjectIdList = []
        this.form.questionTypeVMS=[]
        // this.form.paperType = 1
      }
    },
    submitForm () {
      let _this = this
      console.log(this.subjectIdList)
      console.log(this.form.subjectSource)
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.formLoading = true;
@@ -304,9 +306,10 @@
            this.form.subjectId= this.form.subjectId
          };
          let op = [];
          for(var ele of this.form.userIds){
          for(var ele of this.form.menuIds){
            op.push(ele[1])
          };
          this.form.menuIds = JSON.stringify(this.form.menuIds);
          this.form.userIds = op;
          console.log("laks",this.form)
          if(this.form.questionTypeVMS == null){
@@ -337,6 +340,7 @@
      })
    },
    addQuestion (titleItem) {
      console.log('titleItem', titleItem)
      this.currentTitleItem = titleItem
      this.questionPage.showDialog = true
      this.search()
@@ -355,7 +359,9 @@
      let _this = this
      this.questionPage.multipleSelection.forEach(q => {
        questionApi.select(q.id).then(re => {
          _this.currentTitleItem.questionItems.push(re.response)
          if (!_this.currentTitleItem.questionItems.some(obj => obj.id === re.response.id)) {
            _this.currentTitleItem.questionItems.push(re.response)
          }
        })
      })
      this.questionPage.showDialog = false