소스 검색

fix:恢复列表点击单选框无法选择数据以及补充列表selectionAll可能为null的校验逻辑

liujiayin 2 년 전
부모
커밋
d9ea1e37ed
2개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 3
      src/business/platform/data/templaterender/templates/list.vue
  2. 8 6
      src/components/ibps-crud/mixin/base.js

+ 2 - 3
src/business/platform/data/templaterender/templates/list.vue

@@ -630,6 +630,7 @@ export default {
          * 记忆选择核心方法
          */
         changePageCoreRecordData () {
+            // 如果是单选,则将总选择清空
             // 如果总记忆中还没有选择的数据,那么就直接取当前页选中的数据,不需要后面一系列计算
             if (this.$utils.isEmpty(this.selectionAll)) {
                 this.selectionAll = this.selection ? JSON.parse(JSON.stringify(this.selection)) : []
@@ -646,7 +647,6 @@ export default {
             } else {
                 selectionAll.push(this.selectionAll)
             }
-
             // 获取当前页选中的id
             const selectIds = []
             if (this.multiple) {
@@ -661,7 +661,7 @@ export default {
             } else {
                 if (this.$utils.isNotEmpty(this.selection)) {
                     const pkValue = this.getPkValue(this.selection)
-                    // selectIds.push(pkValue)
+                    selectIds.push(pkValue)
                     if (selectAllIds.indexOf(pkValue) < 0) {
                         selectionAll = []
                         selectionAll.push(this.selection)
@@ -673,7 +673,6 @@ export default {
                     }
                 }
             }
-
             const noSelectIds = []
             // 得到当前页没有选中的id
             listData.forEach((row) => {

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

@@ -280,12 +280,14 @@ export default {
             } else { // 管理列
                 selection = data ? this.getPkValue(data) : null
             }
-            this.$emit('action-event', buttonKey, position, selection, data, index, action)
-            // if(this.$utils.isArray(data)){
-            //     this.$emit('action-event', buttonKey, position, selection, this.selectionAll, index, action)
-            // }else{
-            //     this.$emit('action-event', buttonKey, position, selection, data, index, action)
-            // }
+            console.log('283 this.selectionAll',this.selectionAll)
+
+            // this.$emit('action-event', buttonKey, position, selection, data, index, action)
+            if (this.$utils.isArray(data) && this.selectionAll !== null) {
+                this.$emit('action-event', buttonKey, position, selection, this.selectionAll, index, action)
+            } else {
+                this.$emit('action-event', buttonKey, position, selection, data, index, action)
+            }
         },
 
         /**