From 76f8a8c73402cd09512f718436fb1b33c669af28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?yinjinlu-pc=5C=E5=B0=B9=E9=87=91=E8=B7=AF?= <411641505@qq.com> Date: Mon, 25 Nov 2024 11:18:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=89=93=E5=8D=B0=E6=9C=BA?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/print/printerconfig/index.vue | 262 +++++++++++++++++------- 1 file changed, 190 insertions(+), 72 deletions(-) diff --git a/src/views/print/printerconfig/index.vue b/src/views/print/printerconfig/index.vue index ceb3e23..6613b31 100644 --- a/src/views/print/printerconfig/index.vue +++ b/src/views/print/printerconfig/index.vue @@ -38,6 +38,15 @@ + + + - + @@ -98,36 +120,110 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{dict.label}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - + + + 客户端下载 + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -200,8 +255,9 @@ @@ -212,9 +268,12 @@ import { listPrinterconfig, getPrinterconfig, delPrinterconfig, addPrinterconfig export default { name: "Printerconfig", - dicts: ['mes_printer_status', 'mes_printer_type', 'mes_conn_type'], + dicts: ['mes_printer_status', 'mes_printer_type', 'mes_conn_type','sys_yes_no'], data() { return { + //自动生成编码 + autoGenFlag:false, + optType: undefined, // 遮罩层 loading: true, // 选中数组 @@ -237,14 +296,28 @@ export default { queryParams: { pageNum: 1, pageSize: 10, - printerType: null, printerName: null, brand: null, printerModel: null, connectionType: null, printerUrl: null, printerIp: null, printerPort: null, clientSid: null, clientIp: null, clientPort: null, enableFlag: null, status: null, }, + printerType: null, printerCode: null, printerName: null, brand: null, printerModel: null, connectionType: null, printerUrl: null, printerIp: null, printerPort: null, clientSid: null, clientIp: null, clientPort: null, enableFlag: null, status: null, }, // 表单参数 form: {}, // 表单校验 rules: { + printerCode: [ + { required: true, message: "打印机编号不能为空", trigger: "blur" } + ], + printerName: [ { required: true, message: "打印机名称不能为空", trigger: "blur" } - ], } + ], + + printerIp: [ + { required: true, message: "打印机IP地址不能为空", trigger: "blur" } + ], + printerPort: [ + { required: true, message: "打印机端口地址不能为空", trigger: "blur" } + ], + + } + }; }, created() { @@ -268,7 +341,7 @@ export default { // 表单重置 reset() { this.form = { - printerId: null, printerType: null, printerName: null, brand: null, printerModel: null, connectionType: "0", printerUrl: null, printerIp: null, printerPort: null, clientSid: null, clientIp: null, clientPort: null, enableFlag: null, status: "0", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null }; + printerId: null, printerCode: null, printerType: null, printerName: null, brand: null, printerModel: null, connectionType: "0", printerUrl: null, printerIp: null, printerPort: null, clientSid: null, clientIp: null, clientPort: null, enableFlag: 'Y', status: "READY", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null }; this.resetForm("form"); }, /** 搜索按钮操作 */ @@ -292,6 +365,7 @@ export default { this.reset(); this.open = true; this.title = "添加打印机配置"; + this.optType = 'add'; }, /** 修改按钮操作 */ handleUpdate(row) { @@ -301,6 +375,18 @@ export default { this.form = response.data; this.open = true; this.title = "修改打印机配置"; + this.optType = 'edit'; + }); + }, + /** 修改按钮操作 */ + handleView(row) { + this.reset(); + const printerId = row.printerId || this.ids + getPrinterconfig(printerId).then(response => { + this.form = response.data; + this.open = true; + this.title = "查看打印机配置"; + this.optType = 'view'; }); }, /** 提交按钮 */ @@ -338,6 +424,38 @@ export default { this.download('print/printerconfig/export', { ...this.queryParams }, `printerconfig_${new Date().getTime()}.xlsx`) + }, + //图片上传成功 + handleImgUplaoded(imgUrl){ + this.form.printerUrl = imgUrl; + }, + //图片移除 + handleImgRemoved(imgUrl){ + this.form.printerUrl = null; + }, + handleDownloadClient(){ + const resource = "https://foruda.gitee.com/images/1699583353182586077/41820ab8_1151004.png"; + this.$download.saveAs(resource,'client'); + }, + /** + * 将指定打印机作为默认打印机,存储在浏览器本地 + * @param row + */ + handleDefault(row){ + const key = 'defaultPrinter'; + const value = JSON.stringify(row); + localStorage.setItem(key, value); + this.$modal.msgSuccess("设置成功!"); + }, + //自动生成编码 + handleAutoGenChange(autoGenFlag){ + if(autoGenFlag){ + genCode('PRINTER_CODE').then(response =>{ + this.form.printerCode = response; + }); + }else{ + this.form.printerCode = null; + } } } };