Kaynağa Gözat

增加客户,增加供应商操作

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7173 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 yıl önce
ebeveyn
işleme
acb21c1522

+ 105 - 4
src/main/webapp/resources/js/index/app.js

@@ -257,7 +257,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			templateUrl : "static/tpl/index/account/role.html",
 			controller: 'RoleCtrl'
 		}).state('baseInfo', {//基础资料 
-			//TODO
 			url : "/baseInfo",
 			views : {
 				"left-view" : {
@@ -313,6 +312,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			url : "/myMessage",
 			templateUrl : "static/tpl/index/baseInfo/myMessage.html",
 			controller : 'AddPartnerMessageCtrl'
+		}).state('baseInfo.myPartners', {//TODO
+			url : '/myPartners',
+			templateUrl : "static/tpl/index/baseInfo/myPartners.html",
+			controller : 'MyPartnersCtrl'
 		}).state('qc', {
 			url : "/qc",
 			views : {
@@ -4682,7 +4685,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 	}]);
 	
 	//未对账单据列表
-	app.controller('PurchaseApCheckListCtrl',['$scope', 'FaApCheck', 'toaster', '$state','$filter', function($scope, FaApCheck, toaster, $state, $filter){
+	app.controller('PurchaseApCheckListCtrl',['$scope', 'FaApCheck', 'toaster', '$state','$filter', '$modal', function($scope, FaApCheck, toaster, $state, $filter, $modal){
 		$scope.data = {};// 列表数据
 		$scope.loading = true;
 		$scope.getData = function(){
@@ -4698,6 +4701,8 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 
 		}
 		
+		document.getElementById('suuorname').focus();//光标默认在客户
+		
 		$scope.getData();
 		
 		$scope.condition = {
@@ -4710,6 +4715,24 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		    item[openParam] = !item[openParam];
 		}
 		
+		//查找客户
+		$scope.searchCust = function(suuorname) {
+			var modalInstance = $modal.open({
+				animation: true,
+				templateUrl: 'static/tpl/index/fa/custInfo.html',
+				controller: 'SearchCustInfoCtrl',
+				resolve: {
+					suuorname: function() {
+						return suuorname;
+					}
+				}
+			});
+			modalInstance.result.then(function(suuorname){
+				$scope.suuorname = suuorname;
+			});
+			
+		}
+		
 		// 点击筛选根据条件选择数据
 		$scope.suuorname = '';
 		$scope.sdateFrom = '';
@@ -4731,6 +4754,10 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				$scope.checkboxes.checked = false;
 				item.$selected = false;
 			});
+//			if($scope.suuorname == '') {
+//				toaster.pop('info','提示', '请先输入客户');
+//				document.getElementById('suuorname').focus();//光标默认在客户
+//			}
 			$scope.totalMoney = 0;
 			$scope.condition.uuorname = $scope.suuorname;
 			$scope.condition.factory = $scope.factory
@@ -6941,7 +6968,7 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		
 		// 查看范例
 		$scope.showImg = function() {
-			var src = "static/img/product/excel_releaseByBatch_eg.png", box = $('#image-box');
+			var src = "/static/img/all/auditing.png", box = $('#image-box');
 			box.show();
 			box.find('img').attr('src', src);
 			box.find('a').click(function(){
@@ -7384,7 +7411,6 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 					$scope.order.orderItems[i].delivery = $scope.order.orderItems[i].delivery.getTime();
 				}
 			}
-			console.log(order);
 			newPurcOrder.save({}, $scope.order, function(data){
 				$scope.loading = false;
 				toaster.pop('success', '成功', '保存成功');
@@ -7666,6 +7692,24 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 				toaster.pop('error','失败',response.data);
 			});
 		}
+		
+		// 添加为供应商
+		$scope.addSupplier = function(id) {
+			AddPartner.addSupplier({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', '添加供应商成功');
+			}, function(response) {
+				toaster.pop('error', '失败', response.data);
+			})
+		};
+		
+		// 添加客户
+		$scope.addCust = function(id) {
+			AddPartner.addCust({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', '添加客户成功');
+			}, function(response) {
+				toaster.pop('error', '失败', response.data);
+			})
+		};
 	}]);
 	
 	
@@ -7748,5 +7792,62 @@ app.controller('SaleSendCtrl', ['$scope', '$filter', 'SaleSend', 'ngTableParams'
 		}
 	}]);
 	
+	/**
+	 * 我的合作伙伴
+	 */
+	app.controller('MyPartnersCtrl', ['$scope', 'toaster', 'GetProductInfo', function($scope, toaster, GetProductInfo) {
+		// 获取所有的合作伙伴
+		GetProductInfo.getAllPartners({}, function(data) {
+			console.log(data);
+			$scope.partners = data;
+		}, function(res) {
+			toaster.pop('error', '获取列表失败', res.data);
+		});
+		
+		// 添加为客户
+		$scope.addCust = function(partner) {
+			GetProductInfo.addCust({}, partner, function(data) {
+				toaster.pop('success', '提示', '添加客户成功');
+			}, function(response) {
+				toaster.pop('error', '添加客户失败', response.data);
+			});
+		}
+		
+		// 添加为供应商
+		$scope.addSupplier = function(partner) {
+			GetProductInfo.addSupplier({}, partner, function(data) {
+				toaster.pop('success', '提示', '添加供应商成功');
+			}, function(response) {
+				toaster.pop('error', '添加供应商失败', response.data);
+			});
+		}
+	}]);
+	
+	app.controller('SearchCustInfoCtrl', ['$scope', '$modalInstance', 'suuorname', 'FaApCheck', function($scope, $modalInstance, suuorname, FaApCheck) {
+		
+		$scope.getData = function(){
+		    FaApCheck.getAll(function(data){
+				$scope.custs= data;
+				angular.forEach($scope.data, function(item) {
+						item:{
+							$selected:true;
+						}
+					});
+				$scope.loading = false;
+			});
+
+		}
+		
+		$scope.getData();
+		
+		$scope.CustName= function(suuorname) {
+			$modalInstance.close(suuorname);
+		}
+		
+		$scope.close = function() {
+			$modalInstance.close();
+		}
+	}]);
+	
 	return app;
 });

