<template>
	<view>
		<view style="height:30rpx"></view>
		<view class="bg-white plan-sec text-center" style="margin:0rpx 30rpx 30rpx 30rpx">
			<view class="plan-tit padding-top-lg">任务名称：ui测试</view>
			<br>
			<chart2 :bindData="this.getData" v-if=" JSON.stringify(getData) != '{}'"></chart2>
		</view>

		<view class="margin bg-white plan-sec">
			<view class="info-tit margin-left-xs">
				<text class="cuIcon-titles margin-right-xs"></text>
				维保详情
			</view>
			<view class="cu-list menu-avatar">
				<view class="cu-item deviceTypeItem" v-for="(item,index) in planList" :key="index"
					@tap="goDetailPage(item)">
					<view class="content" style="left:0!important;width:80%">
						<view class="title">{{item.spot_name}}</view>
					</view>
					<view class="nav-right num">
						<view class="text-grey">
							<span class="online" v-if="item.data3==2">已执行</span>
							<span class="error" v-if="item.data3==1">未执行</span>
							<text class="icon iconfont margin-right-xs ">&#xe629;</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>


</template>

<script>
	import chart from './components/chart.vue';
	import chart2 from './components/chart2.vue';
	import json from '../../../data/json.js';
	export default {
		components: {
			chart,chart2
		},
		data() {
			return {
				inspectList: json.weiBaoPlan,
				getData:{},
				planList:[]

			};
		},
		onLoad:function(option){
			this.getPlanList({'company_code':uni.getStorageSync('selectedCode')})
		
		},

		methods: {
			
			// 维保计划列表数据请求
			async getPlanList(params = {}) {
				const res = await this.$myRequest({
					url: 'Maintenance/getMaintenanceList',
					data:params,
					showLoading: true
				})
				this.getData=res.data.data[0];
				this.planList=this.getData.point;
				console.log(this.planList)
				
			},
			
			
			
			goDetailPage(item) {
				
				if (item.data3==2) {
					alert(1)
					uni.navigateTo({
						url: "/pages/weiBao/planDetailDone/planDetailDone?id="+item.id+'&zb_id='+this.getData.id,
					})
					
				} else {
					uni.navigateTo({
						url: "/pages/weiBao/planDetail/planDetail?id="+item.id+'&zb_id='+this.getData.id,
					})
				}

			}

		}

	}
</script>

<style lang="scss">
	page {
		background-color: #F4F5F7;
	}
</style>
