Blame view

src/components/SelsctLoad/index.vue 3.43 KB
5aef094b   monkeyhouyi   图标,核查处置
1
2
3
4
5
6
7
8
9
  <template>
    <el-select
      :value="value"
      :disabled="disabled"
      filterable
      remote
      clearable
      reserve-keyword
      placeholder="请输入关平台名称"
5aef094b   monkeyhouyi   图标,核查处置
10
      v-loadMore="nextList"
9913f656   monkeyhouyi   巡查上报
11
12
      @select="onChange"
      @blur="onInput"
5aef094b   monkeyhouyi   图标,核查处置
13
14
      @clear="clearHandle"
      @focus="search"
9913f656   monkeyhouyi   巡查上报
15
      :loading="loading && !this.options.length"
5aef094b   monkeyhouyi   图标,核查处置
16
    >
9913f656   monkeyhouyi   巡查上报
17
      <!-- :remote-method="search" :loading="loading" -->
5aef094b   monkeyhouyi   图标,核查处置
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
      <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
  </template>
  
  <script>
  import { getInfoList } from "@/api/baseData/info";
  export default {
    name: "SelsctLoad",
    props: ['value', 'disabled'],
    computed: {
      noMore() {
        return this.total == this.options.length;
      },
    },
    data() {
      return {
        loading: false,
        searchList: {
          pageIndex: 1,
          pageSize: 20,
          sort: "desc",
          sidx: "",
        },
        total: 0,
        options: [],
      };
    },
    mounted() {},
    methods: {
      selectFocus() {
        this.loadList();
      },
      nextList() {
        if (this.loading || this.noMore) return;
9913f656   monkeyhouyi   巡查上报
58
59
60
61
        this.searchList.pageIndex += 1;
        this.$nextTick(() => {
          this.loadList();
        })
5aef094b   monkeyhouyi   图标,核查处置
62
      },
9913f656   monkeyhouyi   巡查上报
63
      search() {
5aef094b   monkeyhouyi   图标,核查处置
64
65
66
67
68
69
70
        this.options = [];
        this.searchList = {
          pageIndex: 1,
          pageSize: 10,
          sort: "desc",
          sidx: "",
        };
9913f656   monkeyhouyi   巡查上报
71
        this.loadList();
5aef094b   monkeyhouyi   图标,核查处置
72
      },
9913f656   monkeyhouyi   巡查上报
73
      loadList() {
5aef094b   monkeyhouyi   图标,核查处置
74
        this.loading = true;
9913f656   monkeyhouyi   巡查上报
75
        getInfoList({ ...this.searchList, keyword: this.value }).then(({ data }) => {
5aef094b   monkeyhouyi   图标,核查处置
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
          let list = [];
          data.list.length &&
            data.list.forEach((item) => {
              list.push({
                label: item.SysytemInfo.SystemName,
                value: item.SysytemInfo.Id,
              });
            });
          this.options = [...this.options, ...list];
          this.total = data.totalCount;
          this.loading = false;
        });
      },
      // 清除选中
      clearHandle() {
        this.value = "";
        this.$emit("input", "");
        this.$emit("change", "");
      },
  
      onChange(v) {
        this.value = v;
        this.$emit("input", this.options.map((item) => item.value == v).label);
        this.$emit("change", v);
      },
9913f656   monkeyhouyi   巡查上报
101
102
103
104
105
  
      onInput(e) {
        this.$emit("input", e.target.value);
        this.$emit("change", e.target.value);
      }
5aef094b   monkeyhouyi   图标,核查处置
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    },
    watch: {
      value(val) {
        this.search();
      },
    },
  };
  </script>
  
  <style lang="scss" scoped>
  .NCC-selectTree {
    width: 100%;
  }
  .el-scrollbar .el-scrollbar__view .el-select-dropdown__item {
    height: auto;
    max-height: 274px;
    padding: 0;
    overflow: hidden;
    overflow-y: auto;
  }
  .el-select-dropdown__item.selected {
    font-weight: normal;
  }
  ul li::-webkit-scrollbar-track {
    border-radius: 0;
    background-color: #fff;
  }
  ul li >>> .el-tree .el-tree-node__content {
    height: auto;
    padding: 0 20px;
  }
  .el-tree-node__label {
    font-weight: normal;
  }
  .el-tree.single >>> .is-current .el-tree-node__label {
    color: #409eff;
    font-weight: 700;
  }
  .el-tree.single >>> .is-current .el-tree-node__content .custom-tree-node {
    color: #409eff;
    font-weight: 700;
  }
  .el-tree.single >>> .is-current .el-tree-node__children .custom-tree-node {
    color: #606266;
    font-weight: normal;
  }
  .el-tree.single >>> .is-current .el-tree-node__children .el-tree-node__label {
    color: #606266;
    font-weight: normal;
  }
  .empty-text {
    margin: 0;
    text-align: center;
    color: #999;
    font-size: 14px;
    background: #fff;
    cursor: auto;
    padding: 0;
    line-height: 24px;
  }
  </style>