黄梓星 1 жил өмнө
parent
commit
79ccfbbc03

+ 12 - 4
src/views/purchase/PurchaseDemandList/add.vue

@@ -1018,7 +1018,9 @@ export default {
                     })
                     console.log('xxx',rightList)
                     rightList.forEach(items => {
-                      this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
+                      if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`)) {
+                        this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
+                      }
                     })
 
                     errList.forEach(params => {
@@ -1026,7 +1028,9 @@ export default {
                         rules.forEach(rule => {
                             masStr += `第 ${rowIndex + 1} 行${rule.message};`
                         })
-                        this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`).style.background = '#f34b4bb8'
+                        if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`)) {
+                          this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${rowIndex+1})`).style.background = '#f34b4bb8'
+                        }
                     })
                 })
                 this.$modal.notifyError(masStr);
@@ -1061,10 +1065,14 @@ export default {
         })
         console.log('xxx',rightList)
         rightList.forEach(items => {
-          this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
+          if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`)) {
+            this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${items.rightIndex+1})`).style.background = ''
+          }
         })
         errList.forEach(item => {
-          this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`).style.background = '#f34b4bb8'
+          if (this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`)) {
+            this.$refs.table.$el.querySelector(`.elx-body--row:nth-of-type(${item/10})`).style.background = '#f34b4bb8'
+          }
         })
     },
     submit() {