<template>
	<el-container>
		<el-header>
			<div class="right-panel">
				<el-date-picker
					v-model="query.last_time__gte"
					type="date"
					value-format="YYYY-MM-DD"
					placeholder="开始时间"
					style="width: 150px"
				/>
				<el-date-picker
					v-model="query.last_time__lte"
					type="date"
					value-format="YYYY-MM-DD"
					placeholder="结束时间"
					style="margin-left: 2px; width: 150px"
				/>
				<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" prop="batch" width="90">
					<template #default="scope">
						{{ scope.row.data.成品自检_日期 }}
					</template>
				</el-table-column>
				<el-table-column label="自检数" fixed="left">
					<template #default="scope">
						{{ scope.row.data.成品自检_count_use }}
					</template>
				</el-table-column>
				<el-table-column label="腐蚀" class-name="colorheader1">
					<el-table-column label="数量" class-name="colorheader1">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_腐蚀?scope.row.data.成品自检_含缺陷_腐蚀:0}}</span>
						</template>
					</el-table-column>
					<el-table-column label="比例" class-name="colorheader1">
						<template #default="scope">
							<span v-if="scope.row.data.成品自检_含缺陷_腐蚀A_比例">{{ scope.row.data.成品自检_含缺陷_腐蚀A_比例}}%</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.成品自检_含缺陷_亮道?scope.row.data.成品自检_含缺陷_亮道:0}}</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="大/凹面坑" 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>
				<el-table-column label="小面坑" class-name="colorheader4">
					<el-table-column label="数量" class-name="colorheader4">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_小面坑?scope.row.data.成品自检_含缺陷_小面坑:0}}</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="台划" class-name="colorheader5">
					<el-table-column label="数量" class-name="colorheader5">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_台划?scope.row.data.成品自检_含缺陷_台划:0}}</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="平面划" class-name="colorheader6">
					<el-table-column label="数量" class-name="colorheader6">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_平面划?scope.row.data.成品自检_含缺陷_平面划:0}}</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="圆角划" class-name="colorheader7">
					<el-table-column label="数量" class-name="colorheader7">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_圆角划?scope.row.data.成品自检_含缺陷_圆角划:0}}</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="倒角麻" class-name="colorheader1">
					<el-table-column label="数量" class-name="colorheader1">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_倒角麻?scope.row.data.成品自检_含缺陷_倒角麻:0}}</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['成品自检_含缺陷_大/凹面麻']?scope.row.data['成品自检_含缺陷_大/凹面麻']:0}}</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="小面麻" 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>
				<el-table-column label="炸废" class-name="colorheader4">
					<el-table-column label="数量" class-name="colorheader4">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_炸废?scope.row.data.成品自检_含缺陷_炸废:0}}</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="台" class-name="colorheader5">
					<el-table-column label="数量" class-name="colorheader5">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_台?scope.row.data.成品自检_含缺陷_台:0}}</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="小崩" class-name="colorheader6">
					<el-table-column label="数量" class-name="colorheader6">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_小崩?scope.row.data.成品自检_含缺陷_小崩:0}}</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="前角崩" class-name="colorheader7">
					<el-table-column label="数量" class-name="colorheader7">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_前角崩?scope.row.data.成品自检_含缺陷_前角崩:0}}</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="平面硌" class-name="colorheader1">
					<el-table-column label="数量" class-name="colorheader1">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_平面硌?scope.row.data.成品自检_含缺陷_平面硌:0}}</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.成品自检_含缺陷_小柱划?scope.row.data.成品自检_含缺陷_小柱划:0}}</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="总厚" 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>
				<el-table-column label="大外划硌" class-name="colorheader4">
					<el-table-column label="数量" class-name="colorheader4">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_大外划硌?scope.row.data.成品自检_含缺陷_大外划硌:0}}</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="台高" class-name="colorheader5">
					<el-table-column label="数量" class-name="colorheader5">
						<template #default="scope">
							<span>{{ scope.row.data.成品自检_含缺陷_台高?scope.row.data.成品自检_含缺陷_台高:0}}</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.成品自检_count_ok }} </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">
					<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 = 'data__成品自检_日期';
			obj1.value = that.query.last_time__gte;
			obj1.compare = 'gte';

			obj2.field = 'data__成品自检_日期';
			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>
