<template>
	<el-container>
		<el-header>
			<div class="right-panel">
				<el-input v-model="query.batch" 
				placeholder="批次号" 
				clearable 
				style="width: 200px;"
				></el-input>
				<el-button
					type="primary"
					icon="el-icon-search"
					@click="handleQuery"
				></el-button>
				<el-button
					@click="handleExport"
					class="tables"
					type="primary"
					>导出</el-button
				>
			</div>
		</el-header>
		<el-main class="nopadding">
			<el-table
				ref="table"
				:data="tableData"
				id="exportDiv"
				stripe
				style="height: 100%;"
				>
					<el-table-column label="产品编号" prop="batch" min-width="160" fixed="left">
					</el-table-column>
					<el-table-column label="扫边A"  align="center" class-name="colorheader1">
						<el-table-column label="1-内置-材料不良"  align="center" class-name="colorheader1">
							<el-table-column label="气泡" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_气泡 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="线痕" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_线痕 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="断裂" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_断裂 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="划伤" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_划伤 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-破损"  align="center" class-name="colorheader1">
							<el-table-column label="人为磕碰" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="设备故障" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_设备故障 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="断点" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_断点 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="调机破损" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边A_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-加工后崩边"  align="center" class-name="colorheader1">
							<el-table-column label="大崩" class-name="colorheader1">
								<template  #default="scope"><span>{{ scope.row.data.扫边A_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader1">
								<template  #default="scope"><span>{{ scope.row.data.扫边A_缺陷_小崩边 }}</span></template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="其他" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'扫边A') }}</span>
								</template>
							</el-table-column>
					</el-table-column>
					<el-table-column label="扫边B" align="center" class-name="colorheader2">
						<el-table-column label="1-加工前不良"  align="center" class-name="colorheader2">
							<el-table-column label="裂纹" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_加工前_缺陷_裂纹 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="断裂" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_加工前_缺陷_断裂 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="划伤" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_加工前_缺陷_划伤 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="抛光未磨透(线痕)" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_加工前_缺陷_线痕 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="麻点" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_加工前_缺陷_麻点 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="其他" class-name="colorheader2">
							<template #default="scope">
								<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'扫边B前') }}</span>
							</template>
						</el-table-column>
						</el-table-column>
						<el-table-column label="2-内置"  align="center" class-name="colorheader2">
							<el-table-column label="黑圈不良" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-破损"  align="center" class-name="colorheader2">
							<el-table-column label="人为磕碰" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="设备故障" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_设备故障 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="脏污" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_脏污 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="抛光未磨透" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_线痕 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="调机破损" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="断裂" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.扫边B_缺陷_断裂 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="4-加工后崩边"  align="center" class-name="colorheader2">
							<el-table-column label="大崩" class-name="colorheader2">
								<template  #default="scope"><span>{{ scope.row.data.扫边B_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader2">
								<template  #default="scope"><span>{{ scope.row.data.扫边B_缺陷_小崩边 }}</span></template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="其他" class-name="colorheader2">
							<template #default="scope">
								<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'扫边B') }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="精雕" align="center" class-name="colorheader3">
						<el-table-column label="1-加工前不良"  align="center" class-name="colorheader3">
							<el-table-column label="大崩" class-name="colorheader3">
								<template  #default="scope"><span>{{ scope.row.data.精雕_加工前_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader3">
								<template  #default="scope"><span>{{ scope.row.data.精雕_加工前_缺陷_小崩边}}</span></template>
							</el-table-column>
							<el-table-column label="其他" class-name="colorheader3">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'精雕前') }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-内置"  align="center" class-name="colorheader3">
							<el-table-column label="黑圈不良" class-name="colorheader3">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.精雕_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader3">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.精雕_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-破损"  align="center" class-name="colorheader3">
							<el-table-column label="调机破损" class-name="colorheader3">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.精雕_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为磕碰" class-name="colorheader3">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.精雕_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="4-其他" class-name="colorheader3">
							<template #default="scope">
								<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'精雕') }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="倒角" align="center" class-name="colorheader4">
						<el-table-column label="1-加工前不良"  align="center" class-name="colorheader4">
							<el-table-column label="大崩" class-name="colorheader4">
								<template  #default="scope"><span>{{ scope.row.data.倒角_加工前_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader4">
								<template  #default="scope"><span>{{ scope.row.data.倒角_加工前_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="其他" class-name="colorheader4">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'倒角前') }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-内置"  align="center" class-name="colorheader4">
							<el-table-column label="黑圈不良" class-name="colorheader4">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.倒角_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader4">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.倒角_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-破损"  align="center" class-name="colorheader4">
							<el-table-column label="调机破损" class-name="colorheader4">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.倒角_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为磕碰" class-name="colorheader4">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.倒角_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-加工后崩边"  align="center" class-name="colorheader4">
							<el-table-column label="大崩" class-name="colorheader4">
								<template  #default="scope"><span>{{ scope.row.data.倒角_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader4">
								<template  #default="scope"><span>{{ scope.row.data.倒角_缺陷_小崩边 }}</span></template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="4-其他" class-name="colorheader4">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'倒角') }}</span>
								</template>
							</el-table-column>
					</el-table-column>
					<el-table-column label="减薄A" align="center" class-name="colorheader5">
						<el-table-column label="1-内置"  align="center" class-name="colorheader5">
							<el-table-column label="黑圈不良" class-name="colorheader5">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄A_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader5">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄A_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="黑雾" class-name="colorheader5">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄A_缺陷_黑雾 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-破损"  align="center" class-name="colorheader5">
							<el-table-column label="调机破损" class-name="colorheader5">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄A_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为磕碰" class-name="colorheader5">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄A_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-加工后崩边"  align="center" class-name="colorheader5">
							<el-table-column label="大崩" class-name="colorheader5">
								<template  #default="scope"><span>{{ scope.row.data.减薄A_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader5">
								<template  #default="scope"><span>{{ scope.row.data.减薄A_缺陷_小崩边 }}</span></template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-其他" class-name="colorheader5">
							<template #default="scope">
								<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'减薄A') }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="减薄B" align="center" class-name="colorheader6">
						<el-table-column label="1-内置"  align="center" class-name="colorheader6">
							<el-table-column label="黑圈不良" class-name="colorheader6">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄B_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader6">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄B_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="黑雾" class-name="colorheader6">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄B_缺陷_黑雾 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-破损"  align="center" class-name="colorheader6">
							<el-table-column label="调机破损" class-name="colorheader6">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄B_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为" class-name="colorheader6">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.减薄B_缺陷_人为磕碰磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-加工后崩边"  align="center" class-name="colorheader6">
							<el-table-column label="大崩" class-name="colorheader6">
								<template  #default="scope"><span>{{ scope.row.data.减薄B_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader6">
								<template  #default="scope"><span>{{ scope.row.data.减薄B_缺陷_小崩边 }}</span></template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-其他" class-name="colorheader6">
							<template #default="scope">
								<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'减薄B') }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="磨抛" align="center" class-name="colorheader7">
						<el-table-column label="1-加工前不良"  align="center" class-name="colorheader7">
							<el-table-column label="大崩" class-name="colorheader7">
								<template  #default="scope"><span>{{ scope.row.data.磨抛_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader7">
								<template  #default="scope"><span>{{ scope.row.data.磨抛_缺陷_小崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="其他" class-name="colorheader7">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'磨抛前') }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-内置"  align="center" class-name="colorheader7">
							<el-table-column label="黑圈不良" class-name="colorheader7">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.磨抛_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader7">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.磨抛_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-破损"  align="center" class-name="colorheader7">
							<el-table-column label="调机破损" class-name="colorheader7">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.磨抛_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为磕碰" class-name="colorheader7">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.磨抛_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="4-其他" class-name="colorheader7">
							<template #default="scope">
								<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'磨抛') }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="一次超洗" align="center" class-name="colorheader1">
						<el-table-column label="1-加工前不良"  align="center" class-name="colorheader1">
							<el-table-column label="大崩" class-name="colorheader1">
								<template  #default="scope"><span>{{ scope.row.data.一次超洗_加工前_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader1">
								<template  #default="scope"><span>{{ scope.row.data.一次超洗_加工前_缺陷_小崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="其他" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'一次超洗前') }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-内置"  align="center" class-name="colorheader1">
							<el-table-column label="黑圈不良" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.一次超洗_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.一次超洗_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-破损"  align="center" class-name="colorheader1">
							<el-table-column label="调机破损" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.一次超洗_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为磕碰" class-name="colorheader1">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.一次超洗_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
					</el-table-column>
					<el-table-column label="二次超洗" align="center" class-name="colorheader2">
						<el-table-column label="1-加工前不良"  align="center" class-name="colorheader2">
							<el-table-column label="大崩" class-name="colorheader2">
								<template  #default="scope"><span>{{ scope.row.data.二次超洗_加工前_缺陷_崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="小崩边" class-name="colorheader2">
								<template  #default="scope"><span>{{ scope.row.data.二次超洗_加工前_缺陷_小崩边 }}</span></template>
							</el-table-column>
							<el-table-column label="其他" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ getCountQt(scope.row.data,'二次超洗前') }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="2-内置"  align="center" class-name="colorheader2">
							<el-table-column label="黑圈不良" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.二次超洗_缺陷_黑圈不良 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="材料不良" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.二次超洗_缺陷_材料不良 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
						<el-table-column label="3-破损"  align="center" class-name="colorheader2">
							<el-table-column label="调机破损" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.二次超洗_缺陷_调机破损 }}</span>
								</template>
							</el-table-column>
							<el-table-column label="人为磕碰" class-name="colorheader2">
								<template #default="scope">
									<span v-if="scope.row.data">{{ scope.row.data.二次超洗_缺陷_人为磕碰 }}</span>
								</template>
							</el-table-column>
						</el-table-column>
					</el-table-column>
				</el-table>
		</el-main>
		<el-footer>
			<el-pagination 
				background 
				:small="true" 
				:total="dataTotal"
				layout="total, sizes, prev, pager, next, jumper"
				:page-size="params.page_size" 
				:page-sizes="[20, 50, 100, 200]" 
				:current-page="params.page"
				@current-change="getList" 
				@update:page-size="getList2"
			></el-pagination>
		</el-footer>
	</el-container>
