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 @@ - - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + +