<template>
  <el-dialog
    title="详情"
    append-to-body
    :modelValue="addDialog"
    width="90%"
    @close="closeDialog"
    @open="open"
  >
    <el-descriptions :column="4" border title="物料需求信息" :label-width="150">
      <el-descriptions-item label="作业中心">{{
        addForm.wcName
      }}</el-descriptions-item>
      <el-descriptions-item label="建立人员">{{ addForm.createUserName }}</el-descriptions-item>
      <el-descriptions-item label="建立时间">{{ addForm.createTime }}</el-descriptions-item>

      <el-descriptions-item label="物料编码">{{ addForm.goodsCode }}</el-descriptions-item>
      <el-descriptions-item label="班组实际消耗(克)">{{
        addForm.teamActualConsumption
      }}</el-descriptions-item>
      <el-descriptions-item label="班组预添加(克)">{{
        addForm.teamPreAddGram
      }}</el-descriptions-item>
      <el-descriptions-item label="物料名称">{{ addForm.goodsName }}</el-descriptions-item>
      <el-descriptions-item label="可使用定额(克)">{{
        addForm.usableQuotaGram
      }}</el-descriptions-item>
      <el-descriptions-item label="累计结余(克)">{{
        addForm.accumulatedBalanceGram
      }}</el-descriptions-item>
      <el-descriptions-item label="本次添加涉及单号">{{
        addForm.involvingRecordCode
      }}</el-descriptions-item>
      <el-descriptions-item label="本次剩余单号余量">{{
        addForm.involvingSurplus
      }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions
      class="margin-top"
      :column="4"
      border
      title="审批信息"
      v-if="addForm.status != 10000"
    >
    <template>
      <el-descriptions-item label="审批人">{{
        addForm.approvalManName
      }}</el-descriptions-item>
      <el-descriptions-item label="审批时间">{{
        addForm.approvalTime
      }}</el-descriptions-item>
      <el-descriptions-item label="审批结果">{{
        addForm.approvalStatusName
      }}</el-descriptions-item>
      <el-descriptions-item label="审批意见">{{
        addForm.approvalMemo
      }}</el-descriptions-item>
      </template> 
    </el-descriptions>
    <el-descriptions class="margin-top" :column="4" border title="订单信息"> </el-descriptions>
    <el-table :data="tableData">
      <el-table-column label="槽号" prop="slotName" align="center"></el-table-column>
      <el-table-column label="化验值" prop="testVal" align="center"></el-table-column>
      <el-table-column label="申报添加金钾(克)" prop="goodsDemand" align="center"></el-table-column>
      <el-table-column
        label="申报添加银钾(克)"
        prop="goodsDemand"
        align="center"
      ></el-table-column>
      <el-table-column label="理论值" prop="saveBoardVal" align="center"></el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
import { getOrderMoldPlanCaDeatils } from '@/api/productionManagement/addRequirements';
export default {
  props: {
    addDialog: {
      type: Boolean,
      default: false,
    },
    id: {
      type: String,
    },
  },
  data() {
    return {
      addForm: {},
      sumAvailable: '0.0',
      tableData: [],
    };
  },
  mounted() {},
  methods: {
    async open() {
      //接口暂无
      try {
        const ref = await getOrderMoldPlanCaDeatils({ id: this.id });
        if (ref.data.code == 200) {
          this.addForm = ref.data.data;
          this.tableData = ref.data.data.yieldOrderList;
        }
      } catch (err) {
        console.log(err);
      }
    },
    closeDialog() {
      this.$emit('closeDialog');
    },
  },
};
</script>

<style lang="scss" scoped>
.margin-top {
  margin-top: 24px;
}

:deep(.is-bordered-content) {
  width: 280px;
}
</style>
