From 386d30737c298d93205bbe8654fa6af9b90ac829 Mon Sep 17 00:00:00 2001 From: suixy <2277317060@qq.com> Date: Wed, 5 Nov 2025 11:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/oa/base/templateVariable/index.ts | 8 + src/views/oa/base/printTemplate/template.vue | 28 +-- src/views/oa/erp/contractInfo/contract.vue | 228 +++++++++++++++++++ src/views/oa/erp/contractInfo/index.vue | 11 +- 4 files changed, 258 insertions(+), 17 deletions(-) create mode 100644 src/views/oa/erp/contractInfo/contract.vue diff --git a/src/api/oa/base/templateVariable/index.ts b/src/api/oa/base/templateVariable/index.ts index 8e8d1a5..1a20aae 100644 --- a/src/api/oa/base/templateVariable/index.ts +++ b/src/api/oa/base/templateVariable/index.ts @@ -74,3 +74,11 @@ export function getBaseTemplateVariableList (query) { params: query }); }; + +export function templateAssign(query) { + return request({ + url: '/oa/base/templateVariable/assign', + method: 'post', + data: query + }); +}; diff --git a/src/views/oa/base/printTemplate/template.vue b/src/views/oa/base/printTemplate/template.vue index c2a75db..2b73f9f 100644 --- a/src/views/oa/base/printTemplate/template.vue +++ b/src/views/oa/base/printTemplate/template.vue @@ -29,16 +29,7 @@ const template = ref({}); const editorRef = ref(); -const fieldList = ref([ - { - name: '字段1', - value: '${ziduan1}' - }, - { - name: '字段2', - value: '${ziduan2}' - } -]); +const fieldList = ref([]); const templateData = { data0: '合计-1', @@ -102,7 +93,7 @@ const options = ref({ }, autoSave: { enabled: true, - interval: 300000 + interval: 1000 * 60 * 5 } }, page: { @@ -119,7 +110,7 @@ const options = ref({ } }); const renderTemplate = (str, data) => { - return str.replace(/&\{(.*?)\}/g, (_, path) => { + return str.replace(/#\{(.*?)\}/g, (_, path) => { // console.log(path.split('.').reduce((o, k) => o?.[k], data) ?? ''); return path.split('.').reduce((o, k) => o?.[k], data) ?? ''; }); @@ -207,10 +198,15 @@ const fillData = (e) => { const insertText = (e) => { const editor = editorRef.value; - editor.insertContent({ - type: 'text', - text: e.varName - }); + editor.insertContent( + { + type: 'text', + text: e.varName + }, + { + updateSelection: false + } + ); }; onMounted(async () => { getPrintTemplate(route.query.templateId).then((e) => { diff --git a/src/views/oa/erp/contractInfo/contract.vue b/src/views/oa/erp/contractInfo/contract.vue new file mode 100644 index 0000000..0a1e391 --- /dev/null +++ b/src/views/oa/erp/contractInfo/contract.vue @@ -0,0 +1,228 @@ + + + + + + diff --git a/src/views/oa/erp/contractInfo/index.vue b/src/views/oa/erp/contractInfo/index.vue index 3a8124b..1bf69e2 100644 --- a/src/views/oa/erp/contractInfo/index.vue +++ b/src/views/oa/erp/contractInfo/index.vue @@ -163,9 +163,12 @@