duy 1 долоо хоног өмнө
parent
commit
1d9b9f6281

+ 531 - 100
src/views/formula/component/funComponent/ifelse.vue

@@ -54,7 +54,6 @@
             <span class="textblod mg-r-10">真值</span>
             <div class="border-grey sele-ele-box flex1" :class="{'border-green':curFocusIndex == 6}" @click="curFocusIndex = 6">
               <div class="flex jc-sb mg-b-20">
-                <!-- <div>定位数据位置:</div> -->
                 <div class="icon-box">
                   <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelect"></el-link>
                   <el-link :underline="false" type="primary" @click="addOperator('+')" icon="el-icon-circle-plus-outline"></el-link>
@@ -63,11 +62,8 @@
                   <el-link :underline="false" type="primary" @click="addOperator('%')">÷</el-link>
                 </div>
                 <div>
-                  <!-- <el-link :underline="false" type="primary" class="mg-r-20" @click="eleAddFormula">元素添加到公式</el-link> -->
                   <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('(',false)">(</el-link>
                   <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(')',true)">)</el-link>
-                  <!-- <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('[',false)">【</el-link>
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(']',true)">】</el-link> -->
                   <el-link :underline="false" type="primary" @click="addText">输入值</el-link>
                 </div>
               </div>
@@ -84,7 +80,6 @@
             <span class="textblod mg-r-10">假值</span>
             <div class="border-grey sele-ele-box flex1" :class="{'border-green':curFocusIndex == 7}" @click="curFocusIndex = 7">
               <div class="flex jc-sb mg-b-20">
-                <!-- <div>定位数据位置:</div> -->
                 <div class="icon-box">
                   <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelect"></el-link>
                   <el-link :underline="false" type="primary" @click="addOperator('+')" icon="el-icon-circle-plus-outline"></el-link>
@@ -93,11 +88,8 @@
                   <el-link :underline="false" type="primary" @click="addOperator('%')">÷</el-link>
                 </div>
                 <div>
-                  <!-- <el-link :underline="false" type="primary" class="mg-r-20" @click="eleAddFormula">元素添加到公式</el-link> -->
                   <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('(',false)">(</el-link>
                   <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(')',true)">)</el-link>
-                  <!-- <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('[',false)">【</el-link>
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(']',true)">】</el-link> -->
                   <el-link :underline="false" type="primary" @click="addText">输入值</el-link>
                 </div>
               </div>
@@ -114,19 +106,32 @@
     </template>
     <!-- 多条件 -->
      <template v-else>
-      <div v-for="(item,index) in conditionList" :key="index">
+      <div v-for="(item, conditionIndex) in conditionList" :key="conditionIndex">
         <!-- 从第二个条件开始显示“条件X”和删除按钮 -->
-        <div v-if="index >= 1" class="condition-header flex al-c  mg-t-20">
-          <span class="textblod">条件{{ index + 1 }}</span>
-          <el-button type="danger" size="mini" @click="removeCondition(index)" class=" mg-l-20">删除</el-button>
+        <div v-if="conditionIndex >= 1" class="condition-header flex al-c  mg-t-20">
+          <span class="textblod">条件{{ conditionIndex + 1 }}</span>
+          <el-button type="danger" size="mini" @click="removeCondition(conditionIndex)" class=" mg-l-20">删除</el-button>
         </div>
-           <div  v-for="(item1,index1) in conditionInnerList">
-            <div class="mg-t-20 flex jc-al-c" :key="index">
+           <div  v-for="(innerItem, innerIndex) in conditionList[conditionIndex].innerList">
+            <div class="mg-t-20 flex jc-al-c" :key="innerIndex">
                   <span class="textblod mg-r-20" >IF</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="conditionList[conditionIndex].innerList[innerIndex].tag2" 
+                    :tags="conditionList[conditionIndex].innerList[innerIndex].tags2" 
+                    @focus="setMultiFocus(conditionIndex, innerIndex, 'tag2')" 
+                    @blur="inputBlurMulti(conditionIndex, innerIndex, 'tag2')" 
+                    placeholder="输入/参数" 
+                    @before-adding-tag="beforeAddingTag"
+                  />
                   <span class="mg-l-20 mg-r-20">
