Browse Source

Merge branch 'develop_szhj' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop

zhangdan 3 years ago
parent
commit
1d6ffa3a53
1 changed files with 10 additions and 9 deletions
  1. 10 9
      src/components/Table/index.js

+ 10 - 9
src/components/Table/index.js

@@ -253,6 +253,7 @@ export default {
         selectedRowKeys: this.selectedRowKeys,
         selectedRows: this.selectedRows
       }
+      console.log(obj)
       this.$emit('rowSelection', obj)
     },
     onSelectChange (record, selected, selectedRows, nativeEvent) {
@@ -275,17 +276,17 @@ export default {
       if (selected) { //  选择
         this.selectedRows = [...this.selectedRows, ...changeRows]
       } else { //  取消
-        const arrId = []
-        this.selectedRows.map((item, index) => {
-          this.selectedRows.map((subItem, ind) => {
-            if (item[this.rowKeyName] == subItem[this.rowKeyName]) {
-              arrId.push(index)
-            }
-          })
+        const arrIds = []
+        changeRows.map((item, index) => {
+          arrIds.push(item[this.rowKeyName])
         })
-        arrId.map((item, index) => {
-          _this.selectedRows = _this.selectedRows.slice(item, item + 1)
+        const arrs = []
+        this.selectedRows.map((item, index) => {
+          if (arrIds.indexOf(item[this.rowKeyName]) == -1) {
+            arrs.push(item)
+          }
         })
+        this.selectedRows = arrs
       }
       this.updateSelect()
     },