Commit 1dd0c2c1 by qinjianhui

fix: 称重分拣bug修改

parent 24f36f38
......@@ -369,13 +369,16 @@ const weightGet = async () => {
}
const open = () => {
isweight.value = true
weight.stashToCache()
tableData.value = []
const rows = [...weight.cachedList]
weight.restoreFromCache(rows)
tableData.value = rows
isweight.value = true
selectType.value = 'trackingNumber'
logisticsCompanyCode.value = ''
weightText.value = ''
getlogisticsCompanyAllCodelist()
nextTick(() => weighInput.value?.focus())
}
const deleteFn = (row: IpodCnWeighingParams) => {
......
......@@ -111,15 +111,41 @@ class Weigh extends Lock {
stashToCache(): void {
if (this.list.length) {
this.cachedList = [...this.list]
const merged = [...this.cachedList]
for (const item of this.list) {
const idx = merged.findIndex(
(m) => m.id && item.id && m.id === item.id,
)
if (idx >= 0) {
merged[idx] = item
} else {
merged.unshift(item)
}
}
this.cachedList = merged
}
this.list = []
this.weightInput = true
}
restoreFromCache(rows: WeighItem[]): void {
this.list = [...rows]
this.weightInput = !this.hasPendingWeights()
}
syncCachedList(rows: WeighItem[]): void {
this.cachedList = [...rows]
}
removeFromCache(id?: string): void {
if (!id) return
this.cachedList = this.cachedList.filter((el) => el.id !== id)
}
updatedList(data: WeighItem[]) {
this.weightInput = true
this.list = [...data]
this.syncCachedList(data)
this.weightInput = !this.hasPendingWeights()
}
private deduplicate(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment