Ver código fonte

Merge branch 'test-dev' of http://219.151.181.73:3000/web/saber into test-dev

lvy 1 mês atrás
pai
commit
988db1da10

+ 7 - 0
src/api/exctab/exceltab.js

@@ -89,4 +89,11 @@ export const getExcelPdf= (form) => {
     method: 'post',
     data:form
   })
+}
+export const getTempExcelFileUrl= (form) => {
+  return request({
+    url: '/api/blade-user/excel-table/getTempExcelFileUrl',
+    method: 'post',
+    data:form
+  })
 }

+ 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
     }
   })
 }

+ 2 - 2
src/components/PdfView.vue

@@ -5,11 +5,11 @@
     append-to-body
     title="查看pdf文件"
     :visible="drawerVisible"
-     :with-header="false"
+  
     :before-close="handleClose">
      <div style="height: 100%;">
       <!-- 保存按钮 -->
-      <div style="position: absolute; top: 20px; right: 20px; z-index: 100;">
+      <div style="position: absolute; top: 20px; right: 60px; z-index: 100;">
         <el-button 
         v-if="isSave"
         :loading="saveExcelJsonLoadPdf"

+ 7 - 3
src/views/exctab/excelmodel/excelmodel.vue

@@ -268,7 +268,7 @@ import VabOnlyOffice from '@/components/online-office/index'
  import PdfView from '@/components/PdfView.vue';
 import screenfull from "screenfull";
 import LuckySheet from '@/components/lucky-sheet-editor/LuckySheet.vue'
