<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="datetime"
					placeholder="变动时间起"
					value-format="YYYY-MM-DD HH:mm:ss"
					clearable
					style="width: 200px; margin: 5px"
				>
				</el-date-picker>
				<el-date-picker
					v-model="query.last_time__lte"
					type="datetime"
					placeholder="变动时间止"
					value-format="YYYY-MM-DD HH:mm:ss"
					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="params"
				id="exportDiv"
				stripe
			>
				<el-table-column type="index" width="50"  fixed="left"/>
				<el-table-column label="板号" prop="number" fixed="left">
				</el-table-column>
				<el-table-column label="炉号" prop="number" fixed="left">
				</el-table-column>
				<el-table-column label="扭后内质" align="center" class-name="colorheader1">
					<el-table-column label="可加工" class-name="colorheader1">
						<el-table-column label="合格" class-name="colorheader1">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
							</template>
						</el-table-column>
						<el-table-column label="可加工" class-name="colorheader1">
							<template #default="scope">
								<span v-if="scope.row.data">{{1- scope.row.data['扭转检测_缺陷项_放大率￠2mm不合格'] }}</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 v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
							</template>
						</el-table-column>
						<el-table-column label="大点" class-name="colorheader1">
							<template #default="scope">
								<span v-if="scope.row.data">{{1- scope.row.data['扭转检测_缺陷项_放大率￠2mm不合格'] }}</span>
							</template>
						</el-table-column>
					</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 v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率16mm }}</span>
						</template>
					</el-table-column>
					<el-table-column label="轻" class-name="colorheader2">
						<template #default="scope">
							<span v-if="scope.row.data">{{ 1-scope.row.data['扭转检测_缺陷项_放大率￠16mm不合格'] }}</span>
						</template>
					</el-table-column>
					<el-table-column label="重" class-name="colorheader2">
						<template #default="scope">
							<span v-if="scope.row.data">{{ 1-scope.row.data['扭转检测_缺陷项_放大率￠16mm不合格'] }}</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 v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率16mm }}</span>
						</template>
					</el-table-column>
					<el-table-column label="轻" class-name="colorheader3">
						<template #default="scope">
							<span v-if="scope.row.data">{{ 1-scope.row.data['扭转检测_缺陷项_放大率￠16mm不合格'] }}</span>
						</template>
					</el-table-column>
					<el-table-column label="重" class-name="colorheader3">
						<template #default="scope">
							<span v-if="scope.row.data">{{ 1-scope.row.data['扭转检测_缺陷项_放大率￠16mm不合格'] }}</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 v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率16mm }}</span>
						</template>
					</el-table-column>
					<el-table-column label="轻" class-name="colorheader4">
						<template #default="scope">
							<span v-if="scope.row.data">{{ 1-scope.row.data['扭转检测_缺陷项_放大率￠16mm不合格'] }}</span>
						</template>
					</el-table-column>
					<el-table-column label="重" class-name="colorheader4">
						<template #default="scope">
							<span v-if="scope.row.data">{{ 1-scope.row.data['扭转检测_缺陷项_放大率￠16mm不合格'] }}</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="分辨率" align="center" class-name="colorheader5">
					<el-table-column label="国内" class-name="colorheader5">
						<el-table-column label="合格" class-name="colorheader5">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
							</template>
						</el-table-column>
						<el-table-column label="可加工" class-name="colorheader5">
							<template #default="scope">
								<span v-if="scope.row.data">{{1- scope.row.data['扭转检测_缺陷项_放大率￠2mm不合格'] }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="出口" class-name="colorheader5">
						<template #default="scope">
							<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
						</template>
					</el-table-column>
					<el-table-column label="断丝" class-name="colorheader5">
						<template #default="scope">
							<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
						</template>
					</el-table-column>
					<el-table-column label="不合格" class-name="colorheader5">
						<template #default="scope">
							<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="炸裂" align="center" class-name="colorheader6">
					<el-table-column label="可加工" class-name="colorheader6">
						<el-table-column label="完好" class-name="colorheader6">
							<template #default="scope">
								<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
							</template>
						</el-table-column>
						<el-table-column label="崩炸" class-name="colorheader6">
							<template #default="scope">
								<span v-if="scope.row.data">{{1- scope.row.data['扭转检测_缺陷项_放大率￠2mm不合格'] }}</span>
							</template>
						</el-table-column>
					</el-table-column>
					<el-table-column label="炸废" class-name="colorheader6">
						<template #default="scope">
							<span v-if="scope.row.data">{{ scope.row.data.扭转检测_检测项_放大率2mm }}</span>
						</template>
					</el-table-column>
				</el-table-column>
				<el-table-column label="扭转角合格数" align="center" class-name="colorheader7">
					<template #default="scope">
						<span v-if="scope.row.扭转检测_缺陷项_花丝不合格">{{scope.row.扭转检测_countok }}</span>
					</template>
				</el-table-column>
				<el-table-column label="加工数" align="center" class-name="colorheader1">
					<template #default="scope">
						<span v-if="scope.row.data.扭转检测_count_use">{{scope.row.data.扭转检测_count_use }}</span>
					</template>
				</el-table-column>
				<el-table-column label="外形偏" align="center" class-name="colorheader2">
					<template #default="scope">
						<span v-if="scope.row.data.扭转检测_缺陷项_外形偏不合格">{{scope.row.data.扭转检测_缺陷项_外形偏不合格 }}</span>
					</template>
				</el-table-column>
				<el-table-column label="备注" align="center" class-name="colorheader3">
					<template #default="scope">
						<span v-if="scope.row.扭转检测_备注">{{scope.row.扭转检测_备注 }}</span>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
</template>

<script>
export default {
	name: "statistics_guan",
	data() {
		return {
			params: {
				ordering:'-create_time',
				
				querys:[[{field:"wm",value:0,compare:"isnull"},{field:"data__has_key",compare:"",value:"扭转检测_批次号"}]],
			},
			query:{
				batch__contains:'',
				last_time__gte:'',
				last_time__lte:'',
				
			},
			apiObj: this.$API.wpm.wpr.query,
			options:[],
			tableData:[],
		};
	},
	methods: {
		handleQuery(){
			let that = this;
			let querys = [],arr1=[],arr2=[];
			let obj = {},obj1 = {},obj2 = {};
			obj.field = 'batch__contains';
			obj.value = that.query.batch__contains;
			obj.compare = '';

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

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

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

<style scoped>
</style>
