Browse Source

fix:调整多选逻辑

liujiayin 2 years ago
parent
commit
01525cd7c8
1 changed files with 9 additions and 6 deletions
  1. 9 6
      src/components/ibps-crud/mixin/base.js

+ 9 - 6
src/components/ibps-crud/mixin/base.js

@@ -100,10 +100,10 @@ export default {
      * @description 所有列表已选择的数据id
      * 
      */
-    selection_all:{
-      type: Array,
-      default: ()=>[]
-    }
+    selectionAll: {
+      type: Object,
+      default: null
+  }
   },
   methods: {
     /* 表格換颜色*/
@@ -263,8 +263,11 @@ export default {
       const buttonKey = action.key
       let selection = null// 选中数据
       if (position === 'toolbar') { // 工具栏
-        // selection = this.getSelectedIds()
-        selection = this.selection_all.map(i=>i.id_) // 默认给所有已选择的数据id
+        if (this.selectionAll) {
+          selection = this.selectionAll.map(i => i.id_) // 默认给所有已选择的数据id
+      } else {
+          selection = this.getSelectedIds()
+      }
       } else { // 管理列
         selection = data ? this.getPkValue(data) : null
       }