special-vat-invoice.js 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
vatModule.directive('specialVatInvoice', ['$log', function ($log) {
    'use strict';
    $log.debug('issuedInvoiceBdView.ctor()...');
    return {
        restrict: 'E',
        templateUrl: '/app/vat/output-invoice/special-vat-invoice/special-vat-invoice.html' + '?_=' + Math.random(),
        scope:
        {

        },
        controller: 'specialVatInvoiceController',
        link: function (scope, element) {
            //计算datagrid的高度
            scope.setInvoiceGridHeight = function () {
                var pageHeight = $(document).height();
                //var smallTitleHeight = $('#litterTitle').outerHeight();
                var topTitleHeight = $('.header-title').outerHeight();
                var pageSearchHeight = $('.query-panel').outerHeight();
                var pageFastSearchHeight = $('.action-row').outerHeight();
                //var dataGridLineHeight = $('.grid-container .prompt-line').outerHeight();
                var dataGridPagerHeight = $('.page-footer').outerHeight();
                if (dataGridPagerHeight === 0) dataGridPagerHeight = 60;
                var subHeight = pageHeight  - topTitleHeight - pageSearchHeight - pageFastSearchHeight  - dataGridPagerHeight;
                scope.height = subHeight - 50;

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

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