Jelajahi Sumber

数据自变公式

duy 5 hari lalu
induk
melakukan
330a01b774

+ 187 - 62
src/views/formula/component/funComponent/dataChange.vue

@@ -1,23 +1,22 @@
 <template>
   <div class="data-change-form">
-    <div class="form-title">数据自变</div>
-    
+   
+    <div class="mg-b-20">中文输入方式:(xx),括号为英文括号</div>
     <el-form :model="formData" label-width="100px" class="form-container" size="small">
       <!-- 变化方式和数据格式行 -->
       <el-row :gutter="20">
         <el-col :span="8">
           <el-form-item label="变化方式:">
             <el-select v-model="formData.changeMethod" placeholder="请选择">
-              <el-option label="自增" value="increment"></el-option>
-              <el-option label="自减" value="decrement"></el-option>
+              <el-option label="自增" value="+"></el-option>
+              <el-option label="自减" value="-"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="数据格式:">
             <el-select v-model="formData.dataFormat" placeholder="请选择">
-              <el-option label="时间" value="time"></el-option>
-              <el-option label="日期" value="number"></el-option>
+              <el-option label="时间" value="date"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -32,13 +31,15 @@
       <el-row :gutter="20">
         <el-col :span="24">
           <el-form-item label="协同元素:">
-            <el-input 
-              v-model="formData.coordinationElement" 
-              placeholder="请选择参数(非必填)" 
-              clearable
-              @focus="setFocusedField('coordinationElement')"
-              @blur="clearFocusedField"
-            ></el-input>
+            <vue-tags-input 
+                v-model="coordinationTag" 
+                :tags="coordinationTags" 
+                @focus="setElseFocus('coordination')" 
+                @blur="elseInputBlur('coordination')" 
+                placeholder="请选择/输入参数" 
+                @before-adding-tag="beforeAddingTag" 
+                @keyup.native="btKeyUp"
+              />
           </el-form-item>
         </el-col>
       </el-row>
@@ -47,18 +48,26 @@
       <el-row :gutter="1" class="frequency-row">
         <el-col :span="12">
           <el-form-item label="频率:">
-            <el-input v-model="formData.frequency" placeholder="输入自增频率" clearable></el-input>
+            <vue-tags-input 
+                v-model="frequencyTag" 
+                :tags="frequencyTags" 
+                @focus="setElseFocus('frequency')" 
+                @blur="elseInputBlur('frequency')" 
+                placeholder="请选择/输入频率" 
+                @before-adding-tag="beforeAddingTag" 
+                @keyup.native="btKeyUp"
+              />
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label-width="0px" >
             <el-select v-model="formData.frequencyUnit" placeholder="单位" clearable style="width: 120px;">
-                <el-option label="年" value="second"></el-option>
-                <el-option label="月" value="minute"></el-option>
-                <el-option label="日" value="hour"></el-option>
-                <el-option label="时" value="day"></el-option>
-                <el-option label="分" value="month"></el-option>
-                <el-option label="秒" value="year"></el-option>
+                <el-option label="年" value="1"></el-option>
+                <el-option label="月" value="2"></el-option>
+                <el-option label="日" value="3"></el-option>
+                <el-option label="时" value="4"></el-option>
+                <el-option label="分" value="5"></el-option>
+                <el-option label="秒" value="6"></el-option>
             </el-select>
             </el-form-item>
         </el-col>
@@ -68,13 +77,15 @@
         <el-row :gutter="10" class="stop-condition-row">
         <el-col :span="9">
             <el-form-item label="停止条件:">
-            <el-input 
-                v-model="formData.stopConditionParam" 
-                placeholder="请选择参数(非必填)" 
-                clearable
-                @focus="setFocusedField('stopConditionParam')"
-                @blur="clearFocusedField"
-            ></el-input>
+              <vue-tags-input 
+                  v-model="stopConditionParamTag" 
+                  :tags="stopConditionParamTags" 
+                  @focus="setElseFocus('stopConditionParam')" 
+                  @blur="elseInputBlur('stopConditionParam')" 
+                  placeholder="请选择参数" 
+                  @before-adding-tag="beforeAddingTag" 
+                  @keyup.native="btKeyUp"
+                />
             </el-form-item>
         </el-col>
         <el-col :span="4">
@@ -84,24 +95,26 @@
                 placeholder="请选择" 
                 clearable
             >
