From 56c9b08d1c1c978ee3933d074b4d020026686915 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 09 七月 2025 14:26:30 +0800 Subject: [PATCH] 修改 --- src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue | 2 +- src/views/build/conpanyFunctionConsult/qualityObjectives/table/index.vue | 13 +++++++++---- public/tableDeptExample.docx | 0 src/utils/exportWord.js | 19 +++++++++++++++++++ public/tableCompanyExample.docx | 0 package.json | 6 ++++-- src/components/Tinymce/Tinymce.vue | 5 +++-- 7 files changed, 36 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index a4207a4..cb8aa10 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,10 @@ "@wangeditor/editor": "^5.1.18", "@wangeditor/editor-for-vue": "^5.1.12", "@wangeditor/plugin-upload-attachment": "^1.1.0", + "angular-expressions": "^1.5.0", "axios": "0.27.2", "docx-preview": "^0.3.5", - "docxtemplater": "^3.63.2", + "docxtemplater": "^3.65.1", "docxtemplater-image-module-free": "^1.1.1", "echarts": "5.4.0", "element-plus": "2.2.27", @@ -38,10 +39,11 @@ "moment": "^2.30.1", "nprogress": "0.2.0", "pinia": "2.0.22", - "pizzip": "^3.2.0", + "pizzip": "^3.1.0", "quill": "^2.0.0-dev.3", "spark-md5": "^3.0.2", "tinymce": "^5.10.2", + "tinymce-paragraphspacing": "^1.0.1", "video.js": "^8.12.0", "vue": "3.2.45", "vue-cropper": "1.0.3", diff --git a/public/tableCompanyExample.docx b/public/tableCompanyExample.docx index 2180faf..7b1f1ac 100644 --- a/public/tableCompanyExample.docx +++ b/public/tableCompanyExample.docx Binary files differ diff --git a/public/tableDeptExample.docx b/public/tableDeptExample.docx index 7448677..5b23169 100644 --- a/public/tableDeptExample.docx +++ b/public/tableDeptExample.docx Binary files differ diff --git a/src/components/Tinymce/Tinymce.vue b/src/components/Tinymce/Tinymce.vue index 5e743ab..d61231a 100644 --- a/src/components/Tinymce/Tinymce.vue +++ b/src/components/Tinymce/Tinymce.vue @@ -12,6 +12,7 @@ import tinymce from "tinymce/tinymce"; import Editor from "@tinymce/tinymce-vue"; import { upload } from "@/api/backManage/notice"; +import 'tinymce-paragraphspacing' import "tinymce/themes/silver"; import "tinymce/themes/silver/theme"; import "tinymce/icons/default/icons"; @@ -46,11 +47,11 @@ }, plugins: { type: [String, Array], - default: "upfile lists image table wordcount fullscreen " + default: " paragraphspacing upfile lists image table wordcount fullscreen " }, toolbar: { type: [String, Array], - default: " styleselect fontsizeselect | undo redo | upfile image bold italic | fontselect |alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | lists insertfile table | removeformat fullscreen " + default: " styleselect fontsizeselect paragraphspacing | upfile image bold italic | fontselect |alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | undo redo | lists insertfile table | removeformat fullscreen " } }, data() { diff --git a/src/utils/exportWord.js b/src/utils/exportWord.js index e0ee5c1..6c7fbe1 100644 --- a/src/utils/exportWord.js +++ b/src/utils/exportWord.js @@ -23,6 +23,22 @@ } try { + // 新版创建解析器的正确方式(无需 import AngularParser) + const parser = (tag, _variable) => { + return { + get(scope) { + if (scope[tag] !== undefined) { + return scope[tag] || ''; + } + // 处理特殊变量(如 $first) + if (tag.startsWith('$')) { + const varName = tag.slice(1); + return scope[varName] || ''; + } + return ''; + } + }; + }; // 加载模板文件内容到 PizZip const zip = new PizZip(content); const doc = new Docxtemplater(zip, { @@ -30,6 +46,9 @@ linebreaks: true, }); + // const parser = new AngularParser(); + // doc.setOptions({ parser }); + // 设置模板中的占位符数据 doc.setData(data); diff --git a/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue b/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue index 02fa9aa..f9085ba 100644 --- a/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue +++ b/src/views/build/conpanyFunctionConsult/qualityObjectives/objective/components/objectiveDialog.vue @@ -77,7 +77,7 @@ <el-input v-model="state.form.companyName" disabled></el-input> </el-form-item> <el-form-item label="部门名称:" prop="departId" v-else-if="state.form.type == 2"> -<!-- <el-cascader v-model="state.form.departId" :options="state.deptList" />--> +<!-- <el-cascader v-model="state.form.departId" :disabled="title === '查看'" :options="state.deptList" />--> <el-select :disabled="title === '查看'" v-model="state.form.departId" diff --git a/src/views/build/conpanyFunctionConsult/qualityObjectives/table/index.vue b/src/views/build/conpanyFunctionConsult/qualityObjectives/table/index.vue index 530ed77..1b20080 100644 --- a/src/views/build/conpanyFunctionConsult/qualityObjectives/table/index.vue +++ b/src/views/build/conpanyFunctionConsult/qualityObjectives/table/index.vue @@ -340,12 +340,17 @@ const year = now.getFullYear() const month = (now.getMonth() +1).toString().padStart(2, '0'); item.nowDate = year + '-' + month + console.log('item.qualityTargets',item.qualityTargets) item.tableData = item.qualityTargets.map((i,index) => { - return { + return{ ...i, - nuum: index+1, - nuumRowSpan:`${i.qualityTargetMesses.length}cm`, - messageRowSpan:`${i.qualityTargetMesses.length}cm`, + qualityTargetMesses: i.qualityTargetMesses.map((q,qindex) => { + return{ + ...q, + first: qindex == 0, + nuum: index+1 + } + }) } }) try { -- Gitblit v1.9.2