|
|
|
@ -1336,10 +1336,8 @@ class Listofworks extends Component {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 导出实习报告批量
|
|
|
|
|
internshipreport = (url)=>{
|
|
|
|
|
console.log("internshipreport");
|
|
|
|
|
/// 确认是否下砸
|
|
|
|
|
confirmysl(url,type){
|
|
|
|
|
var struy="";
|
|
|
|
|
try {
|
|
|
|
|
struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
|
|
|
|
@ -1349,70 +1347,66 @@ class Listofworks extends Component {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
axios.get((url),{responseType: 'blob'}).then((response) => {
|
|
|
|
|
console.log("1350");
|
|
|
|
|
console.log(response);
|
|
|
|
|
if(response.status&&response.status===-1){
|
|
|
|
|
|
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
|
if(response.data.status&&response.data.status===-1){
|
|
|
|
|
console.log("1352");
|
|
|
|
|
console.log(response);
|
|
|
|
|
|
|
|
|
|
}else if(response.status&&response.status===-2){
|
|
|
|
|
}else if(response.data.status&&response.data.status===-2){
|
|
|
|
|
console.log("1356");
|
|
|
|
|
console.log(response);
|
|
|
|
|
}else {
|
|
|
|
|
if(type === 1){
|
|
|
|
|
this.internshipreport(url,struy)
|
|
|
|
|
}else{
|
|
|
|
|
this.Classstudentachievement(url,struy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 导出实习报告批量
|
|
|
|
|
internshipreport = (url,struy)=>{
|
|
|
|
|
console.log("internshipreport");
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
// window.location.href("/api"+url);
|
|
|
|
|
// console.log("开始下载zip文件")
|
|
|
|
|
axios.get((url),{responseType: 'blob'}).then((response) => {
|
|
|
|
|
console.log("1350");
|
|
|
|
|
console.log(response);
|
|
|
|
|
const type='application/zip'//ZIP文件
|
|
|
|
|
const blob = new Blob([response.data], { type: type })
|
|
|
|
|
const downloadElement = document.createElement('a')
|
|
|
|
|
const href = window.URL.createObjectURL(blob)
|
|
|
|
|
const blob = new Blob([response.data], { type: type });
|
|
|
|
|
const downloadElement = document.createElement('a');
|
|
|
|
|
const href = window.URL.createObjectURL(blob);
|
|
|
|
|
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
|
|
|
|
|
console.log(response.headers['content-disposition'].split('=')[1]);
|
|
|
|
|
downloadElement.href = href
|
|
|
|
|
downloadElement.download = string+struy+".zip"
|
|
|
|
|
document.body.appendChild(downloadElement)
|
|
|
|
|
downloadElement.click()
|
|
|
|
|
document.body.removeChild(downloadElement) // 下载完成移除元素
|
|
|
|
|
downloadElement.href = href;
|
|
|
|
|
downloadElement.download = string+struy+".zip";
|
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
|
downloadElement.click();
|
|
|
|
|
document.body.removeChild(downloadElement) ;// 下载完成移除元素
|
|
|
|
|
window.URL.revokeObjectURL(href) // 释放掉blob对象
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 课堂学生成绩的导出下载
|
|
|
|
|
Classstudentachievement=(url)=>{
|
|
|
|
|
Classstudentachievement=(url,struy)=>{
|
|
|
|
|
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);
|
|
|
|
|
if(response.status&&response.status===-1){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else if(response.status&&response.status===-2){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
console.log("1374");
|
|
|
|
|
console.log(response);
|
|
|
|
|
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
|
|
|
|
|
const blob = new Blob([response.data], { type: type })
|
|
|
|
|
const downloadElement = document.createElement('a')
|
|
|
|
|
const href = window.URL.createObjectURL(blob)
|
|
|
|
|
const blob = new Blob([response.data], { type: type });
|
|
|
|
|
const downloadElement = document.createElement('a');
|
|
|
|
|
const href = window.URL.createObjectURL(blob);
|
|
|
|
|
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
|
|
|
|
|
console.log(response.headers['content-disposition'].split('=')[1]);
|
|
|
|
|
downloadElement.href = href
|
|
|
|
|
downloadElement.href = href;
|
|
|
|
|
downloadElement.download =string+struy+".xlsx";
|
|
|
|
|
document.body.appendChild(downloadElement)
|
|
|
|
|
downloadElement.click()
|
|
|
|
|
document.body.removeChild(downloadElement) // 下载完成移除元素
|
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
|
downloadElement.click();
|
|
|
|
|
document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
|
|
window.URL.revokeObjectURL(href) // 释放掉blob对象
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
@ -1566,8 +1560,8 @@ class Listofworks extends Component {
|
|
|
|
|
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}>
|
|
|
|
|
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
|
|
|
|
|
<ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}>
|
|
|
|
|
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)}>实训报告</a></li>
|
|
|
|
|
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li>
|
|
|
|
|
<li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`,1)}>实训报告</a></li>
|
|
|
|
|
<li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`,2)} >学生成绩</a></li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
</li>:""}
|
|
|
|
|