dev_forum
杨树林 5 years ago
parent d1a962b65f
commit f102b5a8ad

@ -1340,14 +1340,15 @@ class Listofworks extends Component {
// 导出实习报告批量 // 导出实习报告批量
internshipreport = (url)=>{ internshipreport = (url)=>{
console.log("internshipreport"); console.log("internshipreport");
// params: { var struy="";
// homework_common_id: homeworkid, try {
// work_status: this.state.course_groupyslstwo, struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
// course_group: this.state.checkedValuesineinfo, struy=struy.replace(/-/g,"");
// search: this.state.searchtext, }catch (e) {
// } console.log(1347);
// let url = "/zip/shixun_report"; console.log(e);
// let homeworkid = this.props.match.params.homeworkid; }
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1350"); console.log("1350");
console.log(response); console.log(response);
@ -1363,19 +1364,10 @@ class Listofworks extends Component {
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href downloadElement.href = href
var now=""; downloadElement.download = string+struy+".zip"
try {
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log(now);
} catch (e) {
console.log("1376");
}
downloadElement.download = string+now+".zip"
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
@ -1388,6 +1380,17 @@ class Listofworks extends Component {
// 课堂学生成绩的导出下载 // 课堂学生成绩的导出下载
Classstudentachievement=(url)=>{ Classstudentachievement=(url)=>{
console.log("Classstudentachievement"); console.log("Classstudentachievement");
// console.log();
var struy="";
try {
struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
struy=struy.replace(/-/g,"");
}catch (e) {
console.log(1397);
console.log(e);
}
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1374"); console.log("1374");
console.log(response); console.log(response);
@ -1401,21 +1404,10 @@ class Listofworks extends Component {
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
// console.log("1409");
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now=""; console.log(response.headers['content-disposition'].split('=')[1]);
try {
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
} catch (e) {
console.log("1432");
}
downloadElement.href = href downloadElement.href = href
downloadElement.download =string+now+".xlsx"; downloadElement.download =string+struy+".xlsx";
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素

Loading…
Cancel
Save