 
// import NoData from "@/components/NoData";
import _ from 'lodash'
/* eslint-disable */
const filterPlugin = {
    install:function(Vue){
        //基础功能

        //数组数据过滤
        Vue.filter('dataArrayFilter',function(array,obj){
            if(!array) return [];
            return _.filter(array, obj);
        });

        Vue.filter('orderByAsc',function(array){
            if(!array) return [];
            return _.orderBy(array, ['order'], ['asc']);
        });


        //业务
        Vue.filter('subjectType',function(data){
            var result = '';
            switch (data) {
                case 'Face':
                    result = '面试';
                    break;
                case 'Write':
                    result = '笔试';
                    break;
                case 'Machine':
                    result = '机考';
                    break;                
            }
            return result;
        });
        Vue.filter("bankCode", function(data){
            var result = '';
            switch (data) {
                case 'WeiXin':
                    result = '微信支付';
                    break;
                case 'ICBC':
                    result = '工行支付';
                    break;
                case 'YEEPAY':
                    result = '易宝支付';
                    break;
            }
            return result.length == 0 ? data : result;
        });
        Vue.filter("certTypeName", function(data){
            let result = '';
            switch (data) {
                case 'HongKong':
                    result = '港澳台身份证';
                    break;
                case 'WaiGuo':
                    result = '外国护照';
                    break;
                case 'IdCard':
                    result = '大陆身份证';
                    break;
            }
    
            return result.length == 0 ? data : result;
        });
        Vue.filter("trackChooseType", function(data){
            let result = '';
            switch (data) {
                case 'Variety':
                    result = '限定品种';
                    break;
                case 'User':
                    result = '考生自填';
                    break;
                case 'Tracks':
                    result = '指定曲目';
                    break;
                case 'Random':
                    result = '随机抽取';
                    break;
            }
            return result;
        });
        Vue.filter("billStatus", function(data){
            let result = '';
            switch (data) {
                case 'Reply':
                    result = '未支付';
                    break;
                case 'Complete':
                    result = '支付成功';
                    break;
                case 'Refund':
                    result = '已退款';
                    break;
                case 'Request':
                    result = '未支付';
                    break;
            }

            return result;
        });
        Vue.filter("subjectMasterFlag", function(data){
            var result = '';
            switch (data) {
                case 'Active':
                    result = '主项';
                    break;
                case 'InActive':
                    result = '副项';
                    break;
            }
            return result;
        });
        Vue.filter("batchName", function(data){
            let result = '';
            switch (data) {
                case '1':
                    result = '初试';
                    break;
                case '2':
                    result = '复试';
                    break;
                case '3':
                    result = '三试';
                    break;
            }
            return result;
        });
        
    }  
};
export default filterPlugin;
