修改获取建制接口
This commit is contained in:
parent
a463bdde89
commit
8f1d5ff473
|
|
@ -1,5 +1,5 @@
|
|||
// 建制相关API
|
||||
import { get, post, put, del } from '@/utils/request'
|
||||
import { del, get, post, put } from "@/utils/request";
|
||||
|
||||
/**
|
||||
* 获取建制数据列表
|
||||
|
|
@ -14,11 +14,12 @@ export function getInstitutionalList(params = {}) {
|
|||
const defaultParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderByColumn: 'createTime',
|
||||
isAsc: 'descending',
|
||||
}
|
||||
orderByColumn: "createTime",
|
||||
isAsc: "descending",
|
||||
states: "",
|
||||
};
|
||||
|
||||
return get('/app/formed/listFormed', { ...defaultParams, ...params })
|
||||
return get("/app/formed/listFormed", { ...defaultParams, ...params });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -27,7 +28,7 @@ export function getInstitutionalList(params = {}) {
|
|||
* @returns {Promise} 返回建制详情
|
||||
*/
|
||||
export function getInstitutionalDetail(id) {
|
||||
return get(`/app/formed/getFormed/${id}`)
|
||||
return get(`/app/formed/getFormed/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +37,7 @@ export function getInstitutionalDetail(id) {
|
|||
* @returns {Promise} 返回创建结果
|
||||
*/
|
||||
export function createInstitutional(data) {
|
||||
return post('/app/formed/createFormed', data)
|
||||
return post("/app/formed/createFormed", data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +46,7 @@ export function createInstitutional(data) {
|
|||
* @returns {Promise} 返回更新结果
|
||||
*/
|
||||
export function updateInstitutional(data) {
|
||||
return put('/app/formed/updateFormed', data)
|
||||
return put("/app/formed/updateFormed", data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -54,5 +55,5 @@ export function updateInstitutional(data) {
|
|||
* @returns {Promise} 返回删除结果
|
||||
*/
|
||||
export function deleteInstitutional(id) {
|
||||
return del(`/app/formed/deleteFormed/${id}`)
|
||||
return del(`/app/formed/deleteFormed/${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,59 +2,60 @@
|
|||
<view class="page">
|
||||
<custom-navbar ref="customNavbar" title="基础页面" />
|
||||
<tile-grid />
|
||||
<view class="header" :style="{ backgroundColor: CommonEnum.BASE_COLOR }">
|
||||
<view :style="{ backgroundColor: CommonEnum.BASE_COLOR }" class="header">
|
||||
<!-- 状态展示 -->
|
||||
<status-display v-if="loading" type="loading" loading-text="加载中..." />
|
||||
<status-display v-if="loading" loading-text="加载中..." type="loading" />
|
||||
<!-- 页面内容将在这里添加 -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CommonEnum from '../../enum/common'
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
CommonEnum,
|
||||
loading: false,
|
||||
import CommonEnum from "../../enum/common";
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
CommonEnum,
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时获取数据
|
||||
this.loadPageData();
|
||||
},
|
||||
methods: {
|
||||
// 加载页面数据
|
||||
async loadPageData() {
|
||||
this.loading = true;
|
||||
try {
|
||||
// TODO: 调用页面数据API
|
||||
// const response = await getPageData()
|
||||
// 模拟加载
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
}, 1000);
|
||||
} catch (error) {
|
||||
console.error("获取页面数据失败:", error);
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时获取数据
|
||||
this.loadPageData()
|
||||
},
|
||||
methods: {
|
||||
// 加载页面数据
|
||||
async loadPageData() {
|
||||
this.loading = true
|
||||
try {
|
||||
// TODO: 调用页面数据API
|
||||
// const response = await getPageData()
|
||||
// 模拟加载
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 1000)
|
||||
} catch (error) {
|
||||
console.error('获取页面数据失败:', error)
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
background: #f5f0e7;
|
||||
}
|
||||
.header {
|
||||
width: 100%;
|
||||
//min-height: 100vh;//可能导致页面留白
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
padding: 0 15rpx;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
.page {
|
||||
background: #f5f0e7;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 100%;
|
||||
//min-height: 100vh;//可能导致页面留白
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
padding: 0 15rpx 40rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@
|
|||
<tile-grid />
|
||||
<view class="header">
|
||||
<!-- 状态展示 -->
|
||||
<status-display v-if="loading" type="loading" loading-text="加载中..." />
|
||||
<status-display v-if="loading" loading-text="加载中..." type="loading" />
|
||||
<status-display
|
||||
v-else-if="institutionalData.length === 0"
|
||||
type="empty"
|
||||
empty-text="暂无数据"
|
||||
type="empty"
|
||||
/>
|
||||
<!-- 数据列表 -->
|
||||
<institutional-item
|
||||
v-else
|
||||
v-for="(item, index) in institutionalData"
|
||||
v-else
|
||||
:key="index"
|
||||
:item="item"
|
||||
:index="index"
|
||||
:item="item"
|
||||
@view-detail="handleViewDetail"
|
||||
/>
|
||||
</view>
|
||||
|
|
@ -24,104 +24,88 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
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'
|
||||
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";
|
||||
|
||||
export default {
|
||||
mixins: [dataManagerMixin],
|
||||
components: {
|
||||
CustomNavbar,
|
||||
TileGrid,
|
||||
InstitutionalItem,
|
||||
StatusDisplay,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
CommonEnum,
|
||||
bgc: {
|
||||
backgroundColor: CommonEnum.BASE_COLOR,
|
||||
},
|
||||
// 动态数据数组
|
||||
institutionalData: [],
|
||||
export default {
|
||||
mixins: [dataManagerMixin],
|
||||
components: {
|
||||
CustomNavbar,
|
||||
TileGrid,
|
||||
InstitutionalItem,
|
||||
StatusDisplay,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
CommonEnum,
|
||||
bgc: {
|
||||
backgroundColor: CommonEnum.BASE_COLOR,
|
||||
},
|
||||
// 动态数据数组
|
||||
institutionalData: [],
|
||||
pageStatus: "",
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时获取数据
|
||||
this.getInstitutionalData();
|
||||
},
|
||||
methods: {
|
||||
// 获取建制数据
|
||||
async getInstitutionalData() {
|
||||
const res = await getInstitutionalList(this.pageStatus);
|
||||
const rawData = res.rows;
|
||||
this.institutionalData =
|
||||
InstitutionalDataFormatter.transformData(rawData);
|
||||
try {
|
||||
console.log("建制数据已更新, 数量:", this.institutionalData.length);
|
||||
} catch (error) {
|
||||
console.error("获取建制数据失败:", error);
|
||||
uni.showToast({
|
||||
title: "获取数据失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
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)
|
||||
// 处理查看详细
|
||||
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',
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
// 处理查看详细
|
||||
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',
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
title: "页面跳转失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
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;
|
||||
}
|
||||
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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user