<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-input v-model="query.number__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_name" fixed="left" min-width="100">
					<template #default="scope">
						<span>{{ scope.row.material_name.split('|')[0] }}</span>
					</template>
				</el-table-column>
				<el-table-column label="批次号" fixed="left">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_批次号 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="板号" prop="number" 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="炸" align="center" class-name="colorheader1">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_炸?scope.row.data.中检一_缺陷项_炸:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="偏" align="center" class-name="colorheader2">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_偏?scope.row.data.中检一_缺陷项_偏:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="掉头" align="center" class-name="colorheader3">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_掉头?scope.row.data.中检一_缺陷项_掉头:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="台阶划伤" align="center" class-name="colorheader4">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_台阶划伤?scope.row.data.中检一_缺陷项_台阶划伤:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="柱面划伤" align="center" class-name="colorheader5">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_柱面划伤?scope.row.data.中检一_缺陷项_柱面划伤:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="台棱" align="center" class-name="colorheader6">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_台棱?scope.row.data.中检一_缺陷项_台棱:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="台糙" align="center" class-name="colorheader7">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_台糙?scope.row.data.中检一_缺陷项_台糙:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="尺寸大/小" align="center" class-name="colorheader1">
					<template #default="scope">
						<span>{{ scope.row.data['中检一_缺陷项_尺寸大/小']?scope.row.data['中检一_缺陷项_尺寸大/小']:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="崩" align="center" class-name="colorheader2">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_崩?scope.row.data.中检一_缺陷项_崩:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="修崩/炸" align="center" class-name="colorheader3">
					<template #default="scope">
						<span>{{ scope.row.data['中检一_缺陷项_修崩/炸']?scope.row.data['中检一_缺陷项_修崩/炸']:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="拆头" align="center" class-name="colorheader4">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_拆头?scope.row.data.中检一_缺陷项_拆头:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="外黑" align="center" class-name="colorheader5">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_外黑?scope.row.data.中检一_缺陷项_外黑:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="外磕" align="center" class-name="colorheader6">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_外磕?scope.row.data.中检一_缺陷项_外磕:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="打毛/打台" align="center" class-name="colorheader7">
					<template #default="scope">
						<span>{{ scope.row.data['中检一_缺陷项_打毛/打台']?scope.row.data['中检一_缺陷项_打毛/打台']:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="喷码" align="center" class-name="colorheader1">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_喷码?scope.row.data.中检一_缺陷项_喷码:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="掉皮" align="center" class-name="colorheader2">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_掉皮?scope.row.data.中检一_缺陷项_掉皮:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="量崩" align="center" class-name="colorheader3">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_量崩?scope.row.data.中检一_缺陷项_量崩:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="坑" align="center" class-name="colorheader4">
					<template #default="scope">
						<span>{{ scope.row.data.中检一_缺陷项_坑?scope.row.data.中检一_缺陷项_坑:0 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="粘头人" align="center" class-name="colorheader5">
					<template #default="scope">
						<span>{{ scope.row.data.手工粘头_操作人?scope.row.data.手工粘头_操作人:'' }}</span>
						<span>{{ scope.row.data.光锥粘头_操作人?scope.row.data.光锥粘头_操作人:'' }}</span>
						<span>{{ scope.row.data.自动粘头_操作人?scope.row.data.自动粘头_操作人:'' }}</span>
					</template>
				</el-table-column>
				<el-table-column label="开台人" align="center" class-name="colorheader6">
					<template #default="scope">
						<span>{{ scope.row.data.喷码_一体刀_操作人?scope.row.data.喷码_一体刀_操作人:'' }}</span>
						<span>{{ scope.row.data.喷码_磨床开台_操作人?scope.row.data.喷码_磨床开台_操作人:'' }}</span>
						<span>{{ scope.row.data.光锥一体刀_操作人?scope.row.data.光锥一体刀_操作人:'' }}</span>
						<span>{{ scope.row.data.喷码_小批量一体刀_操作人?scope.row.data.喷码_小批量一体刀_操作人:'' }}</span>
					</template>
				</el-table-column>
				<el-table-column label="拆头人" align="center" class-name="colorheader7">
					<template #default="scope">
						<span>{{ scope.row.data.喷码_拆头_操作人?scope.row.data.喷码_拆头_操作人:'' }}</span>
						<span>{{ scope.row.data.喷码_光锥拆头_操作人?scope.row.data.喷码_光锥拆头_操作人:'' }}</span>
					</template>
				</el-table-column>
				<el-table-column label="喷码人" align="center" class-name="colorheader1">
					<template #default="scope">
						<span>{{ scope.row.data.喷码_操作人?scope.row.data.喷码_操作人:'' }}</span>
					</template>
				</el-table-column>
				<el-table-column label="备注" align="center" class-name="colorheader2">
					<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:"wm",value:false,compare:"isnull"},{field:"data__has_key",compare:"",value:"中检一_批次号"}]],
			},
			query:{
				number__contains:'',
				name__contains:'',
				batch__contains:'',
				last_time__gte:'',
				last_time__lte:'',
			},
			apiObj: this.$API.wpm.wpr.query,
			options:[],
			tableData:[],
		};
	},
	methods: {
		handleQuery(){
			let that = this;
			let querys = [[{field:"wm",value:false,compare:"isnull"},{field:"data__中检一_日期",compare:"isnull",value:false},{field:"data__has_key",compare:"",value:"中检一_批次号"}]];
			let obj = {},obj1 = {},obj2 = {},obj3 = {},obj4 = {};
			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__name';
			obj3.value = that.query.name__contains;
			obj3.compare = 'contains';

			obj4.field = 'number';
			obj4.value = that.query.number__contains;
			obj4.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);
			}
			if(that.query.number__contains!==''&&that.query.number__contains!==null){
				querys[0].push(obj4);
			}
			that.params.querys = querys;
			this.$refs.table.queryData(that.params);
		},
		getCountQt(data,type){
			let count_qt = 0,count = 0;
		   
		}
	},
};
</script>

<style scoped>
</style>
