From ec47fecd41a22861c3fc65ca86311225dd28d7ee Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 28 十月 2025 14:02:34 +0800
Subject: [PATCH] 测试完成

---
 src/views/shortmessage/healthinformation/compilequer/index.vue |  157 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 147 insertions(+), 10 deletions(-)

diff --git a/src/views/shortmessage/healthinformation/compilequer/index.vue b/src/views/shortmessage/healthinformation/compilequer/index.vue
index 8a6e6ef..44c8ad5 100644
--- a/src/views/shortmessage/healthinformation/compilequer/index.vue
+++ b/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;
+      // 灏嗚鎻掑叆/鏇挎崲鐨勬枃瀛楁彃鍏�/鏇挎崲锛坴alue.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;

--
Gitblit v1.9.3