WXL (wul)
4 天以前 ec47fecd41a22861c3fc65ca86311225dd28d7ee
src/views/shortmessage/healthinformation/compilequer/index.vue
@@ -60,16 +60,35 @@
            </div>
          </el-form-item>
          <el-form-item label="通知内容" prop="preachcontent">
            <div style="width: 80%">
              <el-input
                type="textarea"
                :rows="5"
                v-model="ruleForm.preachcontent"
                placeholder="请输入通知内容"
              ></el-input>
            </div>
            <el-input
              type="textarea"
              :rows="5"
              show-word-limit
              id="preachcontent"
              v-model.sync="ruleForm.preachcontent"
              placeholder="请输入通知内容"
              @focus="handleInput('preachcontent')"
            ></el-input>
          </el-form-item>
          <el-form-item label="通知变量" prop="name">
          <el-row>
            <el-col :span="24">
              <el-form-item label="通知变量" prop="scriptContent">
                <div style="display: flex; margin-bottom: 10px">
                  <div
                    v-for="item in variablelist"
                    :class="item.default ? 'tsgname' : 'tsgnames'"
                    @click="tsgnameto(item)"
                  >
                    {{ item.variatename }}
                  </div>
                  <div class="tsgnamebj" @click="variabledeawer = true">
                    变量编辑
                  </div>
                </div>
              </el-form-item>
            </el-col></el-row
          >
          <!-- <el-form-item label="通知变量" prop="name">
            <div style="margin-bottom: 5px" v-for="item in variablelist">
              <el-row>
                <el-col :span="5">
@@ -101,7 +120,7 @@
                </el-col>
              </el-row>
            </div>
          </el-form-item>
          </el-form-item> -->
          <el-form-item label="标签" prop="desc">
            <div class="xinz-inf">
@@ -203,9 +222,50 @@
            >
            <el-button type="info" @click="closeFm('ruleForm')">关闭</el-button>
          </el-form-item>
          <el-drawer
            title="变量编辑"
            :visible.sync="variabledeawer"
            direction="ttb"
            size="35%"
          >
            <el-form-item label="通知变量" prop="name">
              <div style="margin-bottom: 5px" v-for="item in variablelist">
                <el-row>
                  <el-col :span="5">
                    <el-input
                      v-model="item.variatename"
                      placeholder="请输入变量名"
                    ></el-input>
                  </el-col>
                  <el-col :span="8" :offset="1">
                    <el-input
                      v-model="item.variate"
                      placeholder="请输入变量内容"
                    ></el-input>
                  </el-col>
                  <el-col :span="8" :offset="1">
                    <el-button
                      type="success"
                      icon="el-icon-plus"
                      circle
                      @click="addvariable(item)"
                    ></el-button>
                    <el-button
                      v-if="!item.default"
                      type="danger"
                      icon="el-icon-delete"
                      circle
                      @click="delvariable(item)"
                    ></el-button>
                  </el-col>
                </el-row>
              </div>
            </el-form-item>
          </el-drawer>
        </el-form>
      </div>
    </div>
    <!-- 添加适用疾病窗口 -->
    <Optional-Form
      ref="child"
@@ -251,6 +311,7 @@
      dynamicTags: [],
      inputVisible: false,
      illnessVisible: false,
      variabledeawer: false,
      dialogVisiblepatient: false,
      inputValue: "",
      sidecolumnrabs: "left",
@@ -270,6 +331,7 @@
        tempDetpRelevances: [],
        version: "1.0.1",
      },
      currentInputId: "",
      rules: {},
      rulesa: {},
      mode: [],
@@ -379,6 +441,36 @@
          }
        });
      }
    },
    // 便捷标签
    tsgnameto(row) {
      let inputValueArr = "";
      let el = document.querySelector("#" + this.currentInputId);
      //el.selectionStart; 这就是当前光标所在的位置(字符串中字符的index)
      if (this.currentInputId == "preachcontent") {
        inputValueArr = this.ruleForm.preachcontent.split("");
      } else {
        return;
      }
      //将输入框内容切成数组,方便后续操作
      // inputValueArr = this.inputValue.split("");
      // 拿到选中文字的长度(后续可以用来替换选中的文字)
      let selectLength = el.selectionEnd - el.selectionStart;
      // 将要插入/替换的文字插入/替换(value.name是要插入/替换的字符串)
      inputValueArr.splice(el.selectionStart, selectLength, `${row.variate}`);
      // 把数组重新转换为字符串并赋值
      inputValueArr = inputValueArr.join("");
      console.log(inputValueArr);
      if (this.currentInputId == "preachcontent") {
        this.ruleForm.preachcontent = inputValueArr;
      } else {
        return;
      }
    },
    handleInput(id) {
      this.currentInputId = id;
      console.log("输入框的值已更新:", this.currentInputId);
      // 在这里执行更新数据的逻辑
    },
    // 保存疾病
    confirmillness(guid) {
@@ -595,6 +687,51 @@
    vertical-align: bottom;
  }
}
.tsgnames {
  width: 90px;
  margin-right: 10px;
  text-align: center;
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  background: #7799fa;
  color: #ffff;
  font-size: 18px;
  border-radius: 5px;
}
.tsgnames:hover {
  background: #3366f5;
}
.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;
}
.tsgnamebj {
  width: 90px;
  margin-left: 15px;
  text-align: center;
  cursor: pointer;
  height: 40px;
  line-height: 40px;
  background: #49dbb7;
  color: #ffff;
  font-size: 18px;
  border-radius: 5px;
}
.tsgnamebj:hover {
  background: #27c449;
}
::v-deep .el-step.is-vertical .el-step__title {
  font-size: 25px;