<template>
	<el-drawer
		v-model="visible"
		title="检验记录"
		:size="'90%'"
		destroy-on-close
		@closed="$emit('closed')"
	>
		<el-container>
			<el-main>
				<scTable
					ref="drawer_table"
					:apiObj="apiObj"
					row-key="id"
					stripe
					:params="paramsObj"
				>
					<el-table-column label="检验类型">
						<template #default="scope">
							<el-tag v-if="scope.row.type2 == 10">
								{{ type2_[scope.row.type2] }}
							</el-tag>
							<el-tag v-else type="success">
								{{ type2_[scope.row.type2] }}
							</el-tag>
						</template>
					</el-table-column>
					<el-table-column label="物料批次" prop="batch">
					</el-table-column>
					<el-table-column label="检验数" prop="count">
					</el-table-column>
					<el-table-column label="合格数" prop="count_ok">
					</el-table-column>
					<el-table-column label="不合格数" prop="count_notok">
					</el-table-column>
					<el-table-column label="检验日期" prop="test_date">
					</el-table-column>
					<el-table-column label="检验人" prop="test_user_name">
					</el-table-column>
				</scTable>
			</el-main>
		</el-container>
	</el-drawer>
</template>
<script>
export default {
	emits: ["closed"],
	props: {
		wm: { type: String, default: "" },
	},
	data() {
		return {
			visible: false,
			apiObj: null,
			paramsObj: {},
			form: {},
			type2_: {
				10: "抽检",
				20: "全检",
			},
			isSaveing: false,
		};
	},
	mounted() {},
	methods: {
		open() {
			this.visible = true;
			this.paramsObj.wm = this.wm;
			this.apiObj = this.$API.qm.ftestwork.list;
			return this;
		},
		table_del(row){
			this.$API.qm.ftestwork.delete.req(row.id).then((res) => {
				this.$refs.drawer_table.fetch();
			});
		},
	},
};
</script>
