<template>
  <el-dialog title="详情" append-to-body :modelValue="openShow" width="70%" @close="closeDialog">
    <el-descriptions title="物料记录"></el-descriptions>
    <el-table :data="detailsInfo.boxbarcodeDetailsVO.yieldOrderList|| []" style="width: 100%">
      <el-table-column type="index" width="50" label="序号"> </el-table-column>
      <el-table-column prop="cardNo" label="流程卡号" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="yoCode" label="生产单号" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="partCode" label="零件号" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="partName" label="零件名称" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="actualWeighing" label="重量">
          <template #default="scope">{{ scope.row.actualWeighing ? Number(scope.row.actualWeighing).toFixed(2)+'g' : '0g' }}</template>
      </el-table-column>
    </el-table>
    <el-descriptions title="执行记录" style="margin-top: 10px;"></el-descriptions>
    <el-table :data="detailsInfo.taskExecuteRecordList|| []" style="width: 100%">
      <el-table-column type="index" width="50" label="序号"> </el-table-column>
      <el-table-column prop="startPos" label="开始位置" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="endPos" label="结束位置" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="method" label="执行状态" show-overflow-tooltip> </el-table-column>
      <el-table-column prop="createTime" label="执行时间" show-overflow-tooltip> </el-table-column>
    </el-table>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="closeDialog">取 消</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script>
import { taskDetails } from '@/api/logisticsManagement/logisticsDistribution';

export default {
  props: {
    showDialog: {
      type: Boolean,
      default: false,
    },
    rowItem: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      openShow: false,
      detailsInfo: {},
    };
  },
  mounted() {
    this.openShow = this.showDialog;
    this.detailsFn();
  },
  methods: {
    async detailsFn() {
      await taskDetails({ boxBarcode: this.rowItem.boxBarcode, taskId: this.rowItem.id }).then(
        res => {
          this.detailsInfo = res.data.data;
        }
      );
    },
    closeDialog() {
      this.openShow = false;
      this.$emit('closeDialog');
    },
  },
};
</script>
<style lang="scss" scoped></style>
