<template>
	<el-container>
		<el-header>
			<div class="right-panel">
				<el-input v-model="query.batch__contains" 
				placeholder="批次号" 
				clearable 
				style="width: 200px;"
				></el-input>
				<el-date-picker
					v-model="query.last_time__gte"
					type="date"
					placeholder="开始日期"
					value-format="YYYY-MM-DD"
					clearable
					style="width: 200px; margin: 5px"
				>
				</el-date-picker>
				<el-date-picker
					v-model="query.last_time__lte"
					type="date"
					placeholder="截止日期"
					value-format="YYYY-MM-DD"
					clearable
					style="width: 200px; margin:0"
				>
				</el-date-picker>
				<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">
			<scTable
				ref="table"
				:apiObj="apiObj"
				:params="params"
				:query="query"
				id="exportDiv"
				stripe
				>
					<el-table-column label="产品编号" prop="batch">
					</el-table-column>
					<el-table-column label="7号车间生产" prop="7号车间生产" align="center">
						<el-table-column label="规格">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.产品规格 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="实际重量/KG">
						</el-table-column>
						<el-table-column label="合格重量/KG">
						</el-table-column>
						<el-table-column label="应出数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_real }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_ok }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格率">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_合格率 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="炸纹">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_zw }}</span>
							</template>
						</el-table-column>
						<el-table-column label="气泡">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_qp }}</span>
							</template>
						</el-table-column>
						<el-table-column label="炸头">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_zt }}</span>
							</template>
						</el-table-column>
						<el-table-column label="条纹">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_tw }}</span>
							</template>
						</el-table-column>
						<el-table-column label="弯曲">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_wq }}</span>
							</template>
						</el-table-column>
						<el-table-column label="断">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_d }}</span>
							</template>
						</el-table-column>
						<el-table-column label="粘料">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_nl }}</span>
							</template>
						</el-table-column>
						<el-table-column label="杂质">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_zz }}</span>
							</template>
						</el-table-column>
						<el-table-column label="其他">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_count_n_qt }}</span>
							</template>
						</el-table-column>
						<el-table-column label="出料">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_出料人 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="切料">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_切料人 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="备注">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.棒料成型_备注 }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="8号车间中检" prop="8号车间中检" align="center">
						<el-table-column label="时间">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="接收数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_ok }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格率">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_合格率 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="纹">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_tw }}</span>
							</template>
						</el-table-column>
						<el-table-column label="气泡">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_qp }}</span>
							</template>
						</el-table-column>
						<el-table-column label="裂">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_l }}</span>
							</template>
						</el-table-column>
						<el-table-column label="弯">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_w }}</span>
							</template>
						</el-table-column>
						<el-table-column label="扁">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_b }}</span>
							</template>
						</el-table-column>
						<el-table-column label="青">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_q }}</span>
							</template>
						</el-table-column>
						<el-table-column label="杂质">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_zz }}</span>
							</template>
						</el-table-column>
						<el-table-column label="矫正">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_count_n_jz }}</span>
							</template>
						</el-table-column>
						<el-table-column label="交送人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_车间执行人 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="接收人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_仓库执行人 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="备注">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.七车间入库_备注 }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="6号车间加工" prop="6号车间加工" align="center">
						<el-table-column label="领棒日期">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间领料_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="领取数量">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间领料_count }}</span>
							</template>
						</el-table-column>
						<!-- 平头 -->
						<el-table-column label="平头">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_平头_count_real }}</span>
							</template>
						</el-table-column>
						<el-table-column label="摔断">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_平头_count_n_sd }}</span>
							</template>
						</el-table-column>
						<el-table-column label="少">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_平头_count_n_s }}</span>
							</template>
						</el-table-column>
						<el-table-column label="加工日期">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_平头_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="操作人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_平头_操作人 }}</span>
							</template>
						</el-table-column>
						<!-- 粘头接收数 -->
						<el-table-column label="粘头接收数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粘铁头_count_use }}</span>
							</template>
						</el-table-column>
						<el-table-column label="气泡">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粘铁头_count_n_qp }}</span>
							</template>
						</el-table-column>
						<el-table-column label="少">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粘铁头_count_n_s }}</span>
							</template>
						</el-table-column>
						<el-table-column label="加工日期">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粘铁头_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="操作人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粘铁头_操作人 }}</span>
							</template>
						</el-table-column>
						<!-- 粗中细接收数 -->
						<el-table-column label="粗中细接收数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_use }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格率">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_合格率 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="皮">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_n_p }}</span>
							</template>
						</el-table-column>
						<el-table-column label="掉头">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_n_dt }}</span>
							</template>
						</el-table-column>
						<el-table-column label="断裂">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_n_dl }}</span>
							</template>
						</el-table-column>
						<el-table-column label="炸裂">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_n_zl }}</span>
							</template>
						</el-table-column>
						<el-table-column label="气泡">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_n_qp }}</span>
							</template>
						</el-table-column>
						<el-table-column label="杂质">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_count_n_zz }}</span>
							</template>
						</el-table-column>
						<el-table-column label="加工日期">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="操作人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_粗中细磨_操作人 }}</span>
							</template>
						</el-table-column>
						<!-- 抛光接收数 -->
						<el-table-column label="抛光接收数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_use }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格率">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_合格率 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="掉头">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_dt }}</span>
							</template>
						</el-table-column>
						<el-table-column label="断裂">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_dl }}</span>
							</template>
						</el-table-column>
						<el-table-column label="气泡">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_qp }}</span>
							</template>
						</el-table-column>
						<el-table-column label="划伤">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_hs }}</span>
							</template>
						</el-table-column>
						<el-table-column label="少">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_s }}</span>
							</template>
						</el-table-column>
						<el-table-column label="杂质">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_zz }}</span>
							</template>
						</el-table-column>
						<el-table-column label="其他">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_count_n_qt }}</span>
							</template>
						</el-table-column>
						<el-table-column label="加工日期">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="操作人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_抛光_操作人 }}</span>
							</template>
						</el-table-column>
						<!-- 开槽接收数 -->
						<el-table-column label="开槽接收数">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_开槽_count_use }}</span>
							</template>
						</el-table-column>
						<!-- <el-table-column label="合格率" prop="合格率">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_开槽_合格率 }}</span>
							</template>
						</el-table-column> -->
						<el-table-column label="切割划伤">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_开槽_hs }}</span>
							</template>
						</el-table-column>
						<el-table-column label="加工日期">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_开槽_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="操作人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.六车间_开槽_操作人 }}</span>
							</template>
						</el-table-column>
						<!-- 6车间自己的检验 -->
						<!-- <el-table-column label="检测接收数" prop="检测接收数">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="磕划" prop="磕划">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="锥" prop="锥">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="皮" prop="皮">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="不亮" prop="不亮">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="纹" prop="纹">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="小" prop="小">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="少" prop="少">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="杂质" prop="杂质">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="裂" prop="裂">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="色差" prop="色差">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="碎" prop="碎">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
							<template #default="scope" v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</template>
						</el-table-column> -->
					</el-table-column>
					<el-table-column label="技术质量" align="center">
						<el-table-column label="终检">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.成品检验_count }}</span>
							</template>
						</el-table-column>
						<el-table-column label="划伤">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.成品检验_count_n_hs }}</span>
							</template>
						</el-table-column>
						<el-table-column label="其他">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.成品检验_count_n_qt }}</span>
							</template>
						</el-table-column>
						<el-table-column label="时间">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.成品检验_日期 }}</span>
							</template>
						</el-table-column>
						<el-table-column label="合格重量/KG">
							<!-- <template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.产品批次编号 }}</span>
							</template> -->
						</el-table-column>
						<el-table-column label="检验人">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.成品检验_操作人 }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="6号领取加工-发货合格率">
						<template #default="scope">
							<span v-if="scope.row.data">{{ scope.row.data.六车间_批次生产合格率 }}</span>
						</template>
					</el-table-column>
					<el-table-column label="7号生产-发货合格率">
						<template #default="scope">
							<span v-if="scope.row.data">{{ scope.row.data.七车间_批次应出合格率 }}</span>
						</template>
					</el-table-column>
				</scTable>
		</el-main>
	</el-container>
</template>

<script>
function deepCopy(obj) {
	return JSON.parse(JSON.stringify(obj));
}
export default {
	name: "chart",
	data() {
		return {
			params: {
				ordering:'-last_time',
				batch__contains:'ZJ2',
			},
			query:{
				last_time__gte:'',
				last_time__lte:'',
			},
			apiObj: this.$API.wpm.batchst,
			options:[],
			tableData:[],
		};
	},
	methods: {
		handleQuery(){
			this.$refs.table.queryData(this.query);
		},
	},
};
</script>

<style scoped>
</style>
