<template>
	<view>
		<text class="u-demo-block__title" style="display: flex; align-items: center; justify-content: center; font-size: 20px; margin-top: 10px; font-weight: bold;">
			各村垃圾清运汇总统计表
		</text>
		<u-divider
				text=""
				textColor="#2979ff"
				lineColor="#2979ff"
		></u-divider>

		<u-list
				@scrolltolower="loadmore"
		>
			<u-list-item
					v-for="(item, index) in dataList"
					:key="index"
			>
				<u-cell  @click="detail(item.id)"
						:title="`${item.name}`"
						:value="`详情>`"
				>
				</u-cell>
			</u-list-item>
		</u-list>
	</view>
</template>

<script>
	import officeService from "@/api/sys/officeService";
	export default {
		data() {
			return {
				status: 'loadmore',
				searchForm: {
					title: ''
				},
				dataList: [],
				loading: false,
			}
		},created() {
			this.loadmore()
		},
		methods: {
			loadmore() {
				//联网加载数据
				this.status = 'loading';
				officeService.villageLevelList().then((data)=>{
					console.log('获取村级数据信息：',data)
					//追加新数据
					this.dataList=this.dataList.concat(data);
				})
			},
			detail(id){
				console.log('查看详情',id)
				uni.navigateTo({
					url: `/pages/edt/TabulateStatisticsDetail?id=${id}`,
					success: function(res) {
						// 跳转成功后的处理
						console.log('跳转成功');
					},
					fail: function(err) {
						// 跳转失败后的处理
						console.log('跳转失败', err);
					},
					complete: function() {
						// 无论跳转成功还是失败都会执行
						console.log('跳转完成');
					}
				})
			}
		}
	}
</script>