|
|
|
@ -11,19 +11,9 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 执法记录列表 --> |
|
|
|
<van-list |
|
|
|
v-model:loading="loading" |
|
|
|
:finished="!hasMore" |
|
|
|
finished-text="已加载全部数据" |
|
|
|
@load="onLoad" |
|
|
|
class="record-list" |
|
|
|
> |
|
|
|
<template v-if="cityRecords.length === 0"> |
|
|
|
<!-- <div class="empty-state"> |
|
|
|
<van-icon name="file-o" class="empty-icon" /> |
|
|
|
<div class="empty-text">暂无数据</div> |
|
|
|
</div> --> |
|
|
|
</template> |
|
|
|
<div class="record-list"> |
|
|
|
<van-loading v-if="loading" class="loading-state" type="spinner">加载中...</van-loading> |
|
|
|
<template v-else> |
|
|
|
<div v-for="(item, index) in cityRecords" :key="index" class="record-card-item"> |
|
|
|
<div class="record-header"> |
|
|
|
<div class="record-date">{{ item.createTime }}</div> |
|
|
|
@ -45,7 +35,8 @@ |
|
|
|
<van-icon :name="isRecordExpanded ? 'arrow-up' : 'arrow-down'" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</van-list> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -68,38 +59,22 @@ defineEmits(['toggle-expand']); |
|
|
|
|
|
|
|
// ========== 数据 ========== |
|
|
|
const recordTab = ref(0); |
|
|
|
|
|
|
|
// 历史执法案件数据 |
|
|
|
const cityRecords = ref([]); |
|
|
|
|
|
|
|
// 分页相关 |
|
|
|
const pageNum = ref(1); |
|
|
|
const pageSize = ref(10); |
|
|
|
const hasMore = ref(true); |
|
|
|
const loading = ref(false); |
|
|
|
|
|
|
|
// ========== 获取执法记录数据 ========== |
|
|
|
const fetchEnfRegistrationList = (isLoadMore = false) => { |
|
|
|
const fetchEnfRegistrationList = () => { |
|
|
|
loading.value = true; |
|
|
|
const params = { |
|
|
|
pageSize: pageSize.value, |
|
|
|
pageNum: isLoadMore ? pageNum.value : 1, |
|
|
|
warnType: recordTab.value === 0 ? 1 : 0 // 0=本单位,1=全市 |
|
|
|
warnType: recordTab.value === 0 ? 1 : 0, |
|
|
|
// pageSize: 20, |
|
|
|
// pageNum: 1, |
|
|
|
}; |
|
|
|
queryEnfRegistrationList(params, (res) => { |
|
|
|
loading.value = false; |
|
|
|
if (res.code === 200) { |
|
|
|
const data = res.data.list || []; |
|
|
|
if (isLoadMore) { |
|
|
|
cityRecords.value = [...cityRecords.value, ...data]; |
|
|
|
} else { |
|
|
|
cityRecords.value = data; |
|
|
|
pageNum.value = 1; |
|
|
|
} |
|
|
|
// 判断是否还有更多数据 |
|
|
|
hasMore.value = data.length >= pageSize.value; |
|
|
|
if (hasMore.value) { |
|
|
|
pageNum.value++; |
|
|
|
} |
|
|
|
const data = res.data || []; |
|
|
|
cityRecords.value = data.filter(item => item !== null && item !== undefined); |
|
|
|
} else { |
|
|
|
console.error('获取执法记录失败:', res.msg); |
|
|
|
} |
|
|
|
@ -109,25 +84,10 @@ const fetchEnfRegistrationList = (isLoadMore = false) => { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
// ========== 列表加载处理 ========== |
|
|
|
const onLoad = () => { |
|
|
|
if (loading.value || !hasMore.value) return; |
|
|
|
fetchEnfRegistrationList(true); |
|
|
|
}; |
|
|
|
|
|
|
|
// ========== 重置分页 ========== |
|
|
|
const resetPagination = () => { |
|
|
|
pageNum.value = 1; |
|
|
|
hasMore.value = true; |
|
|
|
loading.value = false; |
|
|
|
cityRecords.value = []; |
|
|
|
}; |
|
|
|
|
|
|
|
// ========== 切换执法记录 Tab ========== |
|
|
|
const handleRecordTabChange = (tabIndex) => { |
|
|
|
recordTab.value = tabIndex; |
|
|
|
resetPagination(); |
|
|
|
loading.value = true; |
|
|
|
cityRecords.value = []; |
|
|
|
fetchEnfRegistrationList(); |
|
|
|
}; |
|
|
|
|
|
|
|
@ -272,6 +232,13 @@ fetchEnfRegistrationList(); |
|
|
|
font-size: 0.4rem; |
|
|
|
} |
|
|
|
|
|
|
|
.loading-state { |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
padding: 2rem 0; |
|
|
|
} |
|
|
|
|
|
|
|
.record-list { |
|
|
|
height: calc(100vh - 150px); |
|
|
|
} |
|
|
|
|