<template>
  <div>
    <div class="material">
      <div class="content_table">
        <div class="item rx-sc">
          <div class="rx ww50">
            <div class="lable rx-cc">工单编号</div>
            <div class="content">
              {{ item.code }}
            </div>
          </div>

          <div class="rx ww30">
            <div class="lable rx-cc">产品编码</div>
            <div class="content">{{ item.productCode }}</div>
          </div>

          <div class="rx ww20">
            <div class="lable rx-cc">批次号</div>
            <div class="content">{{ item.batchNo }}</div>
          </div>
        </div>

        <div class="item rx-sc">
          <div class="rx ww50">
            <div class="lable rx-cc">产品名称</div>
            <div class="content">{{ item.productName }}</div>
          </div>
          <div class="rx ww30">
            <div class="lable rx-cc">生产数量</div>
            <div class="content rx-sc">
              <div>{{ item.formingNum }}</div>
              <div class="unit">{{ item.unit }}</div>
            </div>
          </div>

          <div class="rx ww20">
            <div class="lable rx-cc ww60">重量</div>
            <div class="content content_num">
              <div>{{ item.formingWeight }}</div>
              <div class="unit">{{ item.weightUnit }}</div>
            </div>
          </div>
        </div>

        <div class="item rx-sc">
          <div class="rx ww50">
            <div class="lable rx-cc">生产编号</div>
            <div class="content" :title="item.productionCodes">{{
              item.productionCodes
            }}</div>
          </div>
          <div class="rx ww30">
            <div class="lable rx-cc">最新工单状态</div>
            <div class="content rx-sc">
              <div>{{ sumStatus(item) }}</div>
            </div>
          </div>

          <div class="rx ww20">
            <div class="lable rx-cc ww60">报工类型</div>
            <div class="content content_num">
              <div>{{ item.singleReport == 1 ? '单个报工' : '批量报工' }}</div>
            </div>
          </div>
        </div>

        <!-- <span v-if="row.outsourceStatus == 1">未委外</span>
            <span v-if="row.outsourceStatus == 2">委外中</span>
            <span v-if="row.outsourceStatus == 3">完成委外-未质检</span> -->

        <div class="item rx-sc">
          <div class="rx ww50">
            <div class="lable rx-cc">委外状态</div>
            <div v-if="item.outsourceStatus">
              <div class="content" v-if="item.outsourceStatus == 1">未委外</div>
              <div class="content" v-if="item.outsourceStatus == 2">委外中</div>
              <div class="content" v-if="item.outsourceStatus == 3"
                >完成委外-未质检</div
              >
            </div>
            <div v-else>
              <div class="content">{{ '' }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'workOrderBom',
    props: {
      item: {
        type: Object,
        default: () => {}
      },
      isDetails: {
        type: Boolean,
        default: false
      }
    },

    computed: {},

    data() {
      return {};
    },

    methods: {
      sumStatus(row) {
        if (row.reportStatus === 1) {
          return '已报工';
        }
        if (row.feedStatus === 1) {
          return '已投料';
        }
      }
    }
  };
</script>

<style scoped lang="scss">
  .material {
    margin-top: 6px;
    .content_table {
      width: 100%;
      border: 1px solid #e3e5e5;
      position: relative;

      .item {
        display: flex;
        border-bottom: 1px solid #e3e5e5;

        .lable {
          width: 72px;
          text-align: center;
          background-color: #f7f9fa;
          font-size: 12px;
          border-right: 1px solid #e3e5e5;
          flex-shrink: 0;
        }

        .lable80 {
          width: 80px !important;
          font-size: 12px;
        }

        .lable90 {
          width: 90px !important;
        }

        .lable100 {
          width: 100px !important;
        }

        .ww60 {
          width: 60px;
        }

        .content {
          width: 250px;
          min-height: 32px;
          font-size: 14px;
          line-height: 14px;
          font-style: normal;
          font-weight: 400;
          padding: 9px 4px;
          box-sizing: border-box;
          word-wrap: break-word;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          flex-grow: 1 !important;

          .unit {
            padding: 0 2px;
            font-size: 12px;
            color: #404446;
          }
        }

        .content_num {
          display: flex;
          align-items: center;
          padding: 2px;
          --input-background-color: #f0f8f2;
        }

        .pd2 {
          padding: 2px 4px;
        }

        &:last-child {
          border-bottom: none;
        }
      }

      .ww55 {
        width: 55%;
      }

      .ww50 {
        width: 50%;
      }

      .ww45 {
        width: 45%;
      }

      .ww40 {
        width: 40%;
      }

      .ww30 {
        width: 30%;
      }

      .ww33 {
        width: 33.33%;
      }

      .ww20 {
        width: 20%;
      }

      .del_box {
        position: absolute;
        right: 2px;
        top: 2px;
      }

      .sort_index {
        position: absolute;
        left: 2px;
        top: 2px;
        width: 14px;
        height: 14px;
        line-height: 14px;
        text-align: center;
        color: #fff;
        font-size: 12px;
        border-radius: 50%;
        background: rgb(21, 122, 44);
      }
    }
  }
</style>
