美文网首页vue
vue el-select 下拉数据过多 打开慢 过滤数据

vue el-select 下拉数据过多 打开慢 过滤数据

作者: 徐福瑞 | 来源:发表于2021-01-12 16:52 被阅读0次

    :filter-method="filterMethod" 添加 搜索绑定方法

    <el-select :filter-method="filterMethod" size="mini" filterable v-model="doctorTemp.icd_ids" multiple placeholder="请选择ICD">
       <el-option v-for="item in changeIcd" :key="item.value" :label="item.label" :value="item.value"> 
       </el-option>
    </el-select>
    
     filterMethod(query) { // ICD出院诊断搜索过滤
                        //query是输入的关键字
                        if (query == '') {
                            this.changeIcd = icd.slice(0, 100) //过滤未选择时只显示100条
                        } else {
                            let result = [] //存储符合条件的下拉选项
                            this.icd.forEach(val => {
                                if (val.label.indexOf(query) != -1) result.push(val)
                            })
                            this.changeIcd = result.slice(0, 100) //只取前100个
                        }
                    },
    
    data:function(){
    changeIcd: [],
    }
     getSelect() {
                        axios.post('/', {
                                'subscript': 'gender,document_type,fee_source,policy_status,in_hospital_type,advance_type,judge,close_reason,qa_template,quality_project,shift_over_type,caller_identity,liyou',
                                'other': 'nationality,doctor,all_users,icd,project_id'
                            })
                            .then(function(response) {
                                var array = ['gender', 'document_type', 'fee_source', 'policy_status', 'in_hospital_type', 'close_reason', 'advance_type', 'judge', 'qa_template', 'quality_project', 'shift_over_type', 'caller_identity', 'liyou', 'nationality', 'doctor', 'all_users', 'icd'];
                                for (i in array) {
                                    that[array[i]] = response.data.data[array[i]];
                                }
    
                                //保留原数据  另赋值数据
                                that.changeIcd = that.icd
    //截取100
                                that.changeHospital_id = that.hospital_id.slice(0, 100)
    
    
    
                                that.qa_template = response.data.data['project_id'];
                            })
                            .catch(function(error) {});
                        axios.post('/', {})
                            .then(function(response) {
                                that.qa_first_level = response.data.data.first_level;
                                that.qa_second_level = response.data.data.second_level;
                            })
                            .catch(function(error) {});
                    },
    

    相关文章

      网友评论

        本文标题:vue el-select 下拉数据过多 打开慢 过滤数据

        本文链接:https://www.haomeiwen.com/subject/jwleaktx.html