-                  <el-select v-model="symbol1" @change="setCondition()" size="medium" placeholder="请选择"  style="width:120px">
+                  <el-select 
+                    v-model="conditionList[conditionIndex].innerList[innerIndex].symbol1" 
+                    @change="setConditionMulti(conditionIndex, innerIndex)" 
+                    size="medium" 
+                    placeholder="请选择"  
+                    style="width:120px"
+                  >
                         <el-option label=">=" value=">="></el-option>
                         <el-option label="<=" value="<="></el-option>
                         <el-option label="=" value="="></el-option>
@@ -138,55 +143,79 @@
                 
                   </el-select>
                   </span>
-                  <vue-tags-input v-model="tag3" :tags="tags3" @focus="curFocusIndex = 3" @blur="inputBlur(3)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag"/>
-                  <i class="el-icon-circle-plus-outline mg-l-20" style="color: #409EFF;cursor: pointer;" @click="addConditionItem(index)"></i>
-                   <i class="el-icon-delete mg-l-20" style="color: red;cursor: pointer;" @click="removeConditionItem(index)" v-if="index>0"></i>
-                 
+                  <vue-tags-input 
+                    v-model="conditionList[conditionIndex].innerList[innerIndex].tag3" 
+                    :tags="conditionList[conditionIndex].innerList[innerIndex].tags3" 
+                    @focus="setMultiFocus(conditionIndex, innerIndex, 'tag3')" 
+                    @blur="inputBlurMulti(conditionIndex, innerIndex, 'tag3')" 
+                    placeholder="输入/参数" 
+                    @before-adding-tag="beforeAddingTag"
+                  />
+                  <i class="el-icon-circle-plus-outline mg-l-20" style="color: #409EFF;cursor: pointer;" @click="addConditionItem(conditionIndex, innerIndex)"></i>
+                   <i class="el-icon-delete mg-l-20" style="color: red;cursor: pointer;" @click="removeConditionItem(conditionIndex, innerIndex)" v-if="innerIndex > 0 || conditionIndex > 0"></i>
             </div>
-            <div v-if="index>0" style="margin-left: 235px;" class="mg-t-10 mg-b-10">
-                      <el-select v-model="symbol1" @change="setCondition()" size="medium" placeholder="请选择"  style="width:120px">
-                      
-                            <el-option label="或者" value="包含"></el-option>
-                            <el-option label="并且" value="不包含"></el-option>
-                    
+            <div v-if="innerIndex > 0" style="margin-left: 25%;" class="mg-t-10 mg-b-10">
+                      <el-select 
+                        v-model="conditionList[conditionIndex].innerList[innerIndex].logicSymbol" 
+                        @change="setConditionMulti(conditionIndex, innerIndex)" 
+                        size="medium" 
+                        placeholder="请选择"  
+                        style="width:120px"
+                      >
+                            <el-option label="或者" value="or"></el-option>
+                            <el-option label="并且" value="and"></el-option>
                       </el-select>
               </div>
            </div>
          <div class="flex jc-al-c mg-t-20" v-if="result == 1">
           <span class="textblod mg-r-10">满足</span>
-          <vue-tags-input v-model="tag4" :tags="tags4" @focus="curFocusIndex = 4" @blur="inputBlur(4)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag" @keyup.native="btKeyUp"/>
+          <vue-tags-input 
+            v-model="conditionList[conditionIndex].tag4" 
+            :tags="conditionList[conditionIndex].tags4" 
+            @focus="setMultiFocus(conditionIndex, null, 'tag4')" 
+            @blur="inputBlurMulti(conditionIndex, null, 'tag4')" 
+            placeholder="输入/参数" 
+            @before-adding-tag="beforeAddingTag" 
+            @keyup.native="btKeyUp"
+          />
           <span class="textblod mg-r-10 mg-l-20">不满足</span>
-          <vue-tags-input v-model="tag5" :tags="tags5" @focus="curFocusIndex = 5" @blur="inputBlur(5)" placeholder="输入/参数" @before-adding-tag="beforeAddingTag" @keyup.native="btKeyUp"/>
+          <vue-tags-input 
+            v-model="conditionList[conditionIndex].tag5" 
+            :tags="conditionList[conditionIndex].tags5" 
+            @focus="setMultiFocus(conditionIndex, null, 'tag5')" 
+            @blur="inputBlurMulti(conditionIndex, null, 'tag5')" 
+            placeholder="输入/参数" 
+            @before-adding-tag="beforeAddingTag" 
+            @keyup.native="btKeyUp"
+          />
           <div class="mg-l-20">
-              <el-button  size="small" type="primary" @click="addCondition(index1)">添加其他条件</el-button>
+              <el-button  size="small" type="primary" @click="addCondition(conditionIndex)">添加其他条件</el-button>
           </div>
         </div>
         <div class="mg-t-20" v-if="result == 2">
           <div class="flex">
             <span class="textblod mg-r-10">满足</span>
-            <div class="border-grey sele-ele-box flex1" :class="{'border-green':curFocusIndex == 6}" @click="curFocusIndex = 6">
+            <div class="border-grey sele-ele-box flex1" 
+                 :class="{'border-green': isCurFocus(conditionIndex, null, 'formula1')}" 
+                 @click="setMultiFocus(conditionIndex, null, 'formula1')">
               <div class="flex jc-sb mg-b-20">
-                <!-- <div>定位数据位置:</div> -->
                 <div class="icon-box">
-                  <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelect"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('+')" icon="el-icon-circle-plus-outline"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('-')" icon="el-icon-remove-outline"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('*')" icon="el-icon-circle-close"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('%')">÷</el-link>
+                  <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelectMulti(conditionIndex, 'formula1')"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '+', 'formula1')" icon="el-icon-circle-plus-outline"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '-', 'formula1')" icon="el-icon-remove-outline"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '*', 'formula1')" icon="el-icon-circle-close"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '%', 'formula1')">÷</el-link>
                 </div>
                 <div>
-           
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('(',false)">(</el-link>
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(')',true)">)</el-link>
-                 
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(']',true)">】</el-link> -->
-                  <el-link :underline="false" type="primary" @click="addText">输入值</el-link>
+                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBracketsMulti(conditionIndex, '(', false, 'formula1')">(</el-link>
+                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBracketsMulti(conditionIndex, ')', true, 'formula1')">)</el-link>
+                  <el-link :underline="false" type="primary" @click="addTextMulti(conditionIndex, 'formula1')">输入值</el-link>
                 </div>
               </div>
-              <draggable v-model="selectEleFormula">
+              <draggable v-model="conditionList[conditionIndex].formula1">
                 <formula-item 
-                  v-for="(item,index) in selectEleFormula" :key="index" 
-                  :item="item" @click="obj => eleFormulaClick(obj,index)"
+                  v-for="(item,index) in conditionList[conditionIndex].formula1" :key="index" 
+                  :item="item" @click="obj => eleFormulaClickMulti(obj, index, conditionIndex, 'formula1')"
                 >
                 </formula-item>
               </draggable>
@@ -194,29 +223,27 @@
           </div>
           <div class="flex mg-t-10">
             <span class="textblod mg-r-10">不满足</span>
-            <div class="border-grey sele-ele-box flex1" :class="{'border-green':curFocusIndex == 7}" @click="curFocusIndex = 7">
+            <div class="border-grey sele-ele-box flex1" 
+                 :class="{'border-green': isCurFocus(conditionIndex, null, 'formula2')}" 
+                 @click="setMultiFocus(conditionIndex, null, 'formula2')">
               <div class="flex jc-sb mg-b-20">
-                <!-- <div>定位数据位置:</div> -->
                 <div class="icon-box">
-                  <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelect"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('+')" icon="el-icon-circle-plus-outline"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('-')" icon="el-icon-remove-outline"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('*')" icon="el-icon-circle-close"></el-link>
-                  <el-link :underline="false" type="primary" @click="addOperator('%')">÷</el-link>
+                  <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelectMulti(conditionIndex, 'formula2')"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '+', 'formula2')" icon="el-icon-circle-plus-outline"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '-', 'formula2')" icon="el-icon-remove-outline"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '*', 'formula2')" icon="el-icon-circle-close"></el-link>
+                  <el-link :underline="false" type="primary" @click="addOperatorMulti(conditionIndex, '%', 'formula2')">÷</el-link>
                 </div>
                 <div>
