Blame view

src/components/RightToolbar/index.vue 3.04 KB
yuanshuhui authored
1
2
<template>
  <div class="top-right-btn">
yuanshuhui authored
3
    <el-row v-if="noSearch">
yuanshuhui authored
4
5
6
7
8
9
10
11
12
13
14
      <el-tooltip
        class="item"
        effect="dark"
        :content="showSearch ? '隐藏搜索' : '显示搜索'"
      >
        <el-button
          size="mini"
          circle
          icon="el-icon-search"
          @click="toggleSearch()"
        />
yuanshuhui authored
15
16
      </el-tooltip>
      <el-tooltip class="item" effect="dark" content="刷新" placement="top">
yuanshuhui authored
17
18
19
20
21
22
23
        <el-button
          size="mini"
          circle
          icon="el-icon-refresh"
          @click="refresh()"
        />
      </el-tooltip>
yuanshuhui authored
24
25
26
27
28
29
30
31
32
33
34
35
36
37
      <el-tooltip class="item" effect="dark" content="筛选" placement="top">
        <el-popover
          placement="bottom"
          width="100"
          trigger="click"
          style="margin-left: 10px"
        >
          <el-button
            slot="reference"
            size="mini"
            circle
            icon="el-icon-s-tools"
          ></el-button>
yuanshuhui authored
38
          <el-checkbox-group v-model="selectData">
yuanshuhui authored
39
40
41
42
43
44
            <el-checkbox
              v-for="item in col_data"
              :key="item.title"
              :label="item.title"
              :checked="item.istrue"
              style="padding: 4px"
yuanshuhui authored
45
              :disabled="item.disabled"
yuanshuhui authored
46
yuanshuhui authored
47
48
49
50
            />
          </el-checkbox-group>
        </el-popover>
      </el-tooltip>
yuanshuhui authored
51
52
53
54
55
56
57
58
59
    </el-row>
    <el-row v-else>
      <el-tooltip class="item" effect="dark" content="刷新" placement="top">
        <el-button
          size="mini"
          circle
          icon="el-icon-refresh"
          @click="refresh()"
        />
yuanshuhui authored
60
      </el-tooltip>
61
62
63
64
65
66
67
68
69
70
71
72
73
74
       <el-tooltip class="item" effect="dark" content="筛选" placement="top">
        <el-popover
          placement="bottom"
          width="100"
          trigger="click"
          style="margin-left: 10px"
        >
          <el-button
            slot="reference"
            size="mini"
            circle
            icon="el-icon-s-tools"
          ></el-button>
yuanshuhui authored
75
          <el-checkbox-group v-model="selectData">
76
77
78
79
80
81
            <el-checkbox
              v-for="item in col_data"
              :key="item.title"
              :label="item.title"
              :checked="item.istrue"
              style="padding: 4px"
yuanshuhui authored
82
              :disabled="item.disabled"
yuanshuhui authored
83
84
            />
yuanshuhui authored
85
86
87
88
          </el-checkbox-group>
        </el-popover>
      </el-tooltip>
yuanshuhui authored
89
90
91
92
93
94
95
    </el-row>
  </div>
</template>
<script>
export default {
  name: "RightToolbar",
  data() {
yuanshuhui authored
96
97
    return {
      show: this.noSearch,
yuanshuhui authored
98
99
      col_data: this.colData,
      selectData: [],
yuanshuhui authored
100
    };
yuanshuhui authored
101
102
103
104
105
106
  },
  props: {
    showSearch: {
      type: Boolean,
      default: true,
    },
yuanshuhui authored
107
108
    noSearch: {
      type: Boolean,
yuanshuhui authored
109
      default: true,
yuanshuhui authored
110
    },
yuanshuhui authored
111
112
113
114
    colData: {
      type: Array,
      default: () => []
    }
yuanshuhui authored
115
116
117
118
119
  },
  watch: {
    selectData(newVal, oldVal) {
      this.$emit("selectData", newVal);
    },
yuanshuhui authored
120
  },
yuanshuhui authored
121
122
123
124
125
126
127
128
  methods: {
    //搜索
    toggleSearch() {
      this.$emit("update:showSearch", !this.showSearch);
    },
    //刷新
    refresh() {
      this.$emit("queryTable");
yuanshuhui authored
129
    }
yuanshuhui authored
130
131
132
  },
};
</script>