refactor(inventoryCount): 优化盘点列表与详情逻辑
- 盘点列表从详情页返回时自动刷新,保证状态与详情操作一致 - 默认列表仅展示 approved/checking/completed/cancelled 四种状态,过滤 created/submitted/rejected - 详情页移除提交审核入口(删除按钮、canSubmit 计算属性及 handleSubmitAudit 方法) - 盘点数量字段兼容 checked_quantity,回退 check_quantity(涉及列表行解析与回填两处)
This commit is contained in:
parent
d518be2c36
commit
ee497b1700
@ -124,7 +124,8 @@ export default {
|
|||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
paginationTotal: 0,
|
paginationTotal: 0,
|
||||||
recordList: [],
|
recordList: [],
|
||||||
loading: false
|
loading: false,
|
||||||
|
_listLoaded: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options = {}) {
|
onLoad(options = {}) {
|
||||||
@ -143,6 +144,11 @@ export default {
|
|||||||
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult });
|
||||||
this.safeDispatchBroadcast('resume');
|
this.safeDispatchBroadcast('resume');
|
||||||
this.scheduleBroadcastSelfHeal();
|
this.scheduleBroadcastSelfHeal();
|
||||||
|
// 从详情页返回时刷新列表,保证状态与详情页操作一致
|
||||||
|
if (this._listLoaded) {
|
||||||
|
this.loadRecordList(this.currentPage);
|
||||||
|
}
|
||||||
|
this._listLoaded = true;
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.safeDispatchBroadcast('pause');
|
this.safeDispatchBroadcast('pause');
|
||||||
@ -248,6 +254,9 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.statusFilter) {
|
if (this.statusFilter) {
|
||||||
where.status = this.statusFilter;
|
where.status = this.statusFilter;
|
||||||
|
} else {
|
||||||
|
// 列表仅展示以下四种状态,过滤掉 created/submitted/rejected
|
||||||
|
where.status = ['approved', 'checking', 'completed', 'cancelled'];
|
||||||
}
|
}
|
||||||
if (Object.keys(where).length) {
|
if (Object.keys(where).length) {
|
||||||
params.where = where;
|
params.where = where;
|
||||||
|
|||||||
@ -116,9 +116,6 @@
|
|||||||
|
|
||||||
<!-- 底部操作 -->
|
<!-- 底部操作 -->
|
||||||
<view class="footer-bar">
|
<view class="footer-bar">
|
||||||
<view v-if="canSubmit" class="footer-bar__btn footer-bar__btn--secondary" @click="handleSubmitAudit">
|
|
||||||
<text class="footer-bar__btn-text">提交审核</text>
|
|
||||||
</view>
|
|
||||||
<view v-if="canCancel" class="footer-bar__btn footer-bar__btn--secondary" @click="handleCancel">
|
<view v-if="canCancel" class="footer-bar__btn footer-bar__btn--secondary" @click="handleCancel">
|
||||||
<text class="footer-bar__btn-text">取消任务</text>
|
<text class="footer-bar__btn-text">取消任务</text>
|
||||||
</view>
|
</view>
|
||||||
@ -154,9 +151,6 @@ export default {
|
|||||||
canFinish() {
|
canFinish() {
|
||||||
return this.status === 'approved' || this.status === 'checking';
|
return this.status === 'approved' || this.status === 'checking';
|
||||||
},
|
},
|
||||||
canSubmit() {
|
|
||||||
return this.status === 'created' || this.status === 'rejected';
|
|
||||||
},
|
|
||||||
canCancel() {
|
canCancel() {
|
||||||
return this.status === 'created' || this.status === 'submitted' || this.status === 'rejected';
|
return this.status === 'created' || this.status === 'submitted' || this.status === 'rejected';
|
||||||
}
|
}
|
||||||
@ -413,7 +407,7 @@ export default {
|
|||||||
const batchNo = this.firstValue(source, ['batch_no', 'batchNo', 'batch_number']);
|
const batchNo = this.firstValue(source, ['batch_no', 'batchNo', 'batch_number']);
|
||||||
const locationCode = this.firstValue(source, ['location_code', 'locationCode', 'space_code', 'spaceCode']);
|
const locationCode = this.firstValue(source, ['location_code', 'locationCode', 'space_code', 'spaceCode']);
|
||||||
const systemRaw = this.firstValue(source, ['system_quantity', 'systemQuantity', 'book_quantity', 'stock_quantity', 'quantity']);
|
const systemRaw = this.firstValue(source, ['system_quantity', 'systemQuantity', 'book_quantity', 'stock_quantity', 'quantity']);
|
||||||
const checkRaw = this.firstValue(source, ['check_quantity', 'checkQuantity']);
|
const checkRaw = this.firstValue(source, ['checked_quantity', 'checkedQuantity', 'check_quantity', 'checkQuantity']);
|
||||||
const diffRaw = this.firstValue(source, ['diff_quantity', 'diffQuantity']);
|
const diffRaw = this.firstValue(source, ['diff_quantity', 'diffQuantity']);
|
||||||
const detailId = this.firstValue(source, ['id', 'detail_id', 'detailId']) || `${index + 1}`;
|
const detailId = this.firstValue(source, ['id', 'detail_id', 'detailId']) || `${index + 1}`;
|
||||||
const systemNumber = systemRaw === '' ? null : Number(systemRaw);
|
const systemNumber = systemRaw === '' ? null : Number(systemRaw);
|
||||||
@ -511,8 +505,10 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const detail = (response && typeof response === 'object') ? (response.detail || {}) : {};
|
const detail = (response && typeof response === 'object') ? (response.detail || {}) : {};
|
||||||
const checkQty = detail.check_quantity !== undefined && detail.check_quantity !== null
|
const checkQtyRaw = detail.checked_quantity !== undefined && detail.checked_quantity !== null
|
||||||
? Number(detail.check_quantity) : quantity;
|
? detail.checked_quantity : detail.check_quantity;
|
||||||
|
const checkQty = checkQtyRaw !== undefined && checkQtyRaw !== null
|
||||||
|
? Number(checkQtyRaw) : quantity;
|
||||||
item.checkQuantity = checkQty;
|
item.checkQuantity = checkQty;
|
||||||
item.inputValue = String(checkQty);
|
item.inputValue = String(checkQty);
|
||||||
item.diffQuantity = detail.diff_quantity !== undefined && detail.diff_quantity !== null
|
item.diffQuantity = detail.diff_quantity !== undefined && detail.diff_quantity !== null
|
||||||
@ -587,19 +583,6 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSubmitAudit() {
|
|
||||||
if (this.submitting || !this.taskId) return;
|
|
||||||
uni.showModal({
|
|
||||||
title: '提交审核',
|
|
||||||
content: '确认提交该盘点任务进入审核?',
|
|
||||||
confirmText: '提交',
|
|
||||||
cancelText: '取消',
|
|
||||||
success: async (res) => {
|
|
||||||
if (!res.confirm) return;
|
|
||||||
await this.doStatusAction('check.submit', '已提交审核');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
if (this.submitting || !this.taskId) return;
|
if (this.submitting || !this.taskId) return;
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user