-                  <!-- <el-link :underline="false" type="primary" class="mg-r-20" @click="eleAddFormula">元素添加到公式</el-link> -->
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('(',false)">(</el-link>
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(')',true)">)</el-link>
-                  <!-- <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets('[',false)">【</el-link>
-                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBrackets(']',true)">】</el-link> -->
-                  <el-link :underline="false" type="primary" @click="addText">输入值</el-link>
+                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBracketsMulti(conditionIndex, '(', false, 'formula2')">(</el-link>
+                  <el-link :underline="false" type="primary" class="mg-r-10" @click="addBracketsMulti(conditionIndex, ')', true, 'formula2')">)</el-link>
+                  <el-link :underline="false" type="primary" @click="addTextMulti(conditionIndex, 'formula2')">输入值</el-link>
                 </div>
               </div>
-              <draggable v-model="selectEleFormula2">
+              <draggable v-model="conditionList[conditionIndex].formula2">
                 <formula-item 
-                  v-for="(item,index) in selectEleFormula2" :key="index" 
-                  :item="item" @click="obj => eleFormulaClick(obj,index)"
+                  v-for="(item,index) in conditionList[conditionIndex].formula2" :key="index" 
+                  :item="item" @click="obj => eleFormulaClickMulti(obj, index, conditionIndex, 'formula2')"
                 >
                 </formula-item>
               </draggable>
