invoiceModule.directive('bdViewByVin', ['$log', function ($log) {
    'use strict';
    $log.debug('BDViewByVIN.ctor()...');
    return {
        restrict: 'E',
        templateUrl: '/app/vat/output-invoice/bd-view-by-vin/bd-view-by-vin.html' + '?_=' + Math.random(),
        scope:
        {

        },
        controller: 'bdViewByVINController',
        link: function (scope, element) {
            //计算datagrid的高度
            scope.setInvoiceGridHeight = function () {
                var pageHeight = $(document).height();
                var topTitleHeight = $('.header-title').outerHeight();
                var pageSearchHeight = $('.query-panel').outerHeight();
                var pageFastSearchHeight = $('.data-grid-container').outerHeight();
                var dataGridPagerHeight = $('.page-footer').outerHeight();
                if (dataGridPagerHeight === 0) dataGridPagerHeight = 60;
                var subHeight = pageHeight - topTitleHeight - pageSearchHeight - pageFastSearchHeight - dataGridPagerHeight;
                scope.height = subHeight - 30;

                try {
                    $('#bdVinGrid').dxDataGrid('instance').repaint();
                }
                catch (e) {
                    console.log(e);
                }
            };

            $(window).on('resize', function () {
                scope.setInvoiceGridHeight();
            });
        }
    };
}]);