<template>
  <!-- 添加或修改项目信息对话框 -->
  <el-dialog
    title="领料信息"
    v-model="visible"
    width="1100px"
    append-to-body
    draggable
  >
    <div class="form-container">
      <el-table
        ref="furnaceNoRef"
        :data="furnaceNoInfoList"
        row-key="id"
        size="small"
        v-loading="loading"
        border
        height="370px"
        header-row-class-name="list-header-row"
        row-class-name="list-row"
        ><el-table-column type="index" label="行号" width="50" align="center" />
        <el-table-column
          label="厂家"
          align="center"
          width="100px"
          prop="factory"
        />
        <el-table-column
          label="炉号"
          align="center"
          width="100px"
          prop="furnaceNumber"
        />
        <el-table-column
          label="牌号"
          align="center"
          width="100px"
          prop="brandNumber"
        />
        <el-table-column label="规格" align="center" width="70" prop="spec" />
        <el-table-column
          label="材料直径"
          align="center"
          width="80"
          prop="diameter"
        />
        <el-table-column label="形状" align="center" width="60" prop="shape" />
        <el-table-column
          label="来料日期"
          align="center"
          width="100"
          prop="incomingDate"
        />
        <el-table-column
          label="原料编码"
          align="center"
          width="90"
          prop="rawMaterialCode"
        />
        <el-table-column
          label="技术要求1"
          align="center"
          prop="firstTechnicalRequirement"
        />
        <el-table-column
          label="技术要求2"
          align="center"
          prop="secondTechnicalRequirement"
        />
      </el-table>
    </div>
    <template #footer>
      <el-button type="primary" icon="Check" @click="submitForm"
        >确 定</el-button
      >
    </template>
  </el-dialog>
</template>
<script setup>
import { getFurnaceNoInfo } from "@/api/business/furnaceNoInfo.js";
/** 领料信息变量 */
const visible = ref(false);
const loading = ref(false);
const furnaceNoInfoList = ref([]);
/***********************  方法区  ****************************/
/** 打开抽屉 */
function open(row) {
  loading.value = true;
  furnaceNoInfoList.value = [];
  getFurnaceNoInfo({
    productionPlanNo: row.productionPlanNo,
    lineNumber: row.lineNumber,
  }).then((res) => {
    if (res.code === 200 && res.data.length > 0) {
      furnaceNoInfoList.value = res.data;
    } else {
      furnaceNoInfoList.value = [];
    }
  });
  loading.value = false;
  visible.value = true;
}
/** 确定按钮 */
function submitForm() {
  visible.value = false;
}
/** 暴露给父组件的方法 */
defineExpose({
  open,
});
</script>