@@ -246,9 +273,7 @@ export default {
   name: "ifelse",
   components: {
     draggable,
-
     VueTagsInput,
-
     formulaItem,
   },
   props: {
@@ -282,6 +307,12 @@ export default {
 
       curFocusIndex:0,//当前在哪个输入框
       curSeleEleIndex:-1,//公式文字里面选中的元素索引
+      // 多条件下的焦点信息
+      multiFocus: {
+        conditionIndex: -1,
+        innerIndex: -1,
+        field: ''
+      },
       symbolReg:/(\+|-|\*|\/)(.+)/,
       inputVisible:false,
       inputText:'',
@@ -297,20 +328,30 @@ export default {
       tag5: '',
       tags5: [],
       symbol1:'',
+      // 重构多条件列表结构,包含独立的tags和公式
       conditionList:[
-        {},
-      
-      ],//多条件的条件列表
-      conditionInnerList:[
-        {},
-      
-      ],//多条件的条件内部列表
-
+        {
+          innerList: [
+            {
+              tag2: '',
+              tags2: [],
+              tag3: '',
+              tags3: [],
+              symbol1: '',
+              logicSymbol: 'and'
+            }
+          ],
+          tag4: '',
+          tags4: [],
+          tag5: '',
+          tags5: [],
+          formula1: [],
+          formula2: []
+        }
+      ]//多条件的条件列表
     }
   },
   mounted(){
-    //console.log(this.formulainfo.arguments[0])
-    //console.log(this.formulainfo.arguments[1])
     let args0 = this.formulainfo.arguments[0];
     let args1 = this.formulainfo.arguments[1];
     let args2 = this.formulainfo.arguments[2];
@@ -324,6 +365,11 @@ export default {
       this.result = '2';
       this.initTFFormula(args1,args2)
     }
+
+    // 初始化多条件数据
+    if (this.symbol === 'more' && this.formulainfo.arguments[0] && Array.isArray(this.formulainfo.arguments[0])) {
+      this.initMultiConditions(this.formulainfo.arguments[0]);
+    }
   },
   methods:{
     showSelectEle(){
@@ -360,6 +406,27 @@ export default {
       }
     },
 
+    // 多条件下的输入框失焦处理
+    inputBlurMulti(conditionIndex, innerIndex, field) {
+      const conditionItem = this.conditionList[conditionIndex];
+      let target;
+      
+      if (innerIndex !== null) {
+        target = conditionItem.innerList[innerIndex];
+      } else {
+        target = conditionItem;
+      }
+      
+      if (target[field]) {
+        if (target[`tags${field.charAt(3)}`] && target[`tags${field.charAt(3)}`][0]) {
+          this.$emit('uncheck', target[`tags${field.charAt(3)}`][0].id);
+        }
+        target[`tags${field.charAt(3)}`] = [];
+      }
+      
+      this.setConditionMulti(conditionIndex, innerIndex);
+    },
+
     addText(){
       this.inputVisible = true;
     },
@@ -475,6 +542,88 @@ export default {
       this.setTF();
     },
 
+    // 多条件下添加元素到公式
+    eleAddFormulaHandleMulti(ele, conditionIndex, formulaType) {
+      const eleFormula = this.conditionList[conditionIndex][formulaType];
+      
+      if(ele.tableElementKey){
+        //元素的简单语法判断
+        if(eleFormula.length != 0){
+          let lastEle = eleFormula[eleFormula.length-1];
+          if(lastEle.type == 'Element'){
+            this.$message({ type: "warning", message: "元素无法连续出现在元素后面" });
+            return;
+          }
+          if(lastEle.type == 'Text'){
+            this.$message({ type: "warning", message: "元素无法连续出现在输入值后面" });
+            return;
+          }
+          if(lastEle.type == 'Brackets' && lastEle.name == ')'){
+            this.$message({ type: "warning", message: "元素无法连续出现在右括号后面" });
+            return;
+          }
+        }
+
+        eleFormula.push({
+          type:'Element',
+          name:ele.eName,
+          id:ele.id,
+          selected:false,
+          tableElementKey:ele.tableElementKey,
+          children:[],
+        })
+      }else if(ele.template && ele.example){
+        //运算符号的简单语法判断
+        if(eleFormula.length == 0){
+          this.$message({ type: "warning", message: "公式开头不能是运算符号" });
+          return;
+        }else{
+          let lastEle = eleFormula[eleFormula.length-1];
+          if(lastEle.type == 'Operator'){
+            this.$message({ type: "warning", message: "运算符号无法连续出现在运算符号后面" });
+            return;
+          }
+          if(lastEle.type == 'Brackets' && lastEle.name == '('){
+            this.$message({ type: "warning", message: "运算符号无法连续出现在左括号后面" });
+            return;
+          }
+        }
+
+        eleFormula.push({
+          type:'Operator',
+          name:this.symbolReg.exec(ele.name)[1],
+          selected:false,
+          template:ele.template
+        })
+      }else if(ele.type == 'Brackets'){
+        //括号
+        eleFormula.splice(ele.selectIndex,0,{
+          type:'Brackets',
+          name:ele.name,
+          selected:false,
+        })
+      }else if(ele.type == 'Text'){
+        //输入值
+        eleFormula.push({
+          type:'Text',
+          name:ele.name,
+          selected:false,
+        })
+      }else if(ele.k){
+        //节点参数
+        eleFormula.push({
+          type:'ParamData',
+          name:ele.name,
+          selected:false,
+          id:ele.id,
+          v:ele.v,
+          k:ele.k,
+        })
+      }
+
+      this.setTFMulti(conditionIndex);
+    },
+
     //点选公式中的元素
     eleFormulaClick({selected,item},index){
       let eleFormula;
@@ -497,11 +646,31 @@ export default {
       }
     },
 
+    // 多条件下点选公式中的元素
+    eleFormulaClickMulti({selected,item}, index, conditionIndex, formulaType) {
+      const eleFormula = this.conditionList[conditionIndex][formulaType];
+      
+      if(selected){
+        eleFormula.forEach((ele)=>{
+          ele.selected = false;
+        })
+        item.selected = true;
+        this.curSeleEleIndex = index;
+      }else{
+        this.curSeleEleIndex = -1;
+      }
+    },
+
     //快捷添加运算符号
     addOperator(operator){
       this.eleAddFormulaHandle(this.formulamap[operator]);
     },
 
+    // 多条件下快捷添加运算符号
+    addOperatorMulti(conditionIndex, operator, formulaType) {
+      this.eleAddFormulaHandleMulti(this.formulamap[operator], conditionIndex, formulaType);
+    },
+
     //删除点选公式中的元素
     removeSelect(){
       let eleFormula;
@@ -522,6 +691,18 @@ export default {
       this.setTF();
     },
 
+    // 多条件下删除点选公式中的元素
+    removeSelectMulti(conditionIndex, formulaType) {
+      const eleFormula = this.conditionList[conditionIndex][formulaType];
+      
+      if(this.curSeleEleIndex > -1){
+        eleFormula.splice(this.curSeleEleIndex,1);
+        this.curSeleEleIndex = -1;
+      }
+
+      this.setTFMulti(conditionIndex);
+    },
+
     //添加括号
     addBrackets(text,type){
       //type 是true 表示在元素右边插入
@@ -538,6 +719,22 @@ export default {
       }
     },
 
+    // 多条件下添加括号
+    addBracketsMulti(conditionIndex, text, type, formulaType) {
+      if(this.curSeleEleIndex == Number(this.curSeleEleIndex)){
+        this.eleAddFormulaHandleMulti({
+          type:'Brackets',
+          name:text,
+          selectIndex:type?Number(this.curSeleEleIndex)+1:this.curSeleEleIndex
+        }, conditionIndex, formulaType);
+        
+        //如果在左边插入index要增1
+        if(!type){
+          this.curSeleEleIndex = Number(this.curSeleEleIndex)+1;
+        }
+      }
+    },
+
     //添加输入值
     addTextHandle(){
       let eleFormula;
@@ -545,6 +742,41 @@ export default {
         eleFormula = this.selectEleFormula;
       }else if(this.curFocusIndex == 7){
         eleFormula = this.selectEleFormula2;
+      }else if(this.symbol === 'more' && this.multiFocus.conditionIndex !== -1 && 
+              (this.multiFocus.field === 'formula1' || this.multiFocus.field === 'formula2')){
+        // 多条件下处理
+        eleFormula = this.conditionList[this.multiFocus.conditionIndex][this.multiFocus.field];
+        
+        //简单语法判断
+        if(eleFormula.length != 0){
+          let lastEle = eleFormula[eleFormula.length-1];
+          if(lastEle.type == 'Element'){
+            this.$message({ type: "warning", message: "输入值无法连续出现在元素后面" });
+            this.inputVisible = false;
+            return;
+          }
+          if(lastEle.type == 'Text'){
+            this.$message({ type: "warning", message: "输入值无法连续出现在输入值后面" });
+            this.inputVisible = false;
+            return;
+          }
+          if(lastEle.type == 'Brackets' && lastEle.name == ')'){
+            this.$message({ type: "warning", message: "输入值无法连续出现在右括号后面" });
+            this.inputVisible = false;
+            return;
+          }
+        }
+
+        eleFormula.push({
+          type:'Text',
+          name:this.inputText,
+          selected:false,
+        });
+        
+        this.setTFMulti(this.multiFocus.conditionIndex);
+        this.inputVisible = false;
+        this.inputText = '';
+        return;
       }else{
         return;
       }
@@ -578,13 +810,80 @@ export default {
       this.eleAddFormulaHandle({
         type:'Text',
         name:this.inputText
-      })
+      });
       this.inputVisible = false;
+      this.inputText = '';
+    },
+
+    // 多条件下添加输入值
+    addTextMulti(conditionIndex, formulaType) {
+      this.multiFocus.conditionIndex = conditionIndex;
+      this.multiFocus.field = formulaType;
+      this.inputVisible = true;
     },
 
     setELe(ele){
-      console.log(ele,'ele');
+      // 处理多条件情况
+      if (this.symbol === 'more' && this.multiFocus.conditionIndex !== -1) {
+        const { conditionIndex, innerIndex, field } = this.multiFocus;
+        const conditionItem = this.conditionList[conditionIndex];
+        let target;
+        
+        // 确定目标对象
+        if (innerIndex !== null) {
+          target = conditionItem.innerList[innerIndex];
+        } else {
+          target = conditionItem;
+        }
+        
+        // 处理公式类型的字段
+        if (field === 'formula1' || field === 'formula2') {
+          this.eleAddFormulaHandleMulti(ele, conditionIndex, field);
+          return;
+        }
+        
+        // 处理标签类型的字段
+        if (target && field) {
+          let obj = {};
+          if(ele.k){
+            obj = {
+              type:'ParamData',
+              name:ele.name,
+              id:ele.id,
+              selected:false,
+              v:ele.v,
+              k:ele.k,
+              children:[],
+            }
+          }else{
+            obj = {
+              type:'Element',
+              name:ele.eName,
+              id:ele.id,
+              selected:false,
+              tableElementKey:ele.tableElementKey,
+              children:[],
+            }
+          }
+          
+          // 清除之前选择的元素
+          if (target[`tags${field.charAt(3)}`] && target[`tags${field.charAt(3)}`][0]) {
+            this.$emit('uncheck', target[`tags${field.charAt(3)}`][0].id);
+          }
+          
+          // 设置新选择的元素
+          obj.text = obj.name;
+          obj.style = 'background-color: #409EFF';
+          target[`tags${field.charAt(3)}`] = [obj];
+          target[field] = '';
+          
+          // 更新条件
+          this.setConditionMulti(conditionIndex, innerIndex);
+        }
+        return;
+      }
       
+      // 原逻辑处理单条件情况
       if(this.curFocusIndex){
         let obj = {};
         if(ele.k){
@@ -625,12 +924,26 @@ export default {
           }else{
             this.setCondition();
           }
-
-          //this.curFocusIndex = 0;
         }
       }
     },
 
+    // 设置多条件下的焦点
+    setMultiFocus(conditionIndex, innerIndex, field) {
+      this.multiFocus = {
+        conditionIndex,
+        innerIndex,
+        field
+      };
+    },
+
+    // 检查是否是当前焦点
+    isCurFocus(conditionIndex, innerIndex, field) {
+      return this.multiFocus.conditionIndex === conditionIndex &&
+             this.multiFocus.innerIndex === innerIndex &&
+             this.multiFocus.field === field;
+    },
+
     //初始化真假值判断if(xxx)部分
     initCondition(args0){
       if(args0){
@@ -711,6 +1024,41 @@ export default {
       }
     },
 
+    // 初始化多条件数据
+    initMultiConditions(args0) {
+      if (Array.isArray(args0)) {
+        this.conditionList = args0.map(condition => {
+          // 处理内部条件列表
+          const innerList = Array.isArray(condition.innerList) ? 
+            condition.innerList.map(inner => ({
+              tag2: inner.tag2 || '',
+              tags2: inner.tags2 || [],
+              tag3: inner.tag3 || '',
+              tags3: inner.tags3 || [],
+              symbol1: inner.symbol1 || '',
+              logicSymbol: inner.logicSymbol || 'and'
+            })) : [{
+              tag2: '',
+              tags2: [],
+              tag3: '',
+              tags3: [],
+              symbol1: '',
+              logicSymbol: 'and'
+            }];
+          
+          return {
+            innerList,
+            tag4: condition.tag4 || '',
+            tags4: condition.tags4 || [],
+            tag5: condition.tag5 || '',
+            tags5: condition.tags5 || [],
+            formula1: condition.formula1 || [],
+            formula2: condition.formula2 || []
+          };
+        });
+      }
+    },
+
     //写入参数真假值判断if(xxx)部分
     setCondition(){
       if(this.symbol == '<&&<' || this.symbol == '<=&&<='){
@@ -737,7 +1085,7 @@ export default {
           arr[6] = this.tags3[0];
         }
         this.formulainfo.arguments[0] = arr;
-      }else{
+      }else if(this.symbol !== 'more'){
         let arr = new Array(3).fill('');
         if(this.tags2.length == 0){
           arr[0] = this.tag2;
@@ -751,8 +1099,30 @@ export default {
           arr[2] = this.tags3[0];
         }
         this.formulainfo.arguments[0] = arr;
+      } else {
+        // 处理多条件情况
+        this.formulainfo.arguments[0] = this.conditionList.map(condition => ({
+          innerList: condition.innerList.map(inner => ({
+            tag2: inner.tag2,
+            tags2: inner.tags2,
+            tag3: inner.tag3,
+            tags3: inner.tags3,
+            symbol1: inner.symbol1,
+            logicSymbol: inner.logicSymbol
+          })),
+          tag4: condition.tag4,
+          tags4: condition.tags4,
+          tag5: condition.tag5,
+          tags5: condition.tags5,
+          formula1: condition.formula1,
+          formula2: condition.formula2
+        }));
       }
-      //console.log(this.formulainfo.arguments[0])
+    },
+
+    // 多条件下设置条件
+    setConditionMulti(conditionIndex, innerIndex) {
+      this.setCondition();
     },
 
     //初始化输入框的真假值
@@ -827,37 +1197,92 @@ export default {
 
     //写入参数真假值
     setTF(){
-      if(this.result == 1){
-        if(this.tags4.length == 0){
-          this.formulainfo.arguments[1] = this.tag4;
-        }else{
-          this.formulainfo.arguments[1] = this.tags4[0];
-        }
-        if(this.tags5.length == 0){
-          this.formulainfo.arguments[2] = this.tag5;
-        }else{
-          this.formulainfo.arguments[2] = this.tags5[0];
+      if(this.symbol !== 'more') {
+        if(this.result == 1){
+          if(this.tags4.length == 0){
+            this.formulainfo.arguments[1] = this.tag4;
+          }else{
+            this.formulainfo.arguments[1] = this.tags4[0];
+          }
+          if(this.tags5.length == 0){
+            this.formulainfo.arguments[2] = this.tag5;
+          }else{
+            this.formulainfo.arguments[2] = this.tags5[0];
+          }
+        }else if(this.result == 2){
+          this.formulainfo.arguments[1] = this.selectEleFormula;
+          this.formulainfo.arguments[2] = this.selectEleFormula2;
         }
-      }else if(this.result == 2){
-        this.formulainfo.arguments[1] = this.selectEleFormula;
-        this.formulainfo.arguments[2] = this.selectEleFormula2;
       }
+      // 多条件情况在setCondition中处理
+    },
+
+    // 多条件下设置真假值
+    setTFMulti(conditionIndex) {
+      this.setCondition();
     },
+
     //添加条件
     addCondition(index){ 
-     this.conditionList.splice(index, 0, {});
+      // 复制最后一个条件的结构作为新条件的基础
+      const newCondition = JSON.parse(JSON.stringify(this.conditionList[index]));
+      // 清空值但保留结构
+      newCondition.innerList = [
+        {
+          tag2: '',
+          tags2: [],
+          tag3: '',
+          tags3: [],
+          symbol1: '',
+          logicSymbol: 'and'
+        }
+      ];
+      newCondition.tag4 = '';
+      newCondition.tags4 = [];
+      newCondition.tag5 = '';
+      newCondition.tags5 = [];
+      newCondition.formula1 = [];
+      newCondition.formula2 = [];
+      
+      this.conditionList.splice(index + 1, 0, newCondition);
+      this.setCondition();
     },
+
     //删除条件
     removeCondition(index){
-      this.conditionList.splice(index,1);
-    },
-    addConditionItem(index){
-     this.conditionInnerList.splice(index, 0, {});
+      if (this.conditionList.length > 1) {
+        this.conditionList.splice(index,1);
+        this.setCondition();
+      } else {
+        this.$message({ type: "warning", message: "至少保留一个条件" });
+      }
     },
-    removeConditionItem(index){
-      this.conditionInnerList.splice(index,1);
+
+    // 添加内部条件项
+    addConditionItem(conditionIndex, innerIndex) {
+      const newInnerItem = {
+        tag2: '',
+        tags2: [],
+        tag3: '',
+        tags3: [],
+        symbol1: '',
+        logicSymbol: 'and'
+      };
+      
+      this.conditionList[conditionIndex].innerList.splice(innerIndex + 1, 0, newInnerItem);
+      this.setCondition();
     },
 
+    // 删除内部条件项
+    removeConditionItem(conditionIndex, innerIndex) {
+      if (this.conditionList[conditionIndex].innerList.length > 1) {
+        this.conditionList[conditionIndex].innerList.splice(innerIndex, 1);
+        this.setCondition();
+      } else {
+        this.$message({ type: "warning", message: "至少保留一个条件项" });
+      }
+    }
+
   }
 }
 </script>
@@ -879,4 +1304,10 @@ export default {
     color: #409EFF;
     cursor: 409EFF;
   }
-</style>
+  .border-green {
+    border-color: green !important;
+  }
+  .border-grey {
+    border: 1px solid #ddd;
+  }
+</style>