Browse Source

数据产品-优化下载功能:更新预览对话框以传递下载限制参数

Xiao_123 5 days ago
parent
commit
8ac6b22055

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

@@ -18,7 +18,7 @@
     </div>
     <div v-loading="loading" style="max-height: 600px; overflow-y: auto;">
       <div v-if="previewData.columns && previewData.columns.length" class="mb-2 d-flex justify-end align-center">
-        <v-autocomplete
+        <v-select
           v-model="selectedColumns"
           :items="allColumns"
           hide-details
@@ -43,7 +43,7 @@
               (+{{ selectedColumns.length - 1 }} others)
             </span>
           </template>
-        </v-autocomplete>
+        </v-select>
       </div>
       <v-simple-table v-if="displayColumns && displayColumns.length" fixed-header height="400px">
         <template v-slot:default>
@@ -258,7 +258,7 @@ export default {
       this.$emit('load-more')
     },
     handleDownload () {
-      this.$emit('download')
+      this.$emit('download', this.previewData.total_count > 10000 ? 10000 : this.previewData.total_count)
     },
     handleVisibleChange (val) {
       this.$emit('update:visible', val)

+ 4 - 4
src/views/dataService/dataProduct/index.vue

@@ -210,16 +210,16 @@ export default {
       }
     },
     // 从预览弹窗下载
-    async handleDownloadFromPreview () {
+    async handleDownloadFromPreview (limit = 200) {
       if (!this.previewDialog.currentItem) {
         return
       }
-      await this.handleDownload(this.previewDialog.currentItem)
+      await this.handleDownload(this.previewDialog.currentItem, limit)
     },
     // 下载数据
-    async handleDownload (item) {
+    async handleDownload (item, limit) {
       try {
-        const response = await api.downloadExcel(item.id, 200)
+        const response = await api.downloadExcel(item.id, limit)
 
         // 响应拦截器已处理错误情况,这里response格式为 { data: blob, name: filename }
         const filename = `${item.product_name || item.product_name_en}_${new Date().toISOString().slice(0, 10).replace(/-/g, '')}.xlsx`