From 8f4a94c094455aec013f11efe4a2836907634fbf Mon Sep 17 00:00:00 2001 From: suixy <2277317060@qq.com> Date: Mon, 20 Oct 2025 17:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E7=89=88=E5=92=8C?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/index.vue | 68 ++++++++- src/views/oa/base/printTemplate/index.vue | 57 ++++--- src/views/oa/base/printTemplate/template.vue | 151 +++++++++++++++++++ 3 files changed, 253 insertions(+), 23 deletions(-) create mode 100644 src/views/oa/base/printTemplate/template.vue diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index 986ad0a..88c3184 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -1,7 +1,17 @@ @@ -9,6 +19,16 @@ import { AlignmentType, Document, Footer, Packer, Paragraph, TextRun } from 'docx'; import { UmoEditor } from '@umoteam/editor'; +const fieldList = ref([ + { + name: '字段1', + value: '字段1' + }, + { + name: '字段2', + value: '字段2' + } +]); const editorRef = ref(); const docData = { '甲方': '青岛xxx科技有限公司', @@ -364,6 +384,50 @@ const download = async (doc) => { document.body.removeChild(link); }; // download(doc) +const insertText = (e) => { + const editor = editorRef.value; + console.log(editor); + console.log(editor.getSelectionNode()); + console.log(editor.getSelectionText()); + // const selection = editor.getSelection(); + // editor.insertContent({ + // type: 'text', + // text: e.value + // }); + // if (selection) { + // editor.focus(); + // editor.setSelection(selection.toEnd ? selection.toEnd() : selection); + // } + editor + .chain() + .focus() + .insertContent({ + type: 'text', + text: e.value + }) + .run(); +}; - + + \ No newline at end of file diff --git a/src/views/oa/base/printTemplate/index.vue b/src/views/oa/base/printTemplate/index.vue index b9fde5b..7a154ac 100644 --- a/src/views/oa/base/printTemplate/index.vue +++ b/src/views/oa/base/printTemplate/index.vue @@ -17,11 +17,11 @@ - - - - - + + + + + 搜索 重置 @@ -95,6 +95,15 @@ + + + @@ -118,25 +127,25 @@ - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + +