|
|
@@ -1,6 +1,100 @@
|
|
|
define(['app/app'], function(app) {
|
|
|
'use strict';
|
|
|
- app.register.controller('BrandMapCtrl', ['$scope', 'CrawlTask', 'ngTableParams', 'BaseService', function($scope, CrawlTask, ngTableParams, BaseService) {
|
|
|
+ app.register.controller('BrandMapCtrl', ['$scope', 'ngTableParams', 'BaseService', 'BrandMap', 'toaster', 'BrandActive', 'StoreInfo', function($scope, ngTableParams, BaseService, BrandMap, toaster, BrandActive, StoreInfo) {
|
|
|
+ $scope.$$map = {};
|
|
|
+ $scope.keyword = '';
|
|
|
+ $scope.storeType = 'AGENCY';
|
|
|
+ $scope.brandMap = {};
|
|
|
+
|
|
|
+ $scope.update = function () {
|
|
|
+ $scope.brandMapTableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.addOneMap = function () {
|
|
|
+ if (!$scope.brandMap.nameChildEn){
|
|
|
+ toaster.pop("info", "请完善要对应的品牌英文名");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if (!$scope.brandMap.nameStandardEn || !$scope.brandMap.nameStandardCn){
|
|
|
+ toaster.pop("info", "请选择对应标准库的品牌");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ BrandMap.addOneBrandMap({}, $scope.brandMap, function () {
|
|
|
+
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop("error", error.data);
|
|
|
+ })
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.brandMapTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 10,
|
|
|
+ sorting : {
|
|
|
+ operateTime : 'DESC'
|
|
|
+ }
|
|
|
+ },{
|
|
|
+ total : 0,
|
|
|
+ getData : function ($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ param.keyword = $scope.keyword;
|
|
|
+ }
|
|
|
+ if ($scope.storeType && $scope.storeType != 'ALL'){
|
|
|
+ param.storeType = $scope.storeType;
|
|
|
+ }
|
|
|
+ BrandMap.getPageOfBrandMap(param, function (page){
|
|
|
+ $scope.$$map.totalElements = page.totalElements;
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ },function () {
|
|
|
+ toaster.pop('error', '获取品牌映射关系失败');
|
|
|
+ } )
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.brandInfoTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 12
|
|
|
+ },{
|
|
|
+ total : 0,
|
|
|
+ getData : function ($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ // if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ // param.keyword = $scope.keyword;
|
|
|
+ // }
|
|
|
+ // if ($scope.storeType && $scope.storeType != 'ALL'){
|
|
|
+ // param.storeType = $scope.storeType;
|
|
|
+ // }
|
|
|
+ BrandActive.getSimpleInfoPage(param, function (page){
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ },function () {
|
|
|
+ toaster.pop('error', '获取标准品牌错误');
|
|
|
+ } )
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.storeInfoTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 12
|
|
|
+ },{
|
|
|
+ total : 0,
|
|
|
+ getData : function ($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ // if ($scope.keyword && $scope.keyword.length > 0){
|
|
|
+ // param.keyword = $scope.keyword;
|
|
|
+ // }
|
|
|
+ // if ($scope.storeType && $scope.storeType != 'ALL'){
|
|
|
+ // param.storeType = $scope.storeType;
|
|
|
+ // }
|
|
|
+ StoreInfo.findStoresPageByKeyword(param, function (page){
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ },function () {
|
|
|
+ toaster.pop('error', '获取标准品牌错误');
|
|
|
+ } )
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
}]);
|
|
|
});
|