feat:【antd】【bpm】流程打印的设计 review
This commit is contained in:
@@ -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 @jason:a-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>
|
||||||
|
|||||||
@@ -319,14 +319,6 @@ const defaultTemplate = `<p style="text-align: center;font-size: 1.25rem;"><stro
|
|||||||
</div>
|
</div>
|
||||||
<p> </p>`;
|
<p> </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>
|
||||||
|
|||||||
Reference in New Issue
Block a user