<template>
  <div>
    <div
      v-if="
        productsObj &&
        productsObj.name != 'undefined' &&
        productsObj.feedQuantity != 'undefined'
      "
    >
      <div class="title_box rx-bc mt6">
        <div class="name">在制品 </div>

        <div class="rx-bc"> </div>
      </div>

      <div class="material">
        <div class="content_table">
          <div class="item rx-sc">
            <div class="rx ww33">
              <div class="lable rx-cc">名称</div>
              <div class="content">
                {{ productsObj.name + '-在制品' }}
              </div>
            </div>

            <div class="rx ww33">
              <div class="lable rx-cc">牌号</div>
              <div class="content">{{ productsObj.brandNu }}</div>
            </div>

            <div class="rx ww33">
              <div class="lable rx-cc">型号</div>
              <div class="content">{{ productsObj.modelType }}</div>
            </div>
          </div>

          <div class="item rx-sc">
            <div class="rx ww33">
              <div class="lable rx-cc">数量</div>
              <div class="content rx-sc">
                <div>
                  {{ productsObj.extInfo.sourceQuantity || 0 }}
                  {{ productsObj.unit }}</div
                >
              </div>
            </div>

            <div class="rx ww33">
              <div class="lable rx-cc">投料数量</div>
              <div class="content content_num rx-sc">
                <el-input
                  size="mini"
                  v-model="productsObj.feedQuantity"
                  type="digit"
                  @input="maxFeedQuantity()"
                  placeholder="请输入投料数量"
                />
              </div>
            </div>
          </div>

          <div class="del_box">
            <el-link
              type="danger"
              icon="el-icon-delete"
              @click="getDelete(index)"
            ></el-link>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'productsBom',
    props: {
      itemObj: {
        type: Object,
        default: () => {}
      },
      productsObj: {
        type: Array,
        default: () => {}
      }
    },

    computed: {},

    data() {
      return {};
    },

    methods: {
      maxFeedQuantity() {
        if (this.productsObj.feedQuantity > this.itemObj.formingNum) {
          this.$set(this.productsObj, 'feedQuantity', this.itemObj.formingNum);
        }
      }
    }
  };
</script>

<style scoped lang="scss"></style>
