2025-07-28 17:52:29 +08:00
|
|
|
|
<template>
|
2025-07-28 18:52:32 +08:00
|
|
|
|
<view class="page">
|
2025-07-31 09:27:55 +08:00
|
|
|
|
<custom-navbar title="建制" />
|
2025-08-01 08:59:07 +08:00
|
|
|
|
<tile-grid/>
|
2025-07-30 16:14:56 +08:00
|
|
|
|
<view class="header">
|
2025-07-31 15:29:40 +08:00
|
|
|
|
<!-- 状态展示 -->
|
|
|
|
|
|
<status-display
|
|
|
|
|
|
v-if="loading"
|
|
|
|
|
|
type="loading"
|
|
|
|
|
|
loading-text="加载中..."
|
|
|
|
|
|
/>
|
|
|
|
|
|
<status-display
|
|
|
|
|
|
v-else-if="institutionalData.length === 0"
|
|
|
|
|
|
type="empty"
|
|
|
|
|
|
empty-text="暂无数据"
|
|
|
|
|
|
/>
|
2025-07-29 11:07:32 +08:00
|
|
|
|
<!-- 数据列表 -->
|
2025-07-31 15:06:10 +08:00
|
|
|
|
<institutional-item
|
|
|
|
|
|
v-else
|
|
|
|
|
|
v-for="(item, index) in institutionalData"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
:item="item"
|
|
|
|
|
|
:index="index"
|
|
|
|
|
|
@view-detail="handleViewDetail"
|
|
|
|
|
|
/>
|
2025-07-29 08:52:55 +08:00
|
|
|
|
</view>
|
2025-07-29 11:07:32 +08:00
|
|
|
|
|
2025-07-28 18:52:32 +08:00
|
|
|
|
</view>
|
2025-07-28 17:52:29 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
2025-07-28 18:52:32 +08:00
|
|
|
|
<script>
|
2025-08-01 08:59:07 +08:00
|
|
|
|
import { getInstitutionalList } from '@/api/institutionalStructure/institutionalStructure.js';
|
2025-07-31 09:27:55 +08:00
|
|
|
|
import CustomNavbar from "../../components/custom-navbar/custom-navbar.vue";
|
2025-07-31 14:28:29 +08:00
|
|
|
|
import TileGrid from "../../components/tile-grid/tile-grid.vue";
|
2025-07-31 15:06:10 +08:00
|
|
|
|
import InstitutionalItem from "./components/institutional-item.vue";
|
2025-07-31 16:36:14 +08:00
|
|
|
|
import StatusDisplay from "../../components/status-display/status-display.vue";
|
2025-07-31 15:29:40 +08:00
|
|
|
|
import { InstitutionalDataFormatter } from "./utils/data-formatter.js";
|
|
|
|
|
|
import { dataManagerMixin } from "./mixins/data-manager.js";
|
2025-07-31 11:34:40 +08:00
|
|
|
|
import CommonEnum from "../../enum/common";
|
2025-08-02 10:35:11 +08:00
|
|
|
|
import { PageLoadingManager } from "../../utils/request.js";
|
2025-07-29 09:53:04 +08:00
|
|
|
|
|
2025-07-28 18:52:32 +08:00
|
|
|
|
export default {
|
2025-07-31 15:29:40 +08:00
|
|
|
|
mixins: [dataManagerMixin],
|
2025-07-31 09:27:55 +08:00
|
|
|
|
components: {
|
2025-07-31 14:28:29 +08:00
|
|
|
|
CustomNavbar,
|
2025-07-31 15:06:10 +08:00
|
|
|
|
TileGrid,
|
2025-07-31 15:29:40 +08:00
|
|
|
|
InstitutionalItem,
|
|
|
|
|
|
StatusDisplay
|
2025-07-31 09:27:55 +08:00
|
|
|
|
},
|
2025-07-28 18:52:32 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-07-31 11:34:40 +08:00
|
|
|
|
CommonEnum,
|
2025-07-28 18:52:32 +08:00
|
|
|
|
bgc: {
|
2025-07-31 11:34:40 +08:00
|
|
|
|
backgroundColor: CommonEnum.BASE_COLOR,
|
2025-07-28 18:52:32 +08:00
|
|
|
|
},
|
2025-07-29 11:07:32 +08:00
|
|
|
|
// 动态数据数组
|
2025-07-31 15:29:40 +08:00
|
|
|
|
institutionalData: []
|
2025-07-28 18:52:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad() {
|
2025-08-02 10:35:11 +08:00
|
|
|
|
// 初始化页面loading管理器
|
|
|
|
|
|
this.pageLoading = new PageLoadingManager()
|
2025-07-29 11:07:32 +08:00
|
|
|
|
// 页面加载时获取数据
|
|
|
|
|
|
this.getInstitutionalData()
|
2025-07-28 18:52:32 +08:00
|
|
|
|
},
|
2025-08-02 10:35:11 +08:00
|
|
|
|
onUnload() {
|
|
|
|
|
|
// 页面卸载时清除loading
|
|
|
|
|
|
if (this.pageLoading) {
|
|
|
|
|
|
this.pageLoading.destroy()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-07-28 18:52:32 +08:00
|
|
|
|
methods: {
|
2025-07-29 11:07:32 +08:00
|
|
|
|
// 获取建制数据
|
|
|
|
|
|
async getInstitutionalData(isLoadMore = false) {
|
2025-08-02 10:35:11 +08:00
|
|
|
|
console.log('开始获取建制数据, isLoadMore:', isLoadMore)
|
|
|
|
|
|
|
|
|
|
|
|
// 显示页面loading
|
|
|
|
|
|
if (this.pageLoading && !isLoadMore) {
|
|
|
|
|
|
this.pageLoading.show('努力加载中~')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const result = await this.fetchData(
|
|
|
|
|
|
isLoadMore,
|
|
|
|
|
|
getInstitutionalList,
|
|
|
|
|
|
InstitutionalDataFormatter.transformData
|
|
|
|
|
|
)
|
|
|
|
|
|
console.log('建制数据获取成功:', result)
|
|
|
|
|
|
// 将数据赋值给 institutionalData
|
|
|
|
|
|
this.institutionalData = this.dataList
|
|
|
|
|
|
console.log('建制数据已更新, 数量:', this.institutionalData.length)
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取建制数据失败:', error)
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '获取数据失败',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
})
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
// 隐藏页面loading
|
|
|
|
|
|
if (this.pageLoading && !isLoadMore) {
|
|
|
|
|
|
this.pageLoading.hide()
|
|
|
|
|
|
console.log('页面loading已隐藏')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-29 11:07:32 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 刷新数据
|
|
|
|
|
|
refreshData() {
|
|
|
|
|
|
this.getInstitutionalData()
|
2025-07-31 15:06:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 处理查看详细
|
|
|
|
|
|
handleViewDetail(data) {
|
|
|
|
|
|
console.log('查看详细:', data.item)
|
2025-08-01 11:54:29 +08:00
|
|
|
|
// 跳转到捐款记录页面,传递建制ID
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/institutionalStructure/donationRecord?formedId=${data.item.formedId}`,
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
console.error('跳转失败:', err);
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '页面跳转失败',
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-07-31 15:06:10 +08:00
|
|
|
|
})
|
2025-07-29 11:07:32 +08:00
|
|
|
|
}
|
2025-07-28 18:52:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-28 17:52:29 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-07-28 18:52:32 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
page {
|
2025-07-31 14:35:08 +08:00
|
|
|
|
background: #F5F0E7;
|
2025-07-29 08:52:55 +08:00
|
|
|
|
}
|
2025-07-30 16:14:56 +08:00
|
|
|
|
.header {
|
2025-07-29 08:52:55 +08:00
|
|
|
|
width: 100%;
|
2025-07-29 11:07:32 +08:00
|
|
|
|
min-height: 100vh;
|
2025-07-29 08:52:55 +08:00
|
|
|
|
display: flex;
|
2025-07-29 09:53:04 +08:00
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
background-color: #FFFBF5;
|
2025-07-31 15:06:10 +08:00
|
|
|
|
padding: 0 15rpx;
|
2025-07-29 11:07:32 +08:00
|
|
|
|
padding-bottom: 40rpx;
|
2025-07-29 09:53:04 +08:00
|
|
|
|
}
|
2025-07-28 18:52:32 +08:00
|
|
|
|
</style>
|