<template>
	<view>
		<view class="card" v-for="(item,index) in list" :key="index">
			<view class="card-left">
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>物料名称:</view><text>{{item.product_name}}</text>
					</view>
					<view class="card-right">
						人员统计
					</view>
				</view>
				<view class="card-up-list">
					<view class="card-up-list-list">
						<view>物料编号:</view><text>{{item.product_number}}</text>
					</view>
				</view>
				<view class="card-dow-list">
					<view class="card-up-list-list">
						<view>规格:</view><text>{{item.product_size}}</text>
					</view>
					<view class="card-up-list-list">
						<view>产线:</view><text>{{item.line_title}}</text>
					</view>
				</view>
			</view>
			<view class="btn-grounp">
				<view v-if="item.status==0||item.status==0" @tap="openLine(item.plan_id)">开线</view>
				<view v-if="item.status==1" class="btn-tx"  @tap="stopLine(item)">停线</view>
				<view v-if="item.status==0" class="btn-xx" @tap="offLine()">下线</view>
				<view  class="btn-blp" @tap="badProduct()">不良品统计</view>
				<view  class="btn-back" @tap="rework()">返修</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		firstCheckLists,
		openLine
	} from "../../api/user.js";
	export default {
		onLoad() {
			this.getData()
		},
		data() {
			return {
				list:[]
			};
		},methods:{
			openLine(plan_id){
				openLine({id:plan_id}).then(res=>{
					this.$functions.sucess("操作成功").then({
						
					},this.getData());
					
				})
			},
			getData(){
				firstCheckLists({type:1}).then(res => {
					this.list = res;
				})
			},
			stopLine(item){
				uni.navigateTo({
					url: `../stopLine/stopLine?planInfo=${encodeURIComponent(JSON.stringify(item))}`			
				});
			},
			offLine(){
				uni.navigateTo({
					url: '../offLine/offLine'				
				});
			},
			badProduct(){
				uni.navigateTo({
					url: '../badProduct/badProduct'				
				});
			}
			,
			rework(){
				uni.navigateTo({
					url: '../rework/rework'				
				});
			}
		}
	}
</script>

<style lang="scss">
@import "./index.scss";
</style>
