From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/bpm/model/form/PrintTemplate/Index.vue | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 116 insertions(+), 0 deletions(-)
diff --git a/src/views/bpm/model/form/PrintTemplate/Index.vue b/src/views/bpm/model/form/PrintTemplate/Index.vue
new file mode 100644
index 0000000..8459466
--- /dev/null
+++ b/src/views/bpm/model/form/PrintTemplate/Index.vue
@@ -0,0 +1,116 @@
+<script setup lang="ts">
+import { Editor, Toolbar } from '@wangeditor-next/editor-for-vue'
+import { IDomEditor } from '@wangeditor-next/editor'
+import MentionModal from './MentionModal.vue'
+
+const emit = defineEmits(['confirm'])
+
+// @mention 鐩稿叧
+const isShowModal = ref(false)
+const showModal = () => {
+ isShowModal.value = true
+}
+const hideModal = () => {
+ isShowModal.value = false
+}
+const insertMention = (id: any, name: any) => {
+ const mentionNode = {
+ type: 'mention',
+ value: name,
+ info: { id },
+ children: [{ text: '' }]
+ }
+ const editor = editorRef.value
+ if (editor) {
+ editor.restoreSelection()
+ editor.deleteBackward('character')
+ editor.insertNode(mentionNode)
+ editor.move(1)
+ }
+}
+
+// Dialog 鐩稿叧
+const dialogVisible = ref(false)
+const open = async (template: string) => {
+ dialogVisible.value = true
+ valueHtml.value = template
+}
+defineExpose({ open })
+const handleConfirm = () => {
+ emit('confirm', valueHtml.value)
+ dialogVisible.value = false
+}
+
+// Editor 鐩稿叧
+const editorRef = shallowRef<IDomEditor>()
+const editorId = ref('wangEditor-1')
+const toolbarConfig = {
+ excludeKeys: ['group-video'],
+ insertKeys: {
+ index: 31,
+ keys: ['ProcessRecordMenu']
+ }
+}
+const editorConfig = {
+ placeholder: '璇疯緭鍏ュ唴瀹�...',
+ EXTEND_CONF: {
+ mentionConfig: {
+ showModal,
+ hideModal
+ }
+ }
+}
+const valueHtml = ref()
+const handleCreated = (editor: IDomEditor) => {
+ editorRef.value = editor
+}
+
+/** 鍒濆鍖� */
+onBeforeUnmount(() => {
+ const editor = editorRef.value
+ if (editor == null) {
+ return
+ }
+ editor.destroy()
+})
+</script>
+
+<template>
+ <el-dialog v-model="dialogVisible" title="鑷畾涔夋ā鏉�" fullscreen>
+ <div style="margin: 0 10px">
+ <el-alert
+ title="杈撳叆 @ 鍙�夋嫨鎻掑叆娴佺▼琛ㄥ崟閫夐」鍜岄粯璁ら�夐」"
+ type="info"
+ show-icon
+ :closable="false"
+ />
+ </div>
+ <!-- TODO @unocss 绠�鍖� style -->
+ <div style=" margin: 10px;border: 1px solid #ccc">
+ <Toolbar
+ style="border-bottom: 1px solid #ccc"
+ :editor="editorRef"
+ :editorId="editorId"
+ :defaultConfig="toolbarConfig"
+ />
+ <Editor
+ style="height: 500px; overflow-y: hidden"
+ v-model="valueHtml"
+ :defaultConfig="editorConfig"
+ :editorId="editorId"
+ @on-created="handleCreated"
+ />
+ <MentionModal
+ v-if="isShowModal"
+ @hide-mention-modal="hideModal"
+ @insert-mention="insertMention"
+ />
+ </div>
+ <div style=" float: right;margin-right: 10px">
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="handleConfirm">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+</template>
+
+<style src="@wangeditor-next/editor/dist/css/style.css"></style>
--
Gitblit v1.8.0