WXL
2024-07-02 1f644c69e6c5df3683e8b4698b3073d487cf6d80
src/views/knowledge/questionbank/particulars/index.vue
@@ -6,9 +6,9 @@
          <div class="headline">
            题目设置详情
            <span style="margin-left: 30px"
              ><el-button type="primary" @click="compileissue"
              ><el-button type="primary" @click="Saveproblem"
                >保 存</el-button
              ></span
              > </span
            ><span style="margin-left: 30px"
              ><el-button type="success" round @click="drawer = true"
                >+选择指标</el-button
@@ -17,7 +17,7 @@
          </div>
          <div style="margin-left: 8%">
            <el-row :gutter="10">
              <el-col :span="10">
              <el-col :span="8">
                <el-form-item label="问题分类">
                  <el-select
                    v-model="topicobj.categoryid"
@@ -41,7 +41,7 @@
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="10">
              <el-col :span="8">
                <el-form-item label="评价类型">
                  <el-select
                    v-model="topicobj.scoretype"
@@ -57,13 +57,21 @@
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="topicobj.scoretype == 1">
                <el-form-item label="题目得分">
                  <el-input
                    v-model="topicobj.score"
                    placeholder="请输入分数"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="8"
                ><el-form-item label="题目标题">
                  <el-input
                    v-model="topicobj.script"
                    v-model="topicobj.topic"
                    placeholder="请输入标题"
                  ></el-input> </el-form-item
              ></el-col>
@@ -164,10 +172,18 @@
              <el-input
                style="width: 40vw"
                type="textarea"
                id="scriptContent"
                id="script"
                v-model="topicobj.script"
                @focus="handleInput('script')"
                placeholder="请输入题目内容"
              ></el-input>
            </el-form-item>
            <el-form-item label="题目说明">
              <el-input
                style="width: 40vw"
                type="textarea"
                v-model="topicobj.scriptContent"
                @focus="handleInput('scriptContent')"
                placeholder="请输入标题"
                placeholder="请输入说明"
              ></el-input>
            </el-form-item>
@@ -551,7 +567,6 @@
  created() {
    this.gettabList();
    this.getissueinfo();
    this.test();
    this.gettargetInfo();
    this.mode = store.getters.mode;
    this.languagelist = store.getters.languagelist;
@@ -618,7 +633,6 @@
    },
    // 新增或修改详情
    compileissue() {
      console.log(11223);
      this.topicobj.svyLibScriptOptions = this.topicobj.svyLibScriptOptions.map(
        (item) => {
          if (item.isoperation != 1 && item.isoperation != 3) {
@@ -671,6 +685,50 @@
      if (this.illnesslistapi.length) {
        deltargetillness(this.illnesslistapi.join(",")).then((res) => {});
      }
    },
    // 判断分值
    Scorejudgment() {
      let scorearr = this.topicobj.svyLibScriptOptions;
      let isValid = scorearr.every((score) => {
        if (score.score) {
          console.log(Number(score.score), this.topicobj.score, "分值");
          if (
            Number(score.score) <= 0 ||
            Number(score.score) > Number(this.topicobj.score)
          ) {
            console.log(score, "错误分值");
            this.$message({
              message: "选项分值必须大于0小于等于" + this.topicobj.score + "分",
              type: "warning",
            });
            return false;
          }
          return true;
        } else {
          this.$message({
            message: "选项分值未设置",
            type: "warning",
          });
          return false;
        }
      });
      if (isValid) {
        this.compileissue();
        // console.log("到保存了");
      }
    },
    Saveproblem() {
      if (this.topicobj.scoretype == 1) {
        console.log(321);
        this.Scorejudgment();
      } else {
        this.compileissue();
      }
    },
    // 删除标签
    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
    },
    // 删除选项
    deletexuanx(row) {
@@ -838,8 +896,8 @@
      let inputValueArr = "";
      let el = document.querySelector("#" + this.currentInputId);
      //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index)
      if (this.currentInputId == "scriptContent") {
        inputValueArr = this.topicobj.scriptContent.split("");
      if (this.currentInputId == "script") {
        inputValueArr = this.topicobj.script.split("");
        console.log(123);
      } else if (this.currentInputId == "nomatchtext") {
        inputValueArr = this.topicobj.nomatchtext.split("");
@@ -861,8 +919,8 @@
      // 把数组重新转换为字符串并赋值
      inputValueArr = inputValueArr.join("");
      console.log(inputValueArr);
      if (this.currentInputId == "scriptContent") {
        this.topicobj.scriptContent = inputValueArr;
      if (this.currentInputId == "script") {
        this.topicobj.script = inputValueArr;
      } else if (this.currentInputId == "nomatchtext") {
        this.topicobj.nomatchtext = inputValueArr;
      } else if (this.currentInputId == "sliencetext") {
@@ -921,14 +979,14 @@
    // 执行
    test() {
      const arrays = [
        ["2", "3", "4"],
        ["1", "2"],
        ["3", "4", "5"],
        ["3", "2", "5"],
        ["2", "3", "4", "5"],
        ["1", "2", "5", "6"],
        ["3", "4", "5", "3"],
        ["3", "2", "5", "7"],
      ];
      const newMixArray = this.generateCombinations(arrays);
      console.log(newMixArray,'全部路线');
      console.log(newMixArray, "全部路线");
      this.screen(newMixArray);
    },
    // 数组求和
@@ -937,9 +995,9 @@
    },
    // 筛选错误路线
    screen(data) {
      const arraysGreaterThan10 = data.filter((arr) => this.sumArray(arr) > 13);
      const arraysGreaterThan10 = data.filter((arr) => this.sumArray(arr) > 21);
      console.log(arraysGreaterThan10,'筛选错误路线大于13分');
      console.log(arraysGreaterThan10, "筛选错误路线大于13分");
    },
  },
};