<template>
  <div>
    <a-range-picker
        ref="aRangedate"
        :placeholder="timePlaceholder"
        :format="timeFormat"
        :valueFormat="timeFormat"
        :value="value"
        :mode="timeMode"
        :show-time="timeShowTime"
        @change="emptyChange"
    />
  </div>
</template>

<script>
import components from './_import-components/audit-range-picker-import'
export default {
  name: 'AuditRangePicker',
  components,
  props: {
    timeRange: {
      type: Array,
      default: undefined,
    },
    timeFormat:{
      type:String,
      default:'YYYY-MM-DD'
    },
    timePlaceholder:{
      type: Array,
      default:()=>['开始时间', '结束时间'],
    },
    timeMode:{
      type: Array,
      default:()=>['date', 'date'],
    },
    timeShowTime:{
      type:Boolean,
      default:false
    },
  },
  data() {
    return {
      value: [],
    }
  },
  watch: {
    timeRange(val) {
      this.value = val
    },
  },
  methods: {
    emptyChange(val) {
      if (val.length){
        this.$emit('update:timeRange', val)
      } else {
        this.$emit('update:timeRange', [])
      }
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
