<template>
	<view>
		<view v-if="list.length>0">
			<view  class="top-box" v-for="(item,index) in list" :key="index" @click="gopath('/pages/declaration/declarationListdetail?type= '+type+'&cent='+JSON.stringify(item))">
				<view>{{item.name}}<span style="margin-left: 20rpx;"  :style="item.status=='已通过'?'color: #00D970;':item.status=='未通过'?'color: #FC4444;':'color: #547DFF;'">{{item.status?item.status:'待审核'}}</span></view>
				<view class="top-box-img">
					<image src="../../static/right2.png" mode="widthFix"></image>
				</view>
			</view>
		</view>
		<view v-else style="width: 100%;text-align: center;margin-top: 100rpx;font-size: 30rpx;">
			暂无数据
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:null,
				list:[],
				from:{
					createdUser:uni.getStorageSync('USERS_KEY').userId,
				}
			}
		},
		onLoad() {
			
		},
		onLoad(params) {
			this.type = params.type

			this.getlist()
		
		},
		methods: {
			getlist() {
				if(this.type == '1') {
					this.API.getCommunity(this.from).then(res=>{
						console.log(res);
						for (let i = 0; i < res.rows.length; i++) {
							res.rows[i].name = res.rows[i].communityName
						}
						this.list = res.rows
					})
				} else if(this.type == '2') {
					this.API.getstreet(this.from).then(res=>{
						console.log(res);
						for (let i = 0; i < res.rows.length; i++) {
							res.rows[i].name = res.rows[i].originalName
						}
						this.list = res.rows
					})
				}else if(this.type == '3') {
					this.API.getbuild(this.from).then(res=>{
						console.log(res);
						for (let i = 0; i < res.rows.length; i++) {
							res.rows[i].name = res.rows[i].tallBuildName
						}
						this.list = res.rows
					})
				}else if(this.type == '4') {
					this.API.getapplication(this.from).then(res=>{
						console.log(res);
						for (let i = 0; i < res.rows.length; i++) {
							res.rows[i].name = res.rows[i].addressName
							res.rows[i].status = res.rows[i].auditStatus
						}
						this.list = res.rows
					})
				}else if(this.type == '5') {
					this.API.getdoorplate(this.from).then(res=>{
						console.log(res);
						for (let i = 0; i < res.rows.length; i++) {
							res.rows[i].name = res.rows[i].communityName
						}
						this.list = res.rows
					})
				}else if(this.type == '6') {
					this.API.getroadSign(this.from).then(res=>{
						console.log(res);
						this.list = res.rows
					})
				}

			},
			gopath(e) {
				uni.navigateTo({
					url: e
				})
			},
		}
	}
</script>

<style lang="scss">
	.top-box {
		display: flex;
		justify-content: space-between;
		margin: 30rpx;
		font-size: 28rpx;
		font-weight: bold;
		background-color: #fff;
		border-radius: 21rpx;
		padding: 30rpx;
	
		.top-box-img {
			image {
				width: 30rpx;
				// height: 40rpx;
			}
		}
	}
	.content{
		padding: 20rpx;
		.box_item{
			background-color: #fff;
			display: flex;
			padding: 20rpx 40rpx;
			border-radius: 20rpx;
			align-items: center;
			.box_left{
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				width: 58%;
				margin-right: 2%;
				.f1{
					font-size: 35rpx;
					font-weight: 600;
					display: block;
					margin-bottom: 20rpx;
				}
				.f2{
					color: #ababab;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;
					overflow: hidden;
				}
			}
			.box_right{
				width: 40%;
				text-align: right;
			}
		}
	}
</style>
