Browse Source

word下载

yuanyiming 1 year ago
parent
commit
9f8e92a3cf

+ 12 - 0
package-lock.json

@@ -14,6 +14,8 @@
         "echarts": "^5.4.2",
         "element-ui": "^2.4.5",
         "exceljs": "^4.3.0",
+        "file-saver": "^2.0.5",
+        "jszip-utils": "^0.1.0",
         "less": "^4.1.3",
         "less-loader": "^11.1.0",
         "pizzip": "^3.1.4",
@@ -6282,6 +6284,11 @@
         "node": "^10.12.0 || >=12.0.0"
       }
     },
+    "node_modules/file-saver": {
+      "version": "2.0.5",
+      "resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz",
+      "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
+    },
     "node_modules/fill-range": {
       "version": "7.0.1",
       "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz",
@@ -7404,6 +7411,11 @@
         "setimmediate": "^1.0.5"
       }
     },
+    "node_modules/jszip-utils": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmmirror.com/jszip-utils/-/jszip-utils-0.1.0.tgz",
+      "integrity": "sha512-tBNe0o3HAf8vo0BrOYnLPnXNo5A3KsRMnkBFYjh20Y3GPYGfgyoclEMgvVchx0nnL+mherPi74yLPIusHUQpZg=="
+    },
     "node_modules/jszip/node_modules/readable-stream": {
       "version": "2.3.8",
       "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",

+ 2 - 0
package.json

@@ -14,6 +14,8 @@
     "echarts": "^5.4.2",
     "element-ui": "^2.4.5",
     "exceljs": "^4.3.0",
+    "file-saver": "^2.0.5",
+    "jszip-utils": "^0.1.0",
     "less": "^4.1.3",
     "less-loader": "^11.1.0",
     "pizzip": "^3.1.4",

BIN
public/file/2023年学生创客项目申报书模板.docx


BIN
public/file/~$23年学生创客项目申报书模板.docx


+ 41 - 32
src/components/studentProjectWord.vue

@@ -22,39 +22,39 @@
       </tr>
       <tr id="radio">
         <td rowspan="2" colspan="2" ref="radio">项目分组</td><td>
-          <el-radio v-model="wordData.radio" label="创意组">创意组</el-radio>
+          <el-radio v-model="wordData.radio" label="1">创意组</el-radio>
         </td>
         <td colspan="4">立项项目为新立项项目,项目成果应具有较好的创意和较为成型的产品原型或能提供较好的商业模式,产生较好的社会效益。</td>
       </tr> 
       <tr>
         <td>
-          <el-radio v-model="wordData.radio" label="初创组">初创组</el-radio>
+          <el-radio v-model="wordData.radio" label="2">初创组</el-radio>
         </td>
         <td colspan="4">立项项目为学校已结题学生创客项目或已入驻学校创业孵化基地的学生初创企业项目(毕业两年内),项目成果应为原结题项目基础上的技术升级、企业注册、规模扩张。</td>
       </tr> 
       <tr id="checkList">
         <td colspan="2" ref="checkList">优先支持项目(可多选)</td> <td colspan="5">
           <el-checkbox-group v-model="wordData.checkList">
-            <el-checkbox label="大赛选拔项目"></el-checkbox>
-            <el-checkbox label="落地注册项目"></el-checkbox>
-            <el-checkbox label="社会征集项目"></el-checkbox>
-            <el-checkbox label="产业命题项目"></el-checkbox>
+            <el-checkbox label="1">大赛选拔项目</el-checkbox>
+            <el-checkbox label="2">大赛选拔项目</el-checkbox>
+            <el-checkbox label="3">社会征集项目</el-checkbox>
+            <el-checkbox label="4">产业命题项目</el-checkbox>
           </el-checkbox-group>
         </td>
       </tr>
       <tr id="schoolRadio">
         <td colspan="2" ref="schoolRadio">美丽校园改造项目(特色项目)</td> <td colspan="5">
-          <el-radio v-model="wordData.schoolRadio" label="校园安全项目">校园安全项目</el-radio>
-          <el-radio v-model="wordData.schoolRadio" label="环境治理项目">环境治理项目</el-radio>
-          <el-radio v-model="wordData.schoolRadio" label="校园服务项目">校园服务项目</el-radio>
-          <el-radio v-model="wordData.schoolRadio" label="文创装置项目">文创装置项目</el-radio>
+          <el-radio v-model="wordData.schoolRadio" label="1">校园安全项目</el-radio>
+          <el-radio v-model="wordData.schoolRadio" label="2">环境治理项目</el-radio>
+          <el-radio v-model="wordData.schoolRadio" label="3">校园服务项目</el-radio>
+          <el-radio v-model="wordData.schoolRadio" label="4">文创装置项目</el-radio>
         </td>
       </tr>
       <tr id="applyParsonRadio">
         <td colspan="2" ref="applyParsonRadio" >项 目 申 请 人</td><td colspan="2">
-          <el-radio v-model="wordData.applyParsonRadio" label="在校学生">在校学生</el-radio>
+          <el-radio v-model="wordData.applyParsonRadio" label="1">在校学生</el-radio>
         </td><td colspan="3">
-          <el-radio v-model="wordData.applyParsonRadio" label="入驻学校孵化基地的初创企业法人">入驻学校孵化基地的初创企业法人</el-radio>
+          <el-radio v-model="wordData.applyParsonRadio" label="2">入驻学校孵化基地的初创企业法人</el-radio>
         </td>
       </tr>
       <tr id="applyParsonName">
@@ -90,7 +90,9 @@
               type="date"
               placeholder="请选择项目计划完成时间"
               prefix-icon="none"
-              value-format="yyyy-MM-dd HH:mm:ss">
+              value-format="yyyy-MM-dd">
+              <!-- value-format="yyyy-MM-dd HH:mm:ss"> -->
+
             </el-date-picker></td>
             <td ref="endTime">计划完成时间</td>
             <td colspan="2">
@@ -99,7 +101,9 @@
                 type="date"
                 placeholder="请选择项目计划完成时间"
                 prefix-icon="none"
-                value-format="yyyy-MM-dd HH:mm:ss">
+                value-format="yyyy-MM-dd">
+                <!-- value-format="yyyy-MM-dd HH:mm:ss"> -->
+
               </el-date-picker>
           </td>
       </tr>
@@ -221,7 +225,7 @@
           <p>项目研发背景</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.back">
@@ -233,7 +237,7 @@
           <p>项目创新点</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.innovate">
@@ -245,7 +249,7 @@
           <p>技术研发路线</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.path">
@@ -257,7 +261,7 @@
           <p>项目应用场景 </p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.scene">
@@ -270,7 +274,7 @@
           <p>项目商业模式/社会价值</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.worth">
@@ -283,7 +287,7 @@
           <p>团队构成及优势</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.team">
@@ -296,7 +300,7 @@
           <p>研发成本来源及构成</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.cost">
@@ -309,7 +313,7 @@
           <p>项目预期成果、数量及形式(产品原型/发明专利/双创竞赛/成果转化/社会效益)</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.expectResults">
@@ -321,7 +325,7 @@
           <p>学生创客人才培养预期成果、数量(教师填写)</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
               v-model="wordData.introduce.expectResultsTeacher">
@@ -333,10 +337,10 @@
           <p>项目预期孵化、转化创业项目情况</p>
           <el-input
               type="textarea"
-              :rows="6"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
-              v-model="wordData.introduce.expectResultsTeacher">
+              v-model="wordData.introduce.expectConversion">
             </el-input>
         </td>
       </tr>
@@ -345,16 +349,16 @@
         <td style="text-align: left;" colspan="6" class="textLeft">
           <el-input
               type="textarea"
-              :rows="8"
+              :autosize="{ minRows: 6, maxRows: 20}"
               style="width: 100%;"
               resize="none"
-              v-model="wordData.plan">
+              v-model="wordData.introduce.plan">
             </el-input>
         </td>
       </tr>
       <tr id="fund">
         <td rowspan="12" ref="fund">预算经费</td><td>总经费</td><td colspan="5">
-                  {{ reversedMessage==0?'':reversedMessage}}
+                  {{ reversedMessage==0?'':reversedMessage}}
         </td>
       </tr>
       <tr>
@@ -486,6 +490,7 @@
               type="textarea"
               :rows="7"
               resize="none"
+              disabled
               style="width: 100%;"
               v-model="input">
             </el-input>
@@ -499,6 +504,7 @@
               type="textarea"
               :rows="7"
               resize="none"
+              disabled
               style="width: 100%;"
               v-model="input">
             </el-input>
@@ -513,6 +519,7 @@
               :rows="7"
               style="background-color: #fff;width: 100%;"
               resize="none"
+              disabled
               v-model="input">
             </el-input>
             <div style="text-align: right;font-size: 18px;width: 80%;margin-bottom: 20px;">负责人签章:</div>
@@ -526,8 +533,8 @@
         <span>2.优先支持项目需提供与研发项目相关的实证材料并查看原件。</span>
         <span>3.初创组已结题项目申请需提供结题验收证明、初创企业申请需提供入驻学校孵化基地协议书及公司营业执照。</span>
         <div style="width: 300px;margin: 20px auto;display: flex;justify-content: space-between;">
-            <el-button style="width: 120px;margin: 20px auto;" @click="submitWord" type="primary">提交项目</el-button>
-            <el-button style="width: 120px;margin: 20px auto;" type="primary">下载表单</el-button>
+            <el-button style="width: 120px;margin: 20px auto;" @click="submitWord" type="primary">下载表单</el-button>
+            <!-- <el-button style="width: 120px;margin: 20px auto;" type="primary">下载表单</el-button> -->
         </div>
       </div>
 </div>
@@ -535,7 +542,7 @@
   
 <script>
 import {getNowDate} from '@/components/tool/Date.js'
-
+import { getWord } from './tool/getWord';
   export default {
     // props:['data'],
     data() {
@@ -771,6 +778,8 @@ import {getNowDate} from '@/components/tool/Date.js'
             break;
           }
         }
+        this.wordData['total']=this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1
+        getWord(this.wordData)
       //   let param={
       //     projectName
       //   }
@@ -782,7 +791,7 @@ import {getNowDate} from '@/components/tool/Date.js'
     },
     computed:{   //经费总合
       reversedMessage: function () {
-        return (this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1)/10000
+        return (this.wordData.fund.facility*1 + this.wordData.fund.materials*1+this.wordData.fund.process*1+ this.wordData.fund.assist*1+this.wordData.fund.authenticate*1+ this.wordData.fund.match*1+this.wordData.fund.activity*1+this.wordData.fund.affair*1)
       }
     },
     mounted(){

+ 83 - 1
src/components/tool/getWord.js

@@ -2,6 +2,9 @@ import Docxtemplater from 'docxtemplater'
 import PizZip from 'pizzip'
 import { getNowDate } from './Date';
 import { GetTime } from './Date';
+import FileSaver, { saveAs } from 'file-saver';
+import JSZipUtils from 'jszip-utils'
+
 // import HTMLModule from 'docx'
 function MakerSpaceWord(data,fund){
     //获取模板文件
@@ -447,6 +450,84 @@ function MakerStudentWord(data,fund){
     x.send()
 }
 
+// 学生创业项目申请表下载模板word版
+function getWord(val){
+    JSZipUtils.getBinaryContent('./file/2023年学生创客项目申报书模板.docx',(err,content)=>{
+        if (err) {
+            return console.log(err);
+        }
+
+        let zip=new PizZip(content);
+
+        let doc=new Docxtemplater().loadZip(zip);
+        // return console.log(val);
+         console.log(val);
+
+        
+
+        //填写数据
+        doc.setData({
+            nowTime:val.applicationDate,
+            projectName:val.projectName,
+            ing:val.radio=='1'?'√':'□',
+            ed:val.radio=='2'?'√':'□',
+            mone:val.checkList.includes('1')?'√':'□',
+            mtwo:val.checkList.includes('2')?'√':'□',
+            mthree:val.checkList.includes('3')?'√':'□',
+            mfour:val.checkList.includes('4')?'√':'□',
+            sone:val.schoolRadio.includes('1')?'√':'□',
+            stwo:val.schoolRadio.includes('2')?'√':'□',
+            sthree:val.schoolRadio.includes('3')?'√':'□',
+            sfour:val.schoolRadio.includes('4')?'√':'□',
+            stu:val.applyParsonRadio.includes('1')?'√':'□',
+            leg:val.applyParsonRadio.includes('2')?'√':'□',
+            appPeason:val.applyParsonName,
+            school:val.college,
+            tel:val.tel,
+            begin_at:val.beginTime,
+            plannedEnd_at:val.endTime,
+            allnum:val.studentS.length+val.teacherS.length,
+            snum:val.studentS.length,
+            tnum:val.teacherS.length,
+            student:val.studentS,
+            teacher:val.teacherS,
+            brief:val.brief,
+            back:val.introduce.back,
+            innovate:val.introduce.innovate,
+            path:val.introduce.path,
+            scene:val.introduce.scene,
+            worth:val.introduce.worth,
+            team:val.introduce.team,
+            cost:val.introduce.cost,
+            expectResults:val.introduce.expectResults,
+            expectResultsTeacher:val.introduce.expectResultsTeacher,
+            expectConversion:val.introduce.expectConversion,
+            plan:val.introduce.plan,
+            total:val.total,
+            facility:val.fund.facility,
+            materials:val.fund.materials,
+            process:val.fund.process,
+            assist:val.fund.assist,
+            authenticate:val.fund.authenticate,
+            match:val.fund.match,
+            activity:val.fund.activity,
+            affair:val.fund.affair,
+        })
+
+        // 进行填充
+        doc.render()
+
+        let out=doc.getZip().generate({
+            type:'blob',
+            mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+        })
+
+        // fs.writeFileSync(path.resolve(__dirname, "output.docx"), buf);
+        saveAs(out,'2023年学生创客项目申报书.docx')
+
+    })
+}
+
 //活动管理的申请表
 function ActivityWord(data){
     let _url = "./file/附件 2:创客专项资金项目申请表创客活动模板.docx";
@@ -513,5 +594,6 @@ export{
     MakerSpaceWord,
     getMakerSpaceWord,
     MakerStudentWord,
-    ActivityWord
+    ActivityWord,
+    getWord
 }

+ 1 - 1
src/views/Word.vue

@@ -6,7 +6,7 @@
         <studentProjectWord />   
 
          <!-- 创客专项资金及项目申请表(个人创客) -->
-        <markerFundWord/>        
+        <!-- <markerFundWord/>         -->
 
          <!-- 创客专项资金及项目申请表(创客活动) -->
         <!-- <markeractivityWord/> -->