From d704d6ee9bf9c7be03220c626b33217b5ea61007 Mon Sep 17 00:00:00 2001 From: jiyufei <67400194@qq.com> Date: Mon, 29 Jul 2024 16:47:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(front):=E7=94=9F=E6=88=90=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/scm/parkequipment/form.vue | 66 +++++++++++++++++-- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/jnpf-java-boot/jnpf-web/src/views/scm/parkequipment/form.vue b/jnpf-java-boot/jnpf-web/src/views/scm/parkequipment/form.vue index 81bcc85..5ed65ca 100644 --- a/jnpf-java-boot/jnpf-web/src/views/scm/parkequipment/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/scm/parkequipment/form.vue @@ -17,11 +17,10 @@ {{ '下一条' }} - - {{ !dataForm.id ? '确定并新增' : '确定并继续' }} - - --> + + {{ !dataForm.id ? '确定并新增' : '确定并继续' }} + + --> 保 存 @@ -199,6 +198,17 @@ + + + + + 生成 + + +
+
+
+
@@ -219,11 +229,15 @@ import { getDefaultCurrentValueUserId } from '@/api/permission/user' import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize' import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js' import { thousandsFormat } from "@/components/Generator/utils/index" +import QRCode from 'qrcodejs2' +import JsBarcode from 'jsbarcode' export default { components: {}, props: [], data() { return { + qrcode: '', + barcode: "", dataFormSubmitType: 0, continueBtnLoading: false, index: 0, @@ -319,7 +333,7 @@ export default { }, ], deviceMacAddress: [ - + { pattern: /^\d+$/, message: '请输入正确的数字', @@ -417,6 +431,46 @@ export default { }, mounted() { }, methods: { + getQRimg() { + if (this.dataForm.equipmentCoding == null || this.dataForm.deviceName == null || + this.dataForm.equipmentType == null || this.dataForm.equipmentBrand == null || this.dataForm.spaceId == null) { + this.$message.error('请完善设备必填信息'); + return + } + let qrCodeJsonString = JSON.stringify(this.dataForm); + this.qrcode = qrCodeJsonString; + if (!this.qrcode) { + return + } + this.$refs.qrCode.innerHTML = ""; + let qrcode = new QRCode(this.$refs.qrCode, { + width: 265, + height: 265, // 高度 + text: this.qrcode, // 二维码内容 + // render: 'canvas' // 设置渲染方式(有两种方式 table和canvas,默认是canvas) + // background: '#f0f' + // foreground: '#ff0' + correctLevel: QRCode.CorrectLevel.H //容错级别 容错级别有:(1)QRCode.CorrectLevel.L (2)QRCode.CorrectLevel.M (3)QRCode.CorrectLevel.Q (4)QRCode.CorrectLevel.H + }) + }, + getBarcode() { + let reg = /^[A-Za-z0-9]+$/ + if (!reg.test(this.barcode)) { + this.$message({ + message: '请输入数字或者英文字母', + type: 'error', + duration: 1500, + }) + return + } + JsBarcode("#barcode", this.barcode, { + // format: "pharmacode", + // lineColor: "#0aa", + width: 4, + height: 80, + displayValue: false + }); + }, spaceChange(var1, var2) { this.dataForm.spaceName = var2.name; this.dataForm.regionId = var2.pid;