<template>
	<view class="dailyCheck">
		<levitatedsphere :x="100" :y="80"></levitatedsphere>
		<headers :showBack="true" :themeType="'white'">
			<view class="headerName">
				日常巡检
			</view>
		</headers>
		<view class="content">
			<view class="item flex2" @click="goList(1)">
				<view class="flex">
					<image class="icon" style="width: 38rpx; height: 22px; margin-right: 7px;" src="../../../static/Rectification.png"></image>
					<text>我提交的巡检</text>
				</view>
				<view class="value"><text class="num">{{submitNumber}}</text>(件)</view>
			</view>
			<view class="item flex2" @click="goList(2)">
				<view class="flex">
					<image class="icon" style="width: 44rpx; height: 21px;margin-right: 7px;" src="../../../static/review.png"></image>
					<text>我整改的巡检</text>
				</view>
				<view class="value"><text class="num">{{mendNumber}}</text>(件)</view>
			</view>
			<view>
				<view class="addBtn" @click="addBtn">新增巡检</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mendNumber:0,
				submitNumber:0
			}
		},
		onShow(){
			this.getListData();
			
		},
		methods: {
			
			//获取记录
			getListData(){
				let that = this;
				let userId = JSON.parse(uni.getStorageSync('userInfo')).userId;
				let projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
				//获取我整改的巡查记录数量
				this.sendRequest({
					url:'xmgl/inspectionRecord/list',
					method:'post',
					data:{
						type: 2,
						endTime: "",
						inspector:userId,
						pageNo: 1,
						pageSize: 10,
						projectSn: projectSn,
						startTime: "",
						state: "",
					},
					success:res=>{
						that.mendNumber = res.result.total;
					}
				});
				//获取我提交的巡查记录数量
				this.sendRequest({
					url:'xmgl/inspectionRecord/list',
					method:'post',
					data:{
						type: 1,
						endTime: "",
						inspector:userId,
						pageNo: 1,
						pageSize: 10,
						projectSn: projectSn,
						startTime: "",
						state: "",
					},
					success:res=>{
						that.submitNumber = res.result.total;
					}
				});
				
			},
			
			//列表页
			goList(type){
			 uni.navigateTo({
			 	url:"./list?type="+type
			 })
			},
			
			
			//新增按钮
			addBtn(){
				uni.navigateTo({
					url:"./addCheck?type=add"
				})
			},
		}
	}
</script>

<style>
	.dailyCheck .content{
		width: 100%;
		height: 100%;
		padding: 20px 30rpx 0;
		box-sizing: border-box;
		
	}
	.flex{
		display: flex;
		align-items: center;
	}
	.flex2{
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.item{
		width: 100%;
		box-sizing: border-box;
		padding: 14px 30rpx;
		box-shadow: 0 0 10px #d3d3d3;
		margin-bottom: 18px;
		border-radius: 4px;
		color: rgba(51, 51, 51, 100);
		font-size: 30rpx;
		font-family: PingFangSC-Regular;
	}
	.value{
		font-size: 26rpx;
	}
	.num{
		margin-right: 5px;
		font-size: 37rpx;
		color: #4181FE;
	}
	.addBtn{
		position: absolute;
		bottom: 50px;
		left: 0;
		right: 0;
		width: 60%;
		margin: 0 auto;
		text-align: center;
		padding: 10px 0;
		border-radius: 30px;
		background-color: rgba(65,129,254,0.9);
		font-size: 30rpx;
		color: #fff;
		box-shadow: 0 0 5px rgba(65,129,254,0.7);
	}
	.addBtn:active{
		background-color: #4181FE;
	}
</style>
