Browse Source

随机插入运算符

duy 2 năm trước cách đây
mục cha
commit
54421b52bf
1 tập tin đã thay đổi với 12 bổ sung17 xóa
  1. 12 17
      src/views/formula/edit1.vue

+ 12 - 17
src/views/formula/edit1.vue

@@ -68,7 +68,7 @@
         <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">
-              <div style="overflow: auto;flex:1;max-height:500px">
+              <div style="overflow: auto;flex:1;max-height:601px">
                   <div class="flex">
                       <el-input
                         size="small"
@@ -947,9 +947,7 @@ export default {
     },
     //快捷添加运算符号
     addOperator(operator){
-
-
-      if(  this.itemList.length>0){
+          if(  this.itemList.length>0){
           this.itemList.forEach(e => {
             let lastEle = this.selectEleFormula[this.selectEleFormula.length-1];
             if(this.selectEleFormula.length != 0 && lastEle.type != 'Operator' && lastEle.type != 'Brackets' && lastEle.name != '('){ /* 不存在运算符 */
@@ -957,27 +955,24 @@ export default {
             }
             this.eleAddFormulaHandle(e);
           })
-      }else{
-          this.eleAddFormulaHandle(this.formulaMap[operator]);
-      }
-      this.itemList=[]
+          }else{
+              this.eleAddFormulaHandle(this.formulaMap[operator]);
+          }
+        this.itemList=[];
     },
-    //插入运算符
-   addOperration(text,type){
+    //随机插入运算符
+    randomaddOperator(text){
       //type 是true 表示在元素右边插入
+      console.log(text,'text');
       if(this.curSeleEleIndex == Number(this.curSeleEleIndex)){
         this.eleAddFormulaHandle({
-          type:type,
+          type:'Operator',
           name:text,
-          selectIndex:type?Number(this.curSeleEleIndex)+1:this.curSeleEleIndex
+          selectIndex:Number(this.curSeleEleIndex)+1
         })
-        //如果在左边插入index要增1
-        if(!type){
-          this.curSeleEleIndex = Number(this.curSeleEleIndex)+1;
-        }
+       
       }
     },
-
     //把元素加到公式里
     eleAddFormulaHandle(ele){
       if(ele.tableElementKey){