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-14 11:22:53 +08:00
|
|
|
|
<tile-grid />
|
2025-07-30 16:14:56 +08:00
|
|
|
|
<view class="header">
|
2025-07-31 15:29:40 +08:00
|
|
|
|
<!-- 状态展示 -->
|
2025-08-14 11:22:53 +08:00
|
|
|
|
<status-display v-if="loading" type="loading" loading-text="加载中..." />
|
|
|
|
|
|
<status-display
|
|
|
|
|
|
v-else-if="institutionalData.length === 0"
|
|
|
|
|
|
type="empty"
|
2025-07-31 15:29:40 +08:00
|
|
|
|
empty-text="暂无数据"
|
|
|
|
|
|
/>
|
2025-07-29 11:07:32 +08:00
|
|
|
|
<!-- 数据列表 -->
|
2025-08-14 11:22:53 +08:00
|
|
|
|
<institutional-item
|
|
|
|
|
|
v-else
|
|
|
|
|
|
v-for="(item, index) in institutionalData"
|
2025-07-31 15:06:10 +08:00
|
|
|
|
:key="index"
|
|
|
|
|
|
:item="item"
|
|
|
|
|
|
:index="index"
|
|
|
|
|
|
@view-detail="handleViewDetail"
|
|
|
|
|
|
/>
|
2025-07-29 08:52:55 +08:00
|
|
|
|
</view>
|
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-14 11:22:53 +08:00
|
|
|
|
import { getInstitutionalList } from '@/api/institutionalStructure/institutionalStructure.js'
|
|
|
|
|
|
import CustomNavbar from '../../components/custom-navbar/custom-navbar.vue'
|
|
|
|
|
|
import TileGrid from '../../components/tile-grid/tile-grid.vue'
|
|
|
|
|
|
import InstitutionalItem from './components/institutional-item.vue'
|
|
|
|
|
|
import StatusDisplay from '../../components/status-display/status-display.vue'
|
|
|
|
|
|
import { InstitutionalDataFormatter } from './utils/data-formatter.js'
|
|
|
|
|
|
import { dataManagerMixin } from './mixins/data-manager.js'
|
|
|
|
|
|
import CommonEnum from '../../enum/common'
|
2025-07-29 09:53:04 +08:00
|
|
|
|
|
2025-08-14 11:22:53 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
mixins: [dataManagerMixin],
|
|
|
|
|
|
components: {
|
|
|
|
|
|
CustomNavbar,
|
|
|
|
|
|
TileGrid,
|
|
|
|
|
|
InstitutionalItem,
|
|
|
|
|
|
StatusDisplay,
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
CommonEnum,
|
|
|
|
|
|
bgc: {
|
|
|
|
|
|
backgroundColor: CommonEnum.BASE_COLOR,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 动态数据数组
|
|
|
|
|
|
institutionalData: [],
|
2025-08-02 10:35:11 +08:00
|
|
|
|
}
|
2025-07-29 11:07:32 +08:00
|
|
|
|
},
|
2025-08-14 11:22:53 +08:00
|
|
|
|
onLoad() {
|
|
|
|
|
|
// 页面加载时获取数据
|
|
|
|
|
|
this.getInstitutionalData()
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
// 获取建制数据
|
|
|
|
|
|
async getInstitutionalData(isLoadMore = false) {
|
|
|
|
|
|
console.log('开始获取建制数据, isLoadMore:', isLoadMore)
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (isLoadMore) {
|
|
|
|
|
|
await this.loadMoreData({
|
|
|
|
|
|
apiCall: getInstitutionalList,
|
|
|
|
|
|
dataTransformer: InstitutionalDataFormatter.transformData,
|
|
|
|
|
|
onSuccess: (data, response) => {
|
|
|
|
|
|
console.log('建制数据加载更多成功:', data.length, '条')
|
|
|
|
|
|
this.institutionalData = this.dataList
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
await this.refreshData({
|
|
|
|
|
|
apiCall: getInstitutionalList,
|
|
|
|
|
|
dataTransformer: InstitutionalDataFormatter.transformData,
|
|
|
|
|
|
onSuccess: (data, response) => {
|
|
|
|
|
|
console.log('建制数据刷新成功:', data.length, '条')
|
|
|
|
|
|
this.institutionalData = this.dataList
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log('建制数据已更新, 数量:', this.institutionalData.length)
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取建制数据失败:', error)
|
2025-08-01 11:54:29 +08:00
|
|
|
|
uni.showToast({
|
2025-08-14 11:22:53 +08:00
|
|
|
|
title: '获取数据失败',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
2025-08-01 11:54:29 +08:00
|
|
|
|
}
|
2025-08-14 11:22:53 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 处理查看详细
|
|
|
|
|
|
handleViewDetail(data) {
|
|
|
|
|
|
console.log('查看详细:', data.item)
|
|
|
|
|
|
// 跳转到捐款记录页面,传递建制ID
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/institutionalStructure/donationRecord?formedId=${data.item.formedId}`,
|
|
|
|
|
|
fail: err => {
|
|
|
|
|
|
console.error('跳转失败:', err)
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '页面跳转失败',
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
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">
|
2025-08-14 11:22:53 +08:00
|
|
|
|
page {
|
|
|
|
|
|
background: #f5f0e7;
|
|
|
|
|
|
}
|
|
|
|
|
|
.header {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
background-color: #fffbf5;
|
|
|
|
|
|
padding: 0 15rpx;
|
|
|
|
|
|
padding-bottom: 40rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|