修复编辑打印模板时绑定设计方案
This commit is contained in:
parent
5d139c097d
commit
b48ebc4cc8
@ -147,7 +147,9 @@ const templateCancel = () => {
|
|||||||
|
|
||||||
// 模板设置提交
|
// 模板设置提交
|
||||||
const templateSubmit = async () => {
|
const templateSubmit = async () => {
|
||||||
state.ruleForm.template = JSON.stringify(hiprintDesignRef.value?.hiprintTemplate.getJson());
|
let templateJson=hiprintDesignRef.value?.hiprintTemplate.getJson();
|
||||||
|
templateJson.panels[0].index=hiprintDesignRef.value?.mode;
|
||||||
|
state.ruleForm.template = JSON.stringify(templateJson);
|
||||||
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {
|
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {
|
||||||
await getAPI(SysPrintApi).apiSysPrintUpdatePost(state.ruleForm);
|
await getAPI(SysPrintApi).apiSysPrintUpdatePost(state.ruleForm);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<el-row :gutter="8" style="margin-bottom: 5px">
|
<el-row :gutter="8" style="margin-bottom: 5px">
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<!-- 流程下拉 模板选择 -->
|
<!-- 流程下拉 模板选择 -->
|
||||||
<el-select v-model="state.mode" showSearch @change="changeMode" :defaultValue="0" option-label-prop="label" class="w100">
|
<el-select v-model="mode" showSearch @change="changeMode" :defaultValue="0" option-label-prop="label" class="w100">
|
||||||
<el-option v-for="(opt, idx) in state.modeList" :key="idx" :label="opt.name" :value="idx">
|
<el-option v-for="(opt, idx) in state.modeList" :key="idx" :label="opt.name" :value="idx">
|
||||||
{{ opt.name }}
|
{{ opt.name }}
|
||||||
</el-option>
|
</el-option>
|
||||||
@ -110,11 +110,11 @@ import PrintPreview from './preview.vue';
|
|||||||
import printData from './print-data';
|
import printData from './print-data';
|
||||||
|
|
||||||
let hiprintTemplate = ref();
|
let hiprintTemplate = ref();
|
||||||
|
// 模板选择
|
||||||
|
let mode = ref(0);
|
||||||
|
|
||||||
const preViewRef = ref();
|
const preViewRef = ref();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
// 模板选择
|
|
||||||
mode: 0,
|
|
||||||
modeList: [] as any,
|
modeList: [] as any,
|
||||||
// 当前纸张
|
// 当前纸张
|
||||||
curPaper: {
|
curPaper: {
|
||||||
@ -178,7 +178,7 @@ const curPaperType = computed(() => {
|
|||||||
|
|
||||||
// 选择模板
|
// 选择模板
|
||||||
const changeMode = () => {
|
const changeMode = () => {
|
||||||
let provider = providers[state.mode];
|
let provider = providers[mode.value];
|
||||||
hiprint.init({
|
hiprint.init({
|
||||||
providers: [provider.f],
|
providers: [provider.f],
|
||||||
});
|
});
|
||||||
@ -325,6 +325,7 @@ 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;
|
||||||
|
|
||||||
@ -333,7 +334,7 @@ const initPaper = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 导出对象
|
// 导出对象
|
||||||
defineExpose({ hiprintTemplate, initPaper });
|
defineExpose({ hiprintTemplate, initPaper, mode });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user