|
|
|
|
@ -104,10 +104,14 @@ const options = ref({
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
page: {
|
|
|
|
|
showBreakMarks: false
|
|
|
|
|
showBreakMarks: false,
|
|
|
|
|
defaultMargin: { left: 3.18, right: 3.18, top: 2.54, bottom: 2.54 }
|
|
|
|
|
},
|
|
|
|
|
onSave: async (e) => {
|
|
|
|
|
template.value.templateData = JSON.stringify(e.json);
|
|
|
|
|
template.value.pageConfig = JSON.stringify({
|
|
|
|
|
pageMargin: editorRef.value.getPage()?.margin || { left: 3.18, right: 3.18, top: 2.54, bottom: 2.54 }
|
|
|
|
|
});
|
|
|
|
|
const res = await updatePrintTemplate(template.value);
|
|
|
|
|
ElMessage.success(res.msg);
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
@ -130,11 +134,19 @@ const insertText = (e) => {
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
console.log(UmoEditor);
|
|
|
|
|
getPrintTemplate(route.query.templateId).then((e) => {
|
|
|
|
|
template.value = e.data;
|
|
|
|
|
const editor = editorRef.value;
|
|
|
|
|
editor.setContent(JSON.parse(e.data.templateData || '{}'));
|
|
|
|
|
let margin = JSON.parse(e.data.pageConfig || '{}').pageMargin || {
|
|
|
|
|
left: 3.18,
|
|
|
|
|
right: 3.18,
|
|
|
|
|
top: 2.54,
|
|
|
|
|
bottom: 2.54
|
|
|
|
|
};
|
|
|
|
|
delete margin.layout;
|
|
|
|
|
options.value.page.defaultMargin =margin
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
const select = {
|
|
|
|
|
templateType: route.query.templateType
|
|
|
|
|
|