Browse Source

fix:处理系统导出未选数据时候的报错,修改数据模板里selection值为所有已选择的数据id

liujiayin 2 năm trước cách đây
mục cha
commit
5d354f1243

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

@@ -21,6 +21,7 @@
             :dynamic-params="dynamicParams"
             :form-name="template ? template.attrs.form_name : ''"
             :class="{ 'ibps-data-template-list__preview': preview }"
+            :selection_all="selectionAll"
             @display-field-change="handleDisplayField"
             @header-dragend="handleHeaderDragend"
             @selection-change="handleSelectionChange"
@@ -698,6 +699,9 @@ export default {
          */
         getSelectAllIds () {
             const selectAllIds = []
+            if (this.$utils.isEmpty(this.selectionAll)) {
+                return
+            }
             if (this.multiple) {
                 this.selectionAll.forEach((row) => {
                     selectAllIds.push(this.getPkValue(row))

+ 10 - 1
src/components/ibps-crud/mixin/base.js

@@ -95,6 +95,14 @@ export default {
     selectionType: {
       type: String,
       default: 'checkbox'
+    },
+    /**
+     * @description 所有列表已选择的数据id
+     * 
+     */
+    selection_all:{
+      type: Array,
+      default: ()=>[]
     }
   },
   methods: {
@@ -255,7 +263,8 @@ export default {
       const buttonKey = action.key
       let selection = null// 选中数据
       if (position === 'toolbar') { // 工具栏
-        selection = this.getSelectedIds()
+        // selection = this.getSelectedIds()
+        selection = this.selection_all.map(i=>i.id_) // 默认给所有已选择的数据id
       } else { // 管理列
         selection = data ? this.getPkValue(data) : null
       }