diff --git a/src/api/videoManagement/videoList.js b/src/api/videoManagement/videoList.js index df17e1e..d23c1bd 100644 --- a/src/api/videoManagement/videoList.js +++ b/src/api/videoManagement/videoList.js @@ -59,6 +59,17 @@ export function mediaSearch(data) { }) } +// 按上架时间导出视频(分页,每页最多 1000) +export function mediaExportByPublishTime(data) { + return request({ + url: '/api/web/mediacoll/media/export', + method: 'post', + filterParam: true, + data, + responseType: 'arraybuffer' + }) +} + // 修改视频 export function mediaUpdate(data) { return request({ diff --git a/src/views/videoManagement/videoList/index.vue b/src/views/videoManagement/videoList/index.vue index cce3864..70e4374 100644 --- a/src/views/videoManagement/videoList/index.vue +++ b/src/views/videoManagement/videoList/index.vue @@ -79,9 +79,43 @@ 批量设置视频 批量删除视频 + 数据导出 + + + + + +
与列表搜索「日期」一致;可不选,由后端按未传时间处理
+
+ + + + + + +
+ +
1000) { + this.$message.warning('每页最多 1000 条') + return + } + const payload = { + pageNum: Number(pageNum) || 1, + pageSize: Number(pageSize) || 1000 + } + if (range && range.length === 2) { + payload.startTime = range[0] + payload.endTime = range[1] + } + this.exportLoading = true + mediaExportByPublishTime(payload) + .then((res) => { + if (res && res.code) { + this.$message.error(res.msg || '导出失败') + return + } + const blob = new Blob([res], { + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }) + const url = window.URL.createObjectURL(blob) + const a = document.createElement('a') + a.href = url + a.download = `视频导出_上架时间_p${payload.pageNum}_${Date.now()}.xlsx` + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + window.URL.revokeObjectURL(url) + this.$message.success('导出成功') + this.exportDialogVisible = false + }) + .catch(() => { + this.$message.error('导出失败') + }) + .finally(() => { + this.exportLoading = false + }) } } }