Commit 16d69ca8 authored by 张伯涛's avatar 张伯涛

下载模板

parent e9f18a28
......@@ -14,3 +14,11 @@ export function handleAddForm(data) {
data
})
}
export function handleImportTemplate(params) {
return request({
url: '/cmspriceclick/exportTemplate',
method: 'get',
responseType: 'blob',
params
})
}
......@@ -838,6 +838,9 @@
>
<i class="el-icon-upload" />
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div slot="tip" class="el-upload__tip">
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
</div>
<div slot="tip" class="el-upload__tip">只能上传 .xls和.xlsx 格式的文件!</div>
</el-upload>
</el-form-item>
......@@ -866,7 +869,7 @@ import {
} from '@/api/try/teaTrialCourse'
import { getDict } from '@/api/system/dict/data'
import { validOpenCourse } from '@/api/classManagement'
import { importSpokesmanExcel, importSysUserExcel, importTemplateSysuser, listByIdentity } from '@/api/system/user'
import { importSpokesmanExcel, listByIdentity } from '@/api/system/user'
import { listAllShop, listCourseAll } from '@/api/sysUnit'
import { mapGetters } from 'vuex'
import {
......@@ -875,7 +878,7 @@ import {
cmspriceclickUpdate
} from '@/api/contentManagement/sysContentVideoInformation'
import { getToken } from '@/utils/auth'
import { listAllByUnitIdType, handleAddForm } from '@/api/clickManagement'
import { listAllByUnitIdType, handleAddForm,handleImportTemplate } from '@/api/clickManagement'
export default {
name: 'Index',
data() {
......@@ -1155,6 +1158,20 @@ export default {
this.formModel.file = ''
this.$refs['formModel'].validateField('file')
},
/** 下载模板*/
importTemplate() {
handleImportTemplate().then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '推广次数导入模板' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
})
},
// 表单重置
reset() {
this.formModel = {
......
......@@ -267,9 +267,10 @@ export default {
queryParams: {
page: 1,
rows: 10,
newVideoId: '',
newsVideoId: '',
startTime: '',
endTime: ''
endTime: '',
unitId: ''
},
total: 0,
tableData: [],
......@@ -542,9 +543,10 @@ export default {
console.log('params', params)
this.echartsOpen = true
this.echartsTitle = '文章'
this.queryParams.newVideoId = params.data.id
this.queryParams.newsVideoId = params.data.id
this.queryParams.page = 1
this.queryParams.rows = 10
this.queryParams.unitId = this.company
if (this.timeFrame && this.timeFrame.length > 0) {
this.queryParams.startTime = this.timeFrame[0] + ' 00:00:00'
this.queryParams.endTime = this.timeFrame[1] + ' 23:59:59'
......@@ -620,9 +622,10 @@ export default {
console.log('params', params)
this.echartsOpen = true
this.echartsTitle = '视频'
this.queryParams.newVideoId = params.data.id
this.queryParams.newsVideoId = params.data.id
this.queryParams.page = 1
this.queryParams.rows = 10
this.queryParams.unitId = this.company
if (this.timeFrame && this.timeFrame.length > 0) {
this.queryParams.startTime = this.timeFrame[0] + ' 00:00:00'
this.queryParams.endTime = this.timeFrame[1] + ' 23:59:59'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment