Browse Source

委外订单导出添加权限校验

wangmh 8 years ago
parent
commit
e0638ebd92

+ 13 - 1
src/main/java/com/uas/platform/b2b/controller/MakeOutOrderController.java

@@ -7,6 +7,7 @@ import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Sort.Direction;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -103,10 +104,21 @@ public class MakeOutOrderController {
 		return makeOrderService.findById(id);
 	}
 
+	/**
+	 * 导出权限判断
+	 *
+	 * @return
+	 */
+	@RequestMapping(value = "/xls/permission", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap exportPermission() {
+		return new ModelMap("success", true);
+	}
+
 	/**
 	 * 导出 excel - 全部
 	 * 
-	 * @param params
+	 * @param searchFilter
 	 * @return
 	 */
 	@RequestMapping(value = "/xls", method = RequestMethod.GET)

+ 12 - 1
src/main/webapp/resources/js/index/app.js

@@ -12331,7 +12331,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     if (page) {
                         params.total(page.totalElement);
                         $defer.resolve(page.content);
-                        $scope.keywordXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
+                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
                     }
                 }, function (response) {
                     $scope.loading = false;
@@ -12392,6 +12392,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.tableParams.page(1);
             $scope.tableParams.reload();
         };
+
+        // 导出
+        $scope.exportXls = function () {
+            MakeOutOrder.exportXls({}, {}, function (data) {
+                if (data.success){
+                    window.location.href = window.location.origin + '/sale/inquiry/xls?_state='+$scope.active+'&searchFilter='+angular.toJson($scope.searchFilterXls);
+                }
+            }, function (response) {
+                toaster.pop('error', '数据加载失败', response.data);
+            });
+        }
     }]);
 
     /**

+ 5 - 1
src/main/webapp/resources/js/index/services/Make.js

@@ -104,7 +104,11 @@ define([ 'ngResource'], function() {
 		});
 	}]).factory('MakeOutOrder', ['$resource',function($resource){
 		return $resource('make/outorders/:id', {}, {
-			getAll: {}
+			getAll: {},
+			exportXls: {
+				url: 'make/outorders/xls/permission',
+				method: 'GET'
+			}
 		})
 	}]);
 });

+ 1 - 1
src/main/webapp/resources/tpl/index/make/outorder.html

@@ -101,7 +101,7 @@
 		<span>委外订单</span>
 		<div class="p-right">
 			<a
-				href="make/outorders/xls?_state={{active}}&searchFilter={{keywordXls}}"
+				href="#" ng-click="exportXls()"
 				target="_self" class="text-simple" title="导出Excel表格"><i
 				class="fa fa-file-excel-o fa-fw"></i>导出</a>
 		</div>