This commit is contained in:
parent
529f04c591
commit
b65ef8e119
|
|
@ -117,7 +117,8 @@
|
||||||
const getTableList = () => {
|
const getTableList = () => {
|
||||||
const res = getListDetails(queryParams.value).then(res => {
|
const res = getListDetails(queryParams.value).then(res => {
|
||||||
total.value = res.data.total
|
total.value = res.data.total
|
||||||
tableList.value.push(...res.data.rows)
|
// tableList.value.push(...res.data.rows)
|
||||||
|
tableList.value = res.data.rows
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@
|
||||||
if (isTap) {
|
if (isTap) {
|
||||||
tableList.value = res.data.rows
|
tableList.value = res.data.rows
|
||||||
} else {
|
} else {
|
||||||
tableList.value.push(...res.data.rows)
|
tableList.value = res.data.rows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,18 @@ const getTableList = async (isTap = false) => {
|
||||||
if (res.data.rows.length == 0) {
|
if (res.data.rows.length == 0) {
|
||||||
tableList.value = []
|
tableList.value = []
|
||||||
} else {
|
} else {
|
||||||
tableList.value.push(...res.data.rows)
|
const merged = [...tableList.value, ...res.data.rows]
|
||||||
|
// 根据 id 去重(保留前面的)
|
||||||
|
const unique = []
|
||||||
|
const seen = new Set()
|
||||||
|
for (const item of merged) {
|
||||||
|
if (!seen.has(item.taskId)) {
|
||||||
|
seen.add(item.taskId)
|
||||||
|
unique.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('🚀 ~ getTableList ~ unique:', unique)
|
||||||
|
tableList.value = unique
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@
|
||||||
const getTableList = () => {
|
const getTableList = () => {
|
||||||
const res = getListDetails(queryParams.value).then(res => {
|
const res = getListDetails(queryParams.value).then(res => {
|
||||||
total.value = res.data.total
|
total.value = res.data.total
|
||||||
tableList.value.push(...res.data.rows)
|
tableList.value = res.data.rows
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,18 @@
|
||||||
if (isTap) {
|
if (isTap) {
|
||||||
tableList.value = res.data.rows
|
tableList.value = res.data.rows
|
||||||
} else {
|
} else {
|
||||||
tableList.value.push(...res.data.rows)
|
const merged = [...tableList.value, ...res.data.rows]
|
||||||
|
// 根据 id 去重(保留前面的)
|
||||||
|
const unique = []
|
||||||
|
const seen = new Set()
|
||||||
|
for (const item of merged) {
|
||||||
|
if (!seen.has(item.taskId)) {
|
||||||
|
seen.add(item.taskId)
|
||||||
|
unique.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('🚀 ~ getTableList ~ unique:', unique)
|
||||||
|
tableList.value = unique
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('🚀 ~ getTableList ~ error:', error)
|
console.log('🚀 ~ getTableList ~ error:', error)
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,18 @@ const getTableList = async (isTap = false) => {
|
||||||
if (res.data.rows.length == 0) {
|
if (res.data.rows.length == 0) {
|
||||||
tableList.value = []
|
tableList.value = []
|
||||||
} else {
|
} else {
|
||||||
tableList.value.push(...res.data.rows)
|
const merged = [...tableList.value, ...res.data.rows]
|
||||||
|
// 根据 id 去重(保留前面的)
|
||||||
|
const unique = []
|
||||||
|
const seen = new Set()
|
||||||
|
for (const item of merged) {
|
||||||
|
if (!seen.has(item.taskId)) {
|
||||||
|
seen.add(item.taskId)
|
||||||
|
unique.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('🚀 ~ getTableList ~ unique:', unique)
|
||||||
|
tableList.value = unique
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue