Browse Source

批量导入物料时增加提示

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@8504 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
f46b65e78c
1 changed files with 22 additions and 14 deletions
  1. 22 14
      src/main/webapp/resources/js/index/app.js

+ 22 - 14
src/main/webapp/resources/js/index/app.js

@@ -9221,20 +9221,28 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		BaseService.scrollBackToTop();
 		// 通过excel批量上传物料
 		$scope.upload = function() {
-			var file = $scope.myFiles[0];
-			$upload.upload({
-				url: 'product/baseInfo/release/excel',
-				file: file,
-				method: 'POST'
-			}).success(function(data) {
-				$scope.result = data;
-				$scope.success = $scope.result.success;
-				$scope.total = $scope.result.total;
-				$scope.alters = $scope.result.alters;
-				$scope.infos = $scope.result.infos;
-			}).error(function(response) {
-				toaster.pop('error', response.data || response);
-			});
+			if($scope.myFiles) {
+				var file = $scope.myFiles[0];
+				console.log(file);
+				if(file.name) {
+					$upload.upload({
+						url: 'product/baseInfo/release/excel',
+						file: file,
+						method: 'POST'
+					}).success(function(data) {
+						$scope.result = data;
+						$scope.success = $scope.result.success;
+						$scope.total = $scope.result.total;
+						$scope.alters = $scope.result.alters;
+						$scope.infos = $scope.result.infos;
+						$scope.myFiles[0] = "";
+					}).error(function(response) {
+						toaster.pop('error', response.data || response);
+					});
+				} else {
+					toaster.pop('info', '提示', '当前文件不存在,请重新选择');
+				}
+			}
 		};
 		
 		// 查看范例