|
@@ -42,29 +42,53 @@ function MakerSpaceWord(data,fund){
|
|
|
|
|
|
let indirect = JSON.parse(item['indirectFund']);
|
|
|
|
|
|
- fundData['device'] = direct.filter(item=>item['directFundData']==1)[0]['budget'];
|
|
|
- fundData['deviceRemarks'] = direct.filter(item=>item['directFundData']==1)[0]['reason'];
|
|
|
+ direct.forEach(item2=>{
|
|
|
+ if (item2['directFundData']==1) {
|
|
|
+ fundData['device'] = direct.filter(item=>item['directFundData']==1)[0]['budget'];
|
|
|
+
|
|
|
+ fundData['deviceRemarks'] = direct.filter(item=>item['directFundData']==1)[0]['reason'];
|
|
|
+ }
|
|
|
|
|
|
- fundData['Material'] = direct.filter(item=>item['directFundData']==2)[0]['budget']
|
|
|
- fundData['MaterialRemarks'] = direct.filter(item=>item['directFundData']==2)[0]['reason'];
|
|
|
+ if (item2['directFundData']==2) {
|
|
|
+ fundData['Material'] = direct.filter(item=>item['directFundData']==2)[0]['budget']
|
|
|
+ fundData['MaterialRemarks'] = direct.filter(item=>item['directFundData']==2)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item2['directFundData']==3) {
|
|
|
+ fundData['processing'] = direct.filter(item=>item['directFundData']==3)[0]['budget']
|
|
|
+ fundData['processingRemarks'] = direct.filter(item=>item['directFundData']==3)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (item2['directFundData']==4) {
|
|
|
+ fundData['Collaboration'] = direct.filter(item=>item['directFundData']==4)[0]['budget']
|
|
|
+ fundData['CollaborationRemarks'] = direct.filter(item=>item['directFundData']==4)[0]['reason'];
|
|
|
+ }
|
|
|
|
|
|
- fundData['processing'] = direct.filter(item=>item['directFundData']==3)[0]['budget']
|
|
|
- fundData['processingRemarks'] = direct.filter(item=>item['directFundData']==3)[0]['reason'];
|
|
|
+ })
|
|
|
+
|
|
|
+ indirect.forEach(item3=>{
|
|
|
+ if (item3['indirectFundData']==1) {
|
|
|
+ fundData['APPRAISAL'] = indirect.filter(item=>item['indirectFundData']==1)[0]['budget']
|
|
|
+ fundData['APPRAISALRemarks'] = indirect.filter(item=>item['indirectFundData']==1)[0]['reason'];
|
|
|
+ }
|
|
|
|
|
|
- fundData['Collaboration'] = direct.filter(item=>item['directFundData']==4)[0]['budget']
|
|
|
- fundData['CollaborationRemarks'] = direct.filter(item=>item['directFundData']==4)[0]['reason'];
|
|
|
+ if (item3['indirectFundData']==2) {
|
|
|
+ fundData['entery'] = indirect.filter(item=>item['indirectFundData']==2)[0]['budget']
|
|
|
+ fundData['enteryRemarks'] = indirect.filter(item=>item['indirectFundData']==2)[0]['reason'];
|
|
|
+ }
|
|
|
|
|
|
- fundData['APPRAISAL'] = indirect.filter(item=>item['indirectFundData']==1)[0]['budget']
|
|
|
- fundData['APPRAISALRemarks'] = indirect.filter(item=>item['indirectFundData']==1)[0]['reason'];
|
|
|
+ if (item3['indirectFundData']==3) {
|
|
|
+ fundData['activities'] = indirect.filter(item=>item['indirectFundData']==3)[0]['budget']
|
|
|
+ fundData['activitiesRemarks'] = indirect.filter(item=>item['indirectFundData']==3)[0]['reason'];
|
|
|
+ }
|
|
|
|
|
|
- fundData['entery'] = indirect.filter(item=>item['indirectFundData']==2)[0]['budget']
|
|
|
- fundData['enteryRemarks'] = indirect.filter(item=>item['indirectFundData']==2)[0]['reason'];
|
|
|
-
|
|
|
- fundData['activities'] = indirect.filter(item=>item['indirectFundData']==3)[0]['budget']
|
|
|
- fundData['activitiesRemarks'] = indirect.filter(item=>item['indirectFundData']==3)[0]['reason'];
|
|
|
-
|
|
|
- fundData['Transaction'] = indirect.filter(item=>item['indirectFundData']==4)[0]['budget']
|
|
|
- fundData['TransactionRemarks'] = indirect.filter(item=>item['indirectFundData']==4)[0]['reason'];
|
|
|
+ if (item3['indirectFundData']==4) {
|
|
|
+ fundData['Transaction'] = indirect.filter(item=>item['indirectFundData']==4)[0]['budget']
|
|
|
+ fundData['TransactionRemarks'] = indirect.filter(item=>item['indirectFundData']==4)[0]['reason'];
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
fundData['total'] = Number(fundData['device'])+Number(fundData['Material'])+Number(fundData['processing'])+Number(fundData['Collaboration'])+Number(fundData['APPRAISAL'])+Number(fundData['entery'])+Number(fundData['activities'])+Number(fundData['Transaction']);
|
|
|
|
|
@@ -137,6 +161,218 @@ function MakerSpaceWord(data,fund){
|
|
|
x.send()
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+function MakerStudentWord(data,fund){
|
|
|
+ console.log(data);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let _url = "./file/2023年学生创客项目申报书模板.docx";
|
|
|
+
|
|
|
+
|
|
|
+ const x = new XMLHttpRequest();
|
|
|
+ x.open("GET",_url, true);
|
|
|
+ x.responseType = "blob";
|
|
|
+ x.onload = function (e) {
|
|
|
+ const blob = x.response;
|
|
|
+
|
|
|
+ const reader = new FileReader();
|
|
|
+ reader.readAsArrayBuffer(blob);
|
|
|
+ reader.onload=function(a){
|
|
|
+ const buffer = reader.result;
|
|
|
+ const binary = new Uint8Array(buffer)
|
|
|
+
|
|
|
+ const zip = new PizZip(binary);
|
|
|
+
|
|
|
+ const doc = new Docxtemplater().loadZip(zip);
|
|
|
+
|
|
|
+
|
|
|
+ data['chapters'] = JSON.parse(data['chapters']);
|
|
|
+ data['course_teacher'] = JSON.parse(data['course_teacher']);
|
|
|
+ data['course_student'] = JSON.parse(data['course_student']);
|
|
|
+
|
|
|
+
|
|
|
+ let fundDataArray = [];
|
|
|
+ fund.forEach(item=>{
|
|
|
+ let fundData = {
|
|
|
+ total:"",
|
|
|
+ device:"",deviceRemarks:"",
|
|
|
+ Material:"",MaterialRemarks:"",
|
|
|
+ processing:"",processingRemarks:"",
|
|
|
+ Collaboration:"",CollaborationRemarks:"",
|
|
|
+ APPRAISAL:"",APPRAISALRemarks:"",
|
|
|
+ entery:"",enteryRemarks:"",
|
|
|
+ activities:"",activitiesRemarks:"",
|
|
|
+ Transaction:"",TransactionRemarks:""
|
|
|
+ }
|
|
|
+
|
|
|
+ let direct = JSON.parse(item['directFund']);
|
|
|
+
|
|
|
+ let indirect = JSON.parse(item['indirectFund']);
|
|
|
+
|
|
|
+ direct.forEach(item2=>{
|
|
|
+ if (item2['directFundData']==1) {
|
|
|
+ fundData['device'] = direct.filter(item=>item['directFundData']==1)[0]['budget'];
|
|
|
+
|
|
|
+ fundData['deviceRemarks'] = direct.filter(item=>item['directFundData']==1)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item2['directFundData']==2) {
|
|
|
+ fundData['Material'] = direct.filter(item=>item['directFundData']==2)[0]['budget']
|
|
|
+ fundData['MaterialRemarks'] = direct.filter(item=>item['directFundData']==2)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item2['directFundData']==3) {
|
|
|
+ fundData['processing'] = direct.filter(item=>item['directFundData']==3)[0]['budget']
|
|
|
+ fundData['processingRemarks'] = direct.filter(item=>item['directFundData']==3)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (item2['directFundData']==4) {
|
|
|
+ fundData['Collaboration'] = direct.filter(item=>item['directFundData']==4)[0]['budget']
|
|
|
+ fundData['CollaborationRemarks'] = direct.filter(item=>item['directFundData']==4)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ indirect.forEach(item3=>{
|
|
|
+ if (item3['indirectFundData']==1) {
|
|
|
+ fundData['APPRAISAL'] = indirect.filter(item=>item['indirectFundData']==1)[0]['budget']
|
|
|
+ fundData['APPRAISALRemarks'] = indirect.filter(item=>item['indirectFundData']==1)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item3['indirectFundData']==2) {
|
|
|
+ fundData['entery'] = indirect.filter(item=>item['indirectFundData']==2)[0]['budget']
|
|
|
+ fundData['enteryRemarks'] = indirect.filter(item=>item['indirectFundData']==2)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item3['indirectFundData']==3) {
|
|
|
+ fundData['activities'] = indirect.filter(item=>item['indirectFundData']==3)[0]['budget']
|
|
|
+ fundData['activitiesRemarks'] = indirect.filter(item=>item['indirectFundData']==3)[0]['reason'];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item3['indirectFundData']==4) {
|
|
|
+ fundData['Transaction'] = indirect.filter(item=>item['indirectFundData']==4)[0]['budget']
|
|
|
+ fundData['TransactionRemarks'] = indirect.filter(item=>item['indirectFundData']==4)[0]['reason'];
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ fundData['total'] = Number(fundData['device'])+Number(fundData['Material'])+Number(fundData['processing'])+Number(fundData['Collaboration'])+Number(fundData['APPRAISAL'])+Number(fundData['entery'])+Number(fundData['activities'])+Number(fundData['Transaction']);
|
|
|
+
|
|
|
+ fundDataArray.push(fundData);
|
|
|
+ })
|
|
|
+
|
|
|
+ for(let i in data['chapters']){
|
|
|
+ data['chapters'][i]=data['chapters'][i].replace(/<[^>]+>/g,"");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let wordData = {
|
|
|
+ begin_date:data['begin_at'],
|
|
|
+ projectName:data['title'],
|
|
|
+ ing:data['typeName']==0?"√":"□",
|
|
|
+ ed:data['typeName']==0?"□":"√",
|
|
|
+
|
|
|
+ mone:data['multiSelectProject'][0]==1?"√":"□",
|
|
|
+ mtwo:data['multiSelectProject'][1]==2?"√":"□",
|
|
|
+ mthree:data['multiSelectProject'][2]==3?"√":"□",
|
|
|
+ mfour:data['multiSelectProject'][3]==4?"√":"□",
|
|
|
+
|
|
|
+ sone:data['schoolRemould']==1?"√":"□",
|
|
|
+ stwo:data['schoolRemould']==2?"√":"□",
|
|
|
+ sthree:data['schoolRemould']==3?"√":"□",
|
|
|
+ sfour:data['schoolRemould']==4?"√":"□",
|
|
|
+
|
|
|
+ stu:data['projectApplyperson']==1?"√":"□",
|
|
|
+ leg:data['projectApplyperson']==1?"□":"√",
|
|
|
+
|
|
|
+ appPeason:data['pro_leader'],
|
|
|
+ school:data['name'],
|
|
|
+ tel:data['phone'],
|
|
|
+
|
|
|
+ begin_at:data['begin_at'],
|
|
|
+ plannedEnd_at:data['plannedEnd_at'],
|
|
|
+
|
|
|
+ allnum:(data['course_teacher'].length+data['course_student'].length),
|
|
|
+ snum:data['course_teacher'].length,
|
|
|
+ tnum:data['course_student'].length,
|
|
|
+
|
|
|
+ brief:data['brief'],
|
|
|
+
|
|
|
+ back:data['chapters']['back'],
|
|
|
+ innovate:data['chapters']['innovate'],
|
|
|
+ path:data['chapters']['path'],
|
|
|
+ scene:data['chapters']['scene'],
|
|
|
+ worth:data['chapters']['worth'],
|
|
|
+ team:data['chapters']['team'],
|
|
|
+ cost:data['chapters']['cost'],
|
|
|
+ expectResults:data['chapters']['expectResults'],
|
|
|
+ expectResultsTeacher:data['chapters']['expectResultsTeacher'],
|
|
|
+ expectConversion:data['chapters']['expectConversion'],
|
|
|
+ plan:data['chapters']['plan'],
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ teacher:data['course_teacher'],
|
|
|
+ student:data['course_student'],
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ fund:fundDataArray,
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ doc.setData(wordData);
|
|
|
+ doc.render();
|
|
|
+
|
|
|
+ const output = doc.getZip().generate({
|
|
|
+ type: "blob",
|
|
|
+ mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
+ compression: "DEFLATE",
|
|
|
+ });
|
|
|
+ let link = document.createElement("a");
|
|
|
+ link.download = '2023年学生创客项目申报书.docx';
|
|
|
+ link.style.display = "none";
|
|
|
+ let blob = new Blob([output]);
|
|
|
+ link.href = URL.createObjectURL(blob);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ x.send()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
export{
|
|
|
- MakerSpaceWord
|
|
|
+ MakerSpaceWord,
|
|
|
+ MakerStudentWord
|
|
|
}
|