<template>
	<div>
		<p style="font-size: 18px;font-weight: 600;text-align: center;margin: 10px;">{{queryDate}}采购统计</p>
		<scTable :data="tableData2" hideDo hidePagination class="exportTables">
			<el-table-column type="index" width="50" />
			<el-table-column
				label="年份"
				prop="年"
				width="80"
			/>
			<el-table-column
				v-if="queryType == '月'"
				width="50"
				label="周"
				prop="周"
			/>
			<el-table-column
				v-else
				width="50"
				label="月份"
				prop="月"
			/>
			<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>
		</scTable>
	</div>
</template>

<script>
export default {
	name: "all_cg",
	props: {
		queryType:{
			type: String,
			default: "月"
		},
		queryDate:{
			type: String,
			default: ""
		},
		start_date:{
			type: String,
			default: ""
		},
		end_date:{
			type: String,
			default: ""
		},
	},
	data() {
		return {
			currentYear: "",
			currentMonth: "",
			typeOptions: ["月", "年"],
			tableData2: [],
			materialItem:{},
		};
	},
	mounted() {
		this.$nextTick(() => {
		    this.getTable();
		})
	},
	methods: {
		getTable() {
			let that = this;
			let obj = {
				query: {
					start_date: that.start_date,
					end_date: that.end_date,
					mio_type: "pur_in",
				},
			};
			let exec = that.queryType == "月" ? "saleOutWeek" : "saleOutMonth";
			that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
				that.tableData2 = [];
				if (res.data2.ds0) {
					let data = res.data2.ds0;
					that.tableData2 = data;
				}
			});
		},
	},
};
</script>

<style scoped>
.tables {
	position: absolute;
	top: 4px;
	right: 6px;
	z-index: 10;
}
</style>
