修复bug

This commit is contained in:
yanran200730
2024-10-29 21:36:40 +08:00
parent b4c3e3796f
commit 4b6e221369
5 changed files with 62 additions and 26 deletions

View File

@@ -196,7 +196,7 @@
<template v-slot="{ row }">
<div class="table-options">
<el-button type="text" @click="showTemplate(row)">模板预览</el-button>
<el-button type="text" @click="updateTempate(row), isShowTemplate = false">使用</el-button>
<el-button type="text" @click="updateTempate(row)">使用</el-button>
</div>
</template>
</el-table-column>
@@ -396,6 +396,7 @@
addField() {
const num = this.dynamicFromList.length > 9 ? this.dynamicFromList.length + 1 : `0${this.dynamicFromList.length + 1}`
// eslint-disable-next-line no-empty
if (this.dynamicFromList.length && !this.dynamicFromList.at(-1)[`field_${num}`]) {
} else {
this.$set(this.dynamicFrom, `field_${num}`, '')
@@ -415,6 +416,9 @@
const config = JSON.parse(res.data.content)
this.hiprintTemplate.update(config)
this.hiprintTemplate.setPaper(config.panels[0].width, config.panels[0].height)
this.dynamicFromList = JSON.parse(res.data.params)
this.isShowTemplate = false
}
this.templateLoading = false

View File

@@ -1,5 +1,7 @@
/* eslint-disable no-undef */
import { hiprint } from 'vue-plugin-hiprint'
export const customProvider = function (options) {
export const customProvider = function () {
const addElementTypes = function (context) {
context.removePrintElementTypes('customProvider')
context.addPrintElementTypes('customProvider', [
@@ -24,11 +26,9 @@ export const customProvider = function (options) {
printData = sukData
}
// eslint-disable-next-line no-undef
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt">
<svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>
</div>`)
// eslint-disable-next-line no-undef
JsBarcode('#' + elId, printData.labelCode, {
format: 'CODE128B',
width: 2,
@@ -37,13 +37,11 @@ export const customProvider = function (options) {
displayValue: false
})
// eslint-disable-next-line no-undef
const codeHtml = $(`#codewrapper-${elId}`).html()
// eslint-disable-next-line no-undef
$(`body>#codewrapper-${elId}`).remove()
// eslint-disable-next-line no-undef
const resizeObserver = new ResizeObserver(() => {
JsBarcode('#' + elId, printData.labelCode, {
JsBarcode('#' + elId, printData.labelCode, {
format: "CODE128B",
width: 2,
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,