-                <el-option label="=" value="equal"></el-option>
-                <el-option label=">" value="greater"></el-option>
-                <el-option label="<" value="less"></el-option>
-                <el-option label="≥" value="greaterEqual"></el-option>
-                <el-option label="≤" value="lessEqual"></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>
             </el-form-item>
         </el-col>
         <el-col :span="8">
             <el-form-item>
-            <el-input 
-                v-model="formData.stopConditionValue" 
-                placeholder="请选择/输入参数值" 
-                clearable
-                @focus="setFocusedField('stopConditionValue')"
-                @blur="clearFocusedField"
-            ></el-input>
+              <vue-tags-input 
+                  v-model="stopConditionValueTag" 
+                  :tags="stopConditionValueTags" 
+                  @focus="setElseFocus('stopConditionValue')" 
+                  @blur="elseInputBlur('stopConditionValue')" 
+                  placeholder="请选择/输入参数值" 
+                  @before-adding-tag="beforeAddingTag" 
+                  @keyup.native="btKeyUp"
+                />
             </el-form-item>
         </el-col>
         </el-row>
@@ -110,8 +123,11 @@
 </template>
 
 <script>
+import {convertToFCDataChange,extractElementMap,parseFCDataChange,restoreOriginalData} from './multiIfElseTools'
+
 export default {
   name: "DatasChange",
+
   props: {
     formulainfo: {
       type: Object,
@@ -125,20 +141,38 @@ export default {
         return {};
       }
     },
+    map:{
+        type: String,
+        default:''
+    },
+    dataForm:{
+      type: Object,
+      default: function () {
+        return {};
+      }
+    }
+    
   },
   data() {
     return {
       value1: true,
-      focusedField: null, // 记录当前聚焦的字段
+      elseFocus: null, // 当前聚焦的标签输入框
+      
+      // 标签输入框相关数据
+      coordinationTag: '',
+      coordinationTags: [],
+      frequencyTag: '',
+      frequencyTags: [],
+      stopConditionParamTag: '',
+      stopConditionParamTags: [],
+      stopConditionValueTag: '',
+      stopConditionValueTags: [],
+      
       formData: {
         changeMethod: '',
-        dataFormat: 'time',
-        coordinationElement: '',
-        frequency: '',
+        dataFormat: '',
         frequencyUnit: '',
-        stopConditionParam: '',
-        stopConditionOperator: 'equal',
-        stopConditionValue: ''
+        stopConditionOperator: ''
       }
     };
   },
@@ -146,6 +180,25 @@ export default {
     // 从props初始化表单数据
     if (this.formulainfo) {
       this.formData = { ...this.formData, ...this.formulainfo };
+      console.log(this.formulainfo,'this.formulainfo');
+      console.log(this.dataForm,'this.dataForm11111111');
+      const resObj=restoreOriginalData(this.dataForm,JSON.parse(this.map));
+      console.log(JSON.parse(this.map),'this.map');
+      
+      console.log(resObj,'resObj');
+      this.formData.changeMethod=resObj.changeMethod;
+      this.formData.dataFormat=resObj.dataFormat;
+      this.formData.frequencyUnit=resObj.frequencyUnit;
+      this.formData.stopConditionOperator=resObj.stopConditionOperator;
+      this.coordinationTag=resObj.coordinationTag;
+      this.coordinationTags=resObj.coordinationTags;
+      this.frequencyTag=resObj.frequencyTag;
+      this.frequencyTags=resObj.frequencyTags;
+      this.stopConditionParamTag=resObj.stopConditionParamTag;
+      this.stopConditionParamTags=resObj.stopConditionParamTags;
+      this.stopConditionValueTag=resObj.stopConditionValueTag;
+      this.stopConditionValueTags=resObj.stopConditionValueTags;
+
     }
   },
   methods: {
@@ -154,27 +207,98 @@ export default {
       this.$emit('select-element');
     },    
     setELe(ele) {
-      console.log(ele, 'ele');
+      console.log(this.elseFocus,'this.elseFocus');
+      
+      if (!this.elseFocus) return;
+      
+      let obj = {};
+      if(ele.k){
+        obj = {
+          type:'ParamData',
+          name:ele.name,
+          id:ele.id,
+          selected:false,
+          v:ele.v,
+          k:ele.k,
+          children:[],
+        }
+      }else{
+        obj = {
+          type:'Element',
+          name:ele.eName,
+          id:ele.id,
+          selected:false,
+          tableElementKey:ele.tableElementKey,
+          children:[],
+        }
+      }
       
-      // 当有元素被选择且有聚焦的字段时,填充对应的值
-      if (ele && ele.eName && this.focusedField) {
-        this.$set(this.formData, this.focusedField, ele.eName);
-        console.log(this.formData,'this.formData');
-        
-        // 可以选择在填充后取消聚焦状态
-        this.focusedField = null;
+      // 根据当前焦点位置设置对应的标签
+      const position = this.elseFocus;
+      const tagField = `${position}Tag`;
+      const tagsField = `${position}Tags`;
+      
+      // 清除之前选择的元素
+      if (this[tagsField] && this[tagsField].length > 0) {
+        this[tagsField].forEach(item => {
+          this.$emit('uncheck', item.id);
+        });
       }
+      
+      // 设置新选择的元素
+      obj.text = obj.name;
+      obj.style = 'background-color: #409EFF';
+      this[tagsField] = [obj]; // 每次选择一个新元素替换现有元素
+      this[tagField] = '';
+      
+      // 可以在这里添加其他需要的逻辑
     },
     // 设置当前聚焦的字段
-    setFocusedField(fieldName) {
-
-        
-      this.focusedField = fieldName;
+    setElseFocus(position) {
+      console.log(position,'position');
+      
+      this.elseFocus = position;
     },
     // 清除聚焦状态
-    clearFocusedField() {
-      // 可以保留聚焦状态直到下一次操作,或立即清除
-      // this.focusedField = null;
+    elseInputBlur(position) {
+      // if (this.elseFocus === position) {
+      //   this.elseFocus = null;
+      // }
+    },
+    // 添加标签前的处理
+    beforeAddingTag(tag) {
+      // 可以在这里验证标签格式等
+      return true;
+    },
+    // 键盘事件处理
+    btKeyUp(e) {
+      // 可以添加键盘事件处理逻辑
+    },
+    getDataChangeList(){
+      // 整合表单数据,包括标签信息
+      const result = {
+        ...this.formData,
+        coordinationTag: this.coordinationTag,
+        coordinationTags: this.coordinationTags,
+        frequencyTags: this.frequencyTags,
+        frequencyTag: this.frequencyTag,
+        stopConditionParamTags: this.stopConditionParamTags,
+        stopConditionParamTag: this.stopConditionParamTag,
+        stopConditionValueTags: this.stopConditionValueTags,
+        stopConditionValueTag: this.stopConditionValueTag
+      };
+      console.log(result, '表单数据');
+      let test = convertToFCDataChange(result);
+      console.log(test,'resObj');
+      let map=extractElementMap(result);
+      console.log(map,'map');
+      
+      let resObj={
+        test,
+        map
+      }
+      
+      return resObj;
     }
   }
 };
@@ -207,7 +331,8 @@ export default {
   
   // 确保输入框占满列宽
   ::v-deep .el-input,
-  ::v-deep .el-select {
+  ::v-deep .el-select,
+  ::v-deep .vue-tags-input {
     width: 100%;
   }
 }

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

@@ -599,5 +599,256 @@ export function restoreData(str,map) {
         "elseTagsRight": elseRightParsed.arrayValues
     };
 }
+export function convertToFCDataChange(data) {
+    // 1. 元素:取arguments[0].tableElementKey(非空则用E[]包裹)
+    let element = '';
+    // 传统判断:先确保data、arguments、arguments[0]存在,再取tableElementKey
+    if (data && data.arguments && data.arguments[0] && data.arguments[0].tableElementKey) {
+        element = `E[${data.arguments[0].tableElementKey}]`;
+    }
+
+    // 2. 变化方式:取changeMethod(默认空字符串)
+    const changeMethod = data && data.changeMethod ? data.changeMethod : '';
+
+    // 3. 数据格式:取dataFormat(默认空字符串)
+    const dataFormat = data && data.dataFormat ? data.dataFormat : '';
+
+    // 4. 协同元素:优先coordinationTags数组 → 再fallback到coordinationTag单个标签
+    let coordinationElement = '';
+    // 先判断coordinationTags数组是否有有效数据
+    if (data && data.coordinationTags && data.coordinationTags.length > 0 && data.coordinationTags[0].tableElementKey) {
+        coordinationElement = `E[${data.coordinationTags[0].tableElementKey}]`;
+    } 
+    // 数组无值时,取coordinationTag单个标签(需非空)
+    else if (data && data.coordinationTag && data.coordinationTag.trim() !== '') {
+        coordinationElement = data.coordinationTag;
+    }
+
+    // 5. 频率:优先frequencyTags数组 → 再fallback到frequencyTag单个标签
+    let frequency = '';
+    // 先判断frequencyTags数组是否有有效数据
+    if (data && data.frequencyTags && data.frequencyTags.length > 0 && data.frequencyTags[0].tableElementKey) {
+        frequency = `E[${data.frequencyTags[0].tableElementKey}]`;
+    } 
+    // 数组无值时,取frequencyTag单个标签(需非空)
+    else if (data && data.frequencyTag && data.frequencyTag.trim() !== '') {
+        frequency = data.frequencyTag;
+    }
+
+    // 6. 单位:取frequencyUnit(默认空字符串)
+    const unit = data && data.frequencyUnit ? data.frequencyUnit : '';
+
+    // 7. 停止元素:优先coordinationTags数组 → 再stopConditionParamTags数组 → 最后fallback到stopConditionParamTag单个标签
+    let stopElement = '';
+    // 优先取coordinationTags数组
+    if (data && data.coordinationTags && data.coordinationTags.length > 0 && data.coordinationTags[0].tableElementKey) {
+        stopElement = `E[${data.coordinationTags[0].tableElementKey}]`;
+    } 
+    // coordinationTags无值时,取stopConditionParamTags数组
+    else if (data && data.stopConditionParamTags && data.stopConditionParamTags.length > 0 && data.stopConditionParamTags[0].tableElementKey) {
+        stopElement = `E[${data.stopConditionParamTags[0].tableElementKey}]`;
+    } 
+    // 两个数组都无值时,取stopConditionParamTag单个标签(需非空)
+    else if (data && data.stopConditionParamTag && data.stopConditionParamTag.trim() !== '') {
+        stopElement = data.stopConditionParamTag;
+    }
+
+    // 8. 判断条件:取stopConditionOperator(默认空字符串)
+    const conditionOperator = data && data.stopConditionOperator ? data.stopConditionOperator : '';
+
+    // 9. 值:优先stopConditionValueTags数组 → 再fallback到stopConditionValueTag单个标签
+    let value = '';
+    // 先判断stopConditionValueTags数组是否有有效数据
+    if (data && data.stopConditionValueTags && data.stopConditionValueTags.length > 0 && data.stopConditionValueTags[0].tableElementKey) {
+        value = `E[${data.stopConditionValueTags[0].tableElementKey}]`;
+    } 
+    // 数组无值时,取stopConditionValueTag单个标签(需非空)
+    else if (data && data.stopConditionValueTag && data.stopConditionValueTag.trim() !== '') {
+        value = data.stopConditionValueTag
+    }
+
+    // 组合成最终的FC.dataChange格式
+    return `FC.dataChange(${element},${changeMethod},${dataFormat},${coordinationElement},${frequency},${unit},${stopElement},${conditionOperator},${value})`;
+}
+
+// 从data中提取所有type为Element的对象,生成以tableElementKey为键的映射
+export function extractElementMap(data) {
+    const elementMap = {};
+    
+    // 需要检查的包含Element对象的数组字段
+    const elementArrays = [
+        'arguments',
+        'coordinationTags',
+        'frequencyTags',
+        'stopConditionParamTags',
+        'stopConditionValueTags'
+    ];
+    
+    // 遍历所有可能包含Element对象的数组
+    elementArrays.forEach(field => {
+        if (data && data[field] && Array.isArray(data[field])) {
+            data[field].forEach(item => {
+                // 检查是否是有效的Element对象
+                if (item && item.type === 'Element' && item.tableElementKey) {
+                    // 以tableElementKey为键,存储对象的关键信息
+                    elementMap[item.tableElementKey] = {
+                        id: item.id,
+                        name: item.name,
+                        tableElementKey: item.tableElementKey,
+                        type: item.type
+                        // 可根据需要添加其他属性
+                    };
+                }
+            });
+        }
+    });
+
+    // 如果你提供的示例中"deviationRangeJson"是固定需要添加的字段,可以在这里补充
+    // elementMap.deviationRangeJson = "{\"symbol\":\"【min,max】\",\"model\":\"1\",\"arguments1\":\"\",\"arguments2\":\"\"}";
     
+    return elementMap;
+}
+
 
+
+export function restoreOriginalData(fcString,mapObj) {
+    // 提取括号内的参数部分
+    const paramsStr = fcString.replace(/^FC\.dataChange\((.*)\)$/, '$1');
+    
+    // 分割参数(处理可能包含逗号的情况)
+    const params = [];
+    let currentParam = '';
+    let bracketCount = 0;
+    
+    for (let char of paramsStr) {
+        if (char === ',' && bracketCount === 0) {
+            params.push(currentParam.trim());
+            currentParam = '';
+        } else {
+            if (char === '[') bracketCount++;
+            if (char === ']') bracketCount--;
+            currentParam += char;
+        }
+    }
+    params.push(currentParam.trim());
+    
+    // 创建结果对象
+    const result = {
+        changeMethod: '',
+        dataFormat: '',
+        frequencyUnit: '',
+        stopConditionOperator: '',
+        name: '数据自变', // 保持原始名称
+        template: {
+            ft: "FC.dataChange(#1,#2,#3,#4,#5,#6,#7,#8,#9)",
+            args: [
+                { "key": "#1", "m": "元素" },
+                { "key": "#2", "m": "变化方式" },
+                { "key": "#3", "m": "数据格式" },
+                { "key": "#4", "m": "协同元素" },
+                { "key": "#5", "m": "频率" },
+                { "key": "#6", "m": "单位(1-年,2-月,3-日,4-时,5-分,6-秒)" },
+                { "key": "#7", "m": "停止元素" },
+                { "key": "#8", "m": "判断条件" },
+                { "key": "#9", "m": "值" }
+            ]
+        },
+        type: 0,
+        example: "对时间元素进行自增或自减",
+        number: null,
+        arguments: [null, null, null, null, null, null, null, null, null],
+        coordinationTag: "",
+        coordinationTags: [],
+        frequencyTags: [],
+        frequencyTag: "",
+        stopConditionParamTags: [],
+        stopConditionParamTag: "",
+        stopConditionValueTags: [],
+        stopConditionValueTag: ""
+    };
+    
+    // 解析参数并填充结果对象
+    // 参数0: 元素
+    if (params[0].startsWith('E[')) {
+        const key = params[0].replace(/^E\[([^\]]+)\]$/, '$1');
+        result.arguments[0] = mapObj[key] ? { ...mapObj[key], selected: false } : null;
+    }
+    
+    // 参数1: 变化方式
+    result.changeMethod = params[1] || '';
+    
+    // 参数2: 数据格式
+    result.dataFormat = params[2] || '';
+    
+    // 参数3: 协同元素
+    if (params[3].startsWith('E[')) {
+        const key = params[3].replace(/^E\[([^\]]+)\]$/, '$1');
+        if (mapObj[key]) {
+            result.coordinationTags = [{ 
+                ...mapObj[key], 
+                selected: false,
+                children: [],
+                text: mapObj[key].name,
+                style: "background-color: #409EFF"
+            }];
+        }
+    } else if (params[3]) {
+        result.coordinationTag = params[3];
+    }
+    
+    // 参数4: 频率
+    if (params[4].startsWith('E[')) {
+        const key = params[4].replace(/^E\[([^\]]+)\]$/, '$1');
+        if (mapObj[key]) {
+            result.frequencyTags = [{ 
+                ...mapObj[key], 
+                selected: false,
+                children: [],
+                text: mapObj[key].name,
+                style: "background-color: #409EFF"
+            }];
+        }
+    } else if (params[4]) {
+        result.frequencyTag = params[4];
+    }
+    
+    // 参数5: 单位
+    result.frequencyUnit = params[5] || '';
+    
+    // 参数6: 停止元素
+    if (params[6].startsWith('E[')) {
+        const key = params[6].replace(/^E\[([^\]]+)\]$/, '$1');
+        if (mapObj[key]) {
+            result.stopConditionParamTags = [{ 
+                ...mapObj[key], 
+                selected: false,
+                children: [],
+                text: mapObj[key].name,
+                style: "background-color: #409EFF"
+            }];
+        }
+    } else if (params[6]) {
+        result.stopConditionParamTag = params[6];
+    }
+    
+    // 参数7: 判断条件
+    result.stopConditionOperator = params[7] || '';
+    
+    // 参数8: 值
+    if (params[8].startsWith('E[')) {
+        const key = params[8].replace(/^E\[([^\]]+)\]$/, '$1');
+        if (mapObj[key]) {
+            result.stopConditionValueTags = [{ 
+                ...mapObj[key], 
+                selected: false,
+                children: [],
+                text: mapObj[key].name,
+                style: "background-color: #409EFF"
+            }];
+        }
+    } else if (params[8]) {
+        result.stopConditionValueTag = params[8];
+    }
+    
+    return result;
+}

+ 75 - 3
src/views/formula/edit.vue

@@ -216,6 +216,8 @@
                 :isMore="isMore"
                 :isGetData="isGetData"
                 :dataListGet="dataListGet"
+                :isDataChange="isDataChange"
+                :dataForm="dataForm"
                 >
               </component>
                 <div class="flex1" v-show="item.showSelectEle" style="margin-top:10px;margin-bottom:30px">
@@ -460,6 +462,7 @@ import {formulaStringToArray} from "./formulaStringToArray"
 
 import draggable from 'vuedraggable'
 import {formatArrayMore,restoreArrayMore,generateResult} from './component/funComponent/multiIfElseTools'
+import dataChange from "./component/funComponent/dataChange"
 
 export default {
   components: {
@@ -478,7 +481,8 @@ export default {
     datasJoin,
     ifelse,
  
-    deviationRange
+    deviationRange,
+    dataChange
   },
   props: {
     wbsid:{
@@ -574,6 +578,7 @@ export default {
         '下标取数':'datas-getlist',
         // '数组转字符串':"datas-join",
         '判断':'ifelse',
+        '数据自变':'data-change'
       
       },
 
@@ -606,6 +611,8 @@ export default {
       formulaDetailMap:{},//公式详情map
       dataListGet:'',
       isGetData:false,//是否获取数据
+      isDataChange:false,//是否数据自变
+      dataForm:''
 
 
     };
@@ -1452,13 +1459,14 @@ export default {
         
         
       }else if(this.$refs.dynamiccomponent&&this.$refs.dynamiccomponent.length>0&&this.$refs.dynamiccomponent[0]&& this.$refs.dynamiccomponent[0].symbol=='getData'){
-       const dataRes = this.$refs.dynamiccomponent[0].getDataConditionData();
+       //数据获取保存公式
+        const dataRes = this.$refs.dynamiccomponent[0].getDataConditionData();
        console.log(dataRes,'dataRes');
        const result =dataRes.result;
        const mapEle = JSON.stringify(dataRes.mapEle);
        console.log(mapEle,'mapEle');
        
-        const resultMap =JSON.stringify(result);
+
             if(this.formulaid){
               updateFormula({
                 id:this.formulaid,
@@ -1510,6 +1518,60 @@ export default {
             
             return;
        
+      }else if(this.$refs.dynamiccomponent&&this.$refs.dynamiccomponent.length>0&&this.$refs.dynamiccomponent[0]&& this.$refs.dynamiccomponent[0].formData){
+        console.log(this.$refs.dynamiccomponent[0],'this.$refs.dynamiccomponent[0');
+        const resForm=this.$refs.dynamiccomponent[0].getDataChangeList();
+        console.log(resForm,'resForm');
+        
+        //数据自变保存
+
+             if(this.formulaid){
+              updateFormula({
+                id:this.formulaid,
+                formula:resForm.test,
+                remark:'',
+                nodeId:this.nodeid,
+                elementId:this.eleid,
+                scale:this.isRetain?this.retainNum:'',
+                number:number,
+                map:JSON.stringify(resForm.map),
+                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:resForm.test,
+                remark:'',
+                nodeId:this.nodeid,
+                elementId:this.eleid,
+                scale:this.isRetain?this.retainNum:'',
+                number:number,
+                map:JSON.stringify(resForm.map),
+                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
       }
       
       
@@ -1628,6 +1690,14 @@ export default {
          this.dataListGet=detail.formula
          console.log( this.dataListGet,' this.dataListGet');
          
+      }else if(detail&&detail.formula.includes('FC.dataChange')){
+        //数据自变
+        this.formulaDetailMap = detail.map;
+      
+         this.isDataChange = true;
+         this.dataForm=detail.formula
+         console.log( this.dataForm,' this.dataListGet');
+         
       }
       else{
         this.isMore = false;
@@ -1635,6 +1705,8 @@ export default {
         this.formulaDetailMap ={}
         this.isGetData = false;
         this.dataListGet=''
+        this.isDataChange = false;
+        this.dataForm='';
 
       }