<template>
  <a-date-picker
    v-model="value"
    mode="year"
    format="YYYY"
    picker="year"
    :open="dateopen"
    placeholder="请选择年份"
    @openChange="onOpenChange"
    @panelChange="onPanelChange"
  />
</template>

<script>
import components from './_import-components/iam-dm-date-picker-import'

export default {
  name: 'IamDmDatePicker',
  metaInfo: {
    title: 'IamDmDatePicker',
  },
  components,
  props: {
    // 绑定值
    value: {
      type: Object,
      default: null,
    },
    // 字段名
    field: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      dateValue: this.value,
      dateopen: false,
    }
  },
  methods: {
    onPanelChange(val) {
      this.$emit('valChange', this.field, val)
      this.dateopen = false
    },
    onOpenChange(val) {
      this.dateopen = val
    },
  },
}
</script>

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