ListSearch.vue 2.45 KB
Newer Older
liuxin committed
1 2 3 4
<template>
  <div class="m-table-search">
    <slot v-bind:searchToggle="searchToggle"></slot>
    <div v-if="formCount>3" :class="searchToggle? (formCount%3 == 0?'m-table-search-operation':'m-table-search-operation-bottom'): 'm-table-search-operation-top'" >
潘际乾 committed
5 6
      <el-button size="small" @click="handleReset">{{ $t('buttons.reset') }}</el-button>
      <el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">{{ $t('buttons.query') }}</el-button>
liuxin committed
7
      <el-button type="text" @click="handleToggleSearch">
潘际乾 committed
8
        {{searchToggle? $t('buttons.fold') : $t('buttons.unfold') }}
liuxin committed
9 10 11 12
        <i :class="searchToggle? 'el-icon-arrow-up': 'el-icon-arrow-down'"></i>
      </el-button>
    </div>
    <div v-if="formCount <= 3" :class="formCount == 3? 'm-table-search-operation': 'm-table-search-operation-top'">
潘际乾 committed
13 14
      <el-button size="small" @click="handleReset">{{ $t('buttons.reset') }}</el-button>
      <el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">{{ $t('buttons.query') }}</el-button>
liuxin committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
    </div>
  </div>
</template>

<script>
export default {
  props: {
    formCount: {
      type: Number,
      default: 6
    }
  },
  data: function () {
    return {
      searchToggle: false
    }
  },
  created: function () {
    if (this.formCount <= 3) {
      this.searchToggle = true
    }
  },
  methods: {
    handleReset: function () {
      this.$emit('form-reset')
    },
    handleSearch: function () {
      this.$emit('form-search')
    },
    handleToggleSearch: function () {
      this.searchToggle = !this.searchToggle
      this.$emit('search-toggle', this.searchToggle)
    },
  }
}
</script>

<style>
.m-table-search {
  position: relative;
55 56
  margin: -20px 0 0 0;
  padding: 20px 0px 10px 20px;
liuxin committed
57 58 59 60 61 62 63 64 65 66 67 68
  border-bottom: 10px solid rgb(232, 232, 232);
}
.m-table-search-operation {
  text-align: right;
}
.m-table-search-form {
  position: flex;
  flex-direction: row;
}
.m-table-search-form .el-form-item__content {
  width: calc(100% - 110px);
}
fukai committed
69
/* .m-table-search-form .el-form-item {
liuxin committed
70 71 72 73 74 75 76
  width: 33%;
  margin-right: 0;
  padding-right: 20px;
  box-sizing: border-box;
}
.m-table-search-form .el-form-item:nth-child(3n) {
  padding-right: 0;
fukai committed
77
} */
liuxin committed
78 79 80 81 82

.m-table-operation {
  margin-top: 15px;
}
.m-table-search-operation-top {
liushikai committed
83
  /* position: absolute; */
liuxin committed
84 85
  right: 20px;
  top: 20px;
liushikai committed
86
  text-align: right;
liuxin committed
87 88 89 90 91 92
}
.m-table-search-operation-bottom {
  position: absolute;
  right: 20px;
  bottom: 30px;
}
liushikai committed
93 94 95
.el-button+.el-button {
    margin-left: 7px;
}
liuxin committed
96
</style>