2025-07-28 17:52:29 +08:00
|
|
|
|
<template>
|
2025-07-28 18:52:32 +08:00
|
|
|
|
<view class="page">
|
2025-08-29 18:01:28 +08:00
|
|
|
|
<custom-navbar ref="customNavbar" 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-27 17:33:10 +08:00
|
|
|
|
<status-display v-if="loading" loading-text="加载中..." type="loading" />
|
2025-08-14 11:22:53 +08:00
|
|
|
|
<status-display
|
|
|
|
|
|
v-else-if="institutionalData.length === 0"
|
2025-07-31 15:29:40 +08:00
|
|
|
|
empty-text="暂无数据"
|
2025-08-27 17:33:10 +08:00
|
|
|
|
type="empty"
|
2025-07-31 15:29:40 +08:00
|
|
|
|
/>
|
2025-07-29 11:07:32 +08:00
|
|
|
|
<!-- 数据列表 -->
|
2025-08-14 11:22:53 +08:00
|
|
|
|
<institutional-item
|
|
|
|
|
|
v-for="(item, index) in institutionalData"
|
2025-08-27 17:33:10 +08:00
|
|
|
|
v-else
|
2025-07-31 15:06:10 +08:00
|
|
|
|
:key="index"
|
|
|
|
|
|
:index="index"
|
2025-08-27 17:33:10 +08:00
|
|
|
|
:item="item"
|
2025-07-31 15:06:10 +08:00
|
|
|
|
@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-27 17:33:10 +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-27 17:33:10 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
mixins: [dataManagerMixin],
|
|
|
|
|
|
components: {
|
|
|
|
|
|
CustomNavbar,
|
|
|
|
|
|
TileGrid,
|
|
|
|
|
|
InstitutionalItem,
|
|
|
|
|
|
StatusDisplay,
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
CommonEnum,
|
|
|
|
|
|
bgc: {
|
|
|
|
|
|
backgroundColor: CommonEnum.BASE_COLOR,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 动态数据数组
|
|
|
|
|
|
institutionalData: [],
|
|
|
|
|
|
pageStatus: "",
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
2025-08-27 18:01:35 +08:00
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
if (options) {
|
|
|
|
|
|
console.log("接收到的参数:", options.pageStatus);
|
|
|
|
|
|
this.pageStatus = options.pageStatus;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 17:33:10 +08:00
|
|
|
|
// 页面加载时获取数据
|
|
|
|
|
|
this.getInstitutionalData();
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
// 获取建制数据
|
|
|
|
|
|
async getInstitutionalData() {
|
2025-08-28 16:12:43 +08:00
|
|
|
|
let res = {};
|
|
|
|
|
|
if (this.pageStatus) {
|
|
|
|
|
|
res = await getInstitutionalList({ states: this.pageStatus });
|
|
|
|
|
|
} else {
|
|
|
|
|
|
res = await getInstitutionalList();
|
|
|
|
|
|
}
|
2025-08-27 17:33:10 +08:00
|
|
|
|
const rawData = res.rows;
|
2025-08-28 16:12:43 +08:00
|
|
|
|
console.log(rawData);
|
2025-08-27 17:33:10 +08:00
|
|
|
|
this.institutionalData =
|
|
|
|
|
|
InstitutionalDataFormatter.transformData(rawData);
|
2025-08-28 17:11:46 +08:00
|
|
|
|
console.log("更新的数据", this.institutionalData);
|
2025-08-27 17:33:10 +08:00
|
|
|
|
try {
|
|
|
|
|
|
console.log("建制数据已更新, 数量:", this.institutionalData.length);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error("获取建制数据失败:", error);
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: "获取数据失败",
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
});
|
2025-08-02 10:35:11 +08:00
|
|
|
|
}
|
2025-07-29 11:07:32 +08:00
|
|
|
|
},
|
2025-08-14 11:22:53 +08:00
|
|
|
|
|
2025-08-27 17:33:10 +08:00
|
|
|
|
// 处理查看详细
|
|
|
|
|
|
handleViewDetail(data) {
|
|
|
|
|
|
console.log("查看详细:", data.item);
|
2025-08-28 17:11:46 +08:00
|
|
|
|
if (data.item.topRight === "进行中") {
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/future/future?formedId=${data.item.formedId}`,
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
console.error("跳转失败:", err);
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: "页面跳转失败",
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 跳转到捐款记录页面,传递建制ID
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/institutionalStructure/donationRecord?formedId=${data.item.formedId}`,
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
console.error("跳转失败:", err);
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: "页面跳转失败",
|
|
|
|
|
|
icon: "none",
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-08-14 11:22:53 +08:00
|
|
|
|
},
|
2025-08-27 17:33:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
};
|
2025-07-28 17:52:29 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-07-28 18:52:32 +08:00
|
|
|
|
<style lang="scss">
|
2025-08-27 17:33:10 +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;
|
|
|
|
|
|
}
|
2025-08-14 11:22:53 +08:00
|
|
|
|
</style>
|