<template>
	<el-dialog title="历史记录" v-model="visible" width="1400px" height="700px" @close="close" append-to-body draggable  style="font-size: 14px;">
		<el-table ref="dialogTable" :data="recordsList" size="small" v-loading="loading" border height="500px" header-row-class-name="list-header-row" row-class-name="list-row" >
			<el-table-column label="批次号" align="center" prop="lotCode" />
			<el-table-column label="计划单号" align="center" prop="productionPlanNo" width="100" />
			<el-table-column label="产品描述" align="center" prop="productDescription" />
			<el-table-column label="工序" align="center" prop="processAlias" width="100" />
			<el-table-column label="投产量" align="center" prop="prodNum" width="80" />
			<el-table-column label="合格数" align="center" prop="qualifiedNum" width="80" />
			<el-table-column label="废品量" align="center" prop="rejectNum" width="80" />
			<el-table-column label="操作者" align="center" prop="nickName" width="80"/>
			<el-table-column label="设备" align="center" prop="equipmentDetailCode" width="80"/>
			<el-table-column label="载具" align="center" prop="carrierCode" width="80"/>
			<el-table-column label="开始时间" align="center" prop="startTime" >
				<template #default="scope">
                <span>{{
        proxy.moment(scope.row.startTime).format("YYYY-MM-DD HH:mm:ss")
      }}</span>
              </template>
			</el-table-column>
			<el-table-column label="结束时间" align="center" prop="endTime" >
				<template #default="scope">
                <span>{{
        proxy.moment(scope.row.endTime).format("YYYY-MM-DD HH:mm:ss")
      }}</span>
              </template>
			</el-table-column>
			<el-table-column label="修改人" align="center" prop="creatorName" width="80" />
			<el-table-column label="修改时间" align="center" prop="createTime" >
				<template #default="scope">
                <span>{{
        proxy.moment(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss")
      }}</span>
              </template>
			</el-table-column>
		</el-table>
	</el-dialog>
</template>
<script setup>
import { listMaxHistory } from "@/api/business/dayworkItemHistoryMax";
const { proxy } = getCurrentInstance();

/** 历史记录变量 */
const recordsList = ref([])
const visible = ref(false)
const loading = ref(false)
const data = reactive({
	queryParams: {
		dayworkId:null
	}
})
const { queryParams } = toRefs(data)
/**
 * 对话框打开 事件
 */
function open(data) {
	visible.value = true
	queryParams.value.dayworkId = data
	getList()
}

/**
 * 对话框关闭 事件
 */
function close() {
	visible.value = false
}

/**
 * 加载数据
 */
function getList() {
	loading.value = true
	listMaxHistory(queryParams.value).then((res) => {
		recordsList.value = res.rows
		loading.value = false
	})
}

defineExpose({
	open
})
</script>
<style scoped>
.el-table--small {
    font-size: 14px;
}</style>
