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QAAQ,eAC3CA,EAAS,QAAU4J,QAAQ5J,EAAS,SAEpCoB,EAAIkC,QAAQtD,GAEZoB,EAAImC,SAGJ,MAAMC,EAASpC,EAAIqC,SAASC,SAAS,CACjCC,KAAM,OACNC,SAAS,0EACTC,YAAa,YAEjB,IAAIC,EAAOC,SAASC,cAAc,KAClCF,EAAKG,SAAY,oBAAmBjE,EAAS,QAAQ,OAAO,eAC5D8D,EAAKI,MAAMC,QAAU,OACrB,IAAI3D,EAAO,IAAI4D,KAAK,CAACZ,IACrBM,EAAKO,KAAOC,IAAIC,gBAAgB/D,GAChCuD,SAASS,KAAKC,YAAYX,GAC1BA,EAAKY,QACLX,SAASS,KAAKG,YAAYb,EAC9B,CAEJ,EACA5D,EAAE0E,MACN,C","sources":["webpack://scproject/./src/components/tool/getWord.js"],"sourcesContent":["import Docxtemplater from 'docxtemplater'\r\nimport PizZip from 'pizzip'\r\nimport { getNowDate } from './Date';\r\nimport { GetTime } from './Date';\r\nimport FileSaver, { saveAs } from 'file-saver';\r\nimport JSZipUtils from 'jszip-utils'\r\n// import {getNowDate} from '@/components/tool/Date.js'\r\n\r\n// import HTMLModule from 'docx'\r\nfunction MakerSpaceWord(data,fund){\r\n //获取模板文件\r\n let _url = \"./file/2023年二级学院特色创客空间建设项目申报书模板.docx\";\r\n const x = new XMLHttpRequest();\r\n x.open(\"GET\", _url, true);\r\n x.responseType = \"blob\";\r\n x.onload = function (e) {\r\n const blob = x.response;\r\n //转成binary\r\n const reader = new FileReader();\r\n reader.readAsArrayBuffer(blob);\r\n reader.onload=function(a){\r\n const buffer = reader.result;\r\n const binary = new Uint8Array(buffer)\r\n //创建一个PizZip实例\r\n const zip = new PizZip(binary);\r\n // 将模板内容加载到 Docxtemplater 中\r\n const doc = new Docxtemplater().loadZip(zip);\r\n console.log(data)\r\n //处理项目数据\r\n data['chapters'] = JSON.parse(data['chapters']);\r\n data['course_teacher'] = JSON.parse(data['course_teacher']);\r\n data['course_student'] = JSON.parse(data['course_student']);\r\n //处理资金使用情况\r\n let fundDataArray = [];\r\n fund.forEach(item=>{\r\n let fundData = {\r\n total:\"\",\r\n device:\"\",deviceRemarks:\"\",\r\n Material:\"\",MaterialRemarks:\"\",\r\n processing:\"\",processingRemarks:\"\",\r\n Collaboration:\"\",CollaborationRemarks:\"\",\r\n APPRAISAL:\"\",APPRAISALRemarks:\"\",\r\n entery:\"\",enteryRemarks:\"\",\r\n activities:\"\",activitiesRemarks:\"\",\r\n Transaction:\"\",TransactionRemarks:\"\"\r\n }\r\n //直接经费\r\n\r\n let direct = JSON.parse(item['directFund']);\r\n //间接经费\r\n let indirect = JSON.parse(item['indirectFund']);\r\n \r\n direct.forEach(item2=>{\r\n if (item2['directFundData']==1) {\r\n fundData['device'] = direct.filter(item=>item['directFundData']==1)[0]['budget'];\r\n // console.log(fundData['device']);\r\n fundData['deviceRemarks'] = direct.filter(item=>item['directFundData']==1)[0]['reason'];\r\n }\r\n \r\n if (item2['directFundData']==2) {\r\n fundData['Material'] = direct.filter(item=>item['directFundData']==2)[0]['budget']\r\n fundData['MaterialRemarks'] = direct.filter(item=>item['directFundData']==2)[0]['reason'];\r\n }\r\n \r\n if (item2['directFundData']==3) {\r\n fundData['processing'] = direct.filter(item=>item['directFundData']==3)[0]['budget']\r\n fundData['processingRemarks'] = direct.filter(item=>item['directFundData']==3)[0]['reason'];\r\n }\r\n \r\n \r\n if (item2['directFundData']==4) {\r\n fundData['Collaboration'] = direct.filter(item=>item['directFundData']==4)[0]['budget']\r\n fundData['CollaborationRemarks'] = direct.filter(item=>item['directFundData']==4)[0]['reason'];\r\n }\r\n \r\n })\r\n \r\n indirect.forEach(item3=>{\r\n if (item3['indirectFundData']==1) {\r\n fundData['APPRAISAL'] = indirect.filter(item=>item['indirectFundData']==1)[0]['budget']\r\n fundData['APPRAISALRemarks'] = indirect.filter(item=>item['indirectFundData']==1)[0]['reason'];\r\n }\r\n \r\n if (item3['indirectFundData']==2) {\r\n fundData['entery'] = indirect.filter(item=>item['indirectFundData']==2)[0]['budget']\r\n fundData['enteryRemarks'] = indirect.filter(item=>item['indirectFundData']==2)[0]['reason'];\r\n }\r\n \r\n if (item3['indirectFundData']==3) {\r\n fundData['activities'] = indirect.filter(item=>item['indirectFundData']==3)[0]['budget']\r\n fundData['activitiesRemarks'] = indirect.filter(item=>item['indirectFundData']==3)[0]['reason'];\r\n }\r\n \r\n if (item3['indirectFundData']==4) {\r\n fundData['Transaction'] = indirect.filter(item=>item['indirectFundData']==4)[0]['budget']\r\n fundData['TransactionRemarks'] = indirect.filter(item=>item['indirectFundData']==4)[0]['reason'];\r\n \r\n }\r\n })\r\n \r\n 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']);\r\n \r\n fundDataArray.push(fundData);\r\n })\r\n \r\n //去除标签\r\n for(let i in data['chapters']){\r\n data['chapters'][i]=data['chapters'][i].replace(/<[^>]+>/g,\"\");\r\n }\r\n\r\n let nowDate = getNowDate().split(' ')[0]\r\n\r\n //模板数据\r\n let wordData = {\r\n year:nowDate.split('-')[0], //申请日期年\r\n month:nowDate.split('-')[1], //申请日期月\r\n day:nowDate.split('-')[2], //申请日期日\r\n ing:data['typeName']=='待建设'?\"√\":\"□\", //已建设\r\n ed:data['typeName']=='已建设'?\"√\":\"□\", //待建设\r\n projectName:data['title'],//项目名称\r\n college:data['name'],//\r\n begin_at:data['begin_at'],//项目开始时间\r\n plannedEnd_at:data['plannedEnd_at'],//计划完成时间\r\n pro_leader:data['pro_leader'],//项目负责人\r\n lead_leader:data['lead_leader'],//学院牵头领导\r\n people:(data['course_teacher'].length+data['course_student'].length),//项目组人数\r\n teacherNum:data['course_teacher'].length,//参与教师人数\r\n studentNum:data['course_student'].length,//参与学生人数\r\n teacher:data['course_teacher'], //教师组//name:姓名 speciality:专业 title:职称 education:学历 section:所在教研室 work:项目组角色分工\r\n student:data['course_student'], //学生组//name:姓名 class:班级 age:年龄 work:项目组任务分工\r\n brief:data['brief'],//项目简介\r\n Construction:data['chapters']['Construction'],//建设内容\r\n ProjectBasis:data['chapters']['ProjectBasis'],//立项依据\r\n development:data['chapters']['development'],//创客空间物理环境、制度建设及软件设施建设情况\r\n studio:data['chapters']['studio'],//学生创客工作室建设情况\r\n studentTeam:data['chapters']['studentTeam'],//学生创客团队(人才)培养预期成果、数量\r\n studentActivities:data['chapters']['studentActivities'],//学生创客活动组织实施情况\r\n Transforming:data['chapters']['Transforming'],//学生创客团队孵化、转化创业项目情况\r\n condition:data['chapters']['condition'],//立 项基 础及条 件\r\n fund:fundDataArray,//预算经费\r\n //total:总经费 \r\n //小型仪器设备费:device deviceRemarks\r\n //材料费:Material MaterialRemarks\r\n //测试化验加工费:processing processingRemarks\r\n //项目协作费:Collaboration CollaborationRemarks\r\n //项目成果鉴定费:APPRAISAL APPRAISALRemarks\r\n //参展参赛费:entery enteryRemarks\r\n //创客交流活动费:activities activitiesRemarks\r\n //知识产权事务费:Transaction TransactionRemarks\r\n }\r\n //渲染模板\r\n doc.setData(wordData);\r\n doc.render();\r\n //获取渲染后的文本\r\n const output = doc.getZip().generate({\r\n type: \"blob\",\r\n mimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n compression: \"DEFLATE\",\r\n });\r\n let link = document.createElement(\"a\");\r\n link.download = '附件3:2023年二级学院特色创客空间建设项目申报书模板(2).docx';\r\n link.style.display = \"none\";\r\n let blob = new Blob([output]);\r\n link.href = URL.createObjectURL(blob);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n return\r\n }\r\n x.send()\r\n}\r\n\r\nfunction getMakerSpaceWord(wordData){\r\n //获取模板文件\r\n let _url = \"./file/2023年二级学院特色创客空间建设项目申报书模板 (2).docx\";\r\n const x = new XMLHttpRequest();\r\n x.open(\"GET\", _url, true);\r\n x.responseType = \"blob\";\r\n x.onload = function (e) {\r\n const blob = x.response;\r\n //转成binary\r\n const reader = new FileReader();\r\n reader.readAsArrayBuffer(blob);\r\n reader.onload=function(a){\r\n const buffer = reader.result;\r\n const binary = new Uint8Array(buffer)\r\n //创建一个PizZip实例\r\n const zip = new PizZip(binary);\r\n // 将模板内容加载到 Docxtemplater 中\r\n const doc = new Docxtemplater().loadZip(zip);\r\n //处理数据\r\n // wordData['fund']['total'] = Number(wordData['fund']['device'])+Number(wordData['fund']['Material'])+Number(wordData['fund']['processing'])+Number(wordData['fund']['Collaboration'])+Number(wordData['fund']['APPRAISAL'])+Number(wordData['fund']['entery'])+Number(wordData['fund']['activities'])+Number(wordData['fund']['Transaction']);\r\n //模板数据\r\n let data = {\r\n applicationDate:wordData['applicationDate'],\r\n ing:wordData['stateName']=='待建设'?\"√\":\"□\", //已建设\r\n ed:wordData['stateName']=='已建设'?\"√\":\"□\", //待建设\r\n projectName:wordData['projectName'],//项目名称\r\n college:wordData['collegeName'],//所在学院\r\n begin_at:wordData['begin_at'].split(' ')[0],//项目开始时间\r\n plannedEnd_at:wordData['plannedEnd_at'].split(' ')[0],//计划完成时间\r\n pro_leader:wordData['pro_leader'],//项目负责人\r\n lead_leader:wordData['lead_leader'],//学院牵头领导\r\n people:(wordData['teacher'].filter(i=>i.name!='').length+wordData['student'].filter(i=>i.name!='').length),//项目组人数\r\n teacherNum:wordData['teacher'].filter(i=>i.name!='').length,//参与教师人数\r\n studentNum:wordData['student'].filter(i=>i.name!='').length,//参与学生人数\r\n teacher:wordData['teacher'], //教师组//name:姓名 speciality:专业 title:职称 education:学历 section:所在教研室 work:项目组角色分工\r\n student:wordData['student'], //学生组//name:姓名 class:班级 age:年龄 work:项目组任务分工\r\n brief:wordData['brief'],//项目简介\r\n Construction:wordData['Construction'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//建设内容\r\n ProjectBasis:wordData['ProjectBasis'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//立项依据\r\n development:wordData['development'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//创客空间物理环境、制度建设及软件设施建设情况\r\n studio:wordData['studio'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//学生创客工作室建设情况\r\n studentTeam:wordData['studentTeam'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//学生创客团队(人才)培养预期成果、数量\r\n studentActivities:wordData['studentActivities'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//学生创客活动组织实施情况\r\n Transforming:wordData['Transforming'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//学生创客团队孵化、转化创业项目情况\r\n condition:wordData['condition'].replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),//立 项基 础及条 件\r\n fund:[wordData['fund']],//预算经费\r\n //total:总经费 \r\n //小型仪器设备费:device deviceRemarks\r\n //材料费:Material MaterialRemarks\r\n //测试化验加工费:processing processingRemarks\r\n //项目协作费:Collaboration CollaborationRemarks\r\n //项目成果鉴定费:APPRAISAL APPRAISALRemarks\r\n //参展参赛费:entery enteryRemarks\r\n //创客交流活动费:activities activitiesRemarks\r\n //知识产权事务费:Transaction TransactionRemarks\r\n }\r\n //渲染模板\r\n doc.setData(data);\r\n doc.render();\r\n //获取渲染后的文本\r\n const output = doc.getZip().generate({\r\n type: \"blob\",\r\n mimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n compression: \"DEFLATE\",\r\n });\r\n let link = document.createElement(\"a\");\r\n link.download = '附件3:2023年二级学院特色创客空间建设项目申报书模板(2).docx';\r\n link.style.display = \"none\";\r\n let blob = new Blob([output]);\r\n link.href = URL.createObjectURL(blob);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n return\r\n }\r\n x.send()\r\n}\r\n\r\n// 学生创业项目申请表下载模板\r\nfunction MakerStudentWord(data,fund){\r\n console.log(data);\r\n // console.log(fund);\r\n //获取模板文件\r\n // ssti-CollegeManage\\public\\file\\2023年学生创客项目申报书模板 .docx\r\n let _url = \"./file/2023年学生创客项目申报书模板.docx\";\r\n // return console.log(_url);\r\n\r\n const x = new XMLHttpRequest();\r\n x.open(\"GET\",_url, true);\r\n x.responseType = \"blob\";\r\n x.onload = function (e) {\r\n const blob = x.response;\r\n //转成binary\r\n const reader = new FileReader();\r\n reader.readAsArrayBuffer(blob);\r\n reader.onload=function(a){\r\n const buffer = reader.result;\r\n const binary = new Uint8Array(buffer)\r\n //创建一个PizZip实例\r\n const zip = new PizZip(binary);\r\n // 将模板内容加载到 Docxtemplater 中\r\n const doc = new Docxtemplater().loadZip(zip);\r\n //处理项目数据\r\n // console.log(111);\r\n // data['chapters'] = data['chapters'];\r\n // data['course_teacher'] = JSON.parse(data['course_teacher']);\r\n // data['course_student'] = JSON.parse(data['course_student']);\r\n // return console.log(data['chapters'],data['course_teacher'],data['course_student']);\r\n //处理资金使用情况\r\n let fundDataArray = [];\r\n fund.forEach(item=>{\r\n let fundData = {\r\n total:\"\",\r\n device:\"\",deviceRemarks:\"\",\r\n Material:\"\",MaterialRemarks:\"\",\r\n processing:\"\",processingRemarks:\"\",\r\n Collaboration:\"\",CollaborationRemarks:\"\",\r\n APPRAISAL:\"\",APPRAISALRemarks:\"\",\r\n entery:\"\",enteryRemarks:\"\",\r\n activities:\"\",activitiesRemarks:\"\",\r\n Transaction:\"\",TransactionRemarks:\"\"\r\n }\r\n //直接经费\r\n let direct = JSON.parse(item['directFund']);\r\n //间接经费\r\n let indirect = JSON.parse(item['indirectFund']);\r\n \r\n direct.forEach(item2=>{\r\n if (item2['directFundData']==1) {\r\n fundData['device'] = direct.filter(item=>item['directFundData']==1)[0]['budget'];\r\n // console.log(fundData['device']);\r\n fundData['deviceRemarks'] = direct.filter(item=>item['directFundData']==1)[0]['reason'];\r\n }\r\n \r\n if (item2['directFundData']==2) {\r\n fundData['Material'] = direct.filter(item=>item['directFundData']==2)[0]['budget']\r\n fundData['MaterialRemarks'] = direct.filter(item=>item['directFundData']==2)[0]['reason'];\r\n }\r\n \r\n if (item2['directFundData']==3) {\r\n fundData['processing'] = direct.filter(item=>item['directFundData']==3)[0]['budget']\r\n fundData['processingRemarks'] = direct.filter(item=>item['directFundData']==3)[0]['reason'];\r\n }\r\n \r\n \r\n if (item2['directFundData']==4) {\r\n fundData['Collaboration'] = direct.filter(item=>item['directFundData']==4)[0]['budget']\r\n fundData['CollaborationRemarks'] = direct.filter(item=>item['directFundData']==4)[0]['reason'];\r\n }\r\n \r\n })\r\n \r\n indirect.forEach(item3=>{\r\n if (item3['indirectFundData']==1) {\r\n fundData['APPRAISAL'] = indirect.filter(item=>item['indirectFundData']==1)[0]['budget']\r\n fundData['APPRAISALRemarks'] = indirect.filter(item=>item['indirectFundData']==1)[0]['reason'];\r\n }\r\n \r\n if (item3['indirectFundData']==2) {\r\n fundData['entery'] = indirect.filter(item=>item['indirectFundData']==2)[0]['budget']\r\n fundData['enteryRemarks'] = indirect.filter(item=>item['indirectFundData']==2)[0]['reason'];\r\n }\r\n \r\n if (item3['indirectFundData']==3) {\r\n fundData['activities'] = indirect.filter(item=>item['indirectFundData']==3)[0]['budget']\r\n fundData['activitiesRemarks'] = indirect.filter(item=>item['indirectFundData']==3)[0]['reason'];\r\n }\r\n \r\n if (item3['indirectFundData']==4) {\r\n fundData['Transaction'] = indirect.filter(item=>item['indirectFundData']==4)[0]['budget']\r\n fundData['TransactionRemarks'] = indirect.filter(item=>item['indirectFundData']==4)[0]['reason'];\r\n \r\n }\r\n })\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n 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']);\r\n \r\n fundDataArray.push(fundData);\r\n })\r\n //去除标签\r\n for(let i in data['chapters']){\r\n data['chapters'][i]=data['chapters'][i].replace(/<[^>]+>/g,\"\");\r\n }\r\n\r\n let nowDate = getNowDate().split(' ')[0]\r\n\r\n //模板数据\r\n let wordData = {\r\n // begin_date:data['begin_at'],//项目开始时间\r\n year:nowDate.split('-')[0], //申请日期年\r\n month:nowDate.split('-')[1], //申请日期月\r\n day:nowDate.split('-')[2], //申请日期日\r\n projectName:data['title'],//项目名称\r\n ing:data['typeName']==0?\"√\":\"□\", //创意组\r\n ed:data['typeName']==0?\"□\":\"√\", //初创组\r\n // college:data['name'],//\r\n mone:data['val.checkList'].indexOf(1)!=-1?\"√\":\"□\", //优先支持项目\r\n mtwo:data['val.checkList'].indexOf(2)!=-1?\"√\":\"□\",\r\n mthree:data['val.checkList'].indexOf(3)!=-1?\"√\":\"□\",\r\n mfour:data['val.checkList'].indexOf(4)!=-1?\"√\":\"□\",\r\n\r\n sone:data['schoolRadio']==1?\"√\":\"□\", //美丽校园改造项目\r\n stwo:data['schoolRadio']==2?\"√\":\"□\",\r\n sthree:data['schoolRadio']==3?\"√\":\"□\",\r\n sfour:data['schoolRadio']==4?\"√\":\"□\",\r\n\r\n stu:data['projectApplyperson']==1?\"√\":\"□\", //项目申请人\r\n leg:data['projectApplyperson']==1?\"□\":\"√\", \r\n\r\n appPeason:data['pro_leader'], //申请人姓名\r\n school:data['name'], //所在学院\r\n tel:data['phone'], //联系电话\r\n\r\n begin_at:data['begin_at'],\r\n plannedEnd_at:data['plannedEnd_at'],\r\n\r\n allnum:(data['course_teacher'].length+data['course_student'].length),//项目组人数\r\n snum:data['course_teacher'].length,//参与教师人数\r\n tnum:data['course_student'].length,//参与学生人数\r\n\r\n brief:data['brief'],//项目简介\r\n\r\n back:data['chapters']['back'],\r\n innovate:data['chapters']['innovate'],\r\n path:data['chapters']['path'],\r\n scene:data['chapters']['scene'],\r\n worth:data['chapters']['worth'],\r\n team:data['chapters']['team'],\r\n cost:data['chapters']['cost'],\r\n expectResults:data['chapters']['expectResults'],\r\n expectResultsTeacher:data['chapters']['expectResultsTeacher'],\r\n expectConversion:data['chapters']['expectConversion'],\r\n plan:data['chapters']['plan'],\r\n \r\n teacher:data['course_teacher'], //教师组//name:姓名 speciality:专业 title:职称 education:学历 section:所在教研室 work:项目组角色分工\r\n student:data['course_student'], //学生组//name:姓名 class:班级 age:年龄 work:项目组任务分工\r\n \r\n fund:fundDataArray,//预算经费\r\n //total:总经费 \r\n //小型仪器设备费:device deviceRemarks\r\n //材料费:Material MaterialRemarks\r\n //测试化验加工费:processing processingRemarks\r\n //项目协作费:Collaboration CollaborationRemarks\r\n //项目成果鉴定费:APPRAISAL APPRAISALRemarks\r\n //参展参赛费:entery enteryRemarks\r\n //创客交流活动费:activities activitiesRemarks\r\n //知识产权事务费:Transaction TransactionRemarks\r\n }\r\n //渲染模板\r\n doc.setData(wordData);\r\n doc.render();\r\n //获取渲染后的文本\r\n const output = doc.getZip().generate({\r\n type: \"blob\",\r\n mimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n compression: \"DEFLATE\",\r\n });\r\n let link = document.createElement(\"a\");\r\n link.download = '2023年学生创客项目申报书.docx';\r\n link.style.display = \"none\";\r\n let blob = new Blob([output]);\r\n link.href = URL.createObjectURL(blob);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n return\r\n }\r\n x.send()\r\n}\r\n\r\n// 新学生创业项目申请表下载模板word版\r\nfunction getWord(val){\r\n JSZipUtils.getBinaryContent('./file/2023年学生创客项目申报书模板.docx',(err,content)=>{\r\n if (err) {\r\n return console.log(err);\r\n }\r\n\r\n let zip=new PizZip(content);\r\n\r\n let doc=new Docxtemplater().loadZip(zip);\r\n // return console.log(val);\r\n\r\n // let FundAll=\r\n // return console.log(val);\r\n\r\n //填写数据\r\n doc.setData({\r\n nowTime:getNowDate(1),//申请日期\r\n projectName:val.projectName,\r\n ing:val.radio=='ed917c55-f51d-11ed-a3f6-509a4c5b67cf'?'√':'□',\r\n ed:val.radio=='f3068e26-f51d-11ed-a3f6-509a4c5b67cf'?'√':'□',\r\n mone:val.checkList.includes('1')?'√':'□',\r\n mtwo:val.checkList.includes('2')?'√':'□',\r\n mthree:val.checkList.includes('3')?'√':'□',\r\n mfour:val.checkList.includes('4')?'√':'□',\r\n sone:val.schoolRadio.includes('1')?'√':'□',\r\n stwo:val.schoolRadio.includes('2')?'√':'□',\r\n sthree:val.schoolRadio.includes('3')?'√':'□',\r\n sfour:val.schoolRadio.includes('4')?'√':'□',\r\n stu:val.applyParsonRadio.includes('1')?'√':'□',\r\n leg:val.applyParsonRadio.includes('2')?'√':'□',\r\n appPeason:val.applyParsonName,\r\n school:val.dp,\r\n tel:val.tel,\r\n begin_at:val.btime,\r\n plannedEnd_at:val.etime,\r\n allnum:val.studentS.length+val.teacherS.length,\r\n snum:val.studentS.length,\r\n tnum:val.teacherS.length,\r\n student:val.studentS,\r\n teacher:val.teacherS,\r\n brief:val.brief,\r\n back:val.introduce.back.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n innovate:val.introduce.innovate.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n path:val.introduce.path.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n scene:val.introduce.scene.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n worth:val.introduce.worth.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n team:val.introduce.team.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n cost:val.introduce.cost.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n expectResults:val.introduce.expectResults.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n expectResultsTeacher:val.introduce.expectResultsTeacher.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n expectConversion:val.introduce.expectConversion.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n plan:val.introduce.plan.replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n total:val.fund.device*1 + val.fund.Material*1+val.fund.processing*1+ val.fund.Collaboration*1+val.fund.APPRAISAL*1+ val.fund.entery*1+val.fund.activities*1+val.fund.Transaction*1,\r\n facility:val.fund.device,\r\n materials:val.fund.Material,\r\n process:val.fund.processing,\r\n assist:val.fund.Collaboration,\r\n authenticate:val.fund.APPRAISAL,\r\n match:val.fund.entery,\r\n activity:val.fund.activities,\r\n affair:val.fund.Transaction,\r\n })\r\n\r\n // 进行填充\r\n doc.render()\r\n\r\n let out=doc.getZip().generate({\r\n type:'blob',\r\n mimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n })\r\n\r\n // fs.writeFileSync(path.resolve(__dirname, \"output.docx\"), buf);\r\n saveAs(out,'2023年学生创客项目申报书.docx')\r\n\r\n })\r\n}\r\n\r\n// 新学生创业项目申请表下载模板word版\r\nfunction getWord2(val){\r\n\tJSZipUtils.getBinaryContent('./file/2024年校级学生创新创业训练计划项目申报书模版2.docx',(err,content)=>{\r\n\t\t\tif (err) {\r\n\t\t\t\t\treturn console.log(err);\r\n\t\t\t}\r\n\r\n\t\t\tlet zip=new PizZip(content);\r\n\r\n\t\t\tlet doc=new Docxtemplater().loadZip(zip);\r\n\t\t\t// return console.log(val);\r\n\t\t\t// let FundAll=\r\n\t\t\t//填写数据\r\n\t\t\tdoc.setData({\r\n\t\t\t\t\tnowTime:getNowDate(1),//申请日期\r\n\t\t\t\t\tprojectName:val.projectName,\r\n\t\t\t\t\titp:val.radio=='4a4e2cfe-e1a1-11ee-81d4-00ff5c7a43f5'?'☑':'□',\r\n\t\t\t\t\tetp:val.radio=='56f0ad8d-e1a1-11ee-81d4-00ff5c7a43f5'?'☑':'□',\r\n\t\t\t\t\ting:val.radio=='ed917c55-f51d-11ed-a3f6-509a4c5b67cf'?'☑':'□',\r\n\t\t\t\t\tmone:val.checkList.includes('1')?'☑':'□',\r\n\t\t\t\t\tmtwo:val.checkList.includes('2')?'☑':'□',\r\n\t\t\t\t\tmthree:val.checkList.includes('3')?'☑':'□',\r\n\t\t\t\t\tmfour:val.checkList.includes('4')?'☑':'□',\r\n\t\t\t\t\tmfive:val.checkList.includes('5')?'☑':'□',\r\n\t\t\t\t\tmsix:val.checkList.includes('6')?'☑':'□',\r\n\t\t\t\t\tmseven:val.checkList.includes('7')?'☑':'□',\r\n\t\t\t\t\tsone:val.schoolRadio.includes('1')?'☑':'□',\r\n\t\t\t\t\tstwo:val.schoolRadio.includes('2')?'☑':'□',\r\n\t\t\t\t\tsthree:val.schoolRadio.includes('3')?'☑':'□',\r\n\t\t\t\t\tsfour:val.schoolRadio.includes('4')?'☑':'□',\r\n\t\t\t\t\tappPeason:val.applyParsonName,\r\n\t\t\t\t\tschool:val.dp,\r\n\t\t\t\t\ttel:val.tel,\r\n\t\t\t\t\tbegin_at:val.btime.split(' ')[0],\r\n\t\t\t\t\tplannedEnd_at:val.etime.split(' ')[0],\r\n\t\t\t\t\tallnum:val.studentS.filter(i=>i.name!='').length+val.teacherS.filter(i=>i.name!='').length,\r\n\t\t\t\t\tsnum:val.studentS.filter(i=>i.name!='').length,\r\n\t\t\t\t\ttnum:val.teacherS.filter(i=>i.name!='').length,\r\n\t\t\t\t\tstudent:val.studentS,\r\n\t\t\t\t\tteacher:val.teacherS,\r\n\t\t\t\t\tbrief:val.brief,\r\n\t\t\t\t\tback:val.introduce.back.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tinnovate:val.introduce.innovate.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tpath:val.introduce.path.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tscene:val.introduce.scene.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tworth:val.introduce.worth.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tteam:val.introduce.team.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tcost:val.introduce.cost.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\texpectResults:val.introduce.expectResults.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\texpectResultsTeacher:val.introduce.expectResultsTeacher.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\texpectConversion:val.introduce.expectConversion.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\tplan:val.introduce.plan.replace(/(<img src=\")([^\"]+)(\" style=\"max-width:100%;\")\\/>/g, '(图片链接:$2)').replace(/<\\/?.+?\\/?>/g,\"\").replace(/&nbsp;/gi,' '),\r\n\t\t\t\t\ttotal:val.fund.device*1 + val.fund.Material*1+val.fund.processing*1+ val.fund.Collaboration*1+val.fund.APPRAISAL*1+ val.fund.entery*1+val.fund.activities*1+val.fund.Transaction*1,\r\n\t\t\t\t\tfacility:val.fund.device,\r\n\t\t\t\t\tmaterials:val.fund.Material,\r\n\t\t\t\t\tprocess:val.fund.processing,\r\n\t\t\t\t\tassist:val.fund.Collaboration,\r\n\t\t\t\t\tauthenticate:val.fund.APPRAISAL,\r\n\t\t\t\t\tmatch:val.fund.entery,\r\n\t\t\t\t\tactivity:val.fund.activities,\r\n\t\t\t\t\taffair:val.fund.Transaction,\r\n\t\t\t\t\tsignOne:val.signData.filter(i=>i.type==4)[0]?val.signData.filter(i=>i.type==4)[0].text:'',\r\n\t\t\t\t\tsignOnePerson:val.signData.filter(i=>i.type==4)[0]?val.signData.filter(i=>i.type==4)[0].username:'',\r\n\t\t\t\t\tsignOneTime:val.signData.filter(i=>i.type==4)[0]?val.signData.filter(i=>i.type==4)[0].time:'',\r\n\r\n\t\t\t\t\tsignTwo:val.signData.filter(i=>i.type==0)[0]?val.signData.filter(i=>i.type==0)[0].text:'',\r\n\t\t\t\t\tsignTwoPerson:val.signData.filter(i=>i.type==0)[0]?val.signData.filter(i=>i.type==0)[0].username:'',\r\n\t\t\t\t\tsignTwoTime:val.signData.filter(i=>i.type==0)[0]?val.signData.filter(i=>i.type==0)[0].time:'',\r\n\r\n\t\t\t\t\tsignThree:val.signData.filter(i=>i.type==3)[0]?val.signData.filter(i=>i.type==3)[0].text:'',\r\n\t\t\t\t\tsignThreePerson:val.signData.filter(i=>i.type==3)[0]?val.signData.filter(i=>i.type==3)[0].username:'',\r\n\t\t\t\t\tsignThreeTime:val.signData.filter(i=>i.type==3)[0]?val.signData.filter(i=>i.type==3)[0].time:'',\r\n\t\t\t})\r\n\r\n\t\t\t// 进行填充\r\n\t\t\tdoc.render()\r\n\r\n\t\t\tlet out=doc.getZip().generate({\r\n\t\t\t\t\ttype:'blob',\r\n\t\t\t\t\tmimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n\t\t\t})\r\n\r\n\t\t\t// fs.writeFileSync(path.resolve(__dirname, \"output.docx\"), buf);\r\n\t\t\tsaveAs(out,'2024年校级学生创新创业训练计划项目申报书.docx')\r\n\r\n\t})\r\n}\r\n\r\n//活动管理的申请表\r\nfunction ActivityWord(data){\r\n let _url = \"./file/附件 2:创客专项资金项目申请表创客活动模板.docx\";\r\n const x = new XMLHttpRequest();\r\n x.open(\"GET\", _url, true);\r\n x.responseType = \"blob\";\r\n x.onload = function (e) {\r\n const blob = x.response;\r\n //转成binary\r\n const reader = new FileReader();\r\n reader.readAsArrayBuffer(blob);\r\n reader.onload=function(a){\r\n const buffer = reader.result;\r\n const binary = new Uint8Array(buffer)\r\n //创建一个PizZip实例\r\n const zip = new PizZip(binary);\r\n // 将模板内容加载到 Docxtemplater 中\r\n const doc = new Docxtemplater().loadZip(zip);\r\n \r\n //处理数据\r\n data['chapters'] = JSON.parse(data['chapters']);\r\n data['begin_at'] = GetTime(data['begin_at'])\r\n data['course_teacher'] = JSON.parse(data['course_teacher'])\r\n //模板数据\r\n let wordData = {\r\n activityName:data['title'],//活动名称\r\n money:data['money'],//预算经费\r\n pro_leader:data['pro_leader'],//负责人\r\n class:data['className'],//所在部门\r\n phone:data['phone'],//联系电话\r\n activityTime:data['begin_at'],//活动时间\r\n studentNum:data['students'],//参加学生人数\r\n teacher:data['course_teacher'],//活动指导教师\r\n plan:data['chapters'][0].replace(/<[^>]+>/g,\"\"),//活动计划\r\n Expectations:data['chapters'][1].replace(/<[^>]+>/g,\"\"),//预期目标\r\n EventAudience:data['chapters'][2].replace(/<[^>]+>/g,\"\"),//活动受众面\r\n fund:data['chapters'][3].replace(/<[^>]+>/g,\"\"),//经费支出计划\r\n }\r\n //渲染模板\r\n doc.setData(wordData);\r\n doc.render();\r\n //获取渲染后的文本\r\n const output = doc.getZip().generate({\r\n type: \"blob\",\r\n mimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n compression: \"DEFLATE\",\r\n });\r\n let link = document.createElement(\"a\");\r\n link.download = '附件 2:创客专项资金项目申请表(创客活动).docx';\r\n link.style.display = \"none\";\r\n let blob = new Blob([output]);\r\n link.href = URL.createObjectURL(blob);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n return\r\n }\r\n x.send()\r\n}\r\n\r\n//创客活动的申请表\r\nfunction makerActivityWord(data,total){\r\n let _url = \"./file/附件 2:创客专项资金项目申请表(创客活动、个人创客)模板.docx\";\r\n const x = new XMLHttpRequest();\r\n x.open(\"GET\", _url, true);\r\n x.responseType = \"blob\";\r\n x.onload = function (e) {\r\n const blob = x.response;\r\n //转成binary\r\n const reader = new FileReader();\r\n reader.readAsArrayBuffer(blob);\r\n reader.onload=function(a){\r\n const buffer = reader.result;\r\n const binary = new Uint8Array(buffer)\r\n //创建一个PizZip实例\r\n const zip = new PizZip(binary);\r\n // 将模板内容加载到 Docxtemplater 中\r\n const doc = new Docxtemplater().loadZip(zip);\r\n \r\n //模板数据\r\n let wordData = {...data,total}\r\n //处理数据\r\n wordData['MP1'] = wordData['expenditureMothPlan'][0];\r\n wordData['MP2'] = wordData['expenditureMothPlan'][1];\r\n wordData['MP3'] = wordData['expenditureMothPlan'][2];\r\n wordData['MP4'] = wordData['expenditureMothPlan'][3];\r\n wordData['MP5'] = wordData['expenditureMothPlan'][4];\r\n wordData['MP6'] = wordData['expenditureMothPlan'][5];\r\n wordData['MP7'] = wordData['expenditureMothPlan'][6];\r\n wordData['MP8'] = wordData['expenditureMothPlan'][7];\r\n wordData['MP9'] = wordData['expenditureMothPlan'][8];\r\n wordData['MP10'] = wordData['expenditureMothPlan'][9];\r\n wordData['MP11'] = wordData['expenditureMothPlan'][10];\r\n wordData['MP12'] = wordData['expenditureMothPlan'][11];\r\n wordData['beTime'] = wordData['activityTime'][0].split(' ')[0]\r\n wordData['edTime'] = wordData['activityTime'][1].split(' ')[0]\r\n wordData['device'] = wordData['fund']['device']\r\n wordData['Material'] = wordData['fund']['Material']\r\n wordData['processing'] = wordData['fund']['processing']\r\n wordData['Collaboration'] = wordData['fund']['Collaboration']\r\n wordData['APPRAISAL'] = wordData['fund']['APPRAISAL']\r\n wordData['entery'] = wordData['fund']['entery']\r\n wordData['activities'] = wordData['fund']['activities']\r\n wordData['Transaction'] = wordData['fund']['Transaction']\r\n wordData['type'] = Boolean(wordData['type'])\r\n\r\n doc.setData(wordData);\r\n\r\n doc.render();\r\n\r\n //获取渲染后的文本\r\n const output = doc.getZip().generate({\r\n type: \"blob\",\r\n mimeType:\"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\r\n compression: \"DEFLATE\",\r\n });\r\n let link = document.createElement(\"a\");\r\n link.download = `附件 2:创客专项资金项目申请表(${wordData['type']?'个人创客':'创客活动'}).docx`;\r\n link.style.display = \"none\";\r\n let blob = new Blob([output]);\r\n link.href = URL.createObjectURL(blob);\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n return\r\n }\r\n x.send()\r\n}\r\n\r\n\r\nexport{\r\n MakerSpaceWord,\r\n getMakerSpaceWord,\r\n MakerStudentWord,\r\n ActivityWord,\r\n getWord,\r\n makerActivityWord,\r\n\t\tgetWord2\r\n}"],"names":["getMakerSpaceWord","wordData","_url","x","XMLHttpRequest","open","responseType","onload","e","blob","response","reader","FileReader","readAsArrayBuffer","a","buffer","result","binary","Uint8Array","zip","PizZip","doc","Docxtemplater","loadZip","data","applicationDate","ing","ed","projectName","college","begin_at","split","plannedEnd_at","pro_leader","lead_leader","people","filter","i","name","length","teacherNum","studentNum","teacher","student","brief","Construction","replace","ProjectBasis","development","studio","studentTeam","studentActivities","Transforming","condition","fund","setData","render","output","getZip","generate","type","mimeType","compression","link","document","createElement","download","style","display","Blob","href","URL","createObjectURL","body","appendChild","click","removeChild","send","getWord","val","JSZipUtils","err","content","console","log","nowTime","getNowDate","radio","mone","checkList","includes","mtwo","mthree","mfour","sone","schoolRadio","stwo","sthree","sfour","stu","applyParsonRadio","leg","appPeason","applyParsonName","school","dp","tel","btime","etime","allnum","studentS","teacherS","snum","tnum","back","introduce","innovate","path","scene","worth","team","cost","expectResults","expectResultsTeacher","expectConversion","plan","total","device","Material","processing","Collaboration","APPRAISAL","entery","activities","Transaction","facility","materials","process","assist","authenticate","match","activity","affair","out","saveAs","ActivityWord","JSON","parse","GetTime","activityName","money","class","phone","activityTime","Expectations","EventAudience","makerActivityWord","Boolean"],"sourceRoot":""}