diff --git a/src/utils/zplGenerator.js b/src/utils/zplGenerator.js index 7f1db20..30e48b0 100644 --- a/src/utils/zplGenerator.js +++ b/src/utils/zplGenerator.js @@ -115,7 +115,7 @@ export class ZPLGenerator { const zpl = [] // 设置中文字体 - zpl.push(`^CI28^LH0,^JUS^CWJ,E:SIMSUN.FNT^CFJ,${element.fontSize},${element.fontSize}`) + zpl.push(`^CI28 ^CWJ,E:MSYH.TTF ^CFJ,${element.fontSize}`) // 基础文本 const textCommand = element.newline diff --git a/src/views/modules/labelSetting/components/PropertyForm.vue b/src/views/modules/labelSetting/components/PropertyForm.vue index 19e71a6..181d8e7 100644 --- a/src/views/modules/labelSetting/components/PropertyForm.vue +++ b/src/views/modules/labelSetting/components/PropertyForm.vue @@ -129,7 +129,7 @@ 选择图片 @@ -244,7 +244,26 @@ export default { components: { comShowLabelSerialInfo,/*标签内容流水号信息的組件*/ }, + watch: { + // 监听元素变化,确保文件输入框状态正确 + 'element.id'() { + // 当切换到不同元素时,重置文件输入框 + this.$nextTick(() => { + if (this.$refs.fileInput) { + this.$refs.fileInput.value = '' + } + }) + } + }, methods: { + handleSelectImage() { + // 确保文件输入框被重置,然后触发点击 + if (this.$refs.fileInput) { + this.$refs.fileInput.value = '' + this.$refs.fileInput.click() + } + }, + /*流水号信息的modal*/ serialInfoModal(row){ let rowData = { @@ -270,8 +289,13 @@ export default { try { const imageData = await this.processImage(file) this.$emit('image-upload', imageData) + + // 重置文件输入框的值,确保下次选择相同文件时也能触发change事件 + event.target.value = '' } catch (error) { this.$message.error('图片处理失败') + // 即使出错也要重置文件输入框 + event.target.value = '' } },