+ 37 - 1
src/main/webapp/resources/js/index/services/BaseInfo.js

@@ -14,7 +14,8 @@ define(['ngResource'], function() {
 			},
 			addNewProd : {
 				url: "product/baseInfo/addNewProduct",
-				method : 'POST'			},
+				method : 'POST'			
+			},
 			update : {
 				url: "product/baseInfo/updateProdInfo",
 				method : 'POST'
@@ -22,6 +23,27 @@ define(['ngResource'], function() {
 			deleteById : {
 				url: "product/baseInfo/delete/:id",
 				method : 'DELETE'
+			},
+			getAllPartners : {
+				url : "product/baseInfo/getAllPartners",
+				method : 'GET',
+				isArray : true
+			},
+			addCust : {
+				url : "product/baseInfo/addCust",
+				method : 'POST',
+				isArray: false,
+				headers: {
+					'Content-Type' : 'application/text;charset=UTF-8'
+				}
+			},
+			addSupplier : {
+				url: "product/baseInfo/addSupplier",
+				method : 'POST',
+				isArray: false,
+				headers: {
+					'Content-Type' : 'application/text;charset=UTF-8'
+				}
 			}
 		})
 	}]).factory('ComponentActive', ['$resource', function($resource) {
@@ -205,6 +227,14 @@ define(['ngResource'], function() {
 			reapply: {
 				url: 'addpartner/reapply/:id',
 				method: 'POST'
+			},
+			addSupplier: {
+				url: 'addpartner/addSupplier/:id',
+				method: 'POST'
+			},
+			addCust: {
+				url: 'addpartner/addCust/:id',
+				method: 'POST'
 			}
 		})
 	}]).factory('AddPartnerMyMessage', ['$resource', function($resource) {
@@ -265,5 +295,11 @@ define(['ngResource'], function() {
 				}
 			},
 		})
+	}]).factory('LinktoAccount', ['$resource', function($resource) {
+		return $resource('B2BtoAccountUrlController', {}, {
+			getAccountEnList: {
+				url: "B2BtoAccountUrlController/account/manageUrl.action",
+			}
+		})
 	}]);
 });