Vue.component('comB', {
    template: '
\
          
\
                      就诊类型:  \
                      \
                            \
                            \
                      \
                      机构等级:  \
                      \
                          \
                          \
                      \
                      \
                          \
                          \
                      \
                      \
                      \
                    搜  索
\
                    {{feiyong}}\
                \
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                                男\
                                女\
                            \
                            \
                            \
                            \
                            \
                            \
                            \
                                \
                                    查看详情\
                                \
                            \
                \
                \
                \
                \
            
\
        \
 ',
    data: function () {
        return {
            currentPage: 1, //初始页
            pageSize: 10,    //    每页的数据 
            pageSizeArr: [10, 20, 30, 50],
            tableData: [],
            feiyong: '',
            total: 0,
            eventType: '0',
            item: '',
            hosLevel: '',
            level: "",
            hos: "",
            value4: new Date(),
            event_type: [{
                "code": '0',
                "name": '门急诊'
            }, {
                "code": '1',
                "name": '住院'
            }],
            hos_hierarchy: [{
                "code": '',
                "name": '全部'
            }, {
                "code": "1",
                "name": '甲等'
            }, {
                "code": "2",
                "name": '乙等'
            }, {
                "code": "3",
                "name": '丙等'
            }],
            level_id: [{
                "code": "",
                "name": '全部',
            }, {
                "code": "1",
                "name": '一级'
            }, {
                "code": "2",
                "name": '二级'
            }, {
                "code": "3",
                "name": '三级'
            },
            ]
        }
    },
    watch: {
    },
    mounted: function () {
        this.getData()
    },
    methods: {
        handleClick: function (row) {
            demographic_id = row.demographic_id,
                blurry_type = row.eventType,
                searchParam = ''
            var url = httpRequest.server + '/profile/app/medication/html/jiuzhen-item.html?' +
                'healthProblemName=' + '&demographic_id=' + demographic_id + '&blurry_type=' + blurry_type + '&searchParam=' + searchParam
            console.log(url)
            //    window.open(url)
            var width = 1000 + 'px';
            var height = 600+ 'px';
            top.layer.open({
                id: 'Lay_xiangqingB',
                type: 2,
                title: false,
                closeBtn: 0,
                shade: 0.5,
                shadeClose: true,
                area: [width, height],
                content: url
            })
        },
        selectChange(value) {
            console.log(value);
            if (value == 3) {
                this.hos_hierarchy.push({ 'code': '9', "name": '特等' })
                this.hos = ''
            } else {
                if (this.level.code == 3) {
                    this.hos = ''
                } else {
                    this.hos = ''
                    var vm = this.hos_hierarchy[0].code
                    console.log(vm)
                    this.hos_hierarchy.splice(4)
                }
            }
        },
        handleCurrentChange: function (val) { //page 当前页
            this.currentPage = val;
            this.getData()
        },
        handleSizeChange: function (val) {// size 页面展示数据条数
            this.pageSize = val;
            this.initData()
        },
        searchClick: function () {
            console.log(this.eventType)
            this.initData()
            this.getFeiYongStr()
        },
        initData: function () {  //初始化数据
            this.currentPage = 1;
            this.getData()
        },
        getData: function () {
            var vm = this;
            var params = {
                month: this.value4.format('yyyy-MM'),
                eventType: this.eventType,
                hosLevel: this.level,
                hosHierarchy: this.hos,
                size: this.pageSize,
                page: this.currentPage
            }
            GlobalEventBus.$emit('setLoading', {
                loading: true
            });
            bigDataOutApi.getHighCostList(params).then(function (res) {
                console.log(res)
                GlobalEventBus.$emit('setLoading');
                vm.tableData = res.detailModelList;
                vm.total = res.totalCount;
                var obj = res.obj;
                vm.getFeiYongStr(obj)
                console.log(obj)
            }).catch(function (err) {
                console.log(err)
                GlobalEventBus.$emit('setLoading');
            })
        },
        getFeiYongStr: function (obj) {
            debugger
            if (this.eventType == "0") {
                this.feiyong = '门急诊费用>=' + obj .toFixed(2)+' ('+ obj.toFixed(2)+'='+ (obj/5).toFixed(2) +'(上月门急诊次均费用)*5)'
            } else {
                this.feiyong = '住院费用>='  + obj .toFixed(2)+' ('+ obj.toFixed(2)+'='+ (obj/5).toFixed(2) +'(上月住院次均费用)*5)'
            }
        }
    }
})