Browse Source

fix(附加数据):修复删除没有提示信息

xiebeibei 3 years ago
parent
commit
39551c668e
1 changed files with 22 additions and 120 deletions
  1. 22 120
      src/views/equipment/addDataDialog.vue

+ 22 - 120
src/views/equipment/addDataDialog.vue

@@ -154,21 +154,10 @@
                                             }
                                         },
                                         focus(){
-                                            self.addDataTableData.map(item=>{
-                                                item['tooltipDisablHost'] = true
-                                            })
-                                            if(row['hostNum']){
-                                                self.$set( self.addDataTableData[index],'tooltipDisablHost',false)
-                                                console.log(self.addDataTableData[index]);
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipDisablHost',true)
-                                            }
-
-                                            self.$forceUpdate()
+                                            self.focusTooltip(row,'hostNum','tooltipDisablHost',index)
                                         },
                                         blur(){
-                                            self.$set( self.addDataTableData[index],'tooltipDisablHost',true);
-                                            self.$forceUpdate()
+                                            self.blurToopTip('tooltipDisablHost',index)
                                         }
                                     }
                                 })
@@ -256,20 +245,10 @@
                                             }
                                         },
                                         focus(){
-                                            self.addDataTableData.map(item=>{
-                                                item['tooltipDisablLoop'] = true
-                                            })
-                                            if(row['loopNum']){
-                                                self.$set( self.addDataTableData[index],'tooltipDisablLoop',false)
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipDisablLoop',true)
-                                            }
-
-                                            self.$forceUpdate()
+                                            self.focusTooltip(row,'loopNum','tooltipDisablLoop',index)
                                         },
                                         blur(){
-                                            self.$set( self.addDataTableData[index],'tooltipDisablLoop',true);
-                                            self.$forceUpdate()
+                                            self.blurToopTip('tooltipDisablLoop',index)
                                         }
                                     }
                                 })
@@ -304,15 +283,7 @@
                                     },
                                     on:{
                                         keydown(e){
-                                            self.keydown(e);
-                                            if(  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
-                                                self.$set( self.addDataTableData[index],'tooltipMsg1',false);
-                                                self.$set( self.addDataTableData[index],'errorMsg1',false)
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipMsg1',true);
-                                                self.$set( self.addDataTableData[index],'errorMsg1',true)
-                                            }
-                                            self.$forceUpdate();
+                                            self.keydown(e,index,'tooltipMsg1','errorMsg1');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
@@ -362,15 +333,7 @@
                                     },
                                     on:{
                                         keydown(e){
-                                            self.keydown(e);
-                                            if(  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
-                                                self.$set( self.addDataTableData[index],'tooltipMsg2',false);
-                                                self.$set( self.addDataTableData[index],'errorMsg2',false)
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipMsg2',true);
-                                                self.$set( self.addDataTableData[index],'errorMsg2',true)
-                                            }
-                                            self.$forceUpdate();
+                                            self.keydown(e,index,'tooltipMsg2','errorMsg2');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
@@ -420,15 +383,7 @@
                                     },
                                     on:{
                                         keydown(e){
-                                            self.keydown(e);
-                                            if(  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
-                                                self.$set( self.addDataTableData[index],'tooltipMsg3',false);
-                                                self.$set( self.addDataTableData[index],'errorMsg3',false)
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipMsg3',true);
-                                                self.$set( self.addDataTableData[index],'errorMsg3',true)
-                                            }
-                                            self.$forceUpdate();
+                                            self.keydown(e,index,'tooltipMsg3','errorMsg3');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
@@ -478,15 +433,7 @@
                                     },
                                     on:{
                                         keydown(e){
-                                            self.keydown(e);
-                                            if(  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
-                                                self.$set( self.addDataTableData[index],'tooltipMsg4',false);
-                                                self.$set( self.addDataTableData[index],'errorMsg4',false)
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipMsg4',true);
-                                                self.$set( self.addDataTableData[index],'errorMsg4',true)
-                                            }
-                                            self.$forceUpdate();
+                                            self.keydown(e,index,'tooltipMsg4','errorMsg4');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
@@ -536,15 +483,7 @@
                                     },
                                     on:{
                                         keydown(e){
-                                            self.keydown(e);
-                                            if(  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
-                                                self.$set( self.addDataTableData[index],'tooltipMsg5',false);
-                                                self.$set( self.addDataTableData[index],'errorMsg5',false)
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipMsg5',true);
-                                                self.$set( self.addDataTableData[index],'errorMsg5',true)
-                                            }
-                                            self.$forceUpdate();
+                                            self.keydown(e,index,'tooltipMsg5','errorMsg5');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
@@ -676,21 +615,10 @@
                                             }
                                         },
                                         focus(){
-                                            self.addDataTableData.map(item=>{
-                                                item['tooltipDisableFize'] = true
-                                            })
-                                            if(row['fireZone']){
-                                                self.$set( self.addDataTableData[index],'tooltipDisableFize',false)
-                                                console.log(self.addDataTableData[index]);
-                                            }else{
-                                                self.$set( self.addDataTableData[index],'tooltipDisableFize',true)
-                                            }
-
-                                            self.$forceUpdate()
+                                            self.focusTooltip(row,'fireZone','tooltipDisableFize',index)
                                         },
                                         blur(){
-                                            self.$set( self.addDataTableData[index],'tooltipDisableFize',true);
-                                            self.$forceUpdate()
+                                            self.blurToopTip('tooltipDisableFize',index)
                                         }
                                     }
                                 })
@@ -728,15 +656,7 @@
                                  },
                                  on:{
                                      keydown(e){
-                                         self.keydown(e);
-                                         if(  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
-                                             self.$set( self.addDataTableData[index],'tooltipMsg',false);
-                                             self.$set( self.addDataTableData[index],'errorMsg',false)
-                                         }else{
-                                             self.$set( self.addDataTableData[index],'tooltipMsg',true);
-                                             self.$set( self.addDataTableData[index],'errorMsg',true)
-                                         }
-                                         self.$forceUpdate();
+                                         self.keydown(e,index,'tooltipMsg','errorMsg');
                                      },
                                      input(e){
                                          self.input(e);
@@ -754,33 +674,6 @@
                                  }
                              })
                          ]);
-                            // var child =
-                            //     self.$createElement("a-input", {
-                            //     attrs:{
-                            //         value:row.monitorCount||row.baCount||row.ddcCount||row.accessCount,
-                            //         placeholder:'请输入',
-                            //         min:0,
-                            //         type:'number',
-                            //         class:row.errorMsg?'input-box':'input-box input-box-error'
-                            //     },
-                            //     on:{
-                            //         keydown(e){
-                            //             self.keydown(e);
-                            //         },
-                            //         input(e){
-                            //             self.input(e);
-                            //             self.$set(self.addDataTableData[index], row.system =='监控系统'?'monitorCount':row.system=='BA系统'?'baCount':row.system=='DDC'?'ddcCount':'accessCount',  e.target.value);
-                            //         },
-                            //         blur(e){
-                            //             if(e.target.value>300){
-                            //                 self.$set( self.addDataTableData[index],'errorMsg',false)
-                            //             }else{
-                            //                 self.$set( self.addDataTableData[index],'errorMsg',true)
-                            //             }
-                            //             self.$forceUpdate();
-                            //         }
-                            //     }
-                            // });
                             const obj = {
                                 children: child,
                                 attrs: {},
@@ -867,10 +760,19 @@
             },
 
             //键盘事件
-            keydown(e){
+            keydown(e,index,nametip,namered){
                 if(e.key=='-'||e.key=='+'||e.key=='e'||e.key=='.'){
                     e.preventDefault()
                 }
+                console.log(e.key);
+                if(e.key!='ArrowUp'&&e.key!='ArrowDown'&&e.key!='ArrowRight'&&e.key!='ArrowLeft'&&e.key!='Backspace'&&e.key!='Delete'&&  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
+                    this.$set( this.addDataTableData[index],nametip,false);
+                    this.$set( this.addDataTableData[index],namered,false)
+                }else{
+                    this.$set( this.addDataTableData[index],nametip,true);
+                    this.$set( this.addDataTableData[index],namered,true)
+                }
+                this.$forceUpdate();
             },
             //输入事件
             input(e){