<template>
    <div class="filter-container">
      <el-date-picker
        v-model="searchDatas.date"
        :picker-options="pickerOptions"
        class="filter-item"
        type="daterange"
        format="yyyy年MM月dd日"
        value-format="yyyy-MM-dd"
        align="left"
        unlink-panels
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      />
      <!-- <el-date-picker v-model="searchDatas.date" type="date" placeholder="日期" class="filter-item"></el-date-picker> -->
      <el-button type="primary" class="filter-item" icon="el-icon-search" @click="btn_search">搜索</el-button>
      <el-button type="primary" class="filter-item" icon="el-icon-plus" @click="btn_add">添加</el-button>
      <el-button v-permission="'HY-import'" type="primary" class="filter-item" @click="btn_import"><svg-icon icon-class="daoru" />导入</el-button>
      <el-button v-permission="'HY-export'" type="primary" class="filter-item" @click="btn_export">导出</el-button>
    </div>
</template>

<script>
import { getProviceCity, getDictionary } from '@/api/commonAPI'
import { pickerOptions } from '@/utils'
import addOrEdit from './addOrEdit'
import importFile from './importFile'

export default {
  name: 'SearchFilter',
  props: {
    searchDatas: {
      required: true,
      type: Object,
      default() {
        return {
          date: '', //日期
        }
      }
    },
    selectedId: Array,
  },
  data() {
    return {
      pickerOptions // 日期数据
    }
  },
  created() {
  },
  methods: {
    btn_search() {
      console.log(this.searchDatas.date)
      this.$emit('search', this.searchDatas)
    },
    btn_export() {
      this.$emit('export', this.searchDatas)
    },
    btn_deletes() {
      this.$emit('delorders')
    },
    btn_add() {
      console.log("123123",this.selectedId);
      this.$layer.iframe({
        content: {
          content: addOrEdit, // 传递的组件对象
          parent: this, // 当前的vue对象
          data: { rowid: '' } // props//该方法会自动添加一个key为layerid的值， 该值为创建层的id， 可以直接使用
        },
        area: ['80%', '90%'],
        title: '添加满减活动'
      })
    },
    btn_import() {
      // if (!this.planId) {
      //   this.$message.warning('请先选择一行!')
      //   return
      // }
      this.$layer.iframe({
        content: {
          content: importFile, // 传递的组件对象
          parent: this, // 当前的vue对象
          data: { 'rowid': '' }// props//该方法会自动添加一个key为layerid的值， 该值为创建层的id， 可以直接使用
        },
        area: ['40%', '380px'],
        shadeClose: false,
        title: '导入号码'
      })
    },
  }
}
</script>

<style rel="stylesheet/scss" scoped>
.filter-container .filter-item.el-select{
  margin-right: 10px;
}
.filter-container .filter-item.el-date-editor{
  margin-right: 10px;
}
</style>
