WXL
2024-08-09 fe7f65e63714807890ab103fbc84cf5f634ae8d8
src/views/repositoryai/intention/index.vue
@@ -112,7 +112,7 @@
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="可用状态" prop="classify">
              <el-form-item label="是否可用" prop="classify">
                <el-select
                  v-model="queryParams.isAvailable"
                  placeholder="请选择"
@@ -179,25 +179,25 @@
              @selection-change="handleSelectionChange"
            >
              <el-table-column type="selection" width="50" align="center" />
              <el-table-column
              <!-- <el-table-column
                label="序号"
                fixed
                align="center"
                key="id"
                prop="id"
              />
              /> -->
              <el-table-column
                label="结果类型"
                label="指标类型"
                fixed
                align="center"
                key="valueType"
                prop="valueType"
                key="scriptType"
                prop="scriptType"
                :show-overflow-tooltip="true"
              >
                <template slot-scope="scope">
                  <dict-tag
                    :options="valuetypelb"
                    :value="scope.row.valueType"
                    :value="scope.row.scriptType"
                  />
                </template>
              </el-table-column>
@@ -228,7 +228,7 @@
                prop="targetdesc"
                width="200"
              /><el-table-column
                label="适用方式"
                label="适用场景"
                align="center"
                key="suitWayList"
                prop="suitWayList"
@@ -421,10 +421,17 @@
                  <el-input
                    v-model="indexform.targetdesc"
                    placeholder="请输入指标描述"
                    id="targetdesc"
                    @focus="currentInputId = 'targetdesc'"
                    maxlength="40"
                  />
                </el-form-item> </el-col
            ></el-row>
            <el-form-item label="插入填空" prop="scriptContent">
              <div style="display: flex; margin-bottom: 10px">
                <div class="tsgname" @click="tsgnameto">插入填空</div>
              </div>
            </el-form-item>
            <el-form-item label="标签" prop="desc" v-if="!measurement">
              <div class="xinz-inf">
                <el-tag
@@ -477,7 +484,10 @@
            <el-row v-if="!measurement">
              <el-col :span="24">
                <el-form-item label="题目类型">
                  <el-radio-group v-model="indexform.scriptType">
                  <el-radio-group
                    @input="Changtype"
                    v-model="indexform.scriptType"
                  >
                    <el-radio :label="1">单选</el-radio>
                    <el-radio :label="2">多选</el-radio>
                    <el-radio :label="3">填空</el-radio>
@@ -525,13 +535,25 @@
            </el-card>
            <div v-if="indexform.scriptType == 3">
              <el-form-item label="收集信息">
                <el-input
                  type="text"
                  placeholder="填入收集信息"
                  v-model="indexform.reply"
                >
                </el-input
              ></el-form-item>
                <el-card class="box-card">
                  <div v-for="item in testuserList" style="margin-bottom: 10px">
                    <el-input
                      type="text"
                      placeholder="填入收集信息"
                      v-model="indexform.optiondesc"
                    >
                      <el-button
                        slot="append"
                        @click="deloption(item)"
                        type="danger"
                        icon="el-icon-delete"
                        circle
                      ></el-button>
                      <span slot="prepend">{{ "(" + item.orderno + ")" }}</span>
                    </el-input>
                  </div>
                </el-card>
              </el-form-item>
            </div>
            <el-row :gutter="20">
              <el-col :span="12">
@@ -707,6 +729,7 @@
      radio: "主分类",
      testvalue: "",
      testgovalue: "",
      creatype: "", //指标临时类型
      hasValue: true,
      classifyform: {
        categoryname: "",
@@ -749,6 +772,7 @@
      mode: [],
      optionstag: [],
      targetoptionList: [],
      Temporarytype: "",
      // 查询参数
      queryParams: {
@@ -787,7 +811,7 @@
    this.gettabList();
    this.getDeptTree();
    this.mode = store.getters.mode;
    this.valuetypelb = store.getters.valuetypelb;
    this.valuetypelb = store.getters.askvaluetype;
    this.languagelist = store.getters.languagelist;
    this.qyoptions = store.getters.askvaluetype;
    this.usable = store.getters.usable;
@@ -832,7 +856,65 @@
        this.deletefenl = row.title;
      }
    },
    // 便捷标签插入填空
    tsgnameto(row) {
      let inputValueArr = "";
      let value = this.testuserList.length + 1;
      let el = document.querySelector("#" + this.currentInputId);
      //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index)
      if (this.currentInputId == "targetdesc") {
        inputValueArr = this.indexform.targetdesc.split("");
      } else {
        return;
      }
      //将输入框内容切成数组,方便后续操作
      // inputValueArr = this.inputValue.split("");
      // 拿到选中文字的长度(后续可以用来替换选中的文字)
      let selectLength = el.selectionEnd - el.selectionStart;
      // 将要插入/替换的文字插入/替换(value.name是要插入/替换的字符串)
      inputValueArr.splice(
        el.selectionStart,
        selectLength,
        "__" + value + "__"
      );
      this.testuserList.push({
        orderno: value,
        optiondesc: "",
        isoperation: 1,
      });
      // 把数组重新转换为字符串并赋值
      inputValueArr = inputValueArr.join("");
      console.log(inputValueArr);
      if (this.currentInputId == "targetdesc") {
        this.indexform.targetdesc = inputValueArr;
      } else {
        return;
      }
    },
    Changtype(item) {
      console.log(this.testuserList);
      console.log(item, "选项变更的处理");
      if (item == 3 && this.testuserList[0].targetvalue) {
        this.$modal
          .confirm("更改类型为填空后选项将清空是否继续?")
          .then(() => {
            this.testuserList = [];
            this.Temporarytype = this.indexform.scriptType;
          })
          .catch(() => {
            this.indexform.scriptType = this.Temporarytype;
          });
      } else if (item == 3) {
        this.testuserList = [];
        this.Temporarytype = this.indexform.scriptType;
      }
      {
        this.Temporarytype = this.indexform.scriptType;
      }
    },
    // 疾病-----------------------
    illnessUpdate(row) {
      this.illnessVisible = true;
@@ -983,10 +1065,17 @@
        console.log(this.targetoptionList, "aaaa.targetoptionList");
        this.testuserList.splice(index, 1); // 从索引位置删除一个元素
        this.sortFn();
        if (this.indexform.scriptType == 3) {
          this.$modal.msgWarning(
            "填空项已删除请手动删除题目内容中对应的填空项"
          );
        }
      } else {
        console.log("未找到该对象");
      }
    },
    syioption(row) {
      const index = this.getIndexInArray(this.testuserList, row);
      const item = this.testuserList.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
@@ -1190,6 +1279,7 @@
      this.indexform = {};
      this.indexform = row;
      this.indexform.scriptType = Number(row.scriptType);
      this.Temporarytype = this.indexform.scriptType;
      if (!row.targetoptionList[0]) {
        row.targetoptionList = [
          {
@@ -1198,6 +1288,7 @@
            targetregex: "",
            targetregex2: "",
            isoperation: 1,
            orderno: 1,
            dynamiccruxs: [],
            nodynamiccruxs: [],
            dynamiccruxsJson: "",
@@ -1391,6 +1482,21 @@
    display: center !important;
  }
}
.tsgname {
  width: 90px;
  margin-right: 10px;
  text-align: center;
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  background: #66c18c;
  color: #ffff;
  font-size: 18px;
  border-radius: 5px;
}
.tsgname:hover {
  background: #20894d;
}
.qrcode-dialo {
  text-align: center;
  //   display: flex;