feat:【antd】【bpm】流程打印的设计 review

This commit is contained in:
YunaiV
2025-11-17 16:53:28 +08:00
parent 5568a174af
commit f24c5f8be9
2 changed files with 17 additions and 21 deletions

View File

@@ -5,8 +5,8 @@ import { computed, onBeforeUnmount, ref, shallowRef } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
// @ts-ignore - tinymce vue 声明文件按项目依赖提供
import Editor from '@tinymce/tinymce-vue'; import Editor from '@tinymce/tinymce-vue';
import { Alert, Button } from 'ant-design-vue';
import { setupTinyPlugins } from './tinymce-plugin'; import { setupTinyPlugins } from './tinymce-plugin';
@@ -23,9 +23,7 @@ const props = withDefaults(
const tinymceScriptSrc = `${import.meta.env.VITE_BASE}tinymce/tinymce.min.js`; const tinymceScriptSrc = `${import.meta.env.VITE_BASE}tinymce/tinymce.min.js`;
const [Modal, modalApi] = useVbenModal({ const [Modal, modalApi] = useVbenModal({
closable: true,
footer: false, footer: false,
title: '自定义模板',
async onOpenChange(isOpen: boolean) { async onOpenChange(isOpen: boolean) {
if (!isOpen) { if (!isOpen) {
return; return;
@@ -51,7 +49,6 @@ const handleConfirm = () => {
modalApi.close(); modalApi.close();
}; };
// 提供给 @ 自动补全的字段(默认 + 表单字段)
const mentionList = computed<MentionItem[]>(() => { const mentionList = computed<MentionItem[]>(() => {
const base: MentionItem[] = [ const base: MentionItem[] = [
{ id: 'startUser', name: '发起人' }, { id: 'startUser', name: '发起人' },
@@ -70,11 +67,10 @@ const mentionList = computed<MentionItem[]>(() => {
name: `[表单]${it.title}`, name: `[表单]${it.title}`,
})); }));
return [...base, ...extras]; return [...base, ...extras];
}); }); // 提供给 @ 自动补全的字段(默认 + 表单字段)
// 编辑器
const valueHtml = ref<string>(''); const valueHtml = ref<string>('');
const editorRef = shallowRef<any>(); const editorRef = shallowRef<any>(); // 编辑器
const tinyInit = { const tinyInit = {
height: 400, height: 400,
@@ -103,9 +99,10 @@ onBeforeUnmount(() => {
</script> </script>
<template> <template>
<Modal class="w-3/4"> <!-- TODO @jasona-button 改成 Modal 自带的 onConfirm 替代= = 我貌似试着改了下有点问题略奇怪 -->
<Modal class="w-3/4" title="自定义模板">
<div class="mb-3"> <div class="mb-3">
<a-alert <Alert
message="输入 @ 可选择插入流程选项和表单选项" message="输入 @ 可选择插入流程选项和表单选项"
type="info" type="info"
show-icon show-icon
@@ -119,8 +116,8 @@ onBeforeUnmount(() => {
/> />
<template #footer> <template #footer>
<div class="flex justify-end gap-2"> <div class="flex justify-end gap-2">
<a-button @click="modalApi.onCancel()"> </a-button> <Button @click="modalApi.onCancel()"> </Button>
<a-button type="primary" @click="handleConfirm"> </a-button> <Button type="primary" @click="handleConfirm"> </Button>
</div> </div>
</template> </template>
</Modal> </Modal>

View File

@@ -319,14 +319,6 @@ const defaultTemplate = `<p style="text-align: center;font-size: 1.25rem;"><stro
</div> </div>
<p>&nbsp;</p>`; <p>&nbsp;</p>`;
const handlePrintTemplateEnableChange = (checked: any) => {
const val = !!checked;
if (val && !modelData.value.printTemplateSetting.template) {
modelData.value.printTemplateSetting.template = defaultTemplate;
}
};
// 自定义打印模板开关
const printTemplateEnable = computed<boolean>({ const printTemplateEnable = computed<boolean>({
get() { get() {
return !!modelData.value?.printTemplateSetting?.enable; return !!modelData.value?.printTemplateSetting?.enable;
@@ -338,9 +330,16 @@ const printTemplateEnable = computed<boolean>({
template: '', template: '',
}; };
} }
modelData.value.printTemplateSetting.enable = !!val; modelData.value.printTemplateSetting.enable = val;
}, },
}); }); // 自定义打印模板开关
function handlePrintTemplateEnableChange(checked: any) {
const val = !!checked;
if (val && !modelData.value.printTemplateSetting.template) {
modelData.value.printTemplateSetting.template = defaultTemplate;
}
}
defineExpose({ initData, validate }); defineExpose({ initData, validate });
</script> </script>