Forráskód Böngészése

excel 点击给输入框背景色

gangyj 2 éve
szülő
commit
6b5613a285

+ 14 - 1
src/views/exctab/ElementIdentification/index.vue

@@ -1180,13 +1180,22 @@ export default {
         this.titleList.push(target.innerHTML)
       }
     },
-
+    
+    //excel父节点点击检测
     parentClick(e){
       let target = e.target;
+
+      let bgs = document.querySelectorAll("#parent .oldlace-bg")
+      //console.log(bgs)
+      for (let i = 0; i < bgs.length; i++) {
+        bgs[i].classList.remove("oldlace-bg");
+      }
       //console.log(target.getAttribute('trindex'))
       if(target.getAttribute('trindex') !== null && target.getAttribute('tdindex')){
         let tdEle = this.getParentTD(target);
         if(tdEle){
+          target.classList.add("oldlace-bg");
+
           let trtd = target.getAttribute('trindex')+"_"+target.getAttribute('tdindex');
             for (let i = 0; i < this.tableData.length; i++) {
             let arr = this.tableData[i].xys.split(',')
@@ -1292,4 +1301,8 @@ export default {
 .region /deep/ .v-modal{
   position: absolute !important;
 }
+
+#parent /deep/ .oldlace-bg{
+  background-color: oldlace;
+}
 </style>

+ 42 - 3
src/views/manager/projectinfo/editElement/editElement.vue

@@ -18,6 +18,7 @@
           <div
             class='parent'
             id='parent'
+            @click="parentClick($event)"
           >
           </div>
 
@@ -419,7 +420,8 @@ export default {
           },
           getInformation (a, b, c) {
             _that.getInformation2(a, b, c)
-          }
+          },
+          getRegularExpression(){}
         }
       })
       var component = new MyComponent().$mount()
@@ -443,7 +445,8 @@ export default {
           },
           getInformation (a, b, c) {
             _that.getInformation2(a, b, c)
-          }
+          },
+          getRegularExpression(){}
         }
       })
       var component = new MyComponent().$mount()
@@ -618,7 +621,38 @@ export default {
         this.eleData = [last];
         this.eleData[0].tdEle.classList.add('select-td');
       }
-    }
+    },
+
+    //excel父节点点击检测
+    parentClick(e){
+      let target = e.target;
+
+      let bgs = document.querySelectorAll("#parent .oldlace-bg")
+      //console.log(bgs)
+      for (let i = 0; i < bgs.length; i++) {
+        bgs[i].classList.remove("oldlace-bg");
+      }
+      //console.log(target.getAttribute('trindex'))
+      if(target.getAttribute('trindex') !== null && target.getAttribute('tdindex')){
+        let tdEle = this.getParentTD(target);
+        if(tdEle){
+          target.classList.add("oldlace-bg");
+
+        }
+      }
+    },
+
+    getParentTD(ele){
+      let targetParent = ele.parentNode;
+      while (targetParent.nodeName !== "TD") {
+          if(targetParent.id == 'parent'){
+            return null;
+          }
+          targetParent = targetParent.parentNode;
+      }
+      return targetParent;
+    },
+
   },
   watch: {
     'options' () {
@@ -696,5 +730,10 @@ export default {
     border-color: #E6A23C;
     border-style: solid;
   }
+
+  /deep/ .oldlace-bg{
+    background-color: oldlace;
+  }
 }
+
 </style>

+ 37 - 0
src/views/manager/projectinfo/treeTemplate/dynamicExcel.vue

@@ -17,6 +17,7 @@
     <div
       class="excelBox"
       style="margin-top:40px;height: 100%;"
+      @click="parentClick($event)"
     >
       <div style="width:60%;height: 100%;overflow: scroll;" class='parent' id='parent'></div>
       <div class="excelRight" style="width:30%;margin-left:4%;height: 100%;overflow: scroll;" >
@@ -171,6 +172,36 @@ export default {
         td
       }
     },
+
+    //excel父节点点击检测
+    parentClick(e){
+      let target = e.target;
+
+      let bgs = document.querySelectorAll("#parent .oldlace-bg")
+      //console.log(bgs)
+      for (let i = 0; i < bgs.length; i++) {
+        bgs[i].classList.remove("oldlace-bg");
+      }
+      //console.log(target.getAttribute('trindex'))
+      if(target.getAttribute('trindex') !== null && target.getAttribute('tdindex')){
+        let tdEle = this.getParentTD(target);
+        if(tdEle){
+          target.classList.add("oldlace-bg");
+
+        }
+      }
+    },
+
+    getParentTD(ele){
+      let targetParent = ele.parentNode;
+      while (targetParent.nodeName !== "TD") {
+          if(targetParent.id == 'parent'){
+            return null;
+          }
+          targetParent = targetParent.parentNode;
+      }
+      return targetParent;
+    },
   },
   components: {
     setInputTPT,
@@ -242,6 +273,12 @@ export default {
   width: 100%;
   height: 100%;
 }
+
+.excelBox{
+  /deep/ .oldlace-bg{
+    background-color: oldlace;
+  }
+}
 </style>