<template>
    <el-date-picker
        v-model="QStartDate"
        :picker-options="pickerBeginDateBefore"
        type="year"
        value-format="yyyy"
       :placeholder="$t('objFill.xuanzhenian')"
        :clearable="((clearable==false||clearable)&&!isQueryHistoryData)?clearable:true"
        @change="getChange">
    </el-date-picker>
</template>
<script>
  export default {
    props:['dateTime','clearable'],
    data() {
      return {
        QStartDate: '',
        pickerBeginDateBefore: {
          disabledDate: time => {
            if(!this.isQueryHistoryData){
              let endTime = this.TourDateRestrictions()
              return time && endTime.getTime() >= time.getTime();
            }
          }
        },
        isQueryHistoryData: false,
      }
    },
    created() {

    },
    mounted() {

      this.GetSupperOrderEditAuth()
    },
    watch: {
      QStartDate:{
        handler(n,o){

        },
        deep:true,
      },
      dateTime:{
        handler(n,o){
          this.QStartDate = this.dateTime
        },
        deep:false,
        immediate: true,
      }
    },
    methods: {
      getChange(){
        this.$emit('change',this.QStartDate)
      },
      GetSupperOrderEditAuth() {
        var actionCode = this.$AuthCode.isQueryHistoryData;
        this.CheckUserAuth(actionCode, res => {
          if (res.data.resultCode == 1 && res.data.data == 1) {
            this.isQueryHistoryData = true;
          }
        });
      },
    }
  }
</script>
