<!-- 免检申请 -->
<template>
  <modal v-model="modal" :footer-hide="true" width="700px" class-name="vertical-center-modal">
    <!--  表单主要内容  -->
    <div class="content">
      <div class="title">
        免检申请
      </div>
      <div class="sub-title border">
        <span>合同信息</span>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">合同编码：</div>
          <div class="value">{{ data.purchaseBillNo }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">供应商：</div>
          <div class="value">{{ data.supplier }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">物料名称：</div>
          <div class="value">{{ data.materialName }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">到货时间：</div>
          <div class="value">{{ data.arriveTime }}</div>
        </div>
        <div class="col">
          <div class="label">到货数量：</div>
          <div class="value">{{ data.inStockQty }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">批次号：</div>
          <div class="value">{{ data.batchNo }}</div>
        </div>
        <div class="col">
          <div class="label">批次数量：</div>
          <div class="value">{{ data.batchQty }}</div>
        </div>
      </div>
      <div class="sub-title border">
        <span>申请信息</span>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">申请人：</div>
          <div class="value">{{ data.userName }}</div>
        </div>
        <div class="col">
          <div class="label">申请时间：</div>
          <div class="value">{{ data.applyTime }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">申请原因：</div>
          <div class="value">
            <Input v-model="data.reason" type="textarea" disabled :rows="4"/>
            </div>
        </div>
      </div>
<!--      <div class="sub-title border">-->
<!--        <span>明细列表</span>-->
<!--      </div>-->
<!--      <div class="row">-->
<!--        <my-table :data="data.checkDetails" :columns="columns" :height="200" :is-show-filter="false" :is-show-page="false"></my-table>-->
<!--      </div>-->
    </div>
  </modal>
</template>

<script>
import MyTable from '_c/my-table/my-table'
import { openPic } from '@/libs/util'

export default {
  name: 'contract-form',
  data () {
    return {
      tabIndex: 0,
      formData: {},
      remark: '',
      modal: false,
      flowsList: [],
      infoData: {},
      columns: [
        {
          title: '序号',
          type: 'index',
          width: 60,
          align: 'center'
        },
        {
          title: '物料标签值',
          key: 'rfidCode',
          minWidth: 200
        },
        {
          title: '抽检米数',
          key: 'checkQty',
          minWidth: 150
        },
        {
          title: '短少',
          key: 'lakeNum',
          minWidth: 150
        },
        {
          title: '抽纱',
          key: 'drawnworkNum',
          minWidth: 150
        },
        {
          title: '褶皱',
          key: 'foldNum',
          minWidth: 150
        },
        {
          title: '脏污',
          key: 'dirtNum',
          minWidth: 150
        },
        {
          title: '破洞',
          key: 'potholeNum',
          minWidth: 150
        },
        {
          title: '缩水',
          key: 'shrinkPercent',
          minWidth: 150
        },
        {
          title: '质检结论',
          key: 'checkJudgmentStr',
          minWidth: 150
        },
        {
          title: '图片',
          key: 'imageUrl',
          minWidth: 200,
          render: (h, params) => {
            let arr = params.row.imageUrl.split(',')
            let els = []
            arr.forEach(item => {
              els.push(
                h('p', {
                  style: {
                    cursor: 'pointer',
                    color: 'blue',
                    padding: '3px 0',
                    textDecoration: 'underline'
                  },
                  on: {
                    click () {
                      openPic(item)
                    }
                  }
                }, item.split('/')[item.split('/').length - 1])
              )
            })
            return h('div',
              els
            )
          }
        }
      ]
    }
  },
  components: {
    MyTable
  },
  props: {
    data: {
      type: Object,
      default () {
        return {}
      }
    },
    value: {
      type: Boolean,
      default: false,
      require: true
    }
  },
  watch: {
    value: {
      handler (n) {
        this.modal = n
      },
      immediate: true
    },
    modal (n) {
      this.$emit('input', n)
      if (n) {

      }
    }
  },
  methods: {
    cancel () {
      this.remark = ''
      this.modal = false
    }
  }
}
</script>

<style lang="less" scoped>
.content {
  padding: 10px 0;
  border-radius: 5px;
  background-color: #FFFFFF;
  &.sub-content {
    background-color: #f2f2f2;
    margin-top: 3px;
    .title {
      padding-top: 0;
    }
  }
  .title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
  }
  .sub-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px;
    font-size: 14px;
    font-weight: bold;
    &.border {
      border-bottom: 1px solid #000000;
    }
    .go {
      font-size: 10px;
      font-weight: normal;
      color: #0000ff;
    }
    .tabs {
      margin-bottom: 1px;
      display: flex;
      justify-content: space-between;
      border: 1px solid #5d6c7b;
      border-radius: 2px;
      font-size: 12px;
      font-weight: normal;
      .tab {
        width: 50px;
        text-align: center;
        border-right: 1px solid #5d6c7b;
        cursor: pointer;
        &:last-child {
          border-right: none;
        }
        &.active {
          background-color: rgba(22, 155, 213, 1);
          color: #FFFFFF;
        }
      }
    }
  }
  .row-wrap {
    position: relative;
    .pic {
      position: absolute;
      right: 20px;
      top: 50%;
      transform: translateY(-50%);
      width: 50px;
      img {
        width: 100%;
      }
    }
  }
  .row {
    padding: 0 20px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .col {
      flex: 1;
      display: flex;
      align-items: flex-start;
      .value {
        flex: 1;
      }
    }
  }
  .card {
    margin-bottom: 5px;
    background-color: #FFFFFF;
    border: 1px solid rgba(215, 215, 215, 1);
    border-radius: 5px;
    .border {
      border-bottom: 1px solid #5d6c7b;
    }
    .line {
      width: 100%;
      border-bottom: 1px solid #5d6c7b;
    }
  }
  .table {
    padding: 0 20px;
    padding-bottom: 20px;
    table {
      border-collapse:collapse;
      border:none;
      width: 100%;
      tr {
        td,th {
          padding: 5px;
          text-align: center;
          border:solid #dcdee2 1px;
          position: relative;
          font-size: 12px;
        }
        th {
          background-color: #eeeeee;
        }
      }
    }
  }
}
/deep/ .ivu-modal-body {
  padding: 0;
  max-height: 90vh;
  overflow: auto;
}
/deep/ .ivu-modal-content {
  background-color: transparent;
}
</style>