-import {getExcelJson,saveExcelJson,getExcelPdf} from '@/api/exctab/exceltab';
+import {getExcelJson,saveExcelJson,getExcelPdf,getTempExcelFileUrl} from '@/api/exctab/exceltab';
 export default {
   components: {
     ManualSorting, VabOnlyOffice,LuckySheet,PdfView
@@ -1149,16 +1149,20 @@ async saveExcelInfo() {
       this.saveExcelJsonLoad = true; // 开始加载
       try {
       
-        const { data: res } = await getExcelPdf({
+        const { data: res } = await getTempExcelFileUrl({
           key: this.from.id,
           jsonExcel: JSON.stringify(saveData)
         });
         
         if (res.code === 200) {
           console.log(res.data,'data');
+        const { data: res1 } = await getExcelPdf({
+          key: this.from.id,
+          url: res1.data
+        });
 
           this.$nextTick(() => {
-            this.$refs.pdfDrawerExcelRef.show(res.data,true)
+            this.$refs.pdfDrawerExcelRef.show(res1.data,true)
           
           })
           

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


+ 216 - 131
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 
@@ -192,65 +194,68 @@
               <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': isCurFocus(conditionIndex, null, 'formula1')}" 
-                 @click="setMultiFocus(conditionIndex, null, 'formula1')">
-              <div class="flex jc-sb mg-b-20">
-                <div class="icon-box">
-                  <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="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>
+            <template v-if="result == 2">
+              <div class="mg-t-20"  >
+                    <div class="flex">
+                      <span class="textblod mg-r-10">满足</span>
+                      <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 class="icon-box">
+                            <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="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="conditionList[conditionIndex].formula1">
+                          <formula-item 
+                            v-for="(item,index) in conditionList[conditionIndex].formula1" :key="index" 
+                            :item="item" @click="obj => eleFormulaClickMulti(obj, index, conditionIndex, 'formula1')"
+                          >
+                          </formula-item>
+                        </draggable>
+                      </div>
+                    </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': isCurFocus(conditionIndex, null, 'formula2')}" 
+                          @click="setMultiFocus(conditionIndex, null, 'formula2')">
+                        <div class="flex jc-sb mg-b-20">
+                          <div class="icon-box">
+                            <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-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="conditionList[conditionIndex].formula2">
+                          <formula-item 
+                            v-for="(item,index) in conditionList[conditionIndex].formula2" :key="index" 
+                            :item="item" @click="obj => eleFormulaClickMulti(obj, index, conditionIndex, 'formula2')"
+                          >
+                          </formula-item>
+                        </draggable>
+                      </div>
+                    </div>
+                  <el-button size="small" @click="addCondition(conditionIndex)" type="primary">添加条件</el-button>
               </div>
-              <draggable v-model="conditionList[conditionIndex].formula1">
-                <formula-item 
-                  v-for="(item,index) in conditionList[conditionIndex].formula1" :key="index" 
-                  :item="item" @click="obj => eleFormulaClickMulti(obj, index, conditionIndex, 'formula1')"
-                >
-                </formula-item>
-              </draggable>
-            </div>
-          </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': isCurFocus(conditionIndex, null, 'formula2')}" 
-                 @click="setMultiFocus(conditionIndex, null, 'formula2')">
-              <div class="flex jc-sb mg-b-20">
-                <div class="icon-box">
-                  <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-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="conditionList[conditionIndex].formula2">
-                <formula-item 
-                  v-for="(item,index) in conditionList[conditionIndex].formula2" :key="index" 
-                  :item="item" @click="obj => eleFormulaClickMulti(obj, index, conditionIndex, 'formula2')"
-                >
-                </formula-item>
-              </draggable>
-            </div>
-          </div>
-        
-        </div>
+        </template>
+      
       </div>
      </template>
 
@@ -268,7 +273,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 +300,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 +350,14 @@ export default {
       // 重构多条件列表结构,包含独立的tags和公式
       conditionList:[
         {
-          innerList: [
+          formulaIfElse: [
             {
               tag2: '',
               tags2: [],
               tag3: '',
               tags3: [],
               symbol1: '',
-              logicSymbol: 'and'
+              logicSymbol: '&&'
             }
           ],
           tag4: '',
@@ -352,6 +371,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 +386,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 +494,7 @@ export default {
       let target;
       
       if (innerIndex !== null) {
-        target = conditionItem.innerList[innerIndex];
+        target = conditionItem.formulaIfElse[innerIndex];
       } else {
         target = conditionItem;
       }
@@ -649,6 +731,7 @@ export default {
     // 多条件下点选公式中的元素
     eleFormulaClickMulti({selected,item}, index, conditionIndex, formulaType) {
       const eleFormula = this.conditionList[conditionIndex][formulaType];
+      console.log(eleFormula,'eleFormula');
       
       if(selected){
         eleFormula.forEach((ele)=>{
@@ -821,7 +904,7 @@ export default {
       this.multiFocus.field = formulaType;
       this.inputVisible = true;
     },
-
+    
     setELe(ele){
       // 处理多条件情况
       if (this.symbol === 'more' && this.multiFocus.conditionIndex !== -1) {
@@ -831,7 +914,7 @@ export default {
         
         // 确定目标对象
         if (innerIndex !== null) {
-          target = conditionItem.innerList[innerIndex];
+          target = conditionItem.formulaIfElse[innerIndex];
         } else {
           target = conditionItem;
         }
@@ -946,6 +1029,8 @@ export default {
 
     //初始化真假值判断if(xxx)部分
     initCondition(args0){
+  
+      
       if(args0){
         if(args0.length == 3){
           //运算符号
@@ -1029,25 +1114,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 +1187,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 +1312,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 +1351,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: "至少保留一个条件项" });

+ 381 - 0
src/views/formula/component/funComponent/multiIfElseTools.js

@@ -0,0 +1,381 @@
+/**
+ * 将数组转换为表达式字符串
+ * @param {Array} arr 输入的数组,包含不同类型的元素
+ * @returns {string} 拼接后的表达式字符串
+ */
+export function convertArrayToExpression(arr) {
+  const result = [];
+  
+  // 遍历输入数组的每个元素
+  arr.forEach(item => {
+    switch (item.type) {
+      case 'Element':
+        // 对于Element类型,提取tableElementKey并包裹在E[]中
+        result.push(`E[${item.tableElementKey}]`);
+        break;
+      case 'Operator':
+        // 对于Operator类型,提取ft属性
+        result.push(item.template.ft || item.ft || '');
+        break;
+      case 'Text':
+        // 对于Text类型,直接使用name属性
+        result.push(item.name);
+        break;
+      default:
+        // 处理未知类型
+        console.warn('未知类型:', item.type);
+    }
+  });
+  
+  // 将结果数组拼接成字符串并返回
+  return result.join('');
+}
+
+export function 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));
+      }
+      
+      // 处理formula1和formula2,转换后赋值给trueData和falseData
+      if (obj.formula1 && Array.isArray(obj.formula1) && obj.formula1.length > 0) {
+          result.trueData = convertArrayToExpression(obj.formula1);
+          result.trueDataArray = obj.formula1;
+      }
+      
+      if (obj.formula2 && Array.isArray(obj.formula2) && obj.formula2.length > 0) {
+          result.falseData = convertArrayToExpression(obj.formula2);
+          result.falseDataArray = obj.formula2;
+      }
+      
+      // 处理其他字段映射
+      Object.keys(obj).forEach(key => {
+          // 特殊处理tags2、tags3、tags4和tags5
+          if (key === 'tags2' && Array.isArray(obj.tags2) && obj.tags2.length > 0) {
+              const value = obj.tags2[0].tableElementKey || '';
+              if (!result.parameter1) {
+                  result.parameter1 = formatValue(value);
+              }
+          } 
+          else if (key === 'tags3' && Array.isArray(obj.tags3) && obj.tags3.length > 0) {
+              const value = obj.tags3[0].tableElementKey || '';
+              if (!result.parameter2) {
+                  result.parameter2 = formatValue(value);
+              }
+          }
+          else if (key === 'tags4' && Array.isArray(obj.tags4) && obj.tags4.length > 0) {
+              const value = obj.tags4[0].tableElementKey || '';
+              if (!result.trueData) {
+                  result.trueData = formatValue(value);
+              }
+          }
+          else if (key === 'tags5' && Array.isArray(obj.tags5) && obj.tags5.length > 0) {
+              const value = obj.tags5[0].tableElementKey || '';
+              if (!result.falseData) {
+                  result.falseData = formatValue(value);
+              }
+          }
+          // 处理其他映射字段
+          else if (fieldMappings[key]) {
+              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));
+}
+
+export function restoreArrayMore(processedArray, formulaDetailMap) {
+  // 定义反转的字段映射关系(与原方法相反)
+  const reverseMappings = {
+      'parameter1': 'tag2',
+      'parameter2': 'tag3',
+      'symbol': 'symbol1',
+      'groupTerm': 'logicSymbol',
+      'trueData': 'tag4',
+      'falseData': 'tag5'
+  };
+  
+  // 从map获取完整元素信息并构建tags对象
+  const getTagElement = (tableElementKey) => {
+      try {
+          const objTargetData = typeof formulaDetailMap === 'string' 
+              ? JSON.parse(formulaDetailMap) 
+              : formulaDetailMap;
+          const baseData = objTargetData[tableElementKey] || {};
+          return {
+              "type": baseData.type || "Element",
+              "name": baseData.name || "",
+              "id": baseData.id || "",
+              "selected": false,
+              "tableElementKey": tableElementKey,
+              "children": [],
+              "text": baseData.name || "",
+              "style": "background-color: #409EFF"
+          };
+      } catch (error) {
+          console.error('Error parsing formulaDetailMap:', error);
+          return {
+              "type": "Element",
+              "name": "",
+              "id": "",
+              "selected": false,
+              "tableElementKey": tableElementKey,
+              "children": [],
+              "text": "",
+              "style": "background-color: #409EFF"
+          };
+      }
+  };
+  
+  // 解析表达式字符串为公式数组(修复符号与数字拆分问题)
+  function parseExpressionToFormula(expression) {
+      if (typeof expression !== 'string') return [];
+      
+      const formula = [];
+      const len = expression.length;
+      let currentPos = 0;
+      
+      // 定义所有运算符
+const operators = new Set(['+', '-', '*', '/', '%', '=', '>', '<', '!', '&', '|', '≥', '≤', '≠', '(', ')']);
+      
+      // 检查是否为运算符
+      const isOperatorChar = (char) => operators.has(char);
+      
+      // 跳过空白字符
+      const skipWhitespace = () => {
+          while (currentPos < len && /\s/.test(expression[currentPos])) {
+              currentPos++;
+          }
+      };
+      
+      while (currentPos < len) {
+          skipWhitespace();
+          if (currentPos >= len) break;
+          
+          const currentChar = expression[currentPos];
+          
+          // 处理元素 (E[...])
+          if (currentChar === 'E' && currentPos + 1 < len && expression[currentPos + 1] === '[') {
+              const endPos = expression.indexOf(']', currentPos + 2);
+              if (endPos !== -1) {
+                  const key = expression.substring(currentPos + 2, endPos);
+                  formula.push(getTagElement(key));
+                  currentPos = endPos + 1;
+              } else {
+                  // 无效格式,作为文本处理
+                  formula.push({ type: 'Text', name: expression.substring(currentPos) });
+                  break;
+              }
+          }
+          // 处理运算符
+          else if (isOperatorChar(currentChar)) {
+              let operator = currentChar;
+              currentPos++;
+              
+              // 处理多字符运算符 (如>=、<=、&&、||等)
+              while (currentPos < len && isOperatorChar(expression[currentPos])) {
+                  operator += expression[currentPos];
+                  currentPos++;
+              }
+              
+              formula.push({
+                  type: 'Operator',
+                  ft: operator,
+                  template: { ft: operator },
+                  name: operator,
+                  selected: false,
+                 
+                 
+                  
+              });
+          }
+          // 处理文本(数字或其他字符)
+          else {
+              let textEndPos = currentPos;
+              
+              // 收集所有非运算符、非元素的字符
+              while (textEndPos < len) {
+                  const char = expression[textEndPos];
+                  // 遇到运算符或元素开始则停止
+                  if (isOperatorChar(char) || (char === 'E' && textEndPos + 1 < len && expression[textEndPos + 1] === '[')) {
+                      break;
+                  }
+                  textEndPos++;
+              }
+              
+              const text = expression.substring(currentPos, textEndPos).trim();
+              if (text) {
+                  formula.push({
+                      type: 'Text',
+                      name: text,
+                        selected: false,
+                  });
+              }
+              
+              currentPos = textEndPos;
+          }
+      }
+      
+      return formula;
+  }
+  
+  // 还原值的格式化,去掉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));
+      }
+      
+      // 还原formula1和formula2
+      if (obj.trueData) {
+          result.formula1 = parseExpressionToFormula(obj.trueData);
+      }
+      if (obj.falseData) {
+          result.formula2 = parseExpressionToFormula(obj.falseData);
+      }
+      
+      // 处理参数与tags数组的还原
+      Object.keys(obj).forEach(key => {
+          const restoredValue = restoreValue(obj[key]);
+          
+          if (key === 'parameter1') {
+              result.tags2 = [getTagElement(restoredValue)];
+              result[reverseMappings[key]] = restoredValue;
+          }
+          else if (key === 'parameter2') {
+              result.tags3 = [getTagElement(restoredValue)];
+              result[reverseMappings[key]] = restoredValue;
+          }
+          else if (key === 'trueData') {
+              result.tags4 = [getTagElement(restoredValue)];
+              result[reverseMappings[key]] = restoredValue;
+          }
+          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));
+}
+
+export function 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) {
+                  result[key] = {
+                      id: tag.id,
+                      name: tag.name,
+                      tableElementKey: key,
+                      type: tag.type
+                  };
+              }
+          });
+      }
+  };
+  
+  // 处理公式数组(formula1和formula2)中的元素
+  const processFormula = (formula) => {
+      if (formula && Array.isArray(formula)) {
+          formula.forEach(item => {
+              if (item.type === 'Element' && item.tableElementKey) {
+                  const key = item.tableElementKey;
+                  result[key] = {
+                      id: item.id,
+                      name: item.name,
+                      tableElementKey: key,
+                      type: item.type
+                  };
+              }
+          });
+      }
+  };
+  
+  // 遍历输入数组中的每一个对象元素
+  input.forEach(data => {
+      if (data.formulaIfElse && Array.isArray(data.formulaIfElse)) {
+          data.formulaIfElse.forEach(formulaItem => {
+              processTags(formulaItem.tags2);
+              processTags(formulaItem.tags3);
+          });
+      }
+      
+      processTags(data.tags4);
+      processTags(data.tags5);
+      
+      processFormula(data.formula1);
+      processFormula(data.formula2);
+  });
+  
+  if (Object.keys(result).length === 0) {
+      return null;
+  }
+  
+  return result;
+}

+ 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>

+ 210 - 81
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>
@@ -66,24 +66,16 @@
       </div>
     </div>
     <div v-show="operationVisible" class="operation-box flex1 flex flex-d-c ov-hidden">
-      <div>选择参数设置</div>
+      <div class="flex ">
+        <div>选择参数设置</div>
+        <div style="margin-left: 29%;font-weight: 700;">公式配置</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"
@@ -100,70 +92,77 @@
             </el-card>
           </el-col>
           <el-col :span="16" class="h-100p flex flex-d-c ov-hidden">
-            <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>
-                <el-option  v-for="item in eleTableList" :key="item.id" :label="item.tableName" :value="(item.pkeyId!==null&&item.pkeyId!==-1)?item.pkeyId:item.id"></el-option>
-              </el-select>
-              <!-- 搜索元素下拉框 -->
-              <el-select v-model="input3" filterable clearable placeholder="搜索元素字段"  @change="getInput" style="width:45%">
-              <el-option
-                v-for="item in eleList1"
-                :key="item.id"
-                :label="item.eName"
-                :value="item.eName">
-              </el-option>
-              </el-select>
-            </div>
-           
-            <div class="mg-t-10 no-mb-col flex1 ov-hidden">
-              <el-scrollbar style="height: 100%">
-                <el-row v-loading="eleListable"  v-if="eleList.length>0">
-                  <el-col :span="6" v-for="item in eleList" :key="item.id" >
-                    <div class="ele-box">
-                      <span v-if="item.k">{{item.name}}</span>
-                      <span v-else>{{item.eName}}</span>
-                      <el-checkbox v-model="item.checked" @change="value => eleChang(value,item)"></el-checkbox>
-                    </div>
+            <div class="operation-box">
+              <!-- 运算符选择区域 -->
+                  <div class="flex jc-sb operation-symbol-box">
                     
-                  </el-col>
-                </el-row>
-                <el-row v-else style="text-align: center;line-height: 328px;border:1px solid #bbb">暂无数据</el-row>
-              </el-scrollbar>
-            </div>
-            <div class="flex jc-sb">
-              <!-- <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>
-              </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>
-            <div class="border-grey sele-ele-box" style="height:50px">
-              <draggable v-model="selectEleFormula">
-                <formula-item
-                  v-for="(item,index) in selectEleFormula" :key="index"
-                  :item="item" @click="obj => eleFormulaClick(obj,index)"
-                >
-                </formula-item>
-              </draggable>
+                    <div class="icon-box ">
+                        <span class="text-sm" >插入运算符:</span>
+                    
+                      <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" 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>
+                      操作
+                    <el-link :underline="false" icon="el-icon-delete" type="danger" @click="removeSelect"></el-link>
+                    </div>
+                  </div>
+      
+                  
+                <div class="border-grey sele-ele-box1" >
+                    <draggable v-model="selectEleFormula">
+                      <formula-item
+                        v-for="(item,index) in selectEleFormula" :key="index"
+                        :item="item" @click="obj => eleFormulaClick(obj,index)"
+                      >
+                      </formula-item>
+                    </draggable>
+                  </div>
+                  <div class="flex mg-t-10" 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>
+                      <el-option  v-for="item in eleTableList" :key="item.id" :label="item.tableName" :value="(item.pkeyId!==null&&item.pkeyId!==-1)?item.pkeyId:item.id"></el-option>
+                    </el-select>
+                    <!-- 搜索元素下拉框 -->
+                    <!-- <el-select v-model="input3" filterable clearable placeholder="搜索元素字段"  @change="getInput" style="width:45%">
+                      <el-option
+                        v-for="item in eleList1"
+                        :key="item.id"
+                        :label="item.eName"
+                        :value="item.eName">
+                      </el-option>
+                    </el-select> -->
+                     <div class="text-align-c">
+                      <el-button size="small" @click="canceloperationVisible ">取消</el-button>
+                      <el-button size="small" @click="operationHandle" type="primary">保存</el-button>
+                    </div>
+                  </div>
+           
+                <div class="mg-t-10 no-mb-col flex1" >
+                  <el-scrollbar style="height: 350px">
+                    <el-row v-loading="eleListable"  v-if="eleList.length>0">
+                      <el-col :span="6" v-for="item in eleList" :key="item.id" >
+                        <div class="ele-box">
+                          <span v-if="item.k">{{item.name}}</span>
+                          <span v-else>{{item.eName}}</span>
+                          <el-checkbox v-model="item.checked" @change="value => eleChang(value,item)"></el-checkbox>
+                        </div>
+                        
+                      </el-col>
+                    </el-row>
+                    <el-row v-else style="text-align: center;line-height: 328px;border:1px solid #bbb">暂无数据</el-row>
+                  </el-scrollbar>
+                </div>
+         
             </div>
           </el-col>
         </el-row>
-        <div class="text-align-c">
-          <el-button size="small" @click="operationHandle" type="primary">保存</el-button>
-          <el-button size="small" @click="canceloperationVisible ">取消</el-button>
-        </div>
+       
       </div>
     </div>
     <div v-show="!operationVisible && !showFunDetail && !deviationRange.show">
@@ -205,7 +204,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 +448,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"
@@ -448,6 +456,7 @@ import {formulaArrayToString} from "./formulaArrayToString"
 import {formulaStringToArray} from "./formulaStringToArray"
 
 import draggable from 'vuedraggable'
+import {formatArrayMore,restoreArrayMore,generateResult} from './component/funComponent/multiIfElseTools'
 
 export default {
   components: {
@@ -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){
@@ -1360,10 +1373,81 @@ export default {
       return true;
     },
 
+
+
+
+
     //保存公式
     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.conditionList[0]',this.$refs.dynamiccomponent[0].conditionList);
+        let resMore=formatArrayMore(this.$refs.dynamiccomponent[0].conditionList);
+        const resJson=generateResult(this.$refs.dynamiccomponent[0].conditionList);
+        console.log(resJson,'resJson');
+        
+     
+            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 +1549,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 =  restoreArrayMore(detail.formulas,this.formulaDetailMap)
+    
+      }else{
+        this.isMore = false;
+        this.moreConditions = []
+        this.formulaDetailMap ={}
+
+      }
+
+    
       if(detail&&detail.id){
           //获取右边元素的字典
           let dictMap=detail.dict
@@ -1475,8 +1573,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 +1936,7 @@ export default {
 }
 
 .icon-box .el-link{
-  font-size: 24px;
+  font-size: 14px;
   margin-right: 10px;
 }
 </style>
@@ -1847,4 +1949,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>

+ 19 - 16
src/views/manager/projectinfo/list.vue

@@ -235,22 +235,25 @@
                 prop=""
                 label="合同段权限">
                 <template slot-scope="scope">
-                  <el-tooltip 
-                    v-for="(item,index) in scope.row.relationContractInfo" 
-                    :key="key"
-                    :content="item.contractName"
-                    placement="top"
-                   
-                  >
-                    <el-tag  
-                      size="small" 
-                      :type="item.contractType===1?'warning':item.contractType===2?'primary':'success'"   
-                      class="custom-ellipse-tag2 ellipsis-tag1"
-                      
-                    >
-                      {{item.contractName}}
-                    </el-tag>
-                  </el-tooltip>
+                  <template v-if="scope.row.relationContractInfo > 0">
+                        <el-tooltip 
+                          v-for="(item,index) in scope.row.relationContractInfo" 
+                          :key="key"
+                          :content="item.contractName"
+                          placement="top"
+                        
+                        >
+                          <el-tag  
+                            size="small" 
+                            :type="item.contractType===1?'warning':item.contractType===2?'primary':'success'"   
+                            class="custom-ellipse-tag2 ellipsis-tag1"
+                            
+                          >
+                            {{item.contractName}}
+                          </el-tag>
+                        </el-tooltip>
+                  </template>
+                
                 </template>
 
               </el-table-column>