列表去重
This commit is contained in:
parent
0f4caa4cdd
commit
b2f0a0cfef
|
|
@ -192,7 +192,7 @@ const queryParams = ref({
|
||||||
appTaskStatus: 0,
|
appTaskStatus: 0,
|
||||||
isSign: 0, // 默认显示全部
|
isSign: 0, // 默认显示全部
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 5,
|
pageSize: 20,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 右滑按钮组-未完成
|
// 右滑按钮组-未完成
|
||||||
|
|
@ -333,7 +333,19 @@ 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)
|
// 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) {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,19 @@ const getTableList = async (isTap = false) => {
|
||||||
} else {
|
} else {
|
||||||
// 下拉加载时,追加数据
|
// 下拉加载时,追加数据
|
||||||
if (res.data.rows && res.data.rows.length > 0) {
|
if (res.data.rows && res.data.rows.length > 0) {
|
||||||
tableList.value = [...tableList.value, ...res.data.rows]
|
// tableList.value = [...tableList.value, ...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) {
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ const queryParams = ref({
|
||||||
keyWord: '', // 关键字
|
keyWord: '', // 关键字
|
||||||
statusList: [3], // 状态
|
statusList: [3], // 状态
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 20,
|
||||||
hasSign: 1,
|
hasSign: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -216,7 +216,19 @@ const getTableList = async (isTap = false, isSearch = false) => {
|
||||||
tableList.value = []
|
tableList.value = []
|
||||||
} else {
|
} else {
|
||||||
// tableList.value = res.data.rows
|
// tableList.value = res.data.rows
|
||||||
tableList.value = [...tableList.value, ...res.data.rows]
|
// tableList.value = [...tableList.value, ...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) {
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,19 @@ const getTableList = async (isTap = false, isSearch = false) => {
|
||||||
tableList.value = []
|
tableList.value = []
|
||||||
} else {
|
} else {
|
||||||
// tableList.value = res.data.rows
|
// tableList.value = res.data.rows
|
||||||
tableList.value = [...tableList.value, ...res.data.rows]
|
// tableList.value = [...tableList.value, ...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) {
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,19 @@ const getTableList = async (isTap = false,isSearch = false) => {
|
||||||
tableList.value = []
|
tableList.value = []
|
||||||
} else {
|
} else {
|
||||||
// tableList.value = res.data.rows
|
// tableList.value = res.data.rows
|
||||||
tableList.value = [...tableList.value, ...res.data.rows]
|
// tableList.value = [...tableList.value, ...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) {
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ const queryParams = ref({
|
||||||
endTime: dateArray.value[1] || '', // 结束时间
|
endTime: dateArray.value[1] || '', // 结束时间
|
||||||
keyWord: '', // 关键字
|
keyWord: '', // 关键字
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 5,
|
pageSize: 20,
|
||||||
appTaskStatus: 0,
|
appTaskStatus: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -249,7 +249,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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue