Pārlūkot izejas kodu

多条件判断真假值修改

duy 1 nedēļu atpakaļ
vecāks
revīzija
477328f3c7

+ 5 - 3
src/api/formula/formula.js

@@ -10,7 +10,7 @@ export const getTypeMap = (params) => {
   })
 }
 
-export const saveFormula = ({formula,remark,nodeId,elementId,scale,number,map,scope,projectId,dev,ver}) => {
+export const saveFormula = ({formula,remark,nodeId,elementId,scale,number,map,scope,projectId,dev,ver,formulas}) => {
   return request({
     url: '/api/blade-manager/formula/save',
     method: 'post',
@@ -25,12 +25,13 @@ export const saveFormula = ({formula,remark,nodeId,elementId,scale,number,map,sc
       scope,
       projectId,
       dev,
-      ver
+      ver,
+      formulas
     }
   })
 }
 
-export const updateFormula = ({id,formula,remark,nodeId,elementId,scale,number,map,scope,dev}) => {
+export const updateFormula = ({id,formula,remark,nodeId,elementId,scale,number,map,scope,dev,formulas}) => {
   return request({
     url: '/api/blade-manager/formula/update',
     method: 'post',
@@ -45,6 +46,7 @@ export const updateFormula = ({id,formula,remark,nodeId,elementId,scale,number,m
       map,
       scope,
       dev,
+      formulas
     }
   })
 }

+ 0 - 0
src/views/formula/component/formulaItem1.vue → src/views/formula/component/formulaItem-new.vue


+ 153 - 72
src/views/formula/component/funComponent/ifelse.vue

@@ -112,61 +112,63 @@
           <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="(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>
+         <div v-for="(innerItem, innerIndex) in conditionList[conditionIndex].formulaIfElse">
+              <!-- 逻辑符号选择框 - 从第二个条件开始显示(innerIndex >= 1) -->
+              <div v-if="innerIndex >= 1" style="margin-left: 25%;" class="mg-t-10 mg-b-10">
+                <el-select 
+                  v-model="conditionList[conditionIndex].formulaIfElse[innerIndex].logicSymbol" 
+                  @change="setConditionMulti(conditionIndex, innerIndex)" 
+                  size="medium" 
+                  placeholder="请选择"  
+                  style="width:120px"
+                >
+                  <el-option label="或者" value="||"></el-option>
+                  <el-option label="并且" value="&&"></el-option>
+                </el-select>
+              </div>
               
-                  <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="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>
-                        <el-option label=">" value=">"></el-option>
-                        <el-option label="<" value="<"></el-option>
-                        <el-option label="≠" value="≠"></el-option>
-                        <el-option label="包含" value="包含"></el-option>
-                        <el-option label="不包含" value="不包含"></el-option>
+              <!-- if条件内容 -->
+              <div class="mg-t-20 flex jc-al-c" :key="innerIndex">
+                <span class="textblod mg-r-20" >IF</span>
                 
-                  </el-select>
-                  </span>
-                  <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="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>
+                <vue-tags-input 
+                  v-model="conditionList[conditionIndex].formulaIfElse[innerIndex].tag2" 
+                  :tags="conditionList[conditionIndex].formulaIfElse[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="conditionList[conditionIndex].formulaIfElse[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>
+                      <el-option label=">" value=">"></el-option>
+                      <el-option label="<" value="<"></el-option>
+                      <el-option label="≠" value="≠"></el-option>
+                      <el-option label="包含" value="包含"></el-option>
+                      <el-option label="不包含" value="不包含"></el-option>
+                </el-select>
+                </span>
+                <vue-tags-input 
+                  v-model="conditionList[conditionIndex].formulaIfElse[innerIndex].tag3" 
+                  :tags="conditionList[conditionIndex].formulaIfElse[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>
+            </div>
          <div class="flex jc-al-c mg-t-20" v-if="result == 1">
           <span class="textblod mg-r-10">满足</span>
           <vue-tags-input 
@@ -268,7 +270,7 @@
 import VueTagsInput from '@johmun/vue-tags-input';
 import formulaItem from "../formulaItem";
 import draggable from 'vuedraggable';
-import { template } from '@antv/g2plot/lib/utils';
+
 export default {
   name: "ifelse",
   components: {
@@ -295,6 +297,20 @@ export default {
       default: function () {
         return {};
       }
+    },
+    isMore:{
+      type: Boolean,
+      default: false
+    },
+    moreConditions:{
+      type: Array,
+      default: function () {
+        return [];
+      }
+    },
+    conditionIndex:{//当前是多条件中的哪一个
+      type: Number,
+      default: 0
     }
   },
   data(){
@@ -331,14 +347,14 @@ export default {
       // 重构多条件列表结构,包含独立的tags和公式
       conditionList:[
         {
-          innerList: [
+          formulaIfElse: [
             {
               tag2: '',
               tags2: [],
               tag3: '',
               tags3: [],
               symbol1: '',
-              logicSymbol: 'and'
+              logicSymbol: '&&'
             }
           ],
           tag4: '',
@@ -352,6 +368,8 @@ export default {
     }
   },
   mounted(){
+    console.log(this.formulainfo,'this.formulainfo333333');
+    
     let args0 = this.formulainfo.arguments[0];
     let args1 = this.formulainfo.arguments[1];
     let args2 = this.formulainfo.arguments[2];
@@ -365,13 +383,74 @@ export default {
       this.result = '2';
       this.initTFFormula(args1,args2)
     }
+    if(this.isMore){
+      this.symbol = 'more';
+      console.log( this.moreConditions,' this.moreConditions;');
+      
+      this.conditionList = this.moreConditions.map(item => this.clearTagsIfHasValue(item));
 
-    // 初始化多条件数据
-    if (this.symbol === 'more' && this.formulainfo.arguments[0] && Array.isArray(this.formulainfo.arguments[0])) {
-      this.initMultiConditions(this.formulainfo.arguments[0]);
+       
+      
+    }else{
+      // this.conditionList=[]
     }
+    
   },
   methods:{
+
+    clearTagsIfHasValue(obj) {
+           // 复制对象以避免修改原对象
+            const result = JSON.parse(JSON.stringify(obj));
+            
+            // 检查tags数组中是否存在name不为空的元素
+            const hasNonEmptyNameElement = (tagsArray) => {
+                return tagsArray && Array.isArray(tagsArray) && 
+                      tagsArray.length > 0 && 
+                      tagsArray.some(item => typeof item.name === 'string' && item.name.trim() !== '');
+            };
+                
+    // 检查tags数组中是否存在name为空字符串的元素
+    const hasEmptyNameElement = (tagsArray) => {
+        return tagsArray && Array.isArray(tagsArray) && 
+               tagsArray.length > 0 && 
+               tagsArray.some(item => typeof item.name === 'string' && item.name.trim() === '');
+    };
+                // 处理顶层的tags4和tags5
+    if (hasEmptyNameElement(result.tags4)) {
+        result.tags4 = [];  // 赋值为null
+    }
+    if (hasEmptyNameElement(result.tags5)) {
+        result.tags5 = [];  // 赋值为null
+    }
+            // 处理顶层的tag4和tag5
+            if (hasNonEmptyNameElement(result.tags4)) {
+                result.tag4 = "";  // 清空对应的tag值
+            }
+            if (hasNonEmptyNameElement(result.tags5)) {
+                result.tag5 = "";  // 清空对应的tag值
+            }
+            
+            // 处理formulaIfElse数组中的tag2和tag3
+            if (result.formulaIfElse && Array.isArray(result.formulaIfElse)) {
+                result.formulaIfElse.forEach(item => {
+                    if (hasNonEmptyNameElement(item.tags2)) {
+                        item.tag2 = "";   // 清空对应的tag值
+                    }
+                    if (hasNonEmptyNameElement(item.tags3)) {
+                        item.tag3 = "";   // 清空对应的tag值
+                    }
+                         if (hasEmptyNameElement(item.tags2)) {
+                            item.tags2 = [];   // 赋值为null
+                        }
+                        if (hasEmptyNameElement(item.tags3)) {
+                            item.tags3 = [];   // 赋值为null
+                        }
+                });
+            }
+            
+    return result;
+          },
+
     showSelectEle(){
       this.$set(this.formulainfo,'showSelectEle',!this.formulainfo.showSelectEle);
     },
@@ -412,7 +491,7 @@ export default {
       let target;
       
       if (innerIndex !== null) {
-        target = conditionItem.innerList[innerIndex];
+        target = conditionItem.formulaIfElse[innerIndex];
       } else {
         target = conditionItem;
       }
@@ -831,7 +910,7 @@ export default {
         
         // 确定目标对象
         if (innerIndex !== null) {
-          target = conditionItem.innerList[innerIndex];
+          target = conditionItem.formulaIfElse[innerIndex];
         } else {
           target = conditionItem;
         }
@@ -946,6 +1025,8 @@ export default {
 
     //初始化真假值判断if(xxx)部分
     initCondition(args0){
+  
+      
       if(args0){
         if(args0.length == 3){
           //运算符号
@@ -1029,25 +1110,25 @@ export default {
       if (Array.isArray(args0)) {
         this.conditionList = args0.map(condition => {
           // 处理内部条件列表
-          const innerList = Array.isArray(condition.innerList) ? 
-            condition.innerList.map(inner => ({
+          const formulaIfElse = Array.isArray(condition.formulaIfElse) ? 
+            condition.formulaIfElse.map(inner => ({
               tag2: inner.tag2 || '',
               tags2: inner.tags2 || [],
               tag3: inner.tag3 || '',
               tags3: inner.tags3 || [],
               symbol1: inner.symbol1 || '',
-              logicSymbol: inner.logicSymbol || 'and'
+              logicSymbol: inner.logicSymbol || '&&'
             })) : [{
               tag2: '',
               tags2: [],
               tag3: '',
               tags3: [],
               symbol1: '',
-              logicSymbol: 'and'
+              logicSymbol: '&&'
             }];
           
           return {
-            innerList,
+            formulaIfElse,
             tag4: condition.tag4 || '',
             tags4: condition.tags4 || [],
             tag5: condition.tag5 || '',
@@ -1102,7 +1183,7 @@ export default {
       } else {
         // 处理多条件情况
         this.formulainfo.arguments[0] = this.conditionList.map(condition => ({
-          innerList: condition.innerList.map(inner => ({
+          formulaIfElse: condition.formulaIfElse.map(inner => ({
             tag2: inner.tag2,
             tags2: inner.tags2,
             tag3: inner.tag3,
@@ -1227,14 +1308,14 @@ export default {
       // 复制最后一个条件的结构作为新条件的基础
       const newCondition = JSON.parse(JSON.stringify(this.conditionList[index]));
       // 清空值但保留结构
-      newCondition.innerList = [
+      newCondition.formulaIfElse = [
         {
           tag2: '',
           tags2: [],
           tag3: '',
           tags3: [],
           symbol1: '',
-          logicSymbol: 'and'
+          logicSymbol: '&&'
         }
       ];
       newCondition.tag4 = '';
@@ -1266,17 +1347,17 @@ export default {
         tag3: '',
         tags3: [],
         symbol1: '',
-        logicSymbol: 'and'
+        logicSymbol: '&&'
       };
       
-      this.conditionList[conditionIndex].innerList.splice(innerIndex + 1, 0, newInnerItem);
+      this.conditionList[conditionIndex].formulaIfElse.splice(innerIndex + 1, 0, newInnerItem);
       this.setCondition();
     },
 
     // 删除内部条件项
     removeConditionItem(conditionIndex, innerIndex) {
-      if (this.conditionList[conditionIndex].innerList.length > 1) {
-        this.conditionList[conditionIndex].innerList.splice(innerIndex, 1);
+      if (this.conditionList[conditionIndex].formulaIfElse.length > 1) {
+        this.conditionList[conditionIndex].formulaIfElse.splice(innerIndex, 1);
         this.setCondition();
       } else {
         this.$message({ type: "warning", message: "至少保留一个条件项" });

+ 19 - 17
src/views/formula/editc-1.vue → src/views/formula/edit-old.vue

@@ -39,7 +39,7 @@
       </div>
     </div>
     <div class="box-dashed">
-      <div class="mg-b-20">函数公式..(节点公式)</div>
+      <div class="mg-b-20">函数公式..</div>
       <div class="edit-text">
         <span>
           <formula-item
@@ -48,7 +48,7 @@
           >
           </formula-item>
         </span>
-        <span style="margin-left: 5px;margin-right: 5px;">=</span>
+        <span>=</span>
         <span   v-for="(item,index) in processFormula"     :key="index">
           <el-tooltip class="item" effect="light" placement="top-start" :disabled="item.type!=='Element'">
             <div slot="content">{{item.tableName }}</div>
@@ -66,16 +66,24 @@
       </div>
     </div>
     <div v-show="operationVisible" class="operation-box flex1 flex flex-d-c ov-hidden">
-      <div class="flex ">
-        <div>选择参数设置</div>
-        <div style="margin-left: 29%;font-weight: 700;">公式配置</div>
-      </div>
+      <div>选择参数设置</div>
       <div class="flex flex-d-c flex1 ov-hidden">
         <el-row :gutter="20" class="flex1 ov-hidden">
           <el-col :span="8" class="h-100p">
             <el-card shadow="never" v-loading="treeLoad" class="h-100p ov-auto">
               <el-scrollbar style="height: 100%">
-              
+                <!-- <el-tree
+                  class="filter-tree"
+                  lazy
+                  :load="loadNode"
+                  @node-click="getNodeDetail"
+                  :props="defaultProps"
+                  :expand-on-click-node="false"
+                  highlight-current
+                  node-key="id"
+                  ref="tree"
+                >
+                </el-tree> -->
                 <el-tree
                   class="filter-tree"
                   :data="treeData"
@@ -92,11 +100,6 @@
             </el-card>
           </el-col>
           <el-col :span="16" class="h-100p flex flex-d-c ov-hidden">
-             <div class="operation-box-inset">
-                <div class="operation-box-inset">
-                  插入运算符
-                </div>
-             </div>
             <div class="flex" style="justify-content: space-between;width:100%">
                <el-select v-model="eleTableId" @change="getTableEle" placeholder="请选择元素表1" style="width:45%">
                 <el-option v-if="paramDataList.length" label="选择节点参数2" value="选择节点参数"></el-option>
@@ -436,6 +439,7 @@ import datasReme from "./component/funComponent/datasReme"
 import datasGetlist from "./component/funComponent/datasGetlist"
 import datasJoin from "./component/funComponent/datasJoin"
 import ifelse from "./component/funComponent/ifelse"
+import dataChange from "./component/funComponent/dataChange"
 
 import deviationRange from "./component/deviationRange/deviationRange"
 import {rangeToString} from "./component/deviationRange/rangeToString"
@@ -462,7 +466,8 @@ export default {
     datasJoin,
     ifelse,
  
-    deviationRange
+    deviationRange,
+    dataChange
   },
   props: {
     wbsid:{
@@ -558,6 +563,7 @@ export default {
         '下标取数':'datas-getlist',
         // '数组转字符串':"datas-join",
         '判断':'ifelse',
+        '数据自变':'data-change'
       
       },
 
@@ -1841,8 +1847,4 @@ export default {
     height: 100%;
   }
 }
-.operation-box-inset{
-  display: flex;
-  flex-direction: column;
-}
 </style>

+ 339 - 8
src/views/formula/edit.vue

@@ -39,7 +39,7 @@
       </div>
     </div>
     <div class="box-dashed">
-      <div class="mg-b-20">函数公式..</div>
+      <div class="mg-b-20">函数公式..(节点公式)</div>
       <div class="edit-text">
         <span>
           <formula-item
@@ -48,7 +48,7 @@
           >
           </formula-item>
         </span>
-        <span>=</span>
+        <span style="margin-left: 5px;margin-right: 5px;">=</span>
         <span   v-for="(item,index) in processFormula"     :key="index">
           <el-tooltip class="item" effect="light" placement="top-start" :disabled="item.type!=='Element'">
             <div slot="content">{{item.tableName }}</div>
@@ -205,7 +205,17 @@
           <template v-else>
             <div class="flex" >
               <div class=" flex-d-c"  style="width:40%">
-                <component ref="dynamiccomponent" v-bind:is="componentMap[item.name]" :formulainfo="item" :curele="equationSelectEle" :formulamap="formulaMap" @uncheck="unCheckEleComp" class="flex1"></component>
+                <component ref="dynamiccomponent" 
+                v-bind:is="componentMap[item.name]" 
+                :formulainfo="item" 
+                :curele="equationSelectEle" 
+                :formulamap="formulaMap"
+                :map="formulaDetailMap"
+                 @uncheck="unCheckEleComp" 
+                 class="flex1" 
+                 :moreConditions="moreConditions" 
+                :isMore="isMore">
+              </component>
                 <div class="flex1" v-show="item.showSelectEle" style="margin-top:10px;margin-bottom:30px">
                   <el-scrollbar style="height: 400px">
                     <el-tree
@@ -439,7 +449,6 @@ import datasReme from "./component/funComponent/datasReme"
 import datasGetlist from "./component/funComponent/datasGetlist"
 import datasJoin from "./component/funComponent/datasJoin"
 import ifelse from "./component/funComponent/ifelse"
-import dataChange from "./component/funComponent/dataChange"
 
 import deviationRange from "./component/deviationRange/deviationRange"
 import {rangeToString} from "./component/deviationRange/rangeToString"
@@ -466,8 +475,7 @@ export default {
     datasJoin,
     ifelse,
  
-    deviationRange,
-    dataChange
+    deviationRange
   },
   props: {
     wbsid:{
@@ -563,7 +571,6 @@ export default {
         '下标取数':'datas-getlist',
         // '数组转字符串':"datas-join",
         '判断':'ifelse',
-        '数据自变':'data-change'
       
       },
 
@@ -591,6 +598,10 @@ export default {
       version:1,//版本号,以后可能会有不兼容旧公式的改动,留作以后可能用来判断
       input3:'',//搜索元素字段
       eleListable:false,
+      isMore:false,//是否是多条件判断
+      moreConditions:[],//多条件判断数组
+      formulaDetailMap:{},//公式详情map
+
     };
   },
   computed: {
@@ -1167,6 +1178,8 @@ export default {
     },
         //获取当前元素的表名
      getItemTableName(item){
+
+      
       if(item.type==="Element"){
         this.rightDict.forEach((ele)=>{
           if(ele.ekey===item.tableElementKey){
@@ -1359,11 +1372,284 @@ export default {
 
       return true;
     },
+  formatArrayMore(inputArray) {
+    console.log(inputArray,'inputArray');
+    
+   // 定义字段映射关系
+    const fieldMappings = {
+        'tag2': 'parameter1',
+        'tag3': 'parameter2',
+        'symbol1': 'symbol',
+        'logicSymbol': 'groupTerm',
+        'tag4': 'trueData',
+        'tag5': 'falseData'
+    };
+    
+    // 处理值的格式化,将特定格式字符串包裹在E[]中
+    function formatValue(value) {
+        // 检查是否是符合格式的字符串(包含:key_)
+        if (typeof value === 'string' && value.includes(':key_')) {
+            return `E[${value}]`;
+        }
+        return value;
+    }
 
+    // 处理单个对象的函数
+    function processObject(obj) {
+        const result = {};
+        
+            // 处理formulaIfElse(如果存在)
+            if (obj.formulaIfElse && Array.isArray(obj.formulaIfElse)) {
+                result.formulaIfElse = obj.formulaIfElse.map(item => processObject(item));
+            }
+            
+            // 处理其他字段映射
+            Object.keys(obj).forEach(key => {
+                // 特殊处理tags2、tags3、tags4和tags5
+                if (key === 'tags2' && Array.isArray(obj.tags2) && obj.tags2.length > 0) {
+                    // 如果tags2有值,取第一个对象的tableElementKey作为parameter1的值,并格式化
+                    const value = obj.tags2[0].tableElementKey || '';
+                    result.parameter1 = formatValue(value);
+                } 
+                else if (key === 'tags3' && Array.isArray(obj.tags3) && obj.tags3.length > 0) {
+                    // 如果tags3有值,取第一个对象的tableElementKey作为parameter2的值,并格式化
+                    const value = obj.tags3[0].tableElementKey || '';
+                    result.parameter2 = formatValue(value);
+                }
+                else if (key === 'tags4' && Array.isArray(obj.tags4) && obj.tags4.length > 0) {
+                    // 如果tags4有值,取第一个对象的tableElementKey作为trueData的值,并格式化
+                    const value = obj.tags4[0].tableElementKey || '';
+                    result.trueData = formatValue(value);
+                }
+                else if (key === 'tags5' && Array.isArray(obj.tags5) && obj.tags5.length > 0) {
+                    // 如果tags5有值,取第一个对象的tableElementKey作为falseData的值,并格式化
+                    const value = obj.tags5[0].tableElementKey || '';
+                    result.falseData = formatValue(value);
+                }
+                // 处理其他映射字段
+                else if (fieldMappings[key]) {
+                    // 只有当对应的tags数组没有提供值时,才使用原始字段值
+                    if ((key === 'tag2' && !result.parameter1) || 
+                        (key === 'tag3' && !result.parameter2) ||
+                        (key === 'tag4' && !result.trueData) ||
+                        (key === 'tag5' && !result.falseData) ||
+                        !['tag2', 'tag3', 'tag4', 'tag5'].includes(key)) {
+                        // 对原始字段值也进行格式化处理
+                        result[fieldMappings[key]] = formatValue(obj[key]);
+                    }
+                }
+            });
+            
+            return result;
+        }
+        
+        // 处理整个数组
+        return inputArray.map(item => processObject(item));
+  },
+restoreArrayMore(processedArray) {
+    // 定义反转的字段映射关系(与原方法相反)
+    const reverseMappings = {
+        'parameter1': 'tag2',
+        'parameter2': 'tag3',
+        'symbol': 'symbol1',
+        'groupTerm': 'logicSymbol',
+        'trueData': 'tag4',
+        'falseData': 'tag5'
+    };
+    
+    // 从this.map获取完整元素信息并构建tags对象
+    const getTagElement = (tableElementKey) => {
+        const objTargetData = JSON.parse(this.formulaDetailMap);
+        const baseData = objTargetData[tableElementKey] || {};
+        // 返回完整的tags元素结构
+        return {
+            "type": baseData.type || "Element",
+            "name": baseData.name || "",
+            "id": baseData.id || "",
+            "selected": false,
+            "tableElementKey": tableElementKey,
+            "children": [],
+            "text": baseData.name || "", // text与name保持一致
+            "style": "background-color: #409EFF" // 保持示例中的样式
+        };
+    };
+    
+    // 还原值的格式化,去掉E[]包裹
+    function restoreValue(value) {
+        if (typeof value === 'string' && value.startsWith('E[') && value.endsWith(']')) {
+            const innerValue = value.slice(2, -1);
+            if (innerValue.includes(':key_')) {
+                return innerValue;
+            }
+        }
+        return value;
+    }
+
+    // 还原单个对象的函数
+    function restoreObject(obj) {
+        const result = {};
+        
+        // 递归还原formulaIfElse(如果存在)
+        if (obj.formulaIfElse && Array.isArray(obj.formulaIfElse)) {
+            result.formulaIfElse = obj.formulaIfElse.map(item => restoreObject(item));
+        }
+        
+        // 处理参数与tags数组的还原
+        Object.keys(obj).forEach(key => {
+            const restoredValue = restoreValue(obj[key]);
+            
+            // parameter1对应tags2和tag2
+            if (key === 'parameter1') {
+                result.tags2 = [getTagElement(restoredValue)];
+                result[reverseMappings[key]] = restoredValue;
+            }
+            // parameter2对应tags3和tag3
+            else if (key === 'parameter2') {
+                result.tags3 = [getTagElement(restoredValue)];
+                result[reverseMappings[key]] = restoredValue;
+            }
+            // trueData对应tags4和tag4
+            else if (key === 'trueData') {
+                result.tags4 = [getTagElement(restoredValue)];
+                result[reverseMappings[key]] = restoredValue;
+            }
+            // falseData对应tags5和tag5
+            else if (key === 'falseData') {
+                result.tags5 = [getTagElement(restoredValue)];
+                result[reverseMappings[key]] = restoredValue;
+            }
+            // 处理其他映射字段
+            else if (reverseMappings[key]) {
+                result[reverseMappings[key]] = restoredValue;
+            }
+        });
+        
+        return result;
+    }
+    
+    // 还原整个数组
+    return processedArray.map(item => restoreObject(item));
+},
+  generateResult(input) {
+     // 检查输入是否有效
+    if (!Array.isArray(input) || input.length === 0) {
+        return null;
+    }
+    
+    // 构建结果对象
+    const result = {};
+    
+    // 处理标签的通用函数
+    const processTags = (tags) => {
+        if (tags && Array.isArray(tags)) {
+            tags.forEach(tag => {
+                const key = tag.tableElementKey;
+                if (key) {
+                    // 如果存在相同的key,这里会覆盖之前的值
+                    // 如有需要,可以修改为数组或其他处理方式
+                    result[key] = {
+                        id: tag.id,
+                        name: tag.name,
+                        tableElementKey: key,
+                        type: tag.type
+                    };
+                }
+            });
+        }
+    };
+    
+    // 遍历输入数组中的每一个对象元素
+    input.forEach(data => {
+        // 处理当前对象中的所有formulaIfElse元素
+        if (data.formulaIfElse && Array.isArray(data.formulaIfElse)) {
+            data.formulaIfElse.forEach(formulaItem => {
+                // 处理每个formulaIfElse元素中的标签
+                processTags(formulaItem.tags2);
+                processTags(formulaItem.tags3);
+            });
+        }
+        
+        // 处理当前对象根级别的标签
+        processTags(data.tags4);
+        processTags(data.tags5);
+    });
+    
+    // 检查是否有数据
+    if (Object.keys(result).length === 0) {
+        return null;
+    }
+    
+    return result;
+},
     //保存公式
     saveFormula(){
       console.log('保存',this.pid);
       console.log(this.processFormula,'this.processFormula1111111112333');
+      console.log(this.resultFormula,'this.resultFormula1111111112333');
+      console.log(this.$refs.dynamiccomponent,'this.$refs.dynamiccomponent');
+      
+      if(this.$refs.dynamiccomponent&&this.$refs.dynamiccomponent.length>0&&this.$refs.dynamiccomponent[0]&& this.$refs.dynamiccomponent[0].symbol=='more'){
+        //多条件保存公式
+
+        console.log('this.$refs.dynamiccomponent[0]',this.$refs.dynamiccomponent[0].conditionList);
+        let resMore=this.formatArrayMore(this.$refs.dynamiccomponent[0].conditionList);
+        const resJson=this.generateResult(this.$refs.dynamiccomponent[0].conditionList);
+     
+            if(this.formulaid){
+              updateFormula({
+                id:this.formulaid,
+                formula:'',
+                formulas:resMore,
+                remark:'',
+                nodeId:this.nodeid,
+                elementId:this.eleid,
+                scale:this.isRetain?this.retainNum:'',
+                number:number,
+                map:JSON.stringify(resJson),
+                scope:this.globaltype,
+                // projectId:this.curProjiect.id||this.projectId,
+                projectId:this.curProjiect.id||this.pid,
+                dev:deviationRangeText
+              }).then(()=>{
+                this.formulaStringToArray();
+                this.$message({
+                  type: "success",
+                  message: "修改成功"
+                });
+              })
+            }else{
+              saveFormula({
+                formula:'',
+                formulas:resMore,
+                remark:'',
+                nodeId:this.nodeid,
+                elementId:this.eleid,
+                scale:this.isRetain?this.retainNum:'',
+                number:number,
+                map:JSON.stringify(resJson),
+                scope:this.globaltype,
+                dev:deviationRangeText,
+                // projectId:this.curProjiect.id||this.projectId,
+                projectId:this.curProjiect.id||this.pid,
+                ver:this.version
+              }).then((res)=>{
+                if(res.data.data){
+                  this.formulaid = res.data.data;
+                }
+                this.formulaStringToArray();
+                this.$message({
+                  type: "success",
+                  message: "保存成功"
+                });
+              })
+            }
+            
+            return;
+        
+        
+      }
+      
+      
       let arr=JSON.parse(JSON.stringify(this.processFormula));
       let filteredArr = arr.filter(item => item.id ===this.checkGsId);
       let obj
@@ -1465,6 +1751,20 @@ export default {
     async formulaStringToArray(){
       let detail = (await formulaDetail({elementId:this.eleid,scope:this.globaltype,nodeId:this.nodeid,projectId:this.curProjiect.id||this.pid})).data.data;
       console.log(detail,'detail');
+      if(detail&&detail.formula.includes('FC.ifelseMulti')){
+        detail.formula = detail.formula.replace('FC.ifelseMulti','FC.ifelse');
+        this.isMore = true;
+            this.formulaDetailMap = detail.map;
+        this.moreConditions =  this.restoreArrayMore(detail.formulas)
+    
+      }else{
+        this.isMore = false;
+        this.moreConditions = []
+        this.formulaDetailMap ={}
+
+      }
+
+    
       if(detail&&detail.id){
           //获取右边元素的字典
           let dictMap=detail.dict
@@ -1475,8 +1775,12 @@ export default {
 
         }
         this.rightDict=dictArr
+        console.log( this.rightDict,' this.rightDict');
+        
         this.formulaid = detail.id;
         //let formula = formulaStringToArray('FC.sum(FC.repeat(E[测试测试_222]))+FC.ifelse(3<E[测试测试_333]&&E[测试测试_333]<10,E[测试测试_222]+E[测试测试_333],E[测试测试_333])',detail.map,this.formulaMap);
+        console.log(this.formulaMap,'this.formulaMap');
+        
         let formula = formulaStringToArray(detail.formula,detail.map,this.formulaMap);
         this.processFormula = formula.processFormula;
         formula.resultFormula[0].id = this.resultFormula[0].id;
@@ -1834,7 +2138,7 @@ export default {
 }
 
 .icon-box .el-link{
-  font-size: 24px;
+  font-size: 14px;
   margin-right: 10px;
 }
 </style>
@@ -1847,4 +2151,31 @@ export default {
     height: 100%;
   }
 }
+.operation-box-inset{
+  display: flex;
+  flex-direction: column;
+}
 </style>
+<style scoped>
+.operation-symbol-box{
+  display: flex;
+  align-items: center;
+  border: 1px solid rgb(229, 231, 235);
+  background-color: #F9FAFB;
+  padding: 10px 10px;
+  border-radius:  5px 5px 0px 0px;
+  margin-top: 10px;
+  
+}
+.sele-ele-box1{
+  padding: 10px;
+  border: 1px solid rgb(229, 231, 235);
+  border-radius: 0px 0px 5px 5px;
+
+  height: 50px;
+}
+.text-sm{
+  font-size: 14px;
+  margin-right: 10px;
+}
+</style>