优化标签小票打印
This commit is contained in:
@@ -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
14
src/store/socket.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useSocket = defineStore({
|
||||
id: "socket",
|
||||
state: () => ({
|
||||
online: false,
|
||||
}),
|
||||
actions: {
|
||||
// 登录
|
||||
changeOnline(state) {
|
||||
this.online = state;
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user