WXL
2024-08-27 b50917f4bdf0b05c028d76d8cdbde44a85ec8b91
src/views/knowledge/questionbank/particulars/index.vue
@@ -101,7 +101,7 @@
                ></el-col>
                <el-col :span="8"
                  ><el-form-item label="是否可用">
                    <el-radio-group v-model="topicobj.isAvailable">
                    <el-radio-group v-model="topicobj.isavailable">
                      <el-radio
                        v-for="(item, index) in usable"
                        :label="item.value"
@@ -348,6 +348,11 @@
                  topicobj.targetname ? "修改指标" : "+选择指标"
                }}</el-button></span
              >
              <span style="margin-left: 30px"
                ><el-button type="primary" @click="Saveproblem"
                  >保 存</el-button
                >
              </span>
            </div>
            <el-divider></el-divider>
            <el-form ref="form">
@@ -401,6 +406,8 @@
                </el-col>
              </el-row>
            </el-form>
            <div>
              <el-divider></el-divider>
            <div v-if="topicobj.scriptType != 4">
              <div class="headline">
                选项设置<span style="margin-left: 30px"
@@ -409,8 +416,6 @@
                  ></span
                >
              </div>
              <el-divider></el-divider>
              <div
                class="topicxq"
                v-for="item in topicobj.svyLibScriptOptions"
@@ -459,7 +464,10 @@
                    </el-form-item>
                  </el-col>
                  <el-col :span="2" :offsset="topicobj.scoretype == 4 ? 11 : 0">
                    <el-col
                      :span="2"
                      :offsset="topicobj.scoretype == 4 ? 11 : 0"
                    >
                    <el-button
                      type="danger"
                      icon="el-icon-delete"
@@ -511,6 +519,7 @@
                    </div>
                  </div>
                </el-form-item>
                </div>
              </div>
              <div v-else class="topicxq">
                <el-input
@@ -610,11 +619,11 @@
          <el-table-column
            label="是否可用"
            align="center"
            key="isAvailable"
            prop="isAvailable"
            key="isavailable"
            prop="isavailable"
          >
            <template slot-scope="scope">
              <dict-tag :options="usable" :value="scope.row.isAvailable" />
              <dict-tag :options="usable" :value="scope.row.isavailable" />
            </template>
          </el-table-column>
          <el-table-column
@@ -763,6 +772,7 @@
        { value: "scriptTopic", table: "scriptTopic" },
      ],
      inputValueillness: "",
      testgovalue: "",
      required: [],
      themelist: [],
      languagelist: [],
@@ -829,9 +839,9 @@
    // 获取数据
    getissueinfo() {
      this.id = this.$route.query.id;
      if (this.$route.query.categoryid) {
      this.topicobj.categoryid = Number(this.$route.query.categoryid);
      console.log(this.topicobj.categoryid);
      }
      this.topicobj.isavailable = "1";
      this.topicobj.language = "普通话";
      // 分类
@@ -937,9 +947,9 @@
    // 判断分值
    Scorejudgment() {
      let scorearr = this.topicobj.svyLibScriptOptions;
      let isValid = scorearr.every((score) => {
      let isValid = scorearr.every((score, index) => {
        if (this.topicobj.scriptType == 1) {
        if (score.score) {
          console.log(Number(score.score), this.topicobj.score, "分值");
          if (
            Number(score.score) < 0 ||
            Number(score.score) > Number(this.topicobj.score)
@@ -952,8 +962,6 @@
            return false;
          }
          return true;
        } else if (this.topicobj.scriptType == 3) {
          return true;
        } else {
          this.$message({
            message: "选项分值未设置",
@@ -961,11 +969,32 @@
          });
          return false;
        }
        } else if (this.topicobj.scriptType == 2) {
          // 累加分值
          const totalScore = scorearr.reduce((acc, score) => {
            if (score.score) {
              return acc + Number(score.score);
            }
            return acc; // 如果 score.score 不存在,不累加
          }, 0);
          // 检查累加的分值是否等于 this.topicobj.score
          if (totalScore !== Number(this.topicobj.score)) {
            this.$message({
              message:
                "多选题选项分值总和必须等于 " + this.topicobj.score + " 分",
              type: "warning",
            });
            return false;
          }
          return true; // 如果总分正确,返回 true
        } else if (this.topicobj.scriptType == 4) {
          return true;
        }
      });
      if (isValid) {
        this.compileissue();
        // console.log("到保存了");
      }
    },
    Saveproblem() {
@@ -978,13 +1007,14 @@
    // 判断指标
    changefn(item) {
      console.log(item);
      if (this.topicobj.targetname || this.topicobj.svyLibScriptOptions[0]) {
        this.$modal
          .confirm("更改类型后选项将清空是否继续?")
          .then(() => {
            this.scriptTypels = this.topicobj.scriptType;
            this.topicobj.svyLibScriptOptions = [];
            this.topicobj.svyLibScriptOptions.forEach((item) => {
              item.isoperation = 3;
            });
          })
          .catch(() => {
            this.topicobj.scriptType = this.scriptTypels;
@@ -1001,8 +1031,6 @@
      console.log(this.topicobj.svyLibScriptOptions);
      if (this.topicobj.svyLibScriptOptions[index].id) {
        console.log(2);
        this.topicobj.svyLibScriptOptions[index].isoperation = 3;
      } else {
        this.topicobj.svyLibScriptOptions.splice(index, 1);
@@ -1055,12 +1083,10 @@
        tagcategoryid: "0",
      };
      listtag(tagqueryParams).then((response) => {
        console.log(response, "待选标签");
        this.optionstag = response.rows;
      });
    },
    handleClosetag(tag) {
      console.log(tag);
      console.log(this.dynamicTags.indexOf(tag));
      const lindex = this.dynamicTags.indexOf(tag);
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
@@ -1331,8 +1357,7 @@
    border-radius: 4px;
    margin-top: 15px;
    margin-left: 10%;
    padding-left: 20px;
    padding-top: 15px;
    padding: 20px;
    border: 1px solid #dcdfe6;
    -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
      0 0 6px 0 rgba(0, 0, 0, 0.04);