<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.成品内质复检_含缺陷_毛坯长点_比例">{{ 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="复丝结构" 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="污染" 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="合格数" align="center" class-name="colorheader4">
					<el-table-column label="数量" class-name="colorheader4">
						<template #default="scope">
							<span>{{ scope.row.data.成品内质复检_count_ok }} </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">
					<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 = 'batch';
			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>