</template>

<script>
function deepCopy(obj) {
	return JSON.parse(JSON.stringify(obj));
}
export default {
	name: "chart",
	data() {
		return {
			dataTotal: 0,
			params: {
				page:1,
				page_size:20,
				ordering:"-last_time",
				querys:[],
			},
			querys:[
					[{field:"data__has_key",compare:"",value:"扫边A_日期"}],
					[{field:"data__has_key",compare:"",value:"扫边B_日期"}],
					[{field:"data__has_key",compare:"",value:"精雕_日期"}],
					[{field:"data__has_key",compare:"",value:"倒角_日期"}],
					[{field:"data__has_key",compare:"",value:"减薄A_日期"}],
					[{field:"data__has_key",compare:"",value:"减薄B_日期"}],
					[{field:"data__has_key",compare:"",value:"磨抛_日期"}],
					[{field:"data__has_key",compare:"",value:"一次超洗_日期"}],
					[{field:"data__has_key",compare:"",value:"二次超洗_日期"}],
				],
			query:{
				batch:'',
			},
			tableData:[],
		};
	},
	mounted() {
		let that = this;
		that.getList();
	},
	methods: {
		getList(val){
			let that = this;
			that.params.page = val?val:1;
			that.params.querys = that.querys;
			that.$API.wpm.batchstquery.req(that.params).then((res) => {
				if (res.count > 0) {
					that.tableData = res.results;
					that.dataTotal = res.count;
				}else{
					that.tableData = [];
					that.dataTotal = 0;
				}
			});
		},
		getList2(val){
			let that = this;
			that.params.page = 1;
			that.params.page_size = val;
			that.getList(1);
		},
		handleQuery(){
			let that = this;
			that.params.page = 1;
			that.params.querys = [];
			if(that.query.batch!==''&&that.query.batch!==null){
				console.log('that.query.batch',that.query.batch);
				let obj = {};
				obj.field = "batch__contains";
				obj.compare = "";//contains
				obj.value = that.query.batch;
				that.querys.forEach((item)=>{
					let arr = item;
					arr.push(obj);
				    that.params.querys.push(arr);
				});
			}else{
				that.params.querys = that.querys;
			}
			this.getList();
			
		},
		getCountQt(data,type){
			let count_qt = 0,count = 0;
		    if(type=='扫边A'){
				if(data.扫边A_count_notok){
					if (data.扫边A_缺陷_气泡 !== undefined) {
						count += data.扫边A_缺陷_气泡 ;
					}
					if (data.扫边A_缺陷_线痕 !== undefined) {
						count += data.扫边A_缺陷_线痕 ;
					}
					if (data.扫边A_缺陷_断裂 !== undefined) {
						count += data.扫边A_缺陷_断裂 ;
					}
					if (data.扫边A_缺陷_划伤 !== undefined) {
						count += data.扫边A_缺陷_划伤 ;
					}
					if (data.扫边A_缺陷_人为磕碰 !== undefined) {
						count += data.扫边A_缺陷_人为磕碰 ;
					}
					if (data.扫边A_缺陷_设备故障 !== undefined) {
						count += data.扫边A_缺陷_设备故障 ;
					}
					if (data.扫边A_缺陷_断点 !== undefined) {
						count += data.扫边A_缺陷_断点 ;
					}
					if (data.扫边A_缺陷_调机破损 !== undefined) {
						count += data.扫边A_缺陷_调机破损 ;
					}
					if (data.扫边A_缺陷_崩边 !== undefined) {
						count += data.扫边A_缺陷_崩边 ;
					}
					if (data.扫边A_缺陷_小崩边 !== undefined) {
						count += data.扫边A_缺陷_小崩边 ;
					}
					count_qt = data.扫边A_count_notok - count;
					return count_qt;
				}
			}else if(type=='扫边B前'){
			    if(data.扫边B_count_pn_jgqbl){
					if (data.扫边B_加工前_缺陷_裂纹 !== undefined) {
						count += data.扫边B_加工前_缺陷_裂纹 ;
					}
					if (data.扫边B_加工前_缺陷_断裂 !== undefined) {
						count += data.扫边B_加工前_缺陷_断裂 ;
					}
					if (data.扫边B_加工前_缺陷_划伤 !== undefined) {
						count += data.扫边B_加工前_缺陷_划伤 ;
					}
					if (data.扫边B_加工前_缺陷_线痕 !== undefined) {
						count += data.扫边B_加工前_缺陷_线痕 ;
					}
					if (data.扫边B_加工前_缺陷_麻点 !== undefined) {
						count += data.扫边B_加工前_缺陷_麻点 ;
					}
					count_qt = data.扫边B_count_pn_jgqbl - count;
					return count_qt;
				}
			}else if(type=='扫边B'){
			    if(data.扫边B_count_notok){
					if (data.扫边B_缺陷_黑圈不良 !== undefined) {
						count += data.扫边B_缺陷_黑圈不良 ;
					}
					if (data.扫边B_缺陷_材料不良 !== undefined) {
						count += data.扫边B_缺陷_材料不良 ;
					}
					if (data.扫边B_缺陷_人为磕碰 !== undefined) {
						count += data.扫边B_缺陷_人为磕碰 ;
					}
					if (data.扫边B_缺陷_设备故障 !== undefined) {
						count += data.扫边B_缺陷_设备故障 ;
					}
					if (data.扫边B_缺陷_脏污 !== undefined) {
						count += data.扫边B_缺陷_脏污 ;
					}
					if (data.扫边B_缺陷_线痕 !== undefined) {
						count += data.扫边B_缺陷_线痕 ;
					}
					if (data.扫边B_缺陷_调机破损 !== undefined) {
						count += data.扫边B_缺陷_调机破损 ;
					}
					if (data.扫边B_缺陷_断裂 !== undefined) {
						count += data.扫边B_缺陷_断裂 ;
					}
					if (data.扫边B_缺陷_崩边 !== undefined) {
						count += data.扫边B_缺陷_崩边 ;
					}
					if (data.扫边B_缺陷_小崩边 !== undefined) {
						count += data.扫边B_缺陷_小崩边 ;
					}
					count_qt = data.扫边B_count_notok - count;
					return count_qt;
				}
			}else if(type=='精雕前'){
			    if(data.精雕_count_pn_jgqbl){
					if (data.精雕_加工前_缺陷_崩边 !== undefined) {
						count += data.精雕_加工前_缺陷_崩边 ;
					}
					if (data.精雕_加工前_缺陷_小崩边 !== undefined) {
						count += data.精雕_加工前_缺陷_小崩边 ;
					}
					count_qt = data.扫边B_count_pn_jgqbl - count;
					return count_qt;
				}
			}else if(type=='精雕'){
			    if(data.精雕_count_notok){
					if (data.精雕_缺陷_黑圈不良 !== undefined) {
						count += data.精雕_缺陷_黑圈不良 ;
					}
					if (data.精雕_缺陷_材料不良 !== undefined) {
						count += data.精雕_缺陷_材料不良 ;
					}
					if (data.精雕_缺陷_调机破损 !== undefined) {
						count += data.精雕_缺陷_调机破损 ;
					}
					if (data.精雕_缺陷_人为磕碰 !== undefined) {
						count += data.精雕_缺陷_人为磕碰 ;
					}
					count_qt = data.精雕_count_notok - count;
					return count_qt;
				}
			}else if(type=='倒角前'){
			    if(data.倒角_count_pn_jgqbl){
					if (data.倒角_加工前_缺陷_崩边 !== undefined) {
						count += data.倒角_加工前_缺陷_崩边 ;
					}
					if (data.倒角_加工前_缺陷_小崩边 !== undefined) {
						count += data.倒角_加工前_缺陷_小崩边 ;
					}
					count_qt = data.倒角_count_pn_jgqbl - count;
					return count_qt;
				}
			}else if(type=='倒角'){
			    if(data.倒角_count_notok){
					if (data.倒角_缺陷_黑圈不良 !== undefined) {
						count += data.倒角_缺陷_黑圈不良 ;
					}
					if (data.倒角_缺陷_材料不良 !== undefined) {
						count += data.倒角_缺陷_材料不良 ;
					}
					if (data.倒角_缺陷_调机破损 !== undefined) {
						count += data.倒角_缺陷_调机破损 ;
					}
					if (data.倒角_缺陷_人为磕碰 !== undefined) {
						count += data.倒角_缺陷_人为磕碰 ;
					}
					if (data.倒角_缺陷_崩边 !== undefined) {
						count += data.倒角_缺陷_崩边 ;
					}
					if (data.倒角_缺陷_小崩边 !== undefined) {
						count += data.倒角_缺陷_小崩边 ;
					}
					count_qt = data.倒角_count_notok - count;
					return count_qt;
				}
			}else if(type=='减薄A'){
			    if(data.减薄A_count_notok){
					if (data.减薄A_缺陷_黑圈不良 !== undefined) {
						count += data.减薄A_缺陷_黑圈不良 ;
					}
					if (data.减薄A_缺陷_材料不良 !== undefined) {
						count += data.减薄A_缺陷_材料不良 ;
					}
					if (data.减薄A_缺陷_黑雾 !== undefined) {
						count += data.减薄A_缺陷_黑雾 ;
					}
					if (data.减薄A_缺陷_调机破损 !== undefined) {
						count += data.减薄A_缺陷_调机破损 ;
					}
					if (data.减薄A_缺陷_人为磕碰 !== undefined) {
						count += data.减薄A_缺陷_人为磕碰 ;
					}
					if (data.减薄A_缺陷_崩边 !== undefined) {
						count += data.减薄A_缺陷_崩边 ;
					}
					if (data.减薄A_缺陷_小崩边 !== undefined) {
						count += data.减薄A_缺陷_小崩边 ;
					}
					count_qt = data.减薄A_count_notok - count;
					return count_qt;
				}
			}else if(type=='减薄B'){
			    if(data.减薄B_count_notok){
					if (data.减薄B_缺陷_黑圈不良 !== undefined) {
						count += data.减薄B_缺陷_黑圈不良 ;
					}
					if (data.减薄B_缺陷_材料不良 !== undefined) {
						count += data.减薄B_缺陷_材料不良 ;
					}
					if (data.减薄B_缺陷_黑雾 !== undefined) {
						count += data.减薄B_缺陷_黑雾 ;
					}
					if (data.减薄B_缺陷_调机破损 !== undefined) {
						count += data.减薄B_缺陷_调机破损 ;
					}
					if (data.减薄B_缺陷_人为磕碰 !== undefined) {
						count += data.减薄B_缺陷_人为磕碰 ;
					}
					if (data.减薄B_缺陷_崩边 !== undefined) {
						count += data.减薄B_缺陷_崩边 ;
					}
					if (data.减薄B_缺陷_小崩边 !== undefined) {
						count += data.减薄B_缺陷_小崩边 ;
					}
					count_qt = data.减薄B_count_notok - count;
					return count_qt;
				}
			}else if(type=='磨抛前'){
			    if(data.磨抛_count_pn_jgqbl){
					if (data.磨抛_加工前_缺陷_崩边 !== undefined) {
						count += data.磨抛_加工前_缺陷_崩边 ;
					}
					if (data.磨抛_加工前_缺陷_小崩边 !== undefined) {
						count += data.磨抛_加工前_缺陷_小崩边 ;
					}
					count_qt = data.磨抛_count_pn_jgqbl - count;
					return count_qt;
				}
			}else if(type=='磨抛'){
			    if(data.磨抛_count_notok){
					if (data.磨抛_缺陷_黑圈不良 !== undefined) {
						count += data.磨抛_缺陷_黑圈不良 ;
					}
					if (data.磨抛_缺陷_材料不良 !== undefined) {
						count += data.磨抛_缺陷_材料不良 ;
					}
					if (data.磨抛_缺陷_调机破损 !== undefined) {
						count += data.磨抛_缺陷_调机破损 ;
					}
					if (data.磨抛_缺陷_人为磕碰 !== undefined) {
						count += data.磨抛_缺陷_人为磕碰 ;
					}
					count_qt = data.磨抛_count_notok - count;
					return count_qt;
				}
			}
			else if(type=='一次超洗前'){
			    if(data.一次超洗_count_pn_jgqbl){
					if (data.一次超洗_加工前_缺陷_崩边 !== undefined) {
						count += data.一次超洗_加工前_缺陷_崩边 ;
					}
					if (data.一次超洗_加工前_缺陷_小崩边 !== undefined) {
						count += data.一次超洗_加工前_缺陷_小崩边 ;
					}
					count_qt = data.一次超洗_count_pn_jgqbl - count;
					return count_qt;
				}
			}else if(type=='一次超洗'){
			    if(data.一次超洗_count_notok){
					if (data.一次超洗_缺陷_黑圈不良 !== undefined) {
						count += data.一次超洗_缺陷_黑圈不良 ;
					}
					if (data.一次超洗_缺陷_材料不良 !== undefined) {
						count += data.一次超洗_缺陷_材料不良 ;
					}
					if (data.一次超洗_缺陷_调机破损 !== undefined) {
						count += data.一次超洗_缺陷_调机破损 ;
					}
					if (data.一次超洗_缺陷_人为磕碰 !== undefined) {
						count += data.一次超洗_缺陷_人为磕碰 ;
					}
					count_qt = data.一次超洗_count_notok - count;
					return count_qt;
				}
			}else if(type=='二次超洗前'){
			    if(data.二次超洗_count_pn_jgqbl){
					if (data.二次超洗_加工前_缺陷_崩边 !== undefined) {
						count += data.二次超洗_加工前_缺陷_崩边 ;
					}
					if (data.二次超洗_加工前_缺陷_小崩边 !== undefined) {
						count += data.二次超洗_加工前_缺陷_小崩边 ;
					}
					count_qt = data.二次超洗_count_pn_jgqbl - count;
					return count_qt;
				}
			}else if(type=='二次超洗'){
			    if(data.二次超洗_count_notok){
					if (data.二次超洗_缺陷_黑圈不良 !== undefined) {
						count += data.二次超洗_缺陷_黑圈不良 ;
					}
					if (data.二次超洗_缺陷_材料不良 !== undefined) {
						count += data.二次超洗_缺陷_材料不良 ;
					}
					if (data.二次超洗_缺陷_调机破损 !== undefined) {
						count += data.二次超洗_缺陷_调机破损 ;
					}
					if (data.二次超洗_缺陷_人为磕碰 !== undefined) {
						count += data.二次超洗_缺陷_人为磕碰 ;
					}
					count_qt = data.二次超洗_count_notok - count;
					return count_qt;
				}
			}
		},
		handleExport() {
			this.exportLoading = true;
			this.$XLSX("#exportDiv", "过程检验统计");
			this.exportLoading = false;
		},
	},
};
</script>

