优化标签小票打印

This commit is contained in:
gyq
2024-06-24 16:43:54 +08:00
parent 408e0e44c4
commit 87627e7b35
13 changed files with 220 additions and 318 deletions

View File

@@ -3,10 +3,38 @@ import { defineStore } from "pinia";
export const usePrint = defineStore({
id: "print",
state: () => ({
localDevices: [], // 本地打印机列表
deviceList: [], // 添加的打印机
data: "", // 要打印的数据
}),
actions: {
// 更新本地打印机列表
updateLocalDevice(list) {
this.localDevices = list;
},
// 更新已添加的打印机
updateDevice(list) {
this.deviceList = list;
},
// 检查本地打印机是否能正常使用
checkLocalPrint(deviceName) {
let print = "";
for (let item of this.localDevices) {
if (item.name == deviceName) {
print = item;
}
}
if (!print.name) {
return false;
} else {
return true;
}
},
// 执行打印操作
printHandle(state) {},
printHandle(state, type = "label") {
if (type == "label") {
}
},
},
});

14
src/store/socket.js Normal file
View File

@@ -0,0 +1,14 @@
import { defineStore } from "pinia";
export const useSocket = defineStore({
id: "socket",
state: () => ({
online: false,
}),
actions: {
// 登录
changeOnline(state) {
this.online = state;
},
},
});