<!--
  @description: 集约化评标明细-获取集约化评标计划
  @author:肖文龙
  @date: 2020年3月11日15:15:13
-->
<template>
  <div>
    <el-dialog
      :visible.sync="dialogData.dialog"
      :close-on-click-modal="false"
      title="选择时间"
      width="440px"
      custom-class="el-dialog__body-p0"
      top="calc((100vh - 301px) / 2)"
    >
      <section class="main" style="margin-bottom: 10px;">
        <el-form ref="formData" :model="formData" :rules="rules">
          <el-form-item ref="evaluationEndTime" label="开标时间段" label-width="110px" prop="evaluationEndTime">
            <el-date-picker
              v-model="evaluationEndTime"
              :picker-options="disabledPickerOptions"
              :format="elValueFormat"
              style="width: 300px"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            />
          </el-form-item>
        </el-form>
      </section>
      <!--底部操作按钮-->
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirm">确 定</el-button>
        <el-button @click="dialogData.dialog = false">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'GetIntensiveevalDetailDialog',
  props: {
    dialogData: {
      type: Object,
      default: function() {
        return {
          dialog: false // 弹窗状态
        }
      }
    }
  },
  data() {
    return {
      formData: {
        evaluationEndTime: '', // 评标结束时间
        evaluationStartTime: '', // 评标开始时间
        gainPlanMethod: '01' // 获取计划方式(00重新获取,对比原数据 01重新获取,删除原数据)
      },
      evaluationEndTime: [], // 开标时间段
      // 必填校验
      rules: {
        evaluationEndTime: [{ required: true, message: '请选择', trigger: 'change' }] // 评标结束时间
      }
    }
  },
  watch: {
    // 开标时间段
    evaluationEndTime(val) {
      this.formData.evaluationStartTime = this.$Moment(val[0]).format(this.momentSaveFormat)// 评标开始时间
      this.formData.evaluationEndTime = this.$Moment(val[1]).format(this.momentSaveFormat)// 评标结束时间
    }
  },
  methods: {
    // 确定
    confirm() {
      this.$refs.formData.validate((valid) => {
        if (valid) {
          this.$emit('getIntensiveevalDetailInfo', this.formData)
          this.dialogData.dialog = false
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>
