提交 ad43204f 编写于 作者: S sunxiwang

员工活码下载

上级 067b521b
......@@ -189,6 +189,22 @@ public class WeEmpleCodeController extends BaseController {
}
}
@PreAuthorize("@ss.hasPermi('wecom:code:download')")
@Log(title = "员工活码下载", businessType = BusinessType.OTHER)
@GetMapping("/download")
public void download(String id, HttpServletRequest request, HttpServletResponse response){
WeEmpleCode weEmpleCode = weEmpleCodeService.selectWeEmpleCodeById(Long.valueOf(id));
if (StringUtils.isEmpty(weEmpleCode.getQrCode())){
return;
}else {
try {
FileUtils.downloadFile(weEmpleCode.getQrCode(), response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 成员添加客户统计
......
......@@ -141,7 +141,16 @@ export function downloadBatch(ids) {
},
responseType: 'blob'
})
//return process.env.VUE_APP_BASE_API + service + '/downloadBatch/?ids=' + ids
}
export function download(id) {
return request({
url: service + '/download',
params: {
id,
},
responseType: 'blob'
})
}
/**
......
<script>
import { getDetail, getUserAddCustomerStat } from '@/api/drainageCode/staff'
import { download, downloadBatch } from '@/api/common'
import { getDetail, getUserAddCustomerStat, download } from '@/api/drainageCode/staff'
import ClipboardJS from 'clipboard'
import echarts from 'echarts'
export default {
......@@ -105,7 +104,22 @@ export default {
return year + '-' + month + '-' + date
},
download() {
window.open(this.form.qrCode)
let userName ="";
this.form.weEmpleCodeUseScops.forEach((item) =>{
userName+=item.businessName+",";
})
let name = userName.substr(0,userName.length-1) +"-"+this.form.activityScene+".png"
download(this.form.id).then((res) =>{
if (res!=null) {
let blob = new Blob([res], {type: 'application/zip'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a'); // 创建a标签
link.href = url;
link.download = name; // 重命名文件
link.click();
URL.revokeObjectURL(url); // 释放内存
}
})
},
},
}
......
......@@ -4,8 +4,8 @@ import {
remove,
batchAdd,
downloadBatch,
download,
} from '@/api/drainageCode/staff'
import { download } from '@/api/common'
import SelectUser from '@/components/SelectUser'
import ClipboardJS from 'clipboard'
export default {
......@@ -129,12 +129,23 @@ export default {
this.getList(1)
})
},
download(id,userName,activityScene){
let name = userName+"-"+activityScene+".png"
download(id).then((res) =>{
if (res!=null) {
let blob = new Blob([res], {type: 'application/zip'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a'); // 创建a标签
link.href = url;
link.download = name; // 重命名文件
link.click();
URL.revokeObjectURL(url); // 释放内存
}
})
},
/** 下载 */
downloadBatch(qrCode) {
// window.open(download(row.qrCode, row.createBy.split(',')[0] + '.png'))
qrCode && window.open(qrCode)
qrCode ||
this.$confirm('是否确认下载所有图片吗?', '警告', {
this.$confirm('是否确认下载所有图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
......@@ -296,7 +307,7 @@ export default {
<template slot-scope="{ row }">
<el-button
type="text"
@click="downloadBatch(row.qrCode)"
@click="download(row.id,row.useUserName,row.activityScene)"
v-hasPermi="['monitor:operlog:query']"
>下载</el-button
>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册