fix(盘点): 库位标记空库位补语音播报,返回列表复位关键字
- 盘点详情页:从库位明细页返回时清空扫描关键字,作业列表恢复显示全部库位 - 盘点详情页/库位页:新增 speakMessage 语音播报(复用全局 $tools.speakText,受语音开关控制) - 标记空库位:上报成功后播报「已标记空库位」,失败播报「标记失败」 - 标记空库位:确认弹窗优先展示库位名称(locationName → locationCode → detailId) - 标记空库位:上报入参补齐 detailId - 完成盘点:成功/失败/异常均增加语音播报(统一播报「盘点完成/盘点失败」,盘盈盘亏仅弹窗展示)
This commit is contained in:
parent
17787988d3
commit
48e2438416
@ -306,6 +306,8 @@ export default {
|
||||
// 从库位明细页返回:刷新作业列表(状态/已盘数可能变化)
|
||||
if (this._pendingWorkRefresh) {
|
||||
this._pendingWorkRefresh = false;
|
||||
// 返回时清空输入框数据,列表显示全部库位
|
||||
this.scanKeyword = '';
|
||||
if (this.isWorkTab && this.canEdit) {
|
||||
this.loadWorkList(this.workPage);
|
||||
}
|
||||
@ -657,11 +659,12 @@ export default {
|
||||
cancelText: '取消',
|
||||
success: async (res) => {
|
||||
if (!res.confirm) return;
|
||||
await this.submitReport({
|
||||
const ok = await this.submitReport({
|
||||
detailId: row.detailId,
|
||||
location: row.location,
|
||||
isEmpty: true
|
||||
}, '已标记空库位');
|
||||
this.speakMessage(ok ? '已标记空库位' : '标记失败', { force: true, minInterval: 0 });
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -799,6 +802,21 @@ export default {
|
||||
if (!this.hasActions || this.submitting) return;
|
||||
this.showActionsPopup = true;
|
||||
},
|
||||
/** 语音播报(复用全局 $tools.speakText,受 voice.enabled 开关控制) */
|
||||
speakMessage(message, options = {}) {
|
||||
const text = String(message || '').trim();
|
||||
if (!text) return;
|
||||
const tools = this.$tools;
|
||||
if (!tools || typeof tools.speakText !== 'function') return;
|
||||
try {
|
||||
const task = tools.speakText(text, options);
|
||||
if (task && typeof task.catch === 'function') {
|
||||
task.catch(error => console.warn('[inventoryCountDetail] 语音播报失败:', error));
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('[inventoryCountDetail] 语音播报异常:', error);
|
||||
}
|
||||
},
|
||||
async handleFinish() {
|
||||
this.showActionsPopup = false;
|
||||
if (this.submitting || !this.taskId) return;
|
||||
@ -813,6 +831,7 @@ export default {
|
||||
try {
|
||||
const response = await this.$http('check.finish', { id: Number(this.taskId) });
|
||||
if (response?.flag === 'failure') {
|
||||
this.speakMessage('盘点失败', { force: true, minInterval: 0 });
|
||||
uni.showToast({ title: response.message || '完成失败', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
@ -822,6 +841,8 @@ export default {
|
||||
if (profit || loss) {
|
||||
title = `盘点完成 盘盈${profit} 盘亏${loss}`;
|
||||
}
|
||||
// 语音播报统一为「盘点完成」(盘盈/盘亏详情仅弹窗展示)
|
||||
this.speakMessage('盘点完成', { force: true, minInterval: 0 });
|
||||
uni.showModal({
|
||||
title,
|
||||
content: '该盘点任务已完成。',
|
||||
@ -833,6 +854,7 @@ export default {
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[inventoryCountDetail] 完成盘点失败:', error);
|
||||
this.speakMessage('盘点失败', { force: true, minInterval: 0 });
|
||||
uni.showToast({ title: '完成盘点失败', icon: 'none' });
|
||||
} finally {
|
||||
this.submitting = false;
|
||||
|
||||
@ -229,6 +229,21 @@ export default {
|
||||
handleKeywordClear() {
|
||||
this.scanKeyword = '';
|
||||
},
|
||||
/** 语音播报(复用全局 $tools.speakText,受 voice.enabled 开关控制) */
|
||||
speakMessage(message, options = {}) {
|
||||
const text = String(message || '').trim();
|
||||
if (!text) return;
|
||||
const tools = this.$tools;
|
||||
if (!tools || typeof tools.speakText !== 'function') return;
|
||||
try {
|
||||
const task = tools.speakText(text, options);
|
||||
if (task && typeof task.catch === 'function') {
|
||||
task.catch(error => console.warn('[inventoryCountLocation] 语音播报失败:', error));
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('[inventoryCountLocation] 语音播报异常:', error);
|
||||
}
|
||||
},
|
||||
// ===== 添加商品记录 / 标记空库位 =====
|
||||
openAddPopup(barcode) {
|
||||
this.pendingBarcode = String(barcode || '').trim();
|
||||
@ -250,12 +265,13 @@ export default {
|
||||
}
|
||||
uni.showModal({
|
||||
title: '标记空库位',
|
||||
content: `确认库位「${this.locationCode || this.detailId}」为空?该库位已有的商品记录会被清除。`,
|
||||
content: `确认库位「${this.locationName || this.locationCode || this.detailId}」为空?该库位已有的商品记录会被清除。`,
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
success: async (res) => {
|
||||
if (!res.confirm) return;
|
||||
await this.submitReport({ isEmpty: true }, '已标记空库位');
|
||||
const ok = await this.submitReport({ isEmpty: true, detailId: this.detailId }, '已标记空库位');
|
||||
this.speakMessage(ok ? '已标记空库位' : '标记失败', { force: true, minInterval: 0 });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user