From 19da9193d5c890b5ff4484c35dfa5702a4154a2a Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Thu, 11 Jun 2026 15:32:00 +0800
Subject: [PATCH 01/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=93=E5=8D=B0?=
=?UTF-8?q?=E6=9C=BA=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/mes/printconfig/index.ts | 46 ++++++
src/locales/en.ts | 13 ++
src/locales/zh-CN.ts | 20 +++
src/views/mes/printconfig/ConfigForm.vue | 121 ++++++++++++++
src/views/mes/printconfig/index.vue | 200 +++++++++++++++++++++++
5 files changed, 400 insertions(+)
create mode 100644 src/api/mes/printconfig/index.ts
create mode 100644 src/views/mes/printconfig/ConfigForm.vue
create mode 100644 src/views/mes/printconfig/index.vue
diff --git a/src/api/mes/printconfig/index.ts b/src/api/mes/printconfig/index.ts
new file mode 100644
index 00000000..06314d8b
--- /dev/null
+++ b/src/api/mes/printconfig/index.ts
@@ -0,0 +1,46 @@
+import request from '@/config/axios'
+
+// 打印机配置 VO
+export interface ConfigVO {
+ id: number // 主键ID
+ hostName: string // 主机名(如PACKING-PC-01),不可修改
+ systemPrinterName: string // 系统打印机名称,关联下拉选项
+ isDefault: boolean // 是否默认:0-否,1-是
+ isEnabled: boolean // 是否启用:0-禁用,1-启用
+ remark: string // 备注,记录打印机用途说明,用户不可修改
+ createdAt: Date // 创建时间
+ updatedAt: Date // 更新时间
+}
+
+// 打印机配置 API
+export const ConfigApi = {
+ // 查询打印机配置分页
+ getConfigPage: async (params: any) => {
+ return await request.get({ url: `/printer/config/page`, params })
+ },
+
+ // 查询打印机配置详情
+ getConfig: async (id: number) => {
+ return await request.get({ url: `/printer/config/get?id=` + id })
+ },
+
+ // 新增打印机配置
+ createConfig: async (data: ConfigVO) => {
+ return await request.post({ url: `/printer/config/create`, data })
+ },
+
+ // 修改打印机配置
+ updateConfig: async (data: ConfigVO) => {
+ return await request.put({ url: `/printer/config/update`, data })
+ },
+
+ // 删除打印机配置
+ deleteConfig: async (id: number) => {
+ return await request.delete({ url: `/printer/config/delete?id=` + id })
+ },
+
+ // 导出打印机配置 Excel
+ exportConfig: async (params) => {
+ return await request.download({ url: `/printer/config/export-excel`, params })
+ },
+}
\ No newline at end of file
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 392c338a..4c818b10 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -3229,6 +3229,19 @@ export default {
validatorTypeRequired: 'Template type can not be empty',
design: 'Design',
designTitle: 'Template Design'
+ },
+ PrintConfig: {
+ hostName: 'Host Name',
+ systemPrinterName: 'Printer Name',
+ defaultStatus: 'Is Default',
+ isEnable: 'Is Enabled',
+ remark: 'remark',
+ createTime: 'Create Time',
+ updateTime: 'Update Time',
+ operate: 'Operate',
+ placeholderHostName: 'Please input host name',
+ placeholderSystemPrinterName: 'Please input printer name',
+ placeholderRemark: 'Please input printer remark',
}
},
QualityManagement: {
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index bcc9da21..9e5ad5aa 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -2719,6 +2719,26 @@ export default {
validatorTypeRequired: '模板类型不能为空',
design: '配置',
designTitle: '模板配置'
+ },
+ PrintConfig: {
+ hostName: '主机名',
+ systemPrinterName: '打印机名称',
+ defaultStatus: '是否默认',
+ isEnable: '是否启用',
+ remark: '备注',
+ createTime: '创建时间',
+ updateTime: '更新时间',
+ operate: '操作',
+ placeholderHostName: '请输入主机名',
+ placeholderSystemPrinterName: '请输入系统打印机名称',
+ placeholderTemplateType: '请选择模板类型',
+ placeholderTemplateJson: '请输入模板JSON内容',
+ placeholderRemark: '请输入备注',
+ validatorCodeRequired: '模板编码不能为空',
+ validatorNameRequired: '模板名称不能为空',
+ validatorTypeRequired: '模板类型不能为空',
+ design: '配置',
+ designTitle: '模板配置'
}
},
QualityManagement: {
diff --git a/src/views/mes/printconfig/ConfigForm.vue b/src/views/mes/printconfig/ConfigForm.vue
new file mode 100644
index 00000000..7331b26f
--- /dev/null
+++ b/src/views/mes/printconfig/ConfigForm.vue
@@ -0,0 +1,121 @@
+
+
+
+
diff --git a/src/views/mes/printconfig/index.vue b/src/views/mes/printconfig/index.vue
new file mode 100644
index 00000000..3f3d35e8
--- /dev/null
+++ b/src/views/mes/printconfig/index.vue
@@ -0,0 +1,200 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('common.query') }}
+ {{ t('common.reset') }}
+
+ {{ t('action.add') }}
+
+
+ {{ t('action.export') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('action.edit') }}
+
+
+ {{ t('action.del') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
From 990558e59d882d191153b0f13328844f4957df9c Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Fri, 12 Jun 2026 08:03:15 +0800
Subject: [PATCH 02/11] =?UTF-8?q?=E6=89=93=E5=8D=B0=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/locales/en.ts | 5 +
src/locales/zh-CN.ts | 7 +-
src/views/mes/printconfig/ConfigForm.vue | 164 ++++++++++++++-
src/views/mes/printconfig/index.vue | 256 ++++++++++++++++++++++-
4 files changed, 417 insertions(+), 15 deletions(-)
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 165eec74..c7a96dca 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -3234,6 +3234,10 @@ export default {
designTitle: 'Template Design'
},
PrintConfig: {
+ moduleName: 'Printer Config',
+ currentHostName: 'Current Host Name',
+ unknownHostName: 'Not detected',
+ currentHostTip: 'This page only displays and manages printer configurations for the current host.',
hostName: 'Host Name',
systemPrinterName: 'Printer Name',
defaultStatus: 'Is Default',
@@ -3245,6 +3249,7 @@ export default {
placeholderHostName: 'Please input host name',
placeholderSystemPrinterName: 'Please input printer name',
placeholderRemark: 'Please input printer remark',
+ testPrint:'Test Print'
}
},
QualityManagement: {
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 2c370e30..4e384913 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -2725,6 +2725,10 @@ export default {
designTitle: '模板配置'
},
PrintConfig: {
+ moduleName: '打印机配置',
+ currentHostName: '当前主机名',
+ unknownHostName: '未获取到',
+ currentHostTip: '当前页面仅展示和管理当前主机的打印机配置。',
hostName: '主机名',
systemPrinterName: '打印机名称',
defaultStatus: '是否默认',
@@ -2742,7 +2746,8 @@ export default {
validatorNameRequired: '模板名称不能为空',
validatorTypeRequired: '模板类型不能为空',
design: '配置',
- designTitle: '模板配置'
+ designTitle: '模板配置',
+ testPrint:'测试打印'
}
},
QualityManagement: {
diff --git a/src/views/mes/printconfig/ConfigForm.vue b/src/views/mes/printconfig/ConfigForm.vue
index 7331b26f..67ee35ed 100644
--- a/src/views/mes/printconfig/ConfigForm.vue
+++ b/src/views/mes/printconfig/ConfigForm.vue
@@ -8,10 +8,24 @@
v-loading="formLoading"
>
-
+
-
+
+
+
+
@@ -24,6 +38,7 @@
+ {{ t('TemplateManagement.PrintConfig.testPrint') }}
{{ t('common.ok') }}
{{ t('common.cancel') }}
@@ -31,13 +46,18 @@
+
+
From b12a98ed27b22800d28e88cbd7048b1dc474e071 Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Fri, 12 Jun 2026 08:16:47 +0800
Subject: [PATCH 03/11] update
---
index.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/index.html b/index.html
index e9f058bc..e8cf0813 100644
--- a/index.html
+++ b/index.html
@@ -3,6 +3,7 @@
+
Date: Fri, 12 Jun 2026 10:47:04 +0800
Subject: [PATCH 04/11] update
---
src/views/mes/printconfig/index.vue | 46 ++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/src/views/mes/printconfig/index.vue b/src/views/mes/printconfig/index.vue
index eb9210a9..bb10d7cd 100644
--- a/src/views/mes/printconfig/index.vue
+++ b/src/views/mes/printconfig/index.vue
@@ -257,6 +257,13 @@ const getActiveXComputerName = () => {
const getSocketHostName = () => {
const socket = getHiwebSocket()
+
+ // ���ȼ�� socket.clientInfo����ǰ���ӿͻ�����Ϣ��
+ const hostNameFromInfo = extractHostName(socket?.clientInfo)
+ if (hostNameFromInfo) {
+ return hostNameFromInfo
+ }
+
const clients = socket?.clients
const clientList = Array.isArray(clients) ? clients : Object.values(clients || {})
@@ -309,14 +316,37 @@ const resolveCurrentHostName = async () => {
window.clearTimeout(timer)
resolve(hostName || getSocketHostName())
}
- const timer = window.setTimeout(() => finish(), 1500)
+
+ const timer = window.setTimeout(() => finish(), 3000)
+ const socket = getHiwebSocket()
+
+ // ������ socket.io ʵ����ֱ�Ӽ��� clients/clientInfo �¼�
+ if (socket?.socket?.on) {
+ const onClients = () => {
+ const hn = getSocketHostName()
+ if (hn) finish(hn)
+ }
+ const onClientInfo = () => {
+ const hn = extractHostName(socket.clientInfo) || getSocketHostName()
+ if (hn) finish(hn)
+ }
+ socket.socket.on('clients', onClients)
+ socket.socket.on('clientInfo', onClientInfo)
+ }
+
+ // ����������������������
+ if (socket) {
+ if (typeof socket.getClients === 'function') socket.getClients()
+ if (typeof socket.getClientInfo === 'function') socket.getClientInfo()
+ if (typeof socket.refreshPrinterList === 'function') socket.refreshPrinterList()
+ }
+
+ // autoConnect ���� socket�����������ص��� false���ȴ����ӳɹ���� true��
autoConnect((status: boolean) => {
if (!status) {
- finish()
return
}
- const socket = getHiwebSocket()
- socket?.refreshPrinterList?.()
+ getHiwebSocket()?.refreshPrinterList?.()
window.setTimeout(() => finish(getSocketHostName()), 300)
})
})
@@ -327,13 +357,9 @@ const resolveCurrentHostName = async () => {
const initCurrentHostName = async () => {
const hostName = await resolveCurrentHostName()
- if (!hostName) {
- let s = normalizeClientHost();
- currentHostName.value = s
- queryParams.hostName = s
- }else{
+ if (hostName) {
currentHostName.value = hostName
- queryParams.hostName = hostName || undefined
+ queryParams.hostName = hostName
}
}
From 75ab796a099d3a720603ae8126ebe3ed1bcd7474 Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Fri, 12 Jun 2026 11:37:12 +0800
Subject: [PATCH 05/11] update
---
src/views/mes/printconfig/index.vue | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/views/mes/printconfig/index.vue b/src/views/mes/printconfig/index.vue
index bb10d7cd..a0ed49b0 100644
--- a/src/views/mes/printconfig/index.vue
+++ b/src/views/mes/printconfig/index.vue
@@ -166,7 +166,7 @@ const queryParams = reactive({
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
const clientHostStorageKey = 'hiprint-client-host'
-const defaultClientHost = 'http://127.0.0.1:17521'
+const defaultClientHost = 'http://localhost:17521'
let hiprintInited = false
@@ -190,6 +190,24 @@ const ensureHiprintInit = () => {
if (hiprintInited) {
return
}
+
+ // Edge ���ݣ�Ϊ hiwebSocket ���?polling ����㽵��? // ԭ���������?transports:["websocket"]��Edge ��ȫ������ WebSocket ��������ʧ��
+ const socket = getHiwebSocket()
+ if (socket?.start && !socket.__transportPatched) {
+ const originalStart = socket.start.bind(socket)
+ socket.start = function (callback?: any) {
+ const originalIo = window.io
+ window.io = function (url: string, opts?: any) {
+ opts = opts || {}
+ opts.transports = ['websocket', 'polling']
+ return originalIo(url, opts)
+ }
+ originalStart(callback)
+ window.io = originalIo
+ }
+ socket.__transportPatched = true
+ }
+
hiprint.init({
host: normalizeClientHost(),
providers: [defaultElementTypeProvider()]
From 5302b0f47dd46cf113d4eb24adab268e67d3935f Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Fri, 12 Jun 2026 14:07:20 +0800
Subject: [PATCH 06/11] update
---
index.html | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index e8cf0813..81bc8248 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,4 @@
-
+
@@ -147,6 +147,31 @@
+
+
+
From 6596c494de866420bb7b5e089433636451ed5a5a Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Fri, 12 Jun 2026 14:17:58 +0800
Subject: [PATCH 07/11] update
---
src/views/mes/printconfig/index.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/mes/printconfig/index.vue b/src/views/mes/printconfig/index.vue
index a0ed49b0..23b96c3f 100644
--- a/src/views/mes/printconfig/index.vue
+++ b/src/views/mes/printconfig/index.vue
@@ -166,7 +166,7 @@ const queryParams = reactive({
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
const clientHostStorageKey = 'hiprint-client-host'
-const defaultClientHost = 'http://localhost:17521'
+const defaultClientHost = 'http://127.0.0.1:17521'
let hiprintInited = false
From 89c8247f223acdf97070c3061c0c0cac34521f03 Mon Sep 17 00:00:00 2001
From: liutao <790864623@qq.com>
Date: Fri, 12 Jun 2026 14:40:17 +0800
Subject: [PATCH 08/11] update
---
index.html | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/index.html b/index.html
index 81bc8248..600c999c 100644
--- a/index.html
+++ b/index.html
@@ -147,31 +147,7 @@
-
-
+