<template>
	<view class="boxContent">

		<view class="box-header">
			
		</view>
		
		<view class="list" style="padding-top: 20rpx;">
			<block>
				<u-card :title="lists.created_at" padding="20" margin="20rpx" :border="true">
					<view class="" slot="body" @click="todetail(lists.id)">
						<u-row gutter="16">
							<u-col span="4">
								<view class="demo-layout bg-purple">巡查项目：</view>
							</u-col>
							<u-col span="8">
								<view class="demo-layout bg-purple-light">{{lists.name}}</view>
							</u-col>
						</u-row>
						<u-row gutter="16">
							<u-col span="4">
								<view class="demo-layout bg-purple">项目状态：</view>
							</u-col>
							<u-col span="8">
								<u-tag v-if="lists.status==1" text="无异常" type="primary" />
								<u-tag v-if="lists.status==2" text="已现场处理" type="warning" />
								<u-tag v-if="lists.status==3" text="不可现场处理" type="error" />
							</u-col>
						</u-row>
						<u-row gutter="16">
							<u-col span="4">
								<view class="demo-layout bg-purple">巡查记录：</view>
							</u-col>
							<u-col span="12">
								<view class="demo-layout bg-purple-light">{{lists.content}}</view>
							</u-col>
						</u-row>
						<u-row gutter="16">
							<u-col span="4">
								<view class="demo-layout bg-purple">现场图片：</view>
							</u-col>
							<u-col span="12" v-for="(item,index) in lists.daily_inspection_files">
								<u-image @click="imgListPreview(item.files.url)" style="margin:20rpx 0" width="100%" height="300rpx" :src="item.files.url"></u-image>
							</u-col>
						</u-row>
						
						<u-row gutter="16" v-if="lists.status==2">
							<u-col span="4">
								<view class="demo-layout bg-purple">处理记录：</view>
							</u-col>
							<u-col span="12">
								<view class="demo-layout bg-purple-light">{{lists.deal_content}}</view>
							</u-col>
						</u-row>
						<u-row gutter="16" v-if="lists.status==2">
							<u-col span="4">
								<view class="demo-layout bg-purple">处理后照片：</view>
							</u-col>
							<u-col span="12" v-for="(item,index) in lists.daily_inspection_deal_files">
								<u-image @click="imgListPreview(item.files.url)" style="margin:20rpx 0" width="100%" height="300rpx" :src="item.files.url"></u-image>
							</u-col>
						</u-row>
						
						<u-row gutter="16" v-if="lists.status==3">
							<u-col span="4">
								<view class="demo-layout bg-purple">定位地址：</view>
							</u-col>
							<u-col span="9">
								{{lists.address}}
							</u-col>
						</u-row>
					</view>
					
				</u-card>
		
			</block>
		</view>

	
		
	</view>


</template>

<script>
	export default {
		data() {
			return {
				lists:{}
			}
		},
		
		
		
		onLoad(options) {
			if(options.id){
				this.loadInfo(options.id)
			}
		},
		onNavigationBarButtonTap(val) {
			window.android.finish();
		},
		methods: {
			imgListPreview(item){
				var urlList = []
				urlList.push(item)  //push中的参数为 :src="item.img_url" 中的图片地址
				uni.previewImage({
					indicator:"number",
					loop:true,
					urls: urlList
				})
				
			},
			loadInfo: function(id) {
				var that = this;
				this.util.request({
					method:"get",
					api: '/api/mobile/daily-inspection/show',
					customLoading: false,
					data: {
						id:id
					},
					
					utilSuccess: function(r) {
						
						that.lists = r
					},
					utilFail: function(res) {
						

						this.util.alert(res);
					}
				});
			}
			

		}

	}
</script>
<style>
	.boxContent {
		background: #f3f4f6;
		min-height: 100vh;
	}

	.footer {
		display: flex;
		justify-content: flex-end;
	}

	.box-header {

		position: fixed;
		top: 0;
		width: 100%;
		z-index: 99;
	}

	.u-row {
		margin: 10rpx 0;
		font-size: 28rpx;
	}
	.u-card{
		z-index: 1;
	}
</style>


<style scoped lang="scss">
	.overflowmask{
		overflow: hidden;
	}
	.loadmore{
		padding:24rpx!important
	}
	.search-wrap {
		background: #0385e5;
		padding: 20rpx;
	}

	.u-config-wrap {
		padding: 30rpx;
	}

	.bg-purple {
		font-weight: bold;
	}

	.slot-content {
		background-color: #FFFFFF;
		padding: 24rpx;

		.item-box {
			margin-bottom: 50rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.item {
				border: 1px solid $u-type-primary;
				color: $u-type-primary;
				padding: 8rpx 40rpx;
				border-radius: 100rpx;
				margin-top: 30rpx;
			}

			.active {
				color: #FFFFFF;
				background-color: $u-type-primary;
			}
		}
	}
</style>
