Browse Source

页面数据修改

dev-V1.0.1
wangmingyong 5 months ago
parent
commit
73242646ff
  1. 109
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/components/EnforcementRecordList.vue
  2. 8
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/components/HistoryActivityList.vue

109
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/components/EnforcementRecordList.vue

@ -11,41 +11,32 @@
</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 v-for="(item, index) in cityRecords" :key="index" class="record-card-item">
<div class="record-header">
<div class="record-date">{{ item.createTime }}</div>
<div class="record-company">{{ enterpriseName }}</div>
<div class="record-count">{{ item.caseType || '执法检查' }}</div>
</div>
<div class="record-timeline" v-if="isRecordExpanded">
<div class="timeline-item">
<div class="timeline-dot"></div>
<div class="timeline-content">
<div class="timeline-time">{{ item.createTime }}</div>
<div class="timeline-unit"><span class="unit-label">执法单位:</span>{{
item.enforcementUnit ||
item.unitName }}</div>
<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>
<div class="record-company">{{ enterpriseName }}</div>
<div class="record-count">{{ item.caseType || '执法检查' }}</div>
</div>
<div class="record-timeline" v-if="isRecordExpanded">
<div class="timeline-item">
<div class="timeline-dot"></div>
<div class="timeline-content">
<div class="timeline-time">{{ item.createTime }}</div>
<div class="timeline-unit"><span class="unit-label">执法单位:</span>{{
item.enforcementUnit ||
item.unitName }}</div>
</div>
</div>
</div>
<div class="record-expand" @click="$emit('toggle-expand')">
<van-icon :name="isRecordExpanded ? 'arrow-up' : 'arrow-down'" />
</div>
</div>
<div class="record-expand" @click="$emit('toggle-expand')">
<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);
}

8
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/components/HistoryActivityList.vue

@ -107,6 +107,14 @@ const fetchActivityList = (isLoadMore = false) => {
if (dateSearch.value) {
params.dateSearch = dateSearch.value;
}
// 日期类型:month=1, quarter=2, year=3
if (dateSearch.value === 'month') {
params.dateType = 1;
} else if (dateSearch.value === 'quarter') {
params.dateType = 2;
} else if (dateSearch.value === 'year') {
params.dateType = 3;
}
queryNonRegistrationList(params, (res) => {
loading.value = false;

Loading…
Cancel
Save