Kaynağa Gözat

Merge branch 'superman' of http://git.shengws.com/zhangbj/xt_vue into superman

XMLWAN 4 yıl önce
ebeveyn
işleme
101ce760fd
1 değiştirilmiş dosya ile 41 ekleme ve 9 silme
  1. 41 9
      src/xt_pages/management/home.vue

+ 41 - 9
src/xt_pages/management/home.vue Dosyayı Görüntüle

@@ -2664,10 +2664,17 @@ export default {
2664 2664
         getAllMachine(this.forms.zone_id, this.forms.device_type).then(response => {
2665 2665
           if (response.data.state === 1) {
2666 2666
             var addmahcer = response.data.data.addmahcer
2667
-            console.log('addmacher是', addmahcer)
2667
+      
2668 2668
             this.tableDatatwo = addmahcer
2669 2669
             this.tabIndex = this.$route.query.index
2670
-            this.$refs.singleTable.setCurrentRow(this.tableDatatwo[this.tabIndex])
2670
+            var id = this.$route.query.id
2671
+            for(let i = 0;i < this.tableDatatwo.length;i++) {
2672
+              if(this.tableDatatwo[i].id == id) {  
2673
+                this.$refs.singleTable.setCurrentRow(this.tableDatatwo[i])
2674
+                break
2675
+              }
2676
+            }
2677
+            // this.$refs.singleTable.setCurrentRow(this.tableDatatwo[this.tabIndex])
2671 2678
           }
2672 2679
         })
2673 2680
       },
@@ -2676,7 +2683,7 @@ export default {
2676 2683
       },
2677 2684
       handleCurrentChange(val) {
2678 2685
         this.unitType = val.unit_type
2679
-        // console.log('val是什么', val)
2686
+        console.log('val是什么', val)
2680 2687
         this.currentRow = val
2681 2688
         this.$forceUpdate()
2682 2689
         this.getMachineDetailById(val.id)
@@ -2969,7 +2976,7 @@ export default {
2969 2976
         var bed_numberss = parseInt(bed_numbers)
2970 2977
         this.form.bed_number = bed_numberss
2971 2978
         this.$refs[formName].validate(valid => {
2972
-          UpdateMachineInfo(this.form).then(response => {
2979
+          UpdateMachineInfo(this.form).then(response => {debugger
2973 2980
             // console.log('form', this.form)
2974 2981
             if (response.data.state === 1) {
2975 2982
               var addmacher = response.data.data.addmacher
@@ -2977,9 +2984,16 @@ export default {
2977 2984
 
2978 2985
               this.$message.success('修改成功')
2979 2986
               // this.$router.push({ path: '/device/home?index=' + this.tabIndex })
2987
+              for(let i = 0;i < this.tableDatatwo.length;i++) {
2988
+                if(this.tableDatatwo[i].id == addmacher.id) {
2989
+                  this.tableDatatwo[i] = addmacher
2990
+                  // this.$refs.singleTable.setCurrentRow(this.tableDatatwo[i])
2991
+                  // this.$forceUpdate
2992
+                }
2993
+              }
2980 2994
               // this.getAllMachine()
2981
-              this.getAllSubregion()
2982
-              // this.$refs.singleTable.setCurrentRow(addmacher)
2995
+              // this.getAllSubregion()
2996
+              this.$refs.singleTable.setCurrentRow(addmacher)
2983 2997
               this.$forceUpdate()
2984 2998
             }
2985 2999
           })
@@ -3018,9 +3032,19 @@ export default {
3018 3032
               if (response.data.state === 1) {
3019 3033
                 // eslint-disable-next-line no-unused-vars
3020 3034
                 var addmacher = response.data.data.addmacher
3035
+
3021 3036
                 this.$message.success('修改成功')
3022
-                this.getAllMachine()
3037
+                for(let i = 0;i < this.tableDatatwo.length;i++) {
3038
+                  if(this.tableDatatwo[i].id == addmacher.id) {
3039
+                    this.tableDatatwo[i] = addmacher
3040
+                
3041
+                  }
3042
+                }
3043
+                // this.getAllMachine()
3044
+                this.$forceUpdate
3023 3045
                 this.getAllSubregion()
3046
+                // this.$refs.singleTable.setCurrentRow(addmacher)
3047
+                
3024 3048
               }
3025 3049
             })
3026 3050
           }
@@ -3046,9 +3070,17 @@ export default {
3046 3070
         this.$refs[formName].validate(valid => {
3047 3071
           UpdateMacheineTwo(this.form).then(response => {
3048 3072
             if (response.data.state === 1) {
3049
-              var add = response.data.data.addmacher
3073
+              var addmacher = response.data.data.addmacher
3050 3074
               this.$message.success('修改成功')
3051
-              this.getAllMachine()
3075
+              for(let i = 0;i < this.tableDatatwo.length;i++) {
3076
+                  if(this.tableDatatwo[i].id == addmacher.id) {
3077
+                    this.tableDatatwo[i] = addmacher
3078
+
3079
+                  }
3080
+                }
3081
+                // this.getAllMachine()
3082
+                this.$forceUpdate
3083
+              // this.getAllMachine()
3052 3084
               this.getAllSubregion()
3053 3085
             }
3054 3086
           })