修改下载视频列表
This commit is contained in:
@@ -79,9 +79,43 @@
|
||||
<el-button @click="batch" icon="el-icon-edit-outline" plain type="warning">批量设置视频</el-button>
|
||||
<!-- <el-button @click="delTag" icon="el-icon-edit-outline" plain type="danger">批量删除标签</el-button> -->
|
||||
<el-button @click="delAll" icon="el-icon-edit-outline" plain type="danger">批量删除视频</el-button>
|
||||
<el-button @click="openExportDialog" icon="el-icon-download" plain type="info">数据导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<el-dialog
|
||||
title="按上架时间导出"
|
||||
:visible.sync="exportDialogVisible"
|
||||
width="520px"
|
||||
append-to-body
|
||||
@open="syncExportFormFromSearch">
|
||||
<el-form label-width="100px" size="small">
|
||||
<el-form-item label="上架时间">
|
||||
<el-date-picker
|
||||
v-model="exportForm.range"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束"
|
||||
value-format="yyyy-MM-ddTHH:mm:ss+08:00"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
style="width: 100%"
|
||||
clearable />
|
||||
<div style="color:#909399;font-size:12px;line-height:1.4;margin-top:6px">与列表搜索「日期」一致;可不选,由后端按未传时间处理</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="页码">
|
||||
<el-input-number v-model="exportForm.pageNum" :min="1" :precision="0" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="每页条数">
|
||||
<el-input-number v-model="exportForm.pageSize" :min="1" :max="1000" :precision="0" controls-position="right" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="exportDialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="exportLoading" @click="submitExport">导 出</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-table
|
||||
@@ -325,7 +359,7 @@ import DelTag from './components/delTag'
|
||||
import { contentTypeList, videoLocationList } from '@/filters/mediaLibrary/videoList'
|
||||
|
||||
import { rankSo, MediaPayTypeList, MediaSatusList } from '@/filters/videoManagement/videoList'
|
||||
import { mediaSearch, mediaDel } from '@/api/videoManagement/videoList'
|
||||
import { mediaSearch, mediaDel, mediaExportByPublishTime } from '@/api/videoManagement/videoList'
|
||||
import ShowVideo from '@/components/ShowVideo/index.vue'
|
||||
import { mediatagList } from '@/api/videoManagement/mediatag'
|
||||
import { topicSearch, topicMediaTop } from '@/api/videoManagement/topic'
|
||||
@@ -416,7 +450,14 @@ export default {
|
||||
videoList: [],
|
||||
selectBatch: [],
|
||||
delTagVisible: false,
|
||||
categoryList: []// 视频分类列表
|
||||
categoryList: [], // 视频分类列表
|
||||
exportDialogVisible: false,
|
||||
exportLoading: false,
|
||||
exportForm: {
|
||||
range: null,
|
||||
pageNum: 1,
|
||||
pageSize: 1000
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -706,6 +747,59 @@ export default {
|
||||
// 视频查看
|
||||
checkMedia(url, data) {
|
||||
this.$refs.showvideo.open(url, data)
|
||||
},
|
||||
|
||||
openExportDialog() {
|
||||
this.exportDialogVisible = true
|
||||
},
|
||||
|
||||
syncExportFormFromSearch() {
|
||||
this.exportForm.range = this.time && this.time.length === 2 ? [...this.time] : null
|
||||
this.exportForm.pageNum = 1
|
||||
this.exportForm.pageSize = 1000
|
||||
},
|
||||
|
||||
submitExport() {
|
||||
const { range, pageNum, pageSize } = this.exportForm
|
||||
if (pageSize > 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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user