<template>
	<el-container>
		<el-header>
			<div class="right-panel">
				<el-input v-model="query.name__contains" 
					placeholder="产品名称" 
					clearable 
					style="width: 200px;"
				></el-input>
				<el-input v-model="query.batch__contains" 
					placeholder="批次号" 
					clearable 
					style="width: 200px;"
				></el-input>
				<el-button
					type="primary"
					icon="el-icon-search"
					@click="handleQuery"
				></el-button>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable
				ref="table"
				:apiObj="apiObj"
				:params="params"
				:query="params"
				id="exportDiv"
				row-key="id"
				stripe
			>
				<el-table-column type="index" width="50"  fixed="left"/>
				<el-table-column label="产品名称" prop="material_start_name" fixed="left" min-width="100">
				</el-table-column>
				<el-table-column label="批次编号" fixed="left" prop="batch">
				</el-table-column>
				<el-table-column label="版型" prop="material_start_model" fixed="left">
				</el-table-column>
				<el-table-column label="中检数" fixed="left">
					<template #default="scope">
						<span>{{ scope.row.data.中检二_count_use }}</span>
					</template>
				</el-table-column>
				<el-table-column label="炸废" 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 v-if="scope.row.data.中检二_含缺陷_炸废_比例">{{scope.row.data.中检二_含缺陷_炸废_比例 }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="崩" 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 v-if="scope.row.data.中检二_含缺陷_崩_比例">{{scope.row.data.中检二_含缺陷_崩_比例 }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="划伤" align="center" class-name="colorheader3">
					<el-table-column label="少" class-name="colorheader3">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_划伤少?scope.row.data.中检二_含缺陷_划伤少:0 }}</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 label="多" class-name="colorheader3">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_划伤多?scope.row.data.中检二_含缺陷_划伤多:0 }}</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="斜角/圆角" 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 v-if="scope.row.data.中检二_含缺陷_斜角/圆角_比例">{{scope.row.data.中检二_含缺陷_斜角/圆角_比例 }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="角偏" align="center" class-name="colorheader5">
					<el-table-column label="数量" class-name="colorheader5">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_角偏}}</span>
						</template>
					</el-table-column>
					<el-table-column label="比例" class-name="colorheader5">
						<template #default="scope">
							<span v-if="scope.row.data.中检二_含缺陷_角偏_比例">{{scope.row.data.中检二_含缺陷_角偏_比例 }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="圆角" align="center" class-name="colorheader6">
					<el-table-column label="划伤" class-name="colorheader6">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_圆角划伤}}</span>
						</template>
					</el-table-column>
					<el-table-column label="比例" class-name="colorheader6">
						<template #default="scope">
							<span v-if="scope.row.data.中检二_含缺陷_圆角划伤_比例">{{scope.row.data.中检二_含缺陷_圆角划伤_比例 }}%</span>
						</template>
					</el-table-column>
					<el-table-column label="抛小" class-name="colorheader6">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_圆角抛小}}</span>
						</template>
					</el-table-column>
					<el-table-column label="比例" class-name="colorheader6">
						<template #default="scope">
							<span v-if="scope.row.data.中检二_含缺陷_圆角抛小_比例">{{scope.row.data.中检二_含缺陷_圆角抛小_比例 }}%</span>
						</template>
					</el-table-column>
					<el-table-column label="高亮" class-name="colorheader6">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_圆角高亮}}</span>
						</template>
					</el-table-column>
					<el-table-column label="比例" class-name="colorheader6">
						<template #default="scope">
							<span v-if="scope.row.data.中检二_含缺陷_圆角高亮_比例">{{scope.row.data.中检二_含缺陷_圆角高亮_比例 }}%</span>
						</template>
					</el-table-column>
					<el-table-column label="麻点" class-name="colorheader6">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_含缺陷_圆角麻点}}</span>
						</template>
					</el-table-column>
					<el-table-column label="比例" class-name="colorheader6">
						<template #default="scope">
							<span v-if="scope.row.data.中检二_含缺陷_圆角麻点_比例">{{scope.row.data.中检二_含缺陷_圆角麻点_比例 }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="圆角没抛到/抛光尺寸不足" 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 v-if="scope.row.data['中检二_含缺陷_圆角没抛到/抛光尺寸不足_比例']">{{scope.row.data['中检二_含缺陷_圆角没抛到/抛光尺寸不足_比例'] }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="凹面" 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 v-if="scope.row.data.中检二_含缺陷_凹面偏_比例">{{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.中检二_含缺陷_凹面炸废_比例">{{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.中检二_含缺陷_凹面崩边_比例">{{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.中检二_含缺陷_凹面划伤_比例">{{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.中检二_含缺陷_凹面麻点_比例">{{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.中检二_含缺陷_凹面硌点_比例">{{scope.row.data.中检二_含缺陷_凹面硌点_比例 }}%</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="合格"  class-name="colorheader2">
					<el-table-column label="数量" class-name="colorheader2">
						<template #default="scope">
							<span>{{ scope.row.data.中检二_count_ok }}</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="备注" align="center" class-name="colorheader3">
					<template #default="scope">
						<span>{{ scope.row.data.中检二_缺陷_备注 }}</span>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
</template>

<script>
export default {
	name: "statistics_guan",
	data() {
		return {
			params: {
				ordering:'-data__中检二_小日期',
				querys:[[{field:"data__has_key",compare:"",value:"中检二_日期"}]],
			},
			query:{
				name__contains:'',
				batch__contains:'',
				last_time__gte:'',
				last_time__lte:'',
			},
			apiObj: this.$API.wpm.batchstquery,
			options:[],
			tableData:[],
		};
	},
	methods: {
		handleQuery(){
			let that = this;
			let querys = [[{field:"data__has_key",compare:"",value:"中检二_批次号"}]];
			let obj = {},obj1 = {},obj2 = {},obj3 = {};
			obj.field = 'data__中检二_批次号';
			obj.value = that.query.batch__contains;
			obj.compare = '';

			obj1.field = 'last_time';
			obj1.value = that.query.last_time__gte;
			obj1.compare = 'gte';

			obj2.field = 'last_time';
			obj2.value = that.query.last_time__lte;
			obj2.compare = 'lte';

			obj3.field = 'material_start__name';
			obj3.value = that.query.name__contains;
			obj3.compare = 'contains';

			if(that.query.batch__contains!==''&&that.query.batch__contains!==null){
				querys[0].push(obj);
			}
			if(that.query.last_time__gte!==''&&that.query.last_time__gte!==null){
				querys[0].push(obj1);
			}
			if(that.query.last_time__lte!==''&&that.query.last_time__lte!==null){
				querys[0].push(obj2);
			}
			if(that.query.name__contains!==''&&that.query.name__contains!==null){
				querys[0].push(obj3);
			}
			that.params.querys = querys;
			this.$refs.table.queryData(that.params);
		},
		getCountQt(data,type){
			let count_qt = 0,count = 0;
		   
		}
	},
};
</script>

<style scoped>
</style>
