invoiceModule.directive('outputInvoiceEdit', ['$log', 'SweetAlert', '$translate', function ($log, SweetAlert, $translate) { 'use strict'; $log.debug('outputInvoiceEdit.ctor()...'); return { restrict: 'E', templateUrl: '/app/vat/output-invoice/output-invoice-edit/output-invoice-edit.html' + '?_=' + Math.random(), scope: { }, controller: 'outputInvoiceEditController', link: function (scope, element) { //计算datagrid的高度 scope.setInvoiceGridHeight = function () { var invoiceDataGridSelector = '#invoiceEditGridContainer'; var pageWrapSelector = ".output-invoice-edit-wrapper"; var menuSelector = ".output-invoice-edit-wrapper .header-title"; var contentHeader = '.edit-content-container .header'; var contentbody = '.edit-content-container .body'; var buttonRow = '.edit-content-container .buttom-row'; var pageFooter = '.output-invoice-edit-wrapper .page-footer'; var dxGridSelector = ".edit-grid-container"; var pageHeight = $(document).height();// 810; // parseInt($(pageWrapSelector).css('height').replace('px', '')); var menuHeight = $(menuSelector).outerHeight(); //parseInt($(menuSelector).css('height').replace('px', '')); var contentHeaderHeight = $(contentHeader).outerHeight(); //parseInt($(contentHeader).css('height').replace('px', '')); var buttonRowHeight = $(buttonRow).outerHeight(); //parseInt($(buttonRow).css('height').replace('px', '')); // var pageFooterHeight = $(pageFooter).outerHeight(); //parseInt($(pageFooter).css('height').replace('px', '')); var pageFooterHeight = 0; var contentbodyHeight = pageHeight - menuHeight - contentHeaderHeight; var height = contentbodyHeight - buttonRowHeight - pageFooterHeight - 40 + 'px'; $(contentbody).css('height', contentbodyHeight); // $(dxGridSelector).css('height', height); //$(invoiceDataGridSelector).css('max-height', '100%'); try { var option = $('#invoiceEditGridContainer').dxDataGrid('option'); option.height = height; $('#invoiceEditGridContainer').dxDataGrid('option', option); $(invoiceDataGridSelector).dxDataGrid('instance').repaint(); } catch (e) { console.log(e); } }; $(window).on('resize', function () { scope.setInvoiceGridHeight(); }); }//# end of link }; } ]);