|
|
@@ -59,58 +59,40 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
}
|
|
|
}).state('sale.todo.inquiry', {
|
|
|
url : "/inquiry",
|
|
|
- templateUrl : "static/tpl/index/sale/inquiry.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'inquiry';
|
|
|
- }
|
|
|
+ templateUrl : "static/tpl/index/sale/table/inquiry.html",
|
|
|
+ controller: 'SaleInquiryCtrl'
|
|
|
}).state('sale.todo.order', {
|
|
|
url : "/order",
|
|
|
- templateUrl : "static/tpl/index/sale/order.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'order';
|
|
|
- }
|
|
|
+ templateUrl : "static/tpl/index/sale/table/order.html",
|
|
|
+ controller: 'SaleOrderCtrl'
|
|
|
}).state('sale.todo.change', {
|
|
|
url : "/change",
|
|
|
- templateUrl : "static/tpl/index/sale/change.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'change';
|
|
|
- }
|
|
|
+ templateUrl : "static/tpl/index/sale/table/change.html",
|
|
|
+ controller: 'SaleChangeCtrl'
|
|
|
}).state('sale.todo.notice', {
|
|
|
url : "/notice",
|
|
|
- templateUrl : "static/tpl/index/sale/notice.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'notice';
|
|
|
- }
|
|
|
+ templateUrl : "static/tpl/index/sale/table/notice.html",
|
|
|
+ controller: 'SaleNoticeCtrl'
|
|
|
}).state('sale.inquiry', {
|
|
|
url : "/inquiry",
|
|
|
templateUrl : "static/tpl/index/sale/inquiry.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'inquiry';
|
|
|
- }
|
|
|
+ controller: 'SaleInquiryCtrl'
|
|
|
}).state('sale.quotation', {
|
|
|
url : "/quotation",
|
|
|
templateUrl : "static/tpl/index/sale/quotation.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'quotation';
|
|
|
- }
|
|
|
+ controller: 'SaleInquiryCtrl'
|
|
|
}).state('sale.order', {
|
|
|
url : "/order",
|
|
|
templateUrl : "static/tpl/index/sale/order.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'order';
|
|
|
- }
|
|
|
+ controller: 'SaleOrderCtrl'
|
|
|
}).state('sale.change', {
|
|
|
url : "/change",
|
|
|
templateUrl : "static/tpl/index/sale/change.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'change';
|
|
|
- }
|
|
|
+ controller: 'SaleChangeCtrl'
|
|
|
}).state('sale.notice', {
|
|
|
url : "/notice",
|
|
|
templateUrl : "static/tpl/index/sale/notice.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = 'notice';
|
|
|
- }
|
|
|
+ controller: 'SaleNoticeCtrl'
|
|
|
}).state('user', {
|
|
|
url : "/user",
|
|
|
views : {
|
|
|
@@ -314,31 +296,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
- var isNumber = function(n) {
|
|
|
- return !isNaN(parseFloat(n)) && isFinite(n);
|
|
|
- };
|
|
|
- var parseParams = function(requestParams) {
|
|
|
- // parse url params
|
|
|
- for (var key in requestParams) {
|
|
|
- if (key.indexOf('[') >= 0) {
|
|
|
- var params = key.split(/\[(.*)\]/), value = requestParams[key], lastKey = '';
|
|
|
- angular.forEach(params.reverse(), function(name) {
|
|
|
- if (name != '') {
|
|
|
- var v = value;
|
|
|
- value = {};
|
|
|
- value[lastKey = name] = isNumber(v) ? parseFloat(v) : v;
|
|
|
- }
|
|
|
- });
|
|
|
- requestParams[lastKey] = angular.extend(requestParams[lastKey] || {}, value[lastKey]);
|
|
|
- delete requestParams[key];
|
|
|
- } else {
|
|
|
- requestParams[key] = isNumber(requestParams[key]) ? parseFloat(requestParams[key]) : requestParams[key];
|
|
|
- }
|
|
|
- }
|
|
|
- return requestParams;
|
|
|
- };
|
|
|
- app.controller('SaleOrderCtrl', function($scope, $filter, PurcOrderItem, ngTableParams,
|
|
|
- toaster, ReportService){
|
|
|
+ app.controller('SaleOrderCtrl', function($scope, $rootScope, $filter, PurcOrderItem, ngTableParams,
|
|
|
+ toaster, ReportService, BaseService){
|
|
|
+ $rootScope.active = 'order';
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page : 1, // show first page
|
|
|
count : 5, // count per page
|
|
|
@@ -350,7 +310,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
counts: [5, 10, 25, 50],
|
|
|
getData : function($defer, params) {
|
|
|
$scope.loading = true;
|
|
|
- PurcOrderItem.getTodo(parseParams(params.url()), function(page){
|
|
|
+ PurcOrderItem.getTodo(BaseService.parseParams(params.url()), function(page){
|
|
|
$scope.loading = false;
|
|
|
if(page) {
|
|
|
params.total(page.totalElements);
|
|
|
@@ -386,7 +346,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
toaster.pop('warning', '提示', '请填写回复数量!');
|
|
|
return;
|
|
|
}
|
|
|
- var reply = angular.copy(item.reply);
|
|
|
+ var reply = angular.copy(item.reply);
|
|
|
if(reply.delivery) {
|
|
|
if(typeof reply.delivery == 'object')
|
|
|
reply.delivery = reply.delivery.getTime();
|
|
|
@@ -416,7 +376,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
- app.controller('SaleChangeCtrl', function($scope, $filter, PurcChange, ngTableParams, toaster){
|
|
|
+ app.controller('SaleChangeCtrl', function($scope, $rootScope, $filter, PurcChange, ngTableParams, toaster, BaseService){
|
|
|
+ $rootScope.active = 'change';
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 5,
|
|
|
@@ -428,7 +389,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
counts: [5, 10, 25, 50],
|
|
|
getData : function($defer, params) {
|
|
|
$scope.loading = true;
|
|
|
- PurcChange.getTodo(parseParams(params.url()), function(page){
|
|
|
+ PurcChange.getTodo(BaseService.parseParams(params.url()), function(page){
|
|
|
$scope.loading = false;
|
|
|
if(page) {
|
|
|
params.total(page.totalElements);
|
|
|
@@ -461,7 +422,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
- app.controller('SaleInquiryCtrl', function($scope, $filter, PurcInquiry, ngTableParams, toaster){
|
|
|
+ app.controller('SaleInquiryCtrl', function($scope, $rootScope, $filter, PurcInquiry, ngTableParams, toaster, BaseService){
|
|
|
+ $rootScope.active = 'inquiry';
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 5,
|
|
|
@@ -475,7 +437,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
counts: [5, 10, 25, 50],
|
|
|
getData : function($defer, params) {
|
|
|
$scope.loading = true;
|
|
|
- PurcInquiry.getTodo(parseParams(params.url()), function(page){
|
|
|
+ PurcInquiry.getTodo(BaseService.parseParams(params.url()), function(page){
|
|
|
$scope.loading = false;
|
|
|
if(page) {
|
|
|
params.total(page.totalElements);
|
|
|
@@ -563,7 +525,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
- app.controller('SaleNoticeCtrl', function($scope, $filter, PurcNotice, ngTableParams, toaster){
|
|
|
+ app.controller('SaleNoticeCtrl', function($scope, $rootScope, $filter, PurcNotice, ngTableParams, toaster, BaseService){
|
|
|
+ $rootScope.active = 'notice';
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page : 1,
|
|
|
count : 5,
|
|
|
@@ -575,7 +538,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
counts: [5, 10, 25, 50],
|
|
|
getData : function($defer, params) {
|
|
|
$scope.loading = true;
|
|
|
- PurcNotice.getTodo(parseParams(params.url()), function(page){
|
|
|
+ PurcNotice.getTodo(BaseService.parseParams(params.url()), function(page){
|
|
|
$scope.loading = false;
|
|
|
if(page) {
|
|
|
params.total(page.totalElements);
|