<!-- 物料设置 -->
<template>
  <modal v-model="modal" width="500px">
    <div class="title" slot="header">
      物料设置
    </div>
    <div class="footer" slot="footer">
      <Button @click="cfm" class="btn" type="primary">提交</Button>
      <Button @click="cancel" class="btn">取消</Button>
    </div>
    <!--  表单主要内容  -->
    <div class="content" ref="print">
      <div class="sub-title border">
        <span>基础设置</span>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">滞留周期：</div>
          <div class="value">
            <Input v-model="delayPeriod" style="width: 120px;"/> 天
          </div>
        </div>
      </div>
<!--      <div class="sub-title border">-->
<!--        <span>盘点设置</span>-->
<!--      </div>-->
<!--      <div class="row">-->
<!--        <div class="col">-->
<!--          <div class="label">日盘数量：</div>-->
<!--          <div class="value">-->
<!--            <Input v-model="everyDayCheckCount" style="width: 120px;"/> 个-->
<!--          </div>-->
<!--        </div>-->
<!--      </div>-->
    </div>
  </modal>
</template>

<script>
import { GetMaterialSet, SaveMaterialSet } from '@/api/baseData'
export default {
  name: 'quality-form',
  data () {
    return {
      modal: false,
      delayPeriod: '',
      everyDayCheckCount: ''
    }
  },
  components: {
  },
  props: {
    value: {
      type: Boolean,
      default: false,
      require: true
    }
  },
  watch: {
    value: {
      handler (n) {
        this.modal = n
      },
      immediate: true
    },
    modal (n) {
      this.$emit('input', n)
      if (n) {
        this.$post('/api/storage-restructure/material/getDelayPeriod').then(res => {
          if (res.code === 200) {
            
            this.delayPeriod = res.data
          }
        })
        // GetMaterialSet().then(res => {
        //   if (res.code === 0) {
        //     this.delayPeriod = res.result.delayPeriod
        //     this.everyDayCheckCount = res.result.everyDayCheckCount
        //   }
        // })
      }
    }
  },
  methods: {
    cfm () {
      this.$post('/api/storage-restructure/material/setDelayPeriod',{
        value:this.delayPeriod
      }).then(res => {
          if (res.code === 200) {
            this.$Message.info(res.msg || '设置成功！')
            this.modal = false
          }
        })
    },
    cancel () {
      this.modal = false
    }
  }
}
</script>

<style lang="less" scoped>
.content {
  .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;
    }
  }
  .row {
    padding: 0 20px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .col {
      flex: 1;
      display: flex;
      align-items: center;
      .table {
        width: 100%;
        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;
              }
            }
            &.green {
              color: #4B7902;
            }
            &.red {
              color: red;
            }
            &.orange {
              color: #B8741A;
            }
          }
        }
      }
    }
  }
  .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;
    }
  }
}
</style>
