|
|
@@ -1,6 +1,6 @@
|
|
|
-define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.router', 'ui.bootstrap' ], function() {
|
|
|
+define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.router', 'ui.bootstrap' , 'file-upload'], function() {
|
|
|
'use strict';
|
|
|
- var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcServices', 'ui.bootstrap']);
|
|
|
+ var app = angular.module('myApp', [ 'toaster', 'angularCharts', 'ngTable', 'ui.router', 'common.services', 'PurcServices', 'ui.bootstrap', 'angularFileUpload']);
|
|
|
app.init = function() {
|
|
|
angular.bootstrap(document, [ 'myApp' ]);
|
|
|
};
|
|
|
@@ -109,48 +109,20 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
url : "/returns",
|
|
|
templateUrl : "static/tpl/index/sale/returns.html",
|
|
|
controller: 'SaleReturnsCtrl'
|
|
|
- }).state('account', {
|
|
|
- url : "/account",
|
|
|
+ }).state('sale.sample', {
|
|
|
+ url : "/sample",
|
|
|
+ templateUrl : "static/tpl/index/sale/sample.html",
|
|
|
+ controller: 'SaleSampleCtrl'
|
|
|
+ }).state('user', {
|
|
|
+ url : "/user",
|
|
|
views : {
|
|
|
"left-view" : {
|
|
|
- templateUrl : "static/tpl/index/account/left.html"
|
|
|
+ templateUrl : "static/tpl/index/user/left.html"
|
|
|
},
|
|
|
"right-view" : {
|
|
|
- templateUrl : "static/tpl/index/account/right.html"
|
|
|
+ templateUrl : "static/tpl/index/user/right.html"
|
|
|
}
|
|
|
}
|
|
|
- }).state('account.index', {
|
|
|
- url : "",
|
|
|
- templateUrl : "static/tpl/index/account/index.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = null;
|
|
|
- }
|
|
|
- }).state('account.home', {
|
|
|
- url : "/",
|
|
|
- templateUrl : "static/tpl/index/account/index.html",
|
|
|
- controller: function($rootScope) {
|
|
|
- $rootScope.active = null;
|
|
|
- }
|
|
|
- }).state('account.enterprise', {
|
|
|
- url : "/enterprise",
|
|
|
- templateUrl : "static/tpl/index/account/enterprise.html",
|
|
|
- controller: 'EnterpriseCtrl'
|
|
|
- }).state('account.user', {
|
|
|
- url : "/user",
|
|
|
- templateUrl : "static/tpl/index/account/user.html",
|
|
|
- controller: 'UserCtrl'
|
|
|
- }).state('account.resource', {
|
|
|
- url : "/resource",
|
|
|
- templateUrl : "static/tpl/index/account/resource.html",
|
|
|
- controller: 'ResourceCtrl'
|
|
|
- }).state('account.authority', {
|
|
|
- url : "/authority",
|
|
|
- templateUrl : "static/tpl/index/account/authority.html",
|
|
|
- controller: 'AuthorityCtrl'
|
|
|
- }).state('account.role', {
|
|
|
- url : "/role",
|
|
|
- templateUrl : "static/tpl/index/account/role.html",
|
|
|
- controller: 'RoleCtrl'
|
|
|
}).state('qc', {
|
|
|
url : "/qc",
|
|
|
views : {
|
|
|
@@ -199,6 +171,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
if(cur == 'RMB') return '¥';
|
|
|
else if(cur == 'USD') return '$';
|
|
|
else if(cur == 'EUR') return '€';
|
|
|
+ else if(cur == null || cur == '') return '¥';
|
|
|
else return cur;
|
|
|
}
|
|
|
};
|
|
|
@@ -432,9 +405,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
params.total(page.totalElements);
|
|
|
$defer.resolve(page.content);
|
|
|
}
|
|
|
- }, function(response){
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '加载失败', response.data);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -491,8 +461,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
if(!item.replies) {
|
|
|
PurcOrderItem.getReply({orderItemId: item.id}, function(replies){
|
|
|
item.replies = replies;
|
|
|
- }, function(response){
|
|
|
- toaster.pop('error', '无法查看回复记录', response.data);
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
@@ -542,9 +510,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
params.total(page.totalElements);
|
|
|
$defer.resolve(page.content);
|
|
|
}
|
|
|
- }, function(response){
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '加载失败', response.data);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -556,7 +521,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
};
|
|
|
|
|
|
$scope.onReplyClick = function(change) {
|
|
|
- if(change.$agreed != null) {
|
|
|
+ if(change.agreed) {
|
|
|
var reply = {id: change.id, agreed: Number(change.$agreed), replyRemark: change.replyRemark};
|
|
|
$scope.loading = true;
|
|
|
PurcChange.reply({changeId: change.id}, reply, function(){
|
|
|
@@ -617,9 +582,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
params.total(page.totalElements);
|
|
|
$defer.resolve(page.content);
|
|
|
}
|
|
|
- }, function(response){
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '加载失败', response.data);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -741,9 +703,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
params.total(page.totalElements);
|
|
|
$defer.resolve(page.content);
|
|
|
}
|
|
|
- }, function(response){
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '加载失败', response.data);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
@@ -847,6 +806,111 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
};
|
|
|
});
|
|
|
|
|
|
+ /**
|
|
|
+ * 客户打样申请
|
|
|
+ */
|
|
|
+ app.controller('SaleSampleCtrl', function($scope, $rootScope, $filter, PurcSample, ngTableParams, toaster, $modal, BaseService, Symbol){
|
|
|
+ $rootScope.active = 'sample';
|
|
|
+ $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 PurcSample;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 5,
|
|
|
+ sorting: {
|
|
|
+ proofingDelivery: '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];
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.openSend = function(index, sample) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'sendModal.html',
|
|
|
+ controller: 'SampleSendCtrl',
|
|
|
+ resolve: {
|
|
|
+ sampleItem: function(){return sample;}
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(){
|
|
|
+ toaster.pop('info', '提示', '送样成功');
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ app.controller('SampleSendCtrl', function($scope, $modalInstance, sampleItem, PurcSample, $upload, toaster){
|
|
|
+ $scope.sampleItem = sampleItem;
|
|
|
+ $scope.sampleItem.sampleSend = $scope.sampleItem.sampleSend || {};
|
|
|
+
|
|
|
+ //确认送样
|
|
|
+ $scope.ok = function (form) {
|
|
|
+ var files = form.attachFile.$viewValue, file = files && files.length > 0 ? files[0] : null;
|
|
|
+ $upload.upload({
|
|
|
+ url: 'sale/sample/' + $scope.sampleItem.id + '/send',
|
|
|
+ method: 'POST',
|
|
|
+ file: file,
|
|
|
+ data: {
|
|
|
+ json: $scope.sampleItem.sampleSend
|
|
|
+ }
|
|
|
+ }).success(function(data){
|
|
|
+ $modalInstance.close('success');
|
|
|
+ }).error(function(data){
|
|
|
+ toaster.pop('danger', '错误', data);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancel = function () {
|
|
|
+ $modalInstance.dismiss(sampleItem);
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
/**
|
|
|
* 客户采购预测
|
|
|
*/
|
|
|
@@ -1277,26 +1341,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
|
|
|
|
|
|
});
|
|
|
|
|
|
- app.controller('EnterpriseCtrl', function($scope, $rootScope){
|
|
|
- $rootScope.active = 'enterprise';
|
|
|
- });
|
|
|
-
|
|
|
- app.controller('UserCtrl', function($scope, $rootScope){
|
|
|
- $rootScope.active = 'user';
|
|
|
- });
|
|
|
-
|
|
|
- app.controller('ResourceCtrl', function($scope, $rootScope){
|
|
|
- $rootScope.active = 'resource';
|
|
|
- });
|
|
|
-
|
|
|
- app.controller('AuthorityCtrl', function($scope, $rootScope){
|
|
|
- $rootScope.active = 'authority';
|
|
|
- });
|
|
|
-
|
|
|
- app.controller('RoleCtrl', function($scope, $rootScope){
|
|
|
- $rootScope.active = 'role';
|
|
|
- });
|
|
|
-
|
|
|
/**
|
|
|
* 计算时间差
|
|
|
*/
|