<template>
  <div class="tablesearch">
    <a-form layout="inline">
      <a-row :gutter="48">
        <a-col :md="8" :sm="24">
          <a-form-item :label="'Code'">
            <a-input placeholder="Code" v-model="searchParams.Code" allow-clear />
          </a-form-item>
        </a-col>
        <a-col :md="8" :sm="24">
          <a-form-item :label="$t('site.table.tableSearch.是否启用')">
            <a-select :placeholder="$t('site.table.tableSearch.是否启用')" v-model="searchParams.IsEnabled" :style="{ width: '150px' }">
              <a-select-option :value="0">{{$t('site.table.tableSearch.禁用')}} </a-select-option>
              <a-select-option :value="1">{{$t('site.table.tableSearch.启用')}} </a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md="(!advanced && 8) || 24" :sm="24">
          <div class="funBtn">
            <a-button
              type="primary"
              @click="searchTable"
              class="search-btn"
            >
              {{$t("查询")}}
            </a-button>
            <a-button type="defalut" @click="resetSearchTable">{{$t("重置")}}</a-button>
          </div>
        </a-col>
      </a-row>
    </a-form>
  </div>
</template>

<script>
export default {
  data () {
    return {
      searchParams: {
        Code: '',
        IsEnabled: '',
      },
      advanced: false,
    }
  },
  methods: {
    toggleAdvanced () {
      this.advanced = !this.advanced
    },
    searchTable () {
      this.$emit('searchTable', this.searchParams)
    },
    resetSearchTable () {
      this.searchParams = {
        Code: '',
        IsEnabled: '',
      }
      this.$emit('refresh', this.searchParams)
    },
  },
}
</script>


