Browse Source

fix:修复数据模板脚本里selection的赋值

liujiayin 2 years ago
parent
commit
2433b412bb

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

@@ -21,7 +21,7 @@
             :dynamic-params="dynamicParams"
             :form-name="template ? template.attrs.form_name : ''"
             :class="{ 'ibps-data-template-list__preview': preview }"
-            :selection_all="selectionAll"
+            :selection-all="selectionAll"
             @display-field-change="handleDisplayField"
             @header-dragend="handleHeaderDragend"
             @selection-change="handleSelectionChange"

+ 2 - 3
src/components/ibps-crud/mixin/base.js

@@ -101,7 +101,7 @@ export default {
          *
          */
         selectionAll: {
-            type: Object,
+            type: [Object, Array],
             default: null
         }
     },
@@ -271,7 +271,7 @@ export default {
             const buttonKey = action.key
             let selection = null// 选中数据
             if (position === 'toolbar') { // 工具栏
-                if (this.selectionAll) {
+                if (this.$utils.isArray(this.selectionAll) && this.selectionAll.length) {
                     selection = this.selectionAll.map(i => i.id_) // 默认给所有已选择的数据id
                 } else {
                     selection = this.getSelectedIds()
@@ -279,7 +279,6 @@ export default {
             } else { // 管理列
                 selection = data ? this.getPkValue(data) : null
             }
-
             this.$emit('action-event', buttonKey, position, selection, data, index, action)
         },