commonModule.directive('cellDetailPanel', ['$log','$timeout', function ($log, $timeout) { $log.debug('cellDetailPanel directive start...'); return { restrict: 'E', templateUrl: '/app/common/controls/atms-cell-detail-panel/cell-detail-panel.html' + '?_=' + Math.random(), scope: { detail: '=', sourceType:'=' }, controller: 'cellDetailPanelController', link: function ($scope, $element, $attr) { $element.draggable({ cancel: '#data-source' }); //计算datagrid的高度 $scope.setInvoiceGridHeight = function () { var pageHeight = $('#cellDetailConent').height(); var topTitleHeight = $('#cell-position').outerHeight(); var pageSearchHeight = $('#key-data').outerHeight(); var pageFastSearchHeight = $('#cell-formula').outerHeight(); var subHeight = pageHeight - topTitleHeight - pageSearchHeight - pageFastSearchHeight-100; $('#data-source').css({ height: subHeight }); var dataSourceTitleHeight = $('#datasource-title').outerHeight(); $scope.height = subHeight - dataSourceTitleHeight - 20; try { $('#bspl-dataSourceGrid').dxDataGrid('instance').repaint(); } catch (e) { console.log(e); } }; //注册广播 $scope.$on('refreshCellPanel', function (isShow) { if (isShow) { //设置表格高度 //$timeout(function () { $scope.setInvoiceGridHeight(); //}, 500); } }); $("#cellDetailPanel").resizable({ stop: function (event, ui) { $scope.setInvoiceGridHeight(); } }); } } }]);