<script setup lang="ts">

import {getReworkItem, reworkRecord} from "@/api/fault";
import ReworkShow from "@/views/quality/rework/components/rework-show.vue";



const props = defineProps({
  row: {
    type: Object,
    required: true,
  },
});

const rework=ref(null);
onMounted(async () => {
   reworkRecord(props.row.businessId).then(
       (data)=>{
         rework.value=data.data;
       }
   );
});
const tableData=ref({});
const reworkItem=ref({});
const showState=ref(false);
const showTable = () => {
  reworkItem.value.recordId = props.row.businessId;
  getReworkItem(reworkItem.value).then((data) => {
    if (data.code === "200") {
      tableData.value = rework.value;
      tableData.value.itemList = data.data;
      showState.value = true;
    } else {
      ElMessage({
        message: data.msg,
        type: "error",
      });
    }
  });
};



</script>

<template>
  <div class="box">

    <el-button
        type="success"
        style="margin-bottom: 10px"
        @click="showTable()"
    >查看返工记录卡</el-button
    >
  </div>
  <ReworkShow v-model="showState" :tableData="tableData" />

</template>

<style>
.cell-item {
  display: flex;
  align-items: center;
}
</style>
