Ver código fonte

数据产品:数据预览加载更多调整

Xiao_123 1 dia atrás
pai
commit
ca605b82db

+ 6 - 3
src/views/dataService/dataProduct/components/PreviewDialog.vue

@@ -176,9 +176,12 @@ export default {
     },
     'previewData.columns' (val) {
       if (val && val.length && this.visible) {
-        // 当列数据更新时,默认选中前6条
-        const defaultCount = Math.min(6, val.length)
-        this.selectedColumns = val.slice(0, defaultCount).map(col => col.name)
+        // 只在首次加载(selectedColumns为空)时,默认选中前6条
+        // 如果已经有选中的列,则保持用户的选择
+        if (this.selectedColumns.length === 0) {
+          const defaultCount = Math.min(6, val.length)
+          this.selectedColumns = val.slice(0, defaultCount).map(col => col.name)
+        }
       }
     }
   },