<template>
	<el-drawer
		title="查看"
		v-model="visible"
		:size="1000"
		destroy-on-close
		@closed="$emit('closed')"
		:close-on-click-modal="false"
	>
		<el-container v-loading="loading">
			<el-main>
				<el-card shadow="hover">
					<el-descriptions :column="3" title="基本信息">
						<el-descriptions-item label="工艺名称:">{{
							form.name
						}}</el-descriptions-item>
						<el-descriptions-item label="物料名称:">{{
							form.material_name
						}}</el-descriptions-item>
					</el-descriptions>
				</el-card>
				<el-card style="margin-top: 8px" shadow="hover">
					<scTable
						ref="tables"
						:data="tableData"
						row-key="id"
						hidePagination
						hideDo
						stripe
					>
						<el-table-column label="排序" prop="sort" width="50">
						</el-table-column>
						<el-table-column label="工序" prop="process_name">
						</el-table-column>
						<el-table-column label="输入" prop="material_in_name">
						</el-table-column>
						<el-table-column label="输出" prop="material_out_name">
						</el-table-column>
						<el-table-column label="出材率" prop="out_rate">
						</el-table-column>
						<el-table-column label="切分融合数量" prop="div_number">
						</el-table-column>
						<el-table-column label="工时" prop="hour_work">
						</el-table-column>
						<el-table-column label="批次校验">
							<template #default="scope">
								<el-tag v-if="scope.row.batch_bind" type="success">是</el-tag>
							</template>
						</el-table-column>
					</scTable>
				</el-card>
			</el-main>
		</el-container>
	</el-drawer>
</template>
<script>
export default {
	emits: ["success", "closed"],
	data() {
		return {
			loading: false,
			visible: false,
			isSaveing: false,
			state_: {
				10: "创建中",
				20: "审批中",
				40: "进行中",
				50: "已完成",
			},
			form: {},
			tableData: [],
		};
	},
	mounted() {
		this.tableData = [];
	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data) {
			let that = this;
			Object.assign(that.form, data);
			that.getRoute(that.form.material);
		},
		//文件列表加载
		getRoute(id) {
			this.$API.mtm.route.list
				.req({ page: 0, routepack: this.form.id })
				.then((res) => {
					this.tableData = res;
				});
		},
	},
};
</script>

<style scoped>
.el-transfer {
	--el-transfer-panel-width: 345px !important;
}
</style>
