Pārlūkot izejas kodu

偏差值范围选择元素回显修改

duy 2 dienas atpakaļ
vecāks
revīzija
1c759ecd75

+ 20 - 2
src/views/formula/component/deviationRange/deviationRange.vue

@@ -21,12 +21,12 @@
       <span style="width:60px"></span>
       <template v-if="!(symbol == '<' || symbol== '≤')">
         <span class="textblod mg-r-10"></span>
-        <vue-tags-input v-model="tag1" :tags="tags1" @focus="curFocusIndex = 1" @blur="inputBlur(1)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag"/>
+        <vue-tags-input v-model="tag1" :tags="tags1" @focus="curFocusIndex = 1" @blur="inputBlur(1)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag"  @tag-clicked="handleTagClick($event,1)" ref="tagsInput1"/>
         <span style="width:20px"></span>
       </template>
       <template v-if="!(symbol == '>' || symbol== '≥')">
         <span class="textblod mg-r-10"></span>
-        <vue-tags-input v-model="tag2" :tags="tags2" @focus="curFocusIndex = 2" @blur="inputBlur(2)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag"/>
+        <vue-tags-input v-model="tag2" :tags="tags2" @focus="curFocusIndex = 2" @blur="inputBlur(2)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag"  @tag-clicked="handleTagClick($event,2)" ref="tagsInput2"/>
       </template>
     </div>
 
@@ -478,6 +478,24 @@ export default {
       })
       this.inputVisible = false;
     },
+    handleTagClick(info,index) {
+     
+       const {tag}=info;
+
+       
+      this.curFocusIndex = index
+     
+      
+      // 调用对应输入框的 focus() 方法
+        if (this.curFocusIndex === 1) {
+          this.$refs.tagsInput1.focus(); // 注意:确保组件已挂载,使用可选链避免报错
+        } else {
+          this.$refs.tagsInput2.focus();
+        }
+
+  
+       this.$emit('clickTag',tag)
+    },
 
   }
 }

+ 14 - 10
src/views/formula/edit.vue

@@ -287,7 +287,7 @@
     <div v-if="!operationVisible && !showFunDetail && deviationRange.show" class="flex1">
       <div class="flex">
         <div class=" flex-d-c"  style="width:40%">
-          <deviation-range ref="deviationrange" :formulainfo="deviationRange" :formulamap="formulaMap" @uncheck="unCheckEleComp" class="flex1"></deviation-range>
+          <deviation-range ref="deviationrange" :formulainfo="deviationRange" :formulamap="formulaMap" @uncheck="unCheckEleComp" class="flex1" @clickTag="handleClickTag"></deviation-range>
           <div class="flex1" v-show="deviationRange.showSelectEle" style="margin-top:10px;margin-bottom:30px">
             <el-scrollbar style="height: 400px">
               <el-tree
@@ -336,7 +336,7 @@
             </el-scrollbar> -->
              <el-scrollbar style="height: 520px">
         
-                     <tableFormWrite :pkeyId="eleTableIdComp" @element-selected="setDeviationRangeEle" :initTableName="initTableNameDev"  :key="4" :container-id="'excel-container-4'" ></tableFormWrite>
+                     <tableFormWrite :pkeyId="eleTableIdComp" @element-selected="setDeviationRangeEle" :initTableName="initTableNameDev"  :key="4" :container-id="'excel-container-4'"  :selectedTableKey="selectedTableKeyDev"></tableFormWrite>
              </el-scrollbar>
           </div>
         </div>
@@ -627,6 +627,7 @@ export default {
       seleList:[],//选择元素弹窗 选中的元素列表
       tableKey:'3',
       initTableNameDev:'',//初始表名 允许偏差值范围
+      selectedTableKeyDev:'', // 存储
 
     };
   },
@@ -1922,12 +1923,10 @@ console.log(remark,'remark');
 
     //设置动态组件里面的元素
     setDeviationRangeEle(item,value){
-      console.log(item,'item');
-      
-      console.log(value,'value');
+     
       
       if(value){
-        //console.log(this.$refs.dynamiccomponent[index])
+       
         
         this.$refs.deviationrange.setELe(item);
       }
@@ -2357,12 +2356,17 @@ replaceSelectedElement(newItem) {
   // 更新选中状态和光标位置
   this.setActiveElement(currentIndex);
 },
-    handleShiftPlus(event) {
-      event.preventDefault();
-      console.log('Shift + + 被按下');
-      // this.yourMethod();
+  //偏差值范围选择元素
+  handleClickTag(item){
+  
+  // console.log(item,'item');
+
+          const keyParts =  item.tableElementKey.split('key');
+          this.selectedTableKeyDev = keyParts.length > 1 ? 'key'+keyParts[1] : null;
+      
     },
   },
+
 };
 </script>