修复绑定打印设计模板左边面板绑定问题

This commit is contained in:
轻风2016 2024-10-10 11:20:02 +08:00
parent b48ebc4cc8
commit 86f8356ef4
2 changed files with 14 additions and 2 deletions

View File

@ -9,7 +9,7 @@
</div> </div>
</template> </template>
<div style="margin: 0px 0px 0px 0px"> <div style="margin: 0px 0px 0px 0px">
<HiprintDesign ref="hiprintDesignRef" /> <HiprintDesign :mode-index="mode" ref="hiprintDesignRef" />
</div> </div>
<template #footer> <template #footer>
<span class="dialog-footer" style="margin-top: 10px"> <span class="dialog-footer" style="margin-top: 10px">
@ -93,6 +93,8 @@ import { UpdatePrintInput } from '/@/api-services/models';
const hiprintDesignRef = ref<InstanceType<typeof HiprintDesign>>(); const hiprintDesignRef = ref<InstanceType<typeof HiprintDesign>>();
const mode = ref(0);
const props = defineProps({ const props = defineProps({
title: String, title: String,
}); });
@ -110,6 +112,8 @@ onMounted(async () => {});
// //
const openDialog = (row: any) => { const openDialog = (row: any) => {
state.ruleForm = JSON.parse(JSON.stringify(row)); state.ruleForm = JSON.parse(JSON.stringify(row));
let templateJson = JSON.parse(state.ruleForm.template);
mode.value = templateJson.panels[0].index;
state.isShowDialog = true; state.isShowDialog = true;
ruleFormRef.value?.resetFields(); ruleFormRef.value?.resetFields();

View File

@ -109,6 +109,14 @@ import providers from './providers';
import PrintPreview from './preview.vue'; import PrintPreview from './preview.vue';
import printData from './print-data'; import printData from './print-data';
//
var props = defineProps({
modeIndex: {
type: Number,
default: 0,
},
});
let hiprintTemplate = ref(); let hiprintTemplate = ref();
// //
let mode = ref(0); let mode = ref(0);
@ -318,6 +326,7 @@ onMounted(() => {
state.modeList = providers.map((e) => { state.modeList = providers.map((e) => {
return { type: e.type, name: e.name, value: e.value }; return { type: e.type, name: e.name, value: e.value };
}); });
mode.value = props.modeIndex;
changeMode(); changeMode();
// otherPaper(); // // otherPaper(); //
}); });
@ -325,7 +334,6 @@ onMounted(() => {
// //
const initPaper = () => { const initPaper = () => {
var template = hiprintTemplate.value.getJson(); var template = hiprintTemplate.value.getJson();
mode.value = template.panels[0].index;
var width = template.panels[0].width; var width = template.panels[0].width;
var height = template.panels[0].height; var height = template.panels[0].height;