index.vue 2.58 KB
Newer Older
wangdanlei's avatar
wangdanlei committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
/**
* @Description: 左侧搜索组件
* @author wx
* @date 2020/4/7
*/
<template>
  <div class="search-result-com">
    <div class="dee-search-form">
      <div style="padding-bottom: 20px;" :class="showAll ? 'static-height' : ''">
        <dee-form
          label-position="top"
          :form="basicData"
          :form-data="formData"
          :params="layout"
        />
      </div>
      <span v-if="showMore" :class="showAll ? 'icon bottom-pic' : 'icon top-pic' " @click="changeShowAll" />
      <el-button
        type="primary"
        class="searchBtn"
        @click="handleSearch"
      >查询</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DeeSearchTable',
  components: {},
  props: {
    formData: {
      type: Array,
      required: true
    },
    basicData: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      layout: {
        size: 'medium'
      },
      showSearch: true,
      showAll: this.formData[0].data.length > 3 // 是否展示所有搜索条件
    }
  },
  computed: {
    showMore() {
      if (this.formData[0].data.length > 3) {
        return true
      } else {
        return false
      }
    }
  },
  created() {
  },
  methods: {
    handleSearch() {
      this.$emit('handleSearch', this.form.propForm)
    },
    handleOperate(type, data) {
      const obj = {
        type: type,
        data: data
      }
      this.$emit('handleOperate', obj)
    },
    changeShowAll() {
      this.showAll = !this.showAll
    }
  }
}
</script>

<style lang="scss">
.search-result-com{
  .dee-search-form{
      margin-bottom: 20px;
      .static-height{
        height:204px;
        overflow: hidden;
      }
      .el-form-item__label{
        white-space: nowrap;
        color:#333;
      }
      // .dee-form2{
      //   .el-form-item {
      //     margin-bottom: 0 !important;
      //   }
      // }
      .searchBtn{
        display: block;
        margin:0 auto;
        width:120px;
        height: 36px;
        line-height: 10px;
      }
      .icon{
        display: block;
        width:18px;
        height:18px;
        margin: 20px auto;
        background-size: cover;
        background-position: center;
      }
      .bottom-pic{
        background-image: url('/icons/tobottom.png');
      }
      .top-pic{
        background-image: url('/icons/totop.png');
      }
      .over-hidden{
        overflow: hidden;
      }

      .w0{
        width:0;
      }
      .flex-start{
        display: flex;
        justify-content: flex-start;
        img{
          margin-right:10px;
        }
      }
  }
}

</style>