Administrator
2022-01-18 137fee1495124434f7b68ab9d24bca553fbc05f3
src/views/exam/addsubject.vue
@@ -77,6 +77,7 @@
      optionContentBId: null,
      optionContentCId: null,
      optionContentDId: null,
      optionContentEId: null,
      arrContent: ["1"],
      list: [
        {
@@ -94,7 +95,6 @@
      choicesType: "0",
      loading: true,
      form: {
        score: 1,
      },
      option: {
        height: "auto",
@@ -126,34 +126,34 @@
            ],
            span: 24,
          },
          {
            label: "类型",
            prop: "tktype",
            slot: true,
            type: "checkbox",
            dicData: [
              {
                label: "简易题库",
                value: "A",
              },
              {
                label: "复杂题库",
                value: "B",
              },
              {
                label: "模拟题库",
                value: "C",
              },
            ],
            rules: [
              {
                required: true,
                message: "请选择类型",
                trigger: "blur",
              },
            ],
            span: 24,
          },
          // {
          //   label: "类型",
          //   prop: "tktype",
          //   slot: true,
          //   type: "checkbox",
          //   dicData: [
          //     {
          //       label: "简易题库",
          //       value: "A",
          //     },
          //     {
          //       label: "复杂题库",
          //       value: "B",
          //     },
          //     {
          //       label: "模拟题库",
          //       value: "C",
          //     },
          //   ],
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择类型",
          //       trigger: "blur",
          //     },
          //   ],
          //   span: 24,
          // },
          {
            label: "选项",
            prop: "",
@@ -244,28 +244,27 @@
              },
            ],
          },
          {
            label: "解析",
            prop: "analysis",
            span: 24,
            type: "textarea",
          },
          {
            label: "分值",
            prop: "score",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入分值",
                trigger: "blur",
              },
            ],
          },
          // {
          //   label: "解析",
          //   prop: "analysis",
          //   span: 24,
          //   type: "textarea",
          // },
          // {
          //   label: "分值",
          //   prop: "score",
          //   span: 24,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入分值",
          //       trigger: "blur",
          //     },
          //   ],
          // },
        ],
      },
      formCheckbox: {
        score: 1,
      },
      optionCheckbox: {
        height: "auto",
@@ -297,34 +296,34 @@
            ],
            span: 24,
          },
          {
            label: "类型",
            prop: "tktype",
            slot: true,
            type: "checkbox",
            dicData: [
              {
                label: "简易题库",
                value: "A",
              },
              {
                label: "复杂题库",
                value: "B",
              },
              {
                label: "模拟题库",
                value: "C",
              },
            ],
            rules: [
              {
                required: true,
                message: "请选择类型",
                trigger: "blur",
              },
            ],
            span: 24,
          },
          // {
          //   label: "类型",
          //   prop: "tktype",
          //   slot: true,
          //   type: "checkbox",
          //   dicData: [
          //     {
          //       label: "简易题库",
          //       value: "A",
          //     },
          //     {
          //       label: "复杂题库",
          //       value: "B",
          //     },
          //     {
          //       label: "模拟题库",
          //       value: "C",
          //     },
          //   ],
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择类型",
          //       trigger: "blur",
          //     },
          //   ],
          //   span: 24,
          // },
          {
            label: "选项",
            prop: "",
@@ -384,6 +383,19 @@
            ],
          },
          {
            label: "E",
            prop: "optionContentE",
            span: 24,
            placeholder: "请输入内容",
            rules: [
              {
                required: false,
                message: "请输入内容",
                trigger: "blur",
              },
            ],
          },
          {
            label: "答案",
            prop: "answer",
            span: 24,
@@ -406,6 +418,10 @@
                label: "D",
                value: "D",
              },
              {
                label: "E",
                value: "E",
              },
            ],
            rules: [
              {
@@ -415,29 +431,27 @@
              },
            ],
          },
          {
            label: "解析",
            prop: "analysis",
            span: 24,
            type: "textarea",
          },
          {
            label: "分值",
            prop: "score",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入分值",
                trigger: "blur",
              },
            ],
          },
          // {
          //   label: "解析",
          //   prop: "analysis",
          //   span: 24,
          //   type: "textarea",
          // },
          // {
          //   label: "分值",
          //   prop: "score",
          //   span: 24,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入分值",
          //       trigger: "blur",
          //     },
          //   ],
          // },
        ],
      },
      formJudge: {
        score: 1,
      },
      formJudge: {},
      optionJudge: {
        height: "auto",
        calcHeight: 80,
@@ -468,34 +482,34 @@
            ],
            span: 24,
          },
          {
            label: "类型",
            prop: "tktype",
            slot: true,
            type: "checkbox",
            dicData: [
              {
                label: "简易题库",
                value: "A",
              },
              {
                label: "复杂题库",
                value: "B",
              },
              {
                label: "模拟题库",
                value: "C",
              },
            ],
            rules: [
              {
                required: true,
                message: "请选择类型",
                trigger: "blur",
              },
            ],
            span: 24,
          },
          // {
          //   label: "类型",
          //   prop: "tktype",
          //   slot: true,
          //   type: "checkbox",
          //   dicData: [
          //     {
          //       label: "简易题库",
          //       value: "A",
          //     },
          //     {
          //       label: "复杂题库",
          //       value: "B",
          //     },
          //     {
          //       label: "模拟题库",
          //       value: "C",
          //     },
          //   ],
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择类型",
          //       trigger: "blur",
          //     },
          //   ],
          //   span: 24,
          // },
          // {
          //   label: "选项",
          //   prop: "",
