<template>
	<view class="wrap">
		<u-card v-for="(item, index) in myinspecttaskList" v-bind:key="index" :title="item.name" margin="12rpx"
			:border="false" :foot-border-top="false" border-radius="8rpx" :head-style="headstyle"
			@body-click="taskClick" :index="item.id">
			<view class="" slot="body">
				<view class="u-body-item-title">
					<span class="itemstate">{{item.state}}</span>
					{{item.name}}
				</view>
				<view class="u-body-item">
					所属任务:
					<span>{{item.inspecttask_.name}}</span>
				</view>
				<view class="u-body-item">
					检查期限:
					<span>{{item.inspecttask_.start_date}}</span>至
					<span>{{item.inspecttask_.end_date}}</span>
				</view>
				<view class="u-body-item">
					涉及单位:
					<span style="color:darkblue;">{{item.depts_count}}</span>家
					巡查组:
					<span style="color:darkblue;">{{item.members.length}}</span>人
				</view>
			</view>
		</u-card>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				myinspecttaskList: [],
				headstyle: {
					"padding-top": "12rpx",
					"padding-bottom": "12rpx"
				}
			}
		},
		onShow() {
			this.getMyInspectTaskList();
		},
		methods: {
			getMyInspectTaskList() {
				this.$u.api.getMyInspectTaskList({}).then(res => {
					this.myinspecttaskList = res.data
				}).catch(e => {})
			},
			taskClick(index) {
				uni.navigateTo({
					url:"/pages/subtask/subtaskdetail?id="+index
				})
			},
		}
	}
</script>
<style>
	page{
		background-color: #ededed;
	}
</style>
<style lang="scss" scoped>
	.u-body-item-title {
		font-size: 32rpx;
		color: #333;
	}

	.u-body-item {
		margin-top: 4rpx;
		span {
			color: #333;
		}
	}
	.itemstate {
		color:$u-type-primary-dark;
		font-weight: bold;
		margin-right: 8rpx;
	}
</style>

