WXL
2024-01-16 ad70f145e8bea957b41043b4a1e37ce37cc5ed1e
src/views/knowledge/questionbank/particulars/index.vue
@@ -12,6 +12,28 @@
            >
          </div>
          <div style="margin-left: 8%">
            <el-form-item label="问题分类">
              <el-select
                v-model="topicobj.assortid"
                size="medium"
                filterable
                placeholder="请选择分类"
              >
                <el-option-group
                  v-for="group in classifylist"
                  :key="group.id"
                  :label="group.name"
                >
                  <el-option
                    v-for="item in group.svyLibTopicCategoryList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  >
                  </el-option>
                </el-option-group>
              </el-select>
            </el-form-item>
            <el-row :gutter="10">
              <el-col :span="6"
                ><el-form-item label="题目标题">
@@ -116,9 +138,9 @@
              <el-input
                style="width: 40vw"
                type="textarea"
                id="questiontext"
                id="topicContent"
                v-model="topicobj.topicContent"
                @focus="handleInput('questiontext')"
                @focus="handleInput('topicContent')"
                placeholder="请输入标题"
              ></el-input>
            </el-form-item>
@@ -323,10 +345,10 @@
      </el-card>
    </div>
    <el-drawer
      title="添加题目"
      title="添加选项"
      :visible.sync="drawer"
      custom-class="demo-drawer"
      width="50%"
      width="66%"
    >
      <div class="preview-left">
        <el-form
@@ -415,6 +437,7 @@
  compileissue,
  delissueinfo,
  Followupinfo,
  getissueclassify,
  deltargetillness,
  addtargetillness,
  getillnesslist,
@@ -467,7 +490,7 @@
      optionsillness: [],
      illnesslistapi: [],
      illnesslist: [],
      classifylist: [],
      optionstag: [],
      xjxsoptions: [],
      usable: [],
@@ -487,10 +510,26 @@
  },
  methods: {
    // 公共方法---------------
    getIndexInArray(arr, obj) {
      return arr.indexOf(obj);
    },
    // 递归扁平化
    flattenArray(arr) {
      let result = [];
      arr.forEach((item) => {
        result.push(item);
        if (item.svyLibTopicCategoryList) {
          console.log(2);
          result = result.concat(
            this.flattenArray(item.svyLibTopicCategoryList)
          );
          delete item.svyLibTopicCategoryList;
        }
      });
      return result;
    },
    // -----------------------------
    // 获取数据
    getissueinfo() {
      this.id = this.$route.query.id;
@@ -512,6 +551,10 @@
      });
      getillness({ outid: this.id, type: 4 }).then((res) => {
        this.illnesslist = res.rows;
      });
      // 分类
      getissueclassify({}).then((res) => {
        this.classifylist = res.rows;
      });
    },
    gettargetInfo() {
@@ -720,16 +763,17 @@
      let inputValueArr = "";
      let el = document.querySelector("#" + this.currentInputId);
      //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index)
      if (this.currentInputId == "questiontext") {
        inputValueArr = this.indexform.questiontext.split("");
      if (this.currentInputId == "topicContent") {
        inputValueArr = this.topicobj.topicContent.split("");
        console.log(123);
      } else if (this.currentInputId == "nomatchtext") {
        inputValueArr = this.indexform.nomatchtext.split("");
        inputValueArr = this.topicobj.nomatchtext.split("");
      } else if (this.currentInputId == "sliencetext") {
        inputValueArr = this.indexform.sliencetext.split("");
        inputValueArr = this.topicobj.sliencetext.split("");
      } else if (this.currentInputId == "noclearlytext") {
        inputValueArr = this.indexform.noclearlytext.split("");
        inputValueArr = this.topicobj.noclearlytext.split("");
      } else if (this.currentInputId == "submoduletext") {
        inputValueArr = this.indexform.submoduletext.split("");
        inputValueArr = this.topicobj.submoduletext.split("");
      } else {
        return;
      }
@@ -742,16 +786,16 @@
      // 把数组重新转换为字符串并赋值
      inputValueArr = inputValueArr.join("");
      console.log(inputValueArr);
      if (this.currentInputId == "questiontext") {
        this.indexform.questiontext = inputValueArr;
      if (this.currentInputId == "topicContent") {
        this.topicobj.topicContent = inputValueArr;
      } else if (this.currentInputId == "nomatchtext") {
        this.indexform.nomatchtext = inputValueArr;
        this.topicobj.nomatchtext = inputValueArr;
      } else if (this.currentInputId == "sliencetext") {
        this.indexform.sliencetext = inputValueArr;
        this.topicobj.sliencetext = inputValueArr;
      } else if (this.currentInputId == "noclearlytext") {
        this.indexform.noclearlytext = inputValueArr;
        this.topicobj.noclearlytext = inputValueArr;
      } else if (this.currentInputId == "submoduletext") {
        this.indexform.submoduletext = inputValueArr;
        this.topicobj.submoduletext = inputValueArr;
      } else {
        return;
      }