<template>
  <base-form slot="content" ref="ruleForm" :data="searchData">
    <div slot="footer">
      <el-button :loading="listLoading" icon="el-icon-search" class="xl-form-btn bgc1" @click="searchHandle">查询</el-button>
      <el-button type="small" icon="el-icon-plus" class="xl-form-btn bgc1" @click="openPopup">添加公众号文章</el-button>
      <el-button type="small" icon="el-icon-plus" class="xl-form-btn bgc2" @click="openIESPopup">添加新资讯</el-button>
      <el-button :loading="listLoading" class="xl-form-btn bgc4" @click="updateHandle">更新统计</el-button>
      <!-- <el-button :loading="listLoading" icon="el-icon-document" class="xl-form-btn bgc2" @click="toExportExcel">导出{{ this.$route.meta.title }}信息</el-button> -->
    </div>
  </base-form>
</template>
<script>
export default {
  props: {
    listLoading: Boolean
  },
  inject: ['parentData'],
  data() {
    return {
      searchData: [
        { label: '标题', key: 'title' },
        { label: '分类', key: 'information_category', type: 'select', options: this.$dictData.information_category},
        { label: '状态', key: 'hide_status', type: 'select', class: 'c-3', options: this.$dictData.hide_status },
        { label: '文章类型', key: 'news_type', type: 'select', class: 'c-3', options: this.$dictData.news_type },
      ]
    }
  },
  methods: {
    updateHandle () {
      this.$api.house.adminformationcountcache().then(res => {
        this.$msg('更新成功！')
      })
    },
    openPopup () {
      this.parentData.openPopup()
    },
    openIESPopup () {
      this.parentData.openIESPopup()
    },
    searchHandle() {
      const oldform = this.$refs.ruleForm.baseForm
      const newForm = { ...oldform }
      this.$emit('change', newForm)
    }
  }
}
</script>
