Преглед изворни кода

fix:调整行点击事件对选择器列表的影响

liujiayin пре 2 година
родитељ
комит
0707aaec80

+ 6 - 0
src/business/platform/data/templaterender/templates/list.vue

@@ -652,6 +652,9 @@ export default {
             // 获取当前页选中的id
             const selectIds = []
             if (this.multiple) {
+                if(!this.$utils.isArray(this.selection)){
+                    this.selection = [this.selection]
+                }
                 this.selection.forEach((row) => {
                     const pkValue = this.getPkValue(row)
                     selectIds.push(pkValue)
@@ -744,6 +747,9 @@ export default {
             if (this.$utils.isEmpty(this.selectionAll)) {
                 return
             }
+            if(!this.$utils.isArray(this.selectionAll)){
+                this.selectionAll = [this.selectionAll]
+            }
             if (this.multiple) {
                 this.selectionAll.forEach((row) => {
                     selectAllIds.push(this.getPkValue(row))

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

@@ -166,13 +166,6 @@ export default {
          * @description 勾选数据时触发的事件
          */
         handleSelect (selection, row) {
-            if (this.selectionType === 'radio') {
-                this.setSelectionRadio(row)
-                this.$emit('selection-change', row)
-                console.log('172 row',row)
-            } else {
-                this.$refs.elTable.toggleRowSelection(row)
-            }
             this.$emit('select', selection, row)
         },
         /**
@@ -216,13 +209,12 @@ export default {
          * @description 行点击时触发的事件
          */
         handleRowClick (row, event, column) {
-            // 行点击时默认选择了该行数据,与按钮行点击事件冲突,先注释掉
-            // if (this.selectionType === 'radio') {
-            //     this.setSelectionRadio(row)
-            //     this.$emit('selection-change', row)
-            // } else {
-            //     this.$refs.elTable.toggleRowSelection(row)
-            // }
+            if (this.selectionType === 'radio') {
+                this.setSelectionRadio(row)
+                this.$emit('selection-change', row)
+            } else {
+                this.$refs.elTable.toggleRowSelection(row)
+            }
             this.$emit('row-click', row, event, column)
 
         },

+ 0 - 1
src/components/ibps-tree-table/index.vue

@@ -5,7 +5,6 @@
     :data="formatData"
     :row-style="showRow"
     v-bind="$attrs"
-    @select="handleRowClick"
     @select-all="handleSelectAll"
     @cell-click="handleCellClick"
     @row-click="handleRowClick"