@@ -538,29 +552,28 @@
              },
            ],
          },
          {
            label: "解析",
            prop: "analysis",
            span: 24,
            type: "textarea",
          },
          {
            label: "分值",
            prop: "score",
            defaultValue: 2,
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入分值",
                trigger: "blur",
              },
            ],
          },
          // {
          //   label: "解析",
          //   prop: "analysis",
          //   span: 24,
          //   type: "textarea",
          // },
          // {
          //   label: "分值",
          //   prop: "score",
          //   defaultValue: 2,
          //   span: 24,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入分值",
          //       trigger: "blur",
          //     },
          //   ],
          // },
        ],
      },
      formFill: {
        score: 1,
      },
      optionFill: {
        height: "auto",
@@ -592,34 +605,34 @@
            ],
            span: 24,
          },
          {
            label: "类型",
            prop: "tktype",
            slot: true,
            type: "checkbox",
            dicData: [
              {
                label: "简易题库",
                value: "A",
              },
              {
                label: "复杂题库",
                value: "B",
              },
              {
                label: "模拟题库",
                value: "C",
              },
            ],
            rules: [
              {
                required: true,
                message: "请选择类型",
                trigger: "blur",
              },
            ],
            span: 24,
          },
          // {
          //   label: "类型",
          //   prop: "tktype",
          //   slot: true,
          //   type: "checkbox",
          //   dicData: [
          //     {
          //       label: "简易题库",
          //       value: "A",
          //     },
          //     {
          //       label: "复杂题库",
          //       value: "B",
          //     },
          //     {
          //       label: "模拟题库",
          //       value: "C",
          //     },
          //   ],
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择类型",
          //       trigger: "blur",
          //     },
          //   ],
          //   span: 24,
          // },
          {
            label: "选项",
            prop: "",
@@ -682,24 +695,24 @@
              },
            ],
          },
          {
            label: "解析",
            prop: "analysis",
            span: 24,
            type: "textarea",
          },
          {
            label: "分值",
            prop: "score",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入分值",
                trigger: "blur",
              },
            ],
          },
          // {
          //   label: "解析",
          //   prop: "analysis",
          //   span: 24,
          //   type: "textarea",
          // },
          // {
          //   label: "分值",
          //   prop: "score",
          //   span: 24,
          //   rules: [
          //     {
          //       required: true,
          //       message: "请输入分值",
          //       trigger: "blur",
          //     },
          //   ],
          // },
        ],
      },
      data: [],
@@ -750,6 +763,7 @@
          that.optionContentBId = data.examSubjectOptions[1].id;
          that.optionContentCId = data.examSubjectOptions[2].id;
          that.optionContentDId = data.examSubjectOptions[3].id;
          that.optionContentEId = data.examSubjectOptions[4].id;
          that.formCheckbox.optionContentA =
            data.examSubjectOptions[0].optionContent;
          that.formCheckbox.optionContentB =
@@ -758,6 +772,8 @@
            data.examSubjectOptions[2].optionContent;
          that.formCheckbox.optionContentD =
            data.examSubjectOptions[3].optionContent;
          that.formCheckbox.optionContentE =
            data.examSubjectOptions[4].optionContent;
        }
        //判断题
        if (data.choicesType == 2) {
@@ -805,7 +821,8 @@
      var that = this;
      row["choicesType"] = this.choicesType;
      row["creator"] = this.userInfo.user_name;
      row.tktype = row.tktype.join(",");
      row['score'] = 2;
      // row.tktype = row.tktype.join(",");
      //选项信息
      const examSubjectOptions = [
        {
@@ -840,6 +857,7 @@
            type: "success",
            message: "操作成功!",
          });
          that.refreshPage();
          that.visible = false;
          that.$refs.form.resetFields();
          done();
@@ -855,7 +873,8 @@
      var that = this;
      row["choicesType"] = this.choicesType;
      row["creator"] = this.userInfo.user_name;
      row.tktype = row.tktype.join(",");
      row['score'] = 2;
      // row.tktype = row.tktype.join(",");
      row.answer = row.answer.join(",");
      //选项信息
      const examSubjectOptions = [
@@ -883,6 +902,12 @@
          optionContent: row.optionContentD,
          creator: this.userInfo.user_name,
        },
        {
          id: that.optionContentEId,
          optionName: "E",
          optionContent: row.optionContentE,
          creator: this.userInfo.user_name,
        },
      ];
      row["examSubjectOptions"] = examSubjectOptions;
      saveSubjectChoicesAndOption(row).then(
@@ -891,6 +916,7 @@
            type: "success",
            message: "操作成功!",
          });
          that.refreshPage();
          that.visible = false;
          that.$refs.formCheckbox.resetFields();
          done();
@@ -906,13 +932,15 @@
      var that = this;
      row["choicesType"] = this.choicesType;
      row["creator"] = this.userInfo.user_name;
      row.tktype = row.tktype.join(",");
      row['score'] = 1;
      // row.tktype = row.tktype.join(",");
      saveSubjectChoicesAndOption(row).then(
        () => {
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          that.refreshPage();
          that.visible = false;
          that.$refs.formJudge.resetFields();
          done();
@@ -923,12 +951,16 @@
        }
      );
    },
    refreshPage(){
      this.$emit('refreshPage',null);
    },
    //填空排序题提交(新增)数据
    submitFill(row, done, loading) {
      var that = this;
      row["choicesType"] = this.choicesType;
      row["creator"] = this.userInfo.user_name;
      row.tktype = row.tktype.join(",");
      row['score'] = 2;
      // row.tktype = row.tktype.join(",");
      //选项信息
      var examSubjectOptions = [];
      if (row.optionContent1) {
@@ -973,6 +1005,7 @@
            type: "success",
            message: "操作成功!",
          });
          that.refreshPage();
          that.visible = false;
          that.$refs.formFill.resetFields();
          done();