<template>
	<view>
		<view class="sm-box">
			<view class="card">
				<view class="title">填写说明:</view>
				<view class="content">1、产品新开机台生产时，由最终工序准备好3个样件置于待检区，检查判定合格后生产。</view>
				<view class="content">2、检验员判定合格后从样品中随机挑选1个样件，进行首件标识。</view>
				<view class="content">4、检查结果:合格项目打“√”，不合格项目打“×”，无此检查项目不填写”</view>
			</view>
		</view>
		<view class="content-box">
			<view class="content-box-card">
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">物料名称:</view>
						<text>{{palnInfo.product_name}}</text>
					</view>
				</view>
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">检验日期:</view>
						<text>{{crrentTime}}</text>
					</view>
				</view>
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">生产日期:</view>
						<text>{{palnInfo.production}}</text>
					</view>
				</view>
				<view class="content-box-card-ul-two">
					<view class="content-box-card-list">
						<view class="content-box-card-title">机型:</view>
						<text>{{palnInfo.product_name}}</text>
					</view>
					<view class="content-box-card-list">
						<view class="content-box-card-title">线别:</view>
						<picker @change="bindline" :value="lineIndex" :range="line">
							<view class="lin-div">
								<text>{{line[lineIndex]}}</text>
								<image src="../../static/xiala.png"></image>
							</view>
						</picker>
					</view>
				</view>
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">抽样方式:</view>
						<view class="right-check">
							<view class="check-list" v-for="(item,index) in cyMethod" :key="index"
								@tap="radioChange(index)">
								<image :src="current==index?'../../static/xz.png':'../../static/wxz.png'"></image>
								<text>{{item.name}}</text>
							</view>
							<view class="other-input">
								<input type="text" placeholder="其他" />
							</view>
						</view>
					</view>
				</view>
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">检验依据:</view>
						<view class="right-check">
							<view class="check-list" v-for="(item,index) in jyBasis" :key="index"
								@tap="jyBasisChange(index)">
								<image :src="jyBasisIds==index?'../../static/xz.png':'../../static/wxz.png'"></image>
								<text>{{item}}</text>
							</view>
							<view class="other-input">
								<input type="text" placeholder="其他" />
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="content-box">
			<view class="content-box-card">
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">检验标准:</view>
						<text>检验标准</text>
					</view>
				</view>
				<view class="content-box-card-ul-two">
					<view class="content-box-card-list">
						<view class="content-box-card-title">规格:</view>
						<text>105</text>
					</view>
					<view class="content-box-card-list">
						<view class="content-box-card-title">公差:</view>
						<text>+3 -3</text>
					</view>
				</view>
				<view class="content-box-card-ul-two">
					<view class="content-box-card-list">
						<view class="content-box-card-title">规格:</view>
						<text>105</text>
					</view>
					<view class="content-box-card-list">
						<view class="content-box-card-title">公差:</view>
						<text>+3 -3</text>
					</view>
				</view>
				<view class="sj-card">
					<view class="sj-title">实际检测</view>
					<view class="sj-nav">
						<view class="left">
							<view>规格</view>
							<view>规格</view>
						</view>
						<view class="right">
							<view class="right-list">
								<view class="num-div">1</view>
								<view class="gg-div">
									<input type="number" />
								</view>
								<view class="gg-div">
									<input type="number" />
								</view>
							</view>
							<view class="right-list">
								<view class="num-div">2</view>
								<view class="gg-div">
									<input type="number" />
								</view>
								<view class="gg-div">
									<input type="number" />
								</view>
							</view>
							<view class="right-list">
								<view class="num-div">3</view>
								<view class="gg-div">
									<input type="number" />
								</view>
								<view class="gg-div">
									<input type="number" />
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="beizhu">
					<textarea value="" placeholder="请输入备注" />
				</view>
			</view>
		</view>
		<view class="content-box">
			<view class="content-box-card">
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">外观:</view>
						<view class="right-check">
							<view class="check-list" v-for="(item,index) in appearance" :key="index"
								@tap="appearanceChange(index)">
								<image :src="appearanceIds==index?'../../static/xz.png':'../../static/wxz.png'"></image>
								<text>{{item}}</text>
							</view>
							<view class="other-input">
								<input type="text" placeholder="其他" />
							</view>
						</view>
					</view>
				</view>
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">结构性能:</view>
						<view class="right-check">
							<view class="check-list" v-for="(item,index) in structure" :key="index"
								@tap="structureChange(index)">
								<image :src="structureIds==index?'../../static/xz.png':'../../static/wxz.png'"></image>
								<text>{{item}}</text>
							</view>
							<view class="other-input">
								<input type="text" placeholder="其他" />
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="content-box">
			<view class="content-box-card">
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">最终判定:</view>
						<view class="right-check">
							<view class="check-list" v-for="(item,index) in ifQualified" :key="index"
								@tap="ifQualifiedChange(index)">
								<image :src="ifQualifiedIds==index?'../../static/xz.png':'../../static/wxz.png'">
								</image>
								<text>{{item}}</text>
							</view>
						</view>
					</view>
				</view>
				<view class="content-box-card-ul">
					<view class="content-box-card-list">
						<view class="content-box-card-title">是否量产:</view>
						<view class="right-check">
							<view class="check-list" v-for="(item,index) in ifProduction" :key="index"
								@tap="ifProductionChange(index)">
								<image :src="ProductionIds==index?'../../static/xz.png':'../../static/wxz.png'"></image>
								<text>{{item}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="submit-btn">
				<button type="primary">提交并发起审核</button>
			</view>

		</view>
	</view>
</template>

<script>
	import {firstCheckDetail} from "../../api/user.js"
	export default {
		
		data() {
			return {
				pId:0,//计划id
				palnInfo:{},//详情
				crrentTime:'',//当前时间
				line: ["A线", "B线", "C线", "D线"],
				lineIndex: 0,
				current: -1,
				ifQualifiedIds: 0,
				
				cyMethod: [{
						name: "开机首检",
						check: false
					},
					{
						name: "开机末检",
						check: false
					},
					{
						name: "修模首件",
						check: false
					},
					{
						name: "转产首件",
						check: false
					},
					{
						name: "生产参数变更",
						check: false
					},
					{
						name: "材料变更",
						check: false
					}
				],
				jyBasisIds: -1,
				jyBasis: [
					"工程图纸",
					"标准样件",
					"制程检验标准",
					"产品标准"
				],
				appearance: ["划伤", "压痕", "拉痕", "摁伤", "油污", "水渍", "少孔", "开裂", "变形", "起皱、叠料", "毛刺", "印字"],
				appearanceIds: -1,
				structure: ["缺料", "螺纹", "铆接", "折弯", "膜厚", "附着力", "直线度", "平整度", "试装配", "表面处理"],
				structureIds: -1,
				ifQualified: ["是", "否"],
				qualifiedIds: -1,
				ifProduction: ["是", "否"],
				ProductionIds: -1
			};
		},
		
		onLoad(e) {
			this.pId = e.plan_id;
			this.palnInfo = JSON.parse(decodeURIComponent(e.planInfo));
				console.log('详情',this.palnInfo);
				this.getTime();
		},
		onShow() {
			this.getInfo();
			this.getTime();
		},
		methods: {
			getTime:function(){
			
			var date = new Date(),
			year = date.getFullYear(),
			month = date.getMonth() + 1,
			day = date.getDate(),
			hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
			minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
			second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
			month >= 1 && month <= 9 ? (month = "0" + month) : "";
			day >= 0 && day <= 9 ? (day = "0" + day) : "";
			var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
			console.log("当前时间",date);
			this.crrentTime=timer
			return timer;
			
			console.log("当前时间",timer)
			},
			getInfo(){
				firstCheckDetail({plan_id:this.pId}).then(res=>{
					// /console.log('详情', res)
				})
			},
			bindline: function(e) {
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.lineIndex = e.target.value
			},
			radioChange(index) {
				this.current = index
			},
			jyBasisChange: function(index) {
				this.jyBasisIds = index
			},
			appearanceChange(index) {
				this.appearanceIds = index
			},
			structureChange(index) {
				this.structureIds = index
			},
			ifQualifiedChange(index) {
				this.qualifiedIds == index
			},
			ifProductionChange(index) {
				this.ProductionIds == index
			}
		}
	}
</script>

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