|
|
@@ -97,6 +97,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
url : "/send",
|
|
|
templateUrl : "static/tpl/index/sale/send.html",
|
|
|
controller: 'SaleSendCtrl'
|
|
|
+ }).state('sale.forecast', {
|
|
|
+ url : "/forecast",
|
|
|
+ templateUrl : "static/tpl/index/sale/forecast.html",
|
|
|
+ controller: 'SaleForecastCtrl'
|
|
|
}).state('sale.accept', {
|
|
|
url : "/accept",
|
|
|
templateUrl : "static/tpl/index/sale/accept.html",
|
|
|
@@ -797,6 +801,68 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
};
|
|
|
});
|
|
|
|
|
|
+ /**
|
|
|
+ * 客户采购预测
|
|
|
+ */
|
|
|
+ app.controller('SaleForecastCtrl', function($scope, $rootScope, $filter, PurcForecast, ngTableParams, toaster, BaseService, Symbol){
|
|
|
+ $rootScope.active = 'forecast';
|
|
|
+ $scope.active = 'all';
|
|
|
+ $scope.agreedText = '全部';
|
|
|
+ $scope.dateZoneText = '一个月内';
|
|
|
+ $scope.condition = {dateZone: 1};
|
|
|
+ $scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
+ $scope.changeAgreed = function(agreed) {
|
|
|
+ $scope.condition.agreed = agreed;
|
|
|
+ $scope.agreedText = typeof agreed == 'undefined' ? '全部' : (agreed == 1 ? '已同意' : '不同意');
|
|
|
+ $scope.condition.$agreedOpen = false;
|
|
|
+ };
|
|
|
+ $scope.changeDateZone = function(zone) {
|
|
|
+ $scope.condition.dateZone = zone;
|
|
|
+ $scope.dateZoneText = typeof zone == 'undefined' ? '半年前' : (zone == 1 ? '一个月内' : '半年内');
|
|
|
+ $scope.condition.$dateZoneOpen = false;
|
|
|
+ };
|
|
|
+ $scope.setActive = function(state) {
|
|
|
+ if($scope.active != state) {
|
|
|
+ $scope.active = state;
|
|
|
+ if($scope.tableParams.page() == 1)
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ else
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var getService = function() {
|
|
|
+ return PurcForecast;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 5,
|
|
|
+ sorting: {
|
|
|
+ orderDate: 'desc'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ getService()[getState($scope.active)].call(null, BaseService.parseParams(params.url()), function(page){
|
|
|
+ $scope.loading = false;
|
|
|
+ if(page) {
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.openDatePicker = function($event, item, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ };
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
/**
|
|
|
* 客户采购验收
|
|
|
*/
|