<template>
	<el-container>
		<el-header>
			<div class="right-panel">
				<el-select 
					v-model="query.batch" 
					style="width: 200px" 
					@change="batchChange"
				>
					<el-option 
						v-for="item in options" 
						:key="item.batch" 
						:label="item.batch" 
						:value="item.batch">
					</el-option>
				</el-select>
				<el-date-picker
					v-model="query.date"
					type="date"
					placeholder="查询日期"
					value-format="YYYY-MM-DD"
					style="width: 150px; margin-right: 10px"
				>
				</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
					:data="tableData"
					id="exportDiv"
					stripe
					hideDo
					hidePagination
				>
					<el-table-column label="产品编号" prop="产品编号">
					</el-table-column>
					<el-table-column label="7号车间生产" prop="7号车间生产" align="center">
						<el-table-column label="规格" prop="规格">
						</el-table-column>
						<el-table-column label="实际重量/KG" prop="实际重量">
						</el-table-column>
						<el-table-column label="合格重量/KG" prop="合格重量">
						</el-table-column>
						<el-table-column label="应出数" prop="应出数">
						</el-table-column>
						<el-table-column label="合格数" prop="合格数">
						</el-table-column>
						<el-table-column label="废品数" prop="废品数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="炸纹" prop="炸纹">
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
						</el-table-column>
						<el-table-column label="炸头" prop="炸头">
						</el-table-column>
						<el-table-column label="条纹" prop="条纹">
						</el-table-column>
						<el-table-column label="弯曲" prop="弯曲">
						</el-table-column>
						<el-table-column label="断" prop="断">
						</el-table-column>
						<el-table-column label="粘料" prop="粘料">
						</el-table-column>
						<el-table-column label="杂质" prop="杂质">
						</el-table-column>
						<el-table-column label="其他" prop="其他">
						</el-table-column>
						<el-table-column label="出料" prop="出料">
						</el-table-column>
						<el-table-column label="切料" prop="切料">
						</el-table-column>
						<el-table-column label="备注" prop="备注">
						</el-table-column>
					</el-table-column>
					<el-table-column label="8号车间中检" prop="8号车间中检" align="center">
						<el-table-column label="时间" prop="时间">
						</el-table-column>
						<el-table-column label="接收数" prop="接收数">
						</el-table-column>
						<el-table-column label="合格数" prop="合格数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="纹" prop="纹">
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
						</el-table-column>
						<el-table-column label="裂" prop="裂">
						</el-table-column>
						<el-table-column label="弯" prop="弯">
						</el-table-column>
						<el-table-column label="扁" prop="扁">
						</el-table-column>
						<el-table-column label="青" prop="青">
						</el-table-column>
						<el-table-column label="杂质" prop="杂质">
						</el-table-column>
						<el-table-column label="矫正" prop="矫正">
						</el-table-column>
						<el-table-column label="交送人" prop="交送人">
						</el-table-column>
						<el-table-column label="接收人" prop="接收人">
						</el-table-column>
						<el-table-column label="备注" prop="备注">
						</el-table-column>
					</el-table-column>
					<el-table-column label="6号车间加工" prop="6号车间加工" align="center">
						<el-table-column label="领棒日期" prop="领棒日期">
						</el-table-column>
						<el-table-column label="领取数量" prop="领取数量">
						</el-table-column>
						<el-table-column label="平头" prop="平头">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="摔断" prop="摔断">
						</el-table-column>
						<el-table-column label="少" prop="少">
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
						</el-table-column>

						<el-table-column label="粘头接收数" prop="粘头接收数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
						</el-table-column>
						<el-table-column label="少" prop="少">
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
						</el-table-column>

						<el-table-column label="粗中细接收数" prop="粗中细接收数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="皮" prop="皮">
						</el-table-column>
						<el-table-column label="掉头" prop="掉头">
						</el-table-column>
						<el-table-column label="断裂" prop="断裂">
						</el-table-column>
						<el-table-column label="炸裂" prop="炸裂">
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
						</el-table-column>
						<el-table-column label="杂质" prop="杂质">
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
						</el-table-column>

						<el-table-column label="抛光接收数" prop="抛光接收数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="掉头" prop="掉头">
						</el-table-column>
						<el-table-column label="断裂" prop="断裂">
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
						</el-table-column>
						<el-table-column label="划伤" prop="划伤">
						</el-table-column>
						<el-table-column label="少" prop="少">
						</el-table-column>
						<el-table-column label="杂质" prop="杂质">
						</el-table-column>
						<el-table-column label="其他" prop="其他">
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
						</el-table-column>

						<el-table-column label="开槽接收数" prop="开槽接收数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="切割划伤" prop="切割划伤">
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
						</el-table-column>

						<el-table-column label="检测接收数" prop="检测接收数">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="磕划" prop="磕划">
						</el-table-column>
						<el-table-column label="锥" prop="锥">
						</el-table-column>
						<el-table-column label="皮" prop="皮">
						</el-table-column>
						<el-table-column label="不亮" prop="不亮">
						</el-table-column>
						<el-table-column label="纹" prop="纹">
						</el-table-column>
						<el-table-column label="气泡" prop="气泡">
						</el-table-column>
						<el-table-column label="小" prop="小">
						</el-table-column>
						<el-table-column label="少" prop="少">
						</el-table-column>
						<el-table-column label="杂质" prop="杂质">
						</el-table-column>
						<el-table-column label="裂" prop="裂">
						</el-table-column>
						<el-table-column label="色差" prop="色差">
						</el-table-column>
						<el-table-column label="碎" prop="碎">
						</el-table-column>
						<el-table-column label="加工日期" prop="加工日期">
						</el-table-column>
						<el-table-column label="操作人" prop="操作人">
						</el-table-column>
					</el-table-column>
					<el-table-column label="技术质量" prop="技术质量" align="center">
						<el-table-column label="终检" prop="终检">
						</el-table-column>
						<el-table-column label="合格率" prop="合格率">
						</el-table-column>
						<el-table-column label="划伤" prop="划伤">
						</el-table-column>
						<el-table-column label="其他" prop="其他">
						</el-table-column>
						<el-table-column label="时间" prop="时间">
						</el-table-column>
						<el-table-column label="合格重量/KG" prop="合格重量">
						</el-table-column>
					</el-table-column>
					<el-table-column label="6号领取加工-发货合格率" prop="6号领取加工-发货合格率">
					</el-table-column>
					<el-table-column label="7号生产-发货合格率" prop="7号生产-发货合格率">
					</el-table-column>
				</scTable>
		</el-main>
	</el-container>
