优化标签小票打印
This commit is contained in:
@@ -169,27 +169,27 @@ function checkLocalPrint(deviceName) {
|
||||
|
||||
// 检测是否打印标签小票
|
||||
function checkLabelPrint(props) {
|
||||
console.log(props);
|
||||
// console.log(props);
|
||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接1");
|
||||
} else {
|
||||
let pids = printLabelList.value[0].config.categoryList.map(item => item.id)
|
||||
let labelList = []
|
||||
let count = 0
|
||||
let sum = 0
|
||||
// let count = 0
|
||||
// let sum = 0
|
||||
|
||||
// props.carts.map(item => {
|
||||
// if (pids.some(el => el == item.categoryId)) {
|
||||
// for (let i = 0; i < item.number; i++) {
|
||||
// sum++
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
props.carts.map(item => {
|
||||
if (pids.some(el => el == item.categoryId)) {
|
||||
for (let i = 0; i < item.number; i++) {
|
||||
sum++
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
props.carts.map(item => {
|
||||
if (pids.some(el => el == item.categoryId)) {
|
||||
for (let i = 0; i < item.number; i++) {
|
||||
count++
|
||||
// count++
|
||||
labelList.push(
|
||||
{
|
||||
outNumber: props.outNumber,
|
||||
@@ -198,7 +198,7 @@ function checkLabelPrint(props) {
|
||||
masterId: props.orderInfo.tableName,
|
||||
deviceName: printLabelList.value[0].config.deviceName,
|
||||
createdAt: dayjs(props.createdAt).format('YYYY-MM-DD HH:mm:ss'),
|
||||
count: `${count}/${sum}`
|
||||
// count: `${count}/${sum}`
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -210,17 +210,18 @@ function checkLabelPrint(props) {
|
||||
}
|
||||
|
||||
// 打印标签
|
||||
const printLabel = (list) => {
|
||||
const printLabel = _.throttle(function (list) {
|
||||
if (!checkLocalPrint(printLabelList.value[0].config.deviceName)) {
|
||||
ElMessage.error("本地打印机无法使用,请检查打印机是否正确连接");
|
||||
} else {
|
||||
for (let i = 0; i <= list.length - 1; i++) {
|
||||
// ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||
setTimeout(() => {
|
||||
ipcRenderer.send('printerTagSync', JSON.stringify(list[i]))
|
||||
}, i * 1000)
|
||||
}, i * 800)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1500, { leading: true, trailing: false })
|
||||
|
||||
// 打印操作
|
||||
async function printHandle() {
|
||||
|
||||
Reference in New Issue
Block a user