|
|
@@ -353,8 +353,8 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
/**
|
|
|
* 项目详情框
|
|
|
*/
|
|
|
- app.controller('ProjectDetailCtrl', ['$scope', 'Project', 'toaster', '$modalInstance', 'BaseService', 'id', '$modal', '$sce',
|
|
|
- function($scope, Project, toaster, $modalInstance, BaseService, id, $modal, $sce) {
|
|
|
+ app.controller('ProjectDetailCtrl', ['$scope', 'Project', 'toaster', '$modalInstance', 'BaseService', 'id', '$modal', '$sce', 'ngTableParams',
|
|
|
+ function($scope, Project, toaster, $modalInstance, BaseService, id, $modal, $sce, ngTableParams) {
|
|
|
|
|
|
var loadData = function() {
|
|
|
// 获取项目详情
|
|
|
@@ -365,6 +365,7 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
toaster.pop('error', '详情加载失败');
|
|
|
});
|
|
|
};
|
|
|
+ loadData();
|
|
|
|
|
|
// 获取当前项目所有进度
|
|
|
$scope.getSchedules = function() {
|
|
|
@@ -376,12 +377,83 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
};
|
|
|
|
|
|
// 获取当前项目捐款明细
|
|
|
- $scope.getRecords = function() {
|
|
|
- Project.getRecords({id:id}, {}, function(data) {
|
|
|
- $scope.projectRecords = data;
|
|
|
- }, function() {
|
|
|
- toaster.pop('error', '捐款明细加载失败');
|
|
|
- });
|
|
|
+ // $scope.getRecords = function() {
|
|
|
+ // Project.getRecords({proId:id}, {}, function(data) {
|
|
|
+ // $scope.projectRecords = data;
|
|
|
+ // }, function() {
|
|
|
+ // toaster.pop('error', '捐款明细加载失败');
|
|
|
+ // });
|
|
|
+ // };
|
|
|
+ $scope.recordParams = new ngTableParams({
|
|
|
+ page: 1,
|
|
|
+ count: 5,
|
|
|
+ sorting: {
|
|
|
+ 'id': 'desc'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts: [],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.searchFilter = { // 筛选条件
|
|
|
+ keyword: $scope.keyword,
|
|
|
+ // 此处area作为支付方式过滤
|
|
|
+ area: $scope.way,
|
|
|
+ fromDate : null !== $scope.fromDate ? $scope.fromDate.getTime(): null,
|
|
|
+ // proId过滤
|
|
|
+ type: id
|
|
|
+ };
|
|
|
+ Project.getRecordsPage.call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词 做导出时需要的字段
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 搜索
|
|
|
+ $scope.onSearch = function() {
|
|
|
+ if ($scope.recordParams.page() === 1) {
|
|
|
+ $scope.recordParams.reload();
|
|
|
+ } else {
|
|
|
+ $scope.recordParams.page(1);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.fromDate = null;
|
|
|
+ $scope.setTime = function(type) {
|
|
|
+ var fromDate = new Date();
|
|
|
+ fromDate.setHours(0, 0, 0, 0);
|
|
|
+ switch (type) {
|
|
|
+ // 一周内
|
|
|
+ case '7' :
|
|
|
+ fromDate.setDate(fromDate.getDate() - 7) ;
|
|
|
+ $scope.fromDate = fromDate;
|
|
|
+ break;
|
|
|
+ // 一个月内
|
|
|
+ case '1' :
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 1) ;
|
|
|
+ $scope.fromDate = fromDate;
|
|
|
+ break;
|
|
|
+ // 三个月内
|
|
|
+ case '3' :
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 3) ;
|
|
|
+ $scope.fromDate = fromDate;
|
|
|
+ break;
|
|
|
+ // 半年内
|
|
|
+ case '6' :
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 6) ;
|
|
|
+ $scope.fromDate = fromDate;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $scope.recordParams.reload();
|
|
|
};
|
|
|
|
|
|
// 获取当前项目财务信息
|
|
|
@@ -395,7 +467,6 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
toaster.pop('error','财务明细加载失败');
|
|
|
});
|
|
|
};
|
|
|
- loadData();
|
|
|
|
|
|
$scope.cancel= function() {
|
|
|
$modalInstance.dismiss();
|
|
|
@@ -2246,47 +2317,65 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
|
|
|
|
|
|
// 添加选中
|
|
|
$scope.addSelected = function() {
|
|
|
- // $scope.tempSelectedProjects = angular.copy($scope.selectedProjects);
|
|
|
- // $scope.tempProjects = angular.copy($scope.projects);
|
|
|
- angular.forEach($scope.projects, function(project, index) {
|
|
|
+ // angular.forEach($scope.projects, function(project, index) {
|
|
|
+ // if (project.checked) {
|
|
|
+ // project.checked = false;
|
|
|
+ // if (angular.isUndefined($scope.selectedProjects)) {
|
|
|
+ // $scope.selectedProjects = [];
|
|
|
+ // }
|
|
|
+ // $scope.selectedProjects.push(project);
|
|
|
+ // $scope.projects.splice(index, 1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // angular.forEach($scope.projects, function(project, index) {
|
|
|
+ // if (project.checked) {
|
|
|
+ // project.checked = false;
|
|
|
+ // $scope.selectedProjects.push(project);
|
|
|
+ // $scope.projects.splice(index, 1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ var i = 0;
|
|
|
+ for (i; i< $scope.projects.length; i++) {
|
|
|
+ var project = $scope.projects[i];
|
|
|
if (project.checked) {
|
|
|
project.checked = false;
|
|
|
if (angular.isUndefined($scope.selectedProjects)) {
|
|
|
$scope.selectedProjects = [];
|
|
|
}
|
|
|
$scope.selectedProjects.push(project);
|
|
|
- $scope.projects.splice(index, 1);
|
|
|
+ $scope.projects.splice(i, 1);
|
|
|
+ i = i-1;
|
|
|
}
|
|
|
- });
|
|
|
- angular.forEach($scope.projects, function(project, index) {
|
|
|
- if (project.checked) {
|
|
|
- project.checked = false;
|
|
|
- $scope.selectedProjects.push(project);
|
|
|
- $scope.projects.splice(index, 1);
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 删除选中
|
|
|
$scope.deleteSelected = function() {
|
|
|
- // $scope.tempSelectedProjects = angular.copy($scope.selectedProjects);
|
|
|
- // $scope.tempProjects = angular.copy($scope.projects);
|
|
|
- // 存在取消操作,用temp过渡
|
|
|
- // 因为会splice,所以相邻的被选中需要遍历两次
|
|
|
- angular.forEach($scope.selectedProjects, function(project, index) {
|
|
|
- if (project.checked) {
|
|
|
- project.checked = false;
|
|
|
- $scope.projects.push(project);
|
|
|
- $scope.selectedProjects.splice(index, 1);
|
|
|
- }
|
|
|
- });
|
|
|
- angular.forEach($scope.selectedProjects, function(project, index) {
|
|
|
+ // // 存在取消操作,用temp过渡
|
|
|
+ // angular.forEach($scope.selectedProjects, function(project, index) {
|
|
|
+ // if (project.checked) {
|
|
|
+ // project.checked = false;
|
|
|
+ // $scope.projects.push(project);
|
|
|
+ // $scope.selectedProjects.splice(index, 1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // angular.forEach($scope.selectedProjects, function(project, index) {
|
|
|
+ // if (project.checked) {
|
|
|
+ // project.checked = false;
|
|
|
+ // $scope.projects.push(project);
|
|
|
+ // $scope.selectedProjects.splice(index, 1);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ var i = 0;
|
|
|
+ for (i; i< $scope.selectedProjects.length; i++) {
|
|
|
+ var project = $scope.selectedProjects[i];
|
|
|
if (project.checked) {
|
|
|
project.checked = false;
|
|
|
$scope.projects.push(project);
|
|
|
- $scope.selectedProjects.splice(index, 1);
|
|
|
+ $scope.selectedProjects.splice(i, 1);
|
|
|
+ i = i -1;
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 取消
|