</template>

<script>
function deepCopy(obj) {
	return JSON.parse(JSON.stringify(obj));
}
export default {
	name: "chart",
	data() {
		return {
			query: {
				batch: "",
				date:''
			},
			options:[],
			tableData:[],
		};
	},
	mounted() {
		let that = this;
		that.getOptions();	
		// that.getTableData();
	},
	methods: {
		//获取物料批次
		getOptions(){
			let that = this;
			let obj = {};
			obj.page = 0;
			obj.type__in = "10,20";
			obj.is_hidden = false;
			that.options = [];
			that.$API.mtm.material.list.req(obj).then((res) => {
				if(res.length>0){
					that.options = res;
				}
			});
		},
		//获取表格数据
		getTableData(){
			let that = this;
			let obj = {};
			obj.query = that.query;
			that.tableData =[];
			that.$API.bi.dataset.exec.req('batch_search', obj).then((res) => {
				if(res.data2.ds0){
					that.tableData = res.data2.ds0;
				}
			});
		},
		searchTypeChange(){
			this.query.batch = '';
		},
		batchChange(val){
		
		},
		handleQuery(){
			this.getTableData();
		},
	},
};
</script>

<style scoped>
#bachart1{
	width: 100%;
	height: 500px;
}

.tableHead {
	background:rgb(0,176,240);
	height:40px;
}
.tableTh{
	width:120px;
	height:36px;
}
.tableTd{
	width:120px;
	height:36px;
}
</style>
