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