Browse Source

企业圈功能更改,数据显示和操作在平台进行

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7235 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
d6583453f1

+ 74 - 28
src/main/webapp/resources/js/index/app.js

@@ -269,13 +269,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				}
 			}
 		}).state('baseInfo.index', {
-			url : "",
-			templateUrl : "static/tpl/index/baseInfo/index.html",
-			controller: 'RightCtrl'
+			url : "/enterpriseList",
+			templateUrl : "static/tpl/index/baseInfo/enterpriseList.html",
+			controller: 'EnterpriseListCtrl'
 		}).state('baseInfo.home', {
-			url : "/",
-			templateUrl : "static/tpl/index/baseInfo/index.html",
-			controller: 'RightCtrl'
+			url : "/enterpriseList",
+			templateUrl : "static/tpl/index/baseInfo/enterpriseList.html",
+			controller: 'EnterpriseListCtrl'
 		}).state('baseInfo.prodList', {
 			url : "/prodList",
 			templateUrl : "static/tpl/index/baseInfo/prodList.html",
@@ -7262,7 +7262,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 	/**
 	 * 企业列表
 	 */
-	app.controller('EnterpriseListCtrl', ['$scope', 'EnterpriseList', 'ngTableParams', '$filter', 'BaseService', 'toaster', 'AddPartner', function($scope, EnterpriseList, ngTableParams, $filter, BaseService, toaster, AddPartner) {
+	app.controller('EnterpriseListCtrl', ['$scope', 'getAccountUserSpace', 'ngTableParams', '$filter', 'BaseService', 'toaster', 'AddPartner', function($scope, getAccountUserSpace, ngTableParams, $filter, BaseService, toaster, AddPartner) {
 		$scope.active = 'all';
 		$scope.agreedText = '全部';
 		$scope.dateZoneText = '一个月内';
@@ -7290,7 +7290,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 			}
 		};
 		var getService = function() {
-			return EnterpriseList;
+			return getAccountUserSpace;
 		};
 		
 		$scope.tableParams = new ngTableParams({
@@ -7306,7 +7306,6 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				var pageParams = params.url();
 				pageParams.keyword = $scope.keyword;
 				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page) {
-					console.log(page);
 					$scope.loading = false;
 					if(page) {
 						params.total(page.totalElement);
@@ -7326,15 +7325,21 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 			$scope.tableParams.reload();
 		};
 		
-		// 增加合作关系
-		$scope.addPartner = function(uu) {
-			console.log(uu);
-			AddPartner.addPartner({uu: uu}, {}, function(data) {
-				toaster.pop('success', '提示', '请求发送成功');
+		// 添加合作关系
+		$scope.addPartner = function(name, businessCode) {
+			AddPartner.addPartner({name: name, businessCode: businessCode}, {}, function(data) {
+				if(data.success) {
+					toaster.pop("success", '添加成功', data.success);
+				}
+				if(data.error) {
+					toaster.pop("error", '添加失败', data.error);
+				}
 			}, function(response) {
 				toaster.pop('error','失败',response.data);
 			});
 		}
+		
+		$scope.status = 'enList';
 	}]);
 	
 	/**
@@ -7481,6 +7486,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		var getCustInfos = function(custuu) {
 			if(custuu) {
 				VendorService.userInfo.query({uu:custuu},null,function(data) {
+					console.log(data);
 					$scope.custInfos = data;
 					var getPage = function(page, size){
 						if($scope.custInfos) {
@@ -7672,7 +7678,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 	/**
 	 * 建立合作关系申请
 	 */
-	app.controller('AddPartnerRequestCtrl', ['$scope', 'AddPartnerMyRequest', 'toaster', 'BaseService', 'ngTableParams', 'AddPartner', function($scope, AddPartnerMyRequest, toaster, BaseService, ngTableParams, AddPartner) {
+	app.controller('AddPartnerRequestCtrl', ['$scope', 'AddPartnerMyRequest', 'toaster', 'BaseService', 'ngTableParams', 'AddPartner', '$timeout', function($scope, AddPartnerMyRequest, toaster, BaseService, ngTableParams, AddPartner, $timeout) {
 		
 		$scope.active = 'todo';
 		
@@ -7714,15 +7720,13 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 			getData : function($defer, params) { // 获取数据的方法
 				$scope.loading = true;
 				var pageParams = params.url();
-				pageParams.searchFilter = { // 筛选条件
-					keyword: $scope.keyword,
-				};
+				pageParams.keyword = $scope.keyword;
 				getService()[getRequestStatus($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
-					console.log(page);
 					$scope.loading = false;
 					if(page) {
+						params.total(page.totalElement);
 						$defer.resolve(page.content);
-						params.total(page.totalElements);
+						$scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
 					}
 				}, function(response){
 					$scope.loading = false;
@@ -7734,30 +7738,69 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		// 再次申请
 		$scope.reapply = function(id) {
 			AddPartner.reapply({id: id}, {}, function(data) {
-				toaster.pop('success', '提示', '请求发送成功');
+				toaster.pop('success', '提示', '操作成功');
 			}, function(response) {
 				toaster.pop('error','失败',response.data);
 			});
 		}
 		
 		// 添加为供应商
-		$scope.addSupplier = function(id) {
-			AddPartner.addSupplier({id: id}, {}, function(data) {
-				toaster.pop('success', '提示', '添加供应商成功');
+		$scope.addSupplier = function(vendUID) {
+			AddPartner.addSupplier({businessCode: vendUID}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				if(data.error) {
+					toaster.pop('error','提示', data.error);
+				}
 			}, function(response) {
 				toaster.pop('error', '失败', response.data);
 			})
 		};
 		
 		// 添加客户
-		$scope.addCust = function(id) {
-			AddPartner.addCust({id: id}, {}, function(data) {
-				toaster.pop('success', '提示', '添加客户成功');
+		$scope.addCust = function(vendUID) {
+			AddPartner.addCust({businessCode: vendUID}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				if(data.error) {
+					toaster.pop('error','提示', data.error);
+				}
 			}, function(response) {
 				toaster.pop('error', '失败', response.data);
 			})
 		};
 		
+		// 搜索框回车
+		$scope.onSearch = function() {
+			$scope.tableParams.page(1);
+			$scope.tableParams.reload();
+		};
+		
+		// 同意申请
+		$scope.agree = function(id) {
+			AddPartner.agreeRequest({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', '操作成功');
+				$timeout(function() {
+					window.location.reload();
+				}, 500);
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		
+		// 拒绝申请
+		$scope.refuse = function(id, reason) {
+			AddPartner.refuseRequest({id: id, reason: reason}, {}, function(data) {
+				toaster.pop('success', '提示', '操作成功');
+				$timeout(function() {
+					window.location.reload();
+				}, 500);
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
 		
 		$scope.status = 'send';
 	}]);
@@ -7812,9 +7855,11 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				};
 				getService()[getMessagetStatus($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
+					console.log(page);
 					if(page) {
+						params.total(page.totalElement);
 						$defer.resolve(page.content);
-						params.total(page.totalElements);
+						$scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
 					}
 				}, function(response){
 					$scope.loading = false;
@@ -7884,6 +7929,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 	app.controller('SearchCustInfoCtrl', ['$scope', '$modalInstance', 'suuorname', 'FaApCheck', function($scope, $modalInstance, suuorname, FaApCheck) {
 		$scope.getData = function(){
 		    FaApCheck.getAllCustomers(function(data) {
+		    	console.log(data);
 				$scope.custs= data;
 				angular.forEach($scope.data, function(item) {
 						item:{

+ 12 - 6
src/main/webapp/resources/js/index/services/BaseInfo.js

@@ -46,12 +46,12 @@ define(['ngResource'], function() {
 				}
 			},
 			businessGroups: {
-				url: "product/baseInfo/enterbusinessGroups",
+				url: "v/enterbusinessGroups",
 				method : 'GET',
 				headers: {
 					'Content-Type' : 'application/text;charset=UTF-8'
 				}
-			}
+			},
 		})
 	}]).factory('ComponentActive', ['$resource', function($resource) {
 		//获取ComponentActive的分页数据
@@ -217,11 +217,17 @@ define(['ngResource'], function() {
 				isArray : false
 			},
 		})
+	}]).factory('getAccountUserSpace', ['$resource', function($resource) {
+		return $resource('product/baseInfo/getUserSpaceDetails', {}, {
+			getAll: {
+				isArray: false
+			}
+		})
 	}]).factory('AddPartner', ['$resource', function($resource) {
 		return $resource('addpartner', {}, {
 			addPartner: {
-				url: 'addpartner/request/:uu',
-				method: 'POST'
+				url: 'addpartner/request/nameAndBusCode',
+				method : 'POST',
 			},
 			agreeRequest: {
 				url: 'addpartner/agree/:id',
@@ -236,11 +242,11 @@ define(['ngResource'], function() {
 				method: 'POST'
 			},
 			addSupplier: {
-				url: 'addpartner/addSupplier/:id',
+				url: 'addpartner/addSupplier/:businessCode',
 				method: 'POST'
 			},
 			addCust: {
-				url: 'addpartner/addCust/:id',
+				url: 'addpartner/addCust/:businessCode',
 				method: 'POST'
 			}
 		})