新增接口调用:print.getList

This commit is contained in:
zm2000 2026-05-29 18:21:30 +08:00
parent 565d4ded5b
commit cbb173ba16

View File

@ -103,7 +103,8 @@
onlyMine: false, onlyMine: false,
currentUserId: '', currentUserId: '',
showPrintPopup: false, showPrintPopup: false,
printStationName: '默认打印台', printStationName: '--',
printStationList: [],
printMessage: '', printMessage: '',
pendingPrintCount: 0, pendingPrintCount: 0,
orderList: [] orderList: []
@ -156,6 +157,32 @@
this.safeDispatchBroadcast('stop'); this.safeDispatchBroadcast('stop');
}, },
methods: { methods: {
buildPrintRecordWhere() {
return {};
},
buildPrintRecordParams() {
return {
page: 1,
pageSize: 20,
where: this.buildPrintRecordWhere()
};
},
extractPrintRecordList(response) {
const list = response?.data?.list || response?.data?.data?.list;
return Array.isArray(list) ? list : [];
},
normalizePrintStationNames(list) {
return list
.map(item => String(item?.name || '').trim())
.filter(name => !!name);
},
async loadPrintStations() {
const response = await this.$http('print.getList', this.buildPrintRecordParams());
const list = this.extractPrintRecordList(response);
const names = this.normalizePrintStationNames(list);
this.printStationList = names;
this.printStationName = names.length ? names.join('、') : '--';
},
safeDispatchBroadcast(action, payload) { safeDispatchBroadcast(action, payload) {
try { try {
const task = this.$store.dispatch(`broadcast/${action}`, payload); const task = this.$store.dispatch(`broadcast/${action}`, payload);
@ -443,7 +470,7 @@
]; ];
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`); this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
}, },
handlePrintAllUnreviewed() { async handlePrintAllUnreviewed() {
const targetList = this.displayOrderList.filter(item => Number(item.unreviewedCount || 0) > 0); const targetList = this.displayOrderList.filter(item => Number(item.unreviewedCount || 0) > 0);
if (!targetList.length) { if (!targetList.length) {
uni.showToast({ uni.showToast({
@ -452,6 +479,16 @@
}); });
return; return;
} }
try {
await this.loadPrintStations();
} catch (error) {
this.printStationList = [];
this.printStationName = '--';
uni.showToast({
title: '打印台加载失败',
icon: 'none'
});
}
this.pendingPrintCount = targetList.length; this.pendingPrintCount = targetList.length;
this.printMessage = `待打印未复核订单 ${targetList.length} 条`; this.printMessage = `待打印未复核订单 ${targetList.length} 条`;
this.showPrintPopup = true; this.showPrintPopup = true;