<template>
  <header-collapse>
    <base-form slot="content" :data="searchData" ref="ruleForm">
      <div slot="footer">
        <el-button :loading="listLoading" icon="el-icon-search" class="xl-form-btn bgc1" @click="searchHandle">查询</el-button>
        <el-button :loading="listLoading" class="xl-form-btn t4" @click="updateCash">更新缓存</el-button>
      </div>
    </base-form>
  </header-collapse>
</template>
<script>
export default {
  props: {
    listLoading: Boolean
  },
  inject: ['parentData'],
  data () {
    return {
      searchData: [
        {label: '类型名称', key: 'dict_name'},
        {label: '编号', key: 'dict_type'},
      ]
    }
  },
  methods: {
    searchHandle () {
      const oldform = this.$refs.ruleForm.baseForm
      let newForm = {...oldform}
      this.$emit('change', newForm)
    },
    updateCash () {
      this.$store.dispatch('user/getDict').then().then(res => {
        this.$msg('更新成功~')
      })
    }
  }
}
</script>
