Просмотр исходного кода

新增产品导入加载动画

shenjj 7 лет назад
Родитель
Сommit
67982454c4

+ 15 - 5
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -15,28 +15,38 @@ define([ 'app/app' ], function(app) {
 			if(--i < 1) Loading.hide();
 		};
 
-		var im_api_url = 'api/chat/message';
+		// var im_api_url = 'api/chat/message';
+		// var upload_api_url = 'release/product/release/excel'
+		// var upload_api_urlPCB = 'release/product/release/excel/pcb'
+		var RegluArr = [
+			'api/chat/message',
+			'release/product/release/excel',
+			'release/product/release/excel/pcb',
+			'release/product/batchRelease/pcb',
+			'release/product/batchRelease'
+		]
 		return {
 			request: function(cfg){
-				if(cfg.url && cfg.url.indexOf(im_api_url) < 0) {
+				// console.log(cfg.url)
+				if(cfg.url && RegluArr.indexOf(cfg.url) < 0) {
 					startLoading();
 				}
 				return cfg;
 			},
 			requestError: function(rejection) {
-				if(rejection.config.url && rejection.config.url.indexOf(im_api_url) < 0) {
+				if(rejection.config.url && RegluArr.indexOf(rejection.config.url) < 0) {
 					endLoading();
 				}
 				return $q.reject(rejection);
 			},
 			response: function(res) {
-				if(res.config.url && res.config.url.indexOf(im_api_url) < 0) {
+				if(res.config.url && RegluArr.indexOf(res.config.url) < 0) {
 					endLoading();
 				}
 				return res;
 			},
 			responseError: function(rejection) {
-				if(rejection.config.url && rejection.config.url.indexOf(im_api_url) < 0) {
+				if(rejection.config.url && RegluArr.indexOf(rejection.config.url) < 0) {
 					endLoading();
 				}
 				if(rejection.status == 401) {

+ 399 - 307
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -71,169 +71,169 @@ define([ 'app/app' ], function(app) {
 
 		//选择相应的销售类型
 		$scope.sellType = function(type) {
-            if (type == 'self') {
-                $scope.batch.selfSellEabled && ($scope.batch.sellType = 'self');
-            } else if (type == 'UAS') {
-                if (!$rootScope.isPcbStore) {
-                    $scope.batch.sellType = 'UAS';
-                    $scope.setShowSelfSellRemindBox(true);
+        if (type == 'self') {
+            $scope.batch.selfSellEabled && ($scope.batch.sellType = 'self');
+        } else if (type == 'UAS') {
+            if (!$rootScope.isPcbStore) {
+                $scope.batch.sellType = 'UAS';
+                $scope.setShowSelfSellRemindBox(true);
+            }
+        }
+        // if($scope.batch.selfSellEabled) {
+    // $scope.batch.sellType = type;
+    // if (type == 'UAS') {
+        //         $scope.setShowSelfSellRemindBox(true);
+    // }
+        // } else {
+    // $scope.batch.sellType = 'UAS';
+        // }
+
+    };
+
+    //上架信息展示
+    $scope.relTableParams = new ngTableParams({
+        count : 10,
+        page : 1
+    }, {
+        total : 0,
+        getData : function($defer, params) {
+            var param = BaseService.parseParams(params.url());
+            if($scope.result && $scope.result.batch) {
+                param.batch = $scope.result.batch;
+                ReleaseProductByBatch.getPageBatchRelease(param, function(page) {
+                    $defer.resolve(page.content);
+                    params.total(page.totalElements);
+                    $scope.pageParams.number = page.number;
+                    $scope.pageParams.content = page.content;
+                    $scope.pageParams.totalElements = page.totalElements;
+                    $scope.pageParams.totalPages = page.totalPages;
+                    $scope.pageParams.start = ((page.number - 1) * page.size) + 1;
+                    $scope.pageParams.end =  page.number * page.size;
+                    if($scope.pageParams.end > $scope.pageParams.totalElements) {
+                        $scope.pageParams.end = $scope.pageParams.totalElements
+                    }
+                }, function(data) {
+                    toaster.pop();
+                });
+            }
+        }
+    });
+
+    /**
+     * 打开删除的模态框
+     */
+    $scope.showDelete = function (item) {
+        var modalInstance = $modal.open({
+            animation: true,
+            templateUrl: 'static/view/common/modal/delete_modal.html',
+            controller: 'product_delete_ctrl',
+            resolve: {
+                id : function() {
+                    return item.id;
                 }
             }
-            // if($scope.batch.selfSellEabled) {
-				// $scope.batch.sellType = type;
-				// if (type == 'UAS') {
-            //         $scope.setShowSelfSellRemindBox(true);
-				// }
-            // } else {
-				// $scope.batch.sellType = 'UAS';
-            // }
-
-        };
+        });
+        modalInstance.result.then(function(){
+            if (item.releaseCode == 112){
+                $scope.result.success = $scope.result.success - 1;
+            }else if(item.releaseCode == 113){
+                $scope.result.failure = $scope.result.failure - 1;
+            }
+            //不需要返回的第一页
+            $scope.relTableParams.reload();
+        }, function(){
+        });
+    };
 
-        //上架信息展示
-        $scope.relTableParams = new ngTableParams({
-            count : 10,
-            page : 1
-        }, {
-            total : 0,
-            getData : function($defer, params) {
-                var param = BaseService.parseParams(params.url());
-                if($scope.result && $scope.result.batch) {
-                    param.batch = $scope.result.batch;
-                    ReleaseProductByBatch.getPageBatchRelease(param, function(page) {
-                        $defer.resolve(page.content);
-                        params.total(page.totalElements);
-                        $scope.pageParams.number = page.number;
-                        $scope.pageParams.content = page.content;
-                        $scope.pageParams.totalElements = page.totalElements;
-                        $scope.pageParams.totalPages = page.totalPages;
-                        $scope.pageParams.start = ((page.number - 1) * page.size) + 1;
-                        $scope.pageParams.end =  page.number * page.size;
-                        if($scope.pageParams.end > $scope.pageParams.totalElements) {
-                            $scope.pageParams.end = $scope.pageParams.totalElements
-                        }
-                    }, function(data) {
-                        toaster.pop();
+    var initRuleCount = function () {
+        return DistributionRule.findCountOfActiveRule({},{},function (data) {
+            if (data.success){
+                $scope.needShowTip = data.data;
+            }
+        }, function (error) {
+            toaster.pop("error", error.data);
+        })
+    };
+    initRuleCount();
+
+    // 查看范例
+    $scope.showImg = function() {
+        var src = '';
+        if($scope.batch.currency === 'RMB') {
+            src = $rootScope.rootPath + "/static/img/product/releaseByBatch-rmb.png";
+        }else {
+            src = $rootScope.rootPath + "/static/img/product/releaseByBatch-usd.png";
+        }
+        var box = $('#image-box');
+        box.find('img').attr('src', src);
+        box.find('a').click(function(){
+            box.hide();
+        });
+        box.dblclick(function(){
+            box.hide();
+        });
+        box.show();
+    };
+
+    //获取登录的信息
+    var getAuthentication = function () {
+        return AuthenticationService.getAuthentication().success(function(data) {
+            if(data && data.enterprises) {
+                data.enterprise = data.enterprises[data.enterprises.length - 1];
+                if(data.enterprises.length > 1) {
+                    var enSelect = [];
+                    angular.forEach(data.enterprises, function(e){
+                        if(e.current)
+                            data.enterprise = e;
+                        else
+                            enSelect.push(e);
                     });
+                    data.enSelect = enSelect;
                 }
             }
+            $rootScope.userInfo = data;
+        }).error(function(response) {
+            toaster.pop('info', '获取定单的信息' + response);
         });
-
-        /**
-         * 打开删除的模态框
-         */
-        $scope.showDelete = function (item) {
-            var modalInstance = $modal.open({
-                animation: true,
-                templateUrl: 'static/view/common/modal/delete_modal.html',
-                controller: 'product_delete_ctrl',
-                resolve: {
-                    id : function() {
-                        return item.id;
-                    }
-                }
-            });
-            modalInstance.result.then(function(){
-                if (item.releaseCode == 112){
-                    $scope.result.success = $scope.result.success - 1;
-                }else if(item.releaseCode == 113){
-                    $scope.result.failure = $scope.result.failure - 1;
-                }
-                //不需要返回的第一页
-                $scope.relTableParams.reload();
-            }, function(){
-            });
-        };
-
-        var initRuleCount = function () {
-            return DistributionRule.findCountOfActiveRule({},{},function (data) {
-                if (data.success){
-                    $scope.needShowTip = data.data;
-                }
-            }, function (error) {
-                toaster.pop("error", error.data);
-            })
-        };
-        initRuleCount();
-
-        // 查看范例
-        $scope.showImg = function() {
-            var src = '';
-            if($scope.batch.currency === 'RMB') {
-                src = $rootScope.rootPath + "/static/img/product/releaseByBatch-rmb.png";
+    };
+
+    //判断是否是商城管理公司,是否可以选择自营。
+    $q.all([getAuthentication()]).then(function() {
+        //获取店铺的信息
+        StoreInfo.getStoreInfoByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
+            $scope.storeInfo = data;
+            if(!data.uuid || data.storeName.indexOf('优软测试二') > -1 || data.storeName.indexOf('优软商城') > -1) {
+                $scope.batch.sellType = 'UAS';
+                $scope.batch.selfSellEabled = false;
             }else {
-                src = $rootScope.rootPath + "/static/img/product/releaseByBatch-usd.png";
+                $scope.batch.sellType = 'self';
+                $scope.batch.selfSellEabled = true;
             }
-            var box = $('#image-box');
-            box.find('img').attr('src', src);
-            box.find('a').click(function(){
-                box.hide();
-            });
-            box.dblclick(function(){
-                box.hide();
-            });
-            box.show();
-        };
-
-        //获取登录的信息
-        var getAuthentication = function () {
-            return AuthenticationService.getAuthentication().success(function(data) {
-                if(data && data.enterprises) {
-                    data.enterprise = data.enterprises[data.enterprises.length - 1];
-                    if(data.enterprises.length > 1) {
-                        var enSelect = [];
-                        angular.forEach(data.enterprises, function(e){
-                            if(e.current)
-                                data.enterprise = e;
-                            else
-                                enSelect.push(e);
-                        });
-                        data.enSelect = enSelect;
-                    }
-                }
-                $rootScope.userInfo = data;
-            }).error(function(response) {
-                toaster.pop('info', '获取定单的信息' + response);
-            });
-        };
-
-        //判断是否是商城管理公司,是否可以选择自营。
-        $q.all([getAuthentication()]).then(function() {
-            //获取店铺的信息
-            StoreInfo.getStoreInfoByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
-                $scope.storeInfo = data;
-                if(!data.uuid || data.storeName.indexOf('优软测试二') > -1 || data.storeName.indexOf('优软商城') > -1) {
-                    $scope.batch.sellType = 'UAS';
-                    $scope.batch.selfSellEabled = false;
-                }else {
-                    $scope.batch.sellType = 'self';
-                    $scope.batch.selfSellEabled = true;
-                }
-            }, function(response) {
-                toaster.pop('error', '获取店铺的信息失败, ' + response.data);
-            });
+        }, function(response) {
+            toaster.pop('error', '获取店铺的信息失败, ' + response.data);
         });
-
-        // 返回店铺的uuid,未开店则返回寄售uuid
-        $q.all([getAuthentication()]).then(function() {
-            //获取店铺的信息
-            StoreInfo.getUuidByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
-                $scope.storeUuid = data.data;
-            }, function(response) {
-                toaster.pop('error', '获取店铺的信息失败, ' + response.data);
-            });
+    });
+
+    // 返回店铺的uuid,未开店则返回寄售uuid
+    $q.all([getAuthentication()]).then(function() {
+        //获取店铺的信息
+        StoreInfo.getUuidByEnuu({enUU : $rootScope.userInfo.enterprise.uu}, function(data) {
+            $scope.storeUuid = data.data;
+        }, function(response) {
+            toaster.pop('error', '获取店铺的信息失败, ' + response.data);
         });
+    });
 
 
-        //选择文件
-        $scope.selectFile = function(value) {
-            if(value != null) {
-                upload_text.value = value;
-            }else {
-                var fileInput = angular.element('#uploadCommodity')[0];
-                upload_text.value = fileInput.value;
-            }
-        };
+    //选择文件
+    $scope.selectFile = function(value) {
+        if(value != null) {
+            upload_text.value = value;
+        }else {
+            var fileInput = angular.element('#uploadCommodity')[0];
+            upload_text.value = fileInput.value;
+        }
+    };
 
 		// 上传Excel批量发布(大量)
 		$scope.upload = function() {
@@ -251,12 +251,22 @@ define([ 'app/app' ], function(app) {
                 var param = {selfSale : $scope.batch.sellType == 'self', currency : $scope.batch.currency, repeatImport : $scope.repeatImport};
 			}
 			var uploadUrl = $rootScope.isPcbStore ? 'release/product/release/excel/pcb' : 'release/product/release/excel';
+			// 上传文件进度条
+			// $scope.uploadProgressText = ''
+      $scope.showCanvas = false
 			$upload.upload({
 				url: uploadUrl,
 				file: file,
 				method: 'POST',
 				params : param
-			}).success(function(data) {
+			}).progress(function(evt) {
+			  clearInterval($scope.AnimationCanvas)
+        $scope.showCanvas = true
+        var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
+        drawFrame(progressPercentage)
+        // $scope.uploadProgressText = progressPercentage + '%'
+        // console.log('progess:' + progressPercentage + '%' + evt.config.file.name);
+      }).success(function(data) {
 				$scope.selectFile(' ');
 				$scope.batch.myFiles = [];
 				$scope.proInfo = data.info;
@@ -283,178 +293,260 @@ define([ 'app/app' ], function(app) {
 				// if(!message) {
 				// 	message = '没有提交任何信息'
 				// }
-                if ($scope.result.filter && $scope.result.filter > 0) {
-                    toaster.pop('warning', '警告', '存在导入失败产品,可下载导入失败表格查看详情');
-                } else {
-                    toaster.pop('success', '提示', '上传完成');
-                }
+        if ($scope.result.filter && $scope.result.filter > 0) {
+            toaster.pop('warning', '警告', '存在导入失败产品,可下载导入失败表格查看详情');
+        } else {
+            toaster.pop('success', '提示', '上传完成');
+        }
 				$scope.relTableParams.page(1);
 				$scope.relTableParams.reload();
-                if ($rootScope.$$productOn.tab === 'bathOnPerson') {
-                    publicPersonProduct();
-                }
-            }).error(function(response) {
-                $scope.result = {};
-                $scope.result.total = 0;
-                $scope.pageParams.number = 0;
-                $scope.pageParams.content = null;
-                $scope.pageParams.totalElements = 0;
-                $scope.pageParams.totalPages = 0;
-                toaster.pop('error', response.data || response);
+        if ($rootScope.$$productOn.tab === 'bathOnPerson') {
+            publicPersonProduct();
+        }
+        $scope.showCanvas = false
+        }).error(function(response) {
+            $scope.result = {};
+            $scope.result.total = 0;
+            $scope.pageParams.number = 0;
+            $scope.pageParams.content = null;
+            $scope.pageParams.totalElements = 0;
+            $scope.pageParams.totalPages = 0;
+            toaster.pop('error', response.data || response);
+            $scope.showCanvas = false
+        })
+    };
+
+    // 下载模板
+    $scope.download = function() {
+        var show = SessionService.get($scope.userInfo.userUU + "-releasetip");
+        var downloadUrl = $rootScope.isPcbStore ? '/release/product/release/template/pcb' : '/release/product/release/template'
+        if (!show) {
+            var modalInstance = $modal.open({
+                animation: true,
+                templateUrl : $rootScope.rootPath + '/static/view/vendor/modal/releaseProductByBatchTip.html',
+                controller : 'releaseProductByBatchTipCtrl'
             });
-        };
-
-        // 下载模板
-        $scope.download = function() {
-            var show = SessionService.get($scope.userInfo.userUU + "-releasetip");
-            var downloadUrl = $rootScope.isPcbStore ? '/release/product/release/template/pcb' : '/release/product/release/template'
-            if (!show) {
-                var modalInstance = $modal.open({
-                    animation: true,
-                    templateUrl : $rootScope.rootPath + '/static/view/vendor/modal/releaseProductByBatchTip.html',
-                    controller : 'releaseProductByBatchTipCtrl'
-                });
-                modalInstance.result.then(function(response) {
-                }, function(res) {
-                    window.location.href = $rootScope.rootPath + downloadUrl + '?currency=' + $scope.batch.currency + ($rootScope.$$productOn.tab == 'bathOnPerson' ? '&isPerson=1' : '');
-                });
-            } else {
+            modalInstance.result.then(function(response) {
+            }, function(res) {
                 window.location.href = $rootScope.rootPath + downloadUrl + '?currency=' + $scope.batch.currency + ($rootScope.$$productOn.tab == 'bathOnPerson' ? '&isPerson=1' : '');
-            }
-        };
-
-        var afterPublish = function () {
-            $modal.open({
-                animation : true,
-                templateUrl : 'static/view/common/modal/product_upload_modal.html',
-                controller : 'rule_tip_ctrl',
-                resolve : {
-                    type : function() {
-                        return 'upload';
-                    },
-                    tipModal : function() {
-                        return true;
-                    },
-                    success : function () {
-                        return $scope.needShowTip;
-                    },
-                    uuid: function () {
-                        return $scope.storeUuid;
-                    }
-                }
             });
-            $scope.relTableParams.page(1);
-            $scope.relTableParams.reload();
-            $scope.result.success = 0;//设置成0,让前端用户不能点击
-            $scope.hadImport = true; //上架后隐藏提示语
+        } else {
+            window.location.href = $rootScope.rootPath + downloadUrl + '?currency=' + $scope.batch.currency + ($rootScope.$$productOn.tab == 'bathOnPerson' ? '&isPerson=1' : '');
         }
-        //批量发布
-        $scope.publish = function(event) {
-            if ($scope.pageParams.totalElements > 0) {
-                if ($rootScope.isPcbStore) {
-                    ReleaseProductByBatch.batchReleasePcb({batch : $scope.result.batch}, null, function(data) {
-                        afterPublish();
-                    }, function(res) {
-                        toaster.pop("error", "发布失败", res.data);
-                    });
-                } else {
-                    ReleaseProductByBatch.batchRelease({batch : $scope.result.batch}, null, function(data) {
-                        afterPublish();
-                    }, function(res) {
-                        toaster.pop("error", "发布失败", res.data);
-                    });
+    };
+
+    var afterPublish = function () {
+        speed = 100
+        clearInterval($scope.AnimationCanvas)
+        $scope.showCanvas = false
+        $modal.open({
+            animation : true,
+            templateUrl : 'static/view/common/modal/product_upload_modal.html',
+            controller : 'rule_tip_ctrl',
+            resolve : {
+                type : function() {
+                    return 'upload';
+                },
+                tipModal : function() {
+                    return true;
+                },
+                success : function () {
+                    return $scope.needShowTip;
+                },
+                uuid: function () {
+                    return $scope.storeUuid;
                 }
-            } else {
-                event.stopPropagation();//阻止冒泡事件
-                event.preventDefault();//阻止默认的事件。
-                toaster.pop("info", "提示", "没有信息发布");
             }
-        };
+        });
+        $scope.relTableParams.page(1);
+        $scope.relTableParams.reload();
+        $scope.result.success = 0;//设置成0,让前端用户不能点击
+        $scope.hadImport = true; //上架后隐藏提示语
+    }
+    //批量发布
+    $scope.publish = function(event) {
+        if ($scope.pageParams.totalElements > 0) {
+            speed = 1
+            $scope.showCanvas = true
+            $scope.AnimationCanvas = setInterval(function () {
+              if (speed > 100) clearInterval($scope.AnimationCanvas)
+              if (speed >= 98) clearInterval($scope.AnimationCanvas)
+              else {
+                speed += RandomNumber();
+                drawFrame(speed)
+              }
+            }, 30)
+          if ($rootScope.isPcbStore) {
+              ReleaseProductByBatch.batchReleasePcb({batch : $scope.result.batch}, null, function(data) {
+                  afterPublish();
+              }, function(res) {
+                  toaster.pop("error", "发布失败", res.data);
+                  clearInterval($scope.AnimationCanvas)
+                  $scope.showCanvas = false
+              });
+          } else {
+              ReleaseProductByBatch.batchRelease({batch : $scope.result.batch}, null, function(data) {
+                  afterPublish();
+              }, function(res) {
+                  toaster.pop("error", "发布失败", res.data);
+                  clearInterval($scope.AnimationCanvas)
+                  $scope.showCanvas = false
+              });
+          }
+        } else {
+            event.stopPropagation();//阻止冒泡事件
+            event.preventDefault();//阻止默认的事件。
+            toaster.pop("info", "提示", "没有信息发布");
+        }
+    };
 
-        function publicPersonProduct() {
-            ReleaseProductByBatch.batchReleasePerson({batch : $scope.result.batch}, null, function(data) {
-                if ($scope.needShowTip) {
-                    $scope.relTableParams.page(1);
-                    $scope.relTableParams.reload();
-                    //$scope.result.success = 0;//设置成0,让前端用户不能点击
-                    $modal.open({
-                        animation : true,
-                        templateUrl : 'static/view/common/modal/product_upload_modal.html',
-                        controller : 'rule_tip_ctrl',
-                        resolve : {
-                            type : function() {
-                                return 'upload';
-                            },
-                            tipModal : function() {
-                                return true;
-                            },
-                            success : function () {
-                                return false;
-                            },
-                            uuid: function () {
-                                return null;
-                            }
-                        }
-                    });
-                    return ;
-                }
-                // toaster.pop("success", "提示", "发布成功 :" + data.data + "条");
-                $scope.personMedol = true;
+    function publicPersonProduct() {
+        ReleaseProductByBatch.batchReleasePerson({batch : $scope.result.batch}, null, function(data) {
+            if ($scope.needShowTip) {
                 $scope.relTableParams.page(1);
                 $scope.relTableParams.reload();
                 //$scope.result.success = 0;//设置成0,让前端用户不能点击
-                /*$scope.hadImport = true; //上架后隐藏提示语*/ // 个人上传不隐藏
-            }, function(res) {
-                toaster.pop("error", "发布失败", res.data);
-            });
-        }
-
-        //下载未匹配成功的数据
-        $scope.downloadExcel = function(){
-            if ($rootScope.$$productOn.tab === 'bathOnPerson') {
-                var datatem = {isAjax : true, batch : $scope.result.batch, isPerson : 1};
-            } else {
-                var datatem = {isAjax : true, batch : $scope.result.batch};
-            }
-            var downloadFailureUrl = $rootScope.isPcbStore ? 'release/product/release/failure/pcb/xls' : 'release/product/release/failure/xls';
-            if($scope.result && $scope.result.batch && $scope.result.filter) {
-                var form = document.getElementById('load-error');
-                form.action= downloadFailureUrl;
-                form.submit();
-                Loading.show();
-                var intervalId = null;
-                var getDownLoadStatus = function () {
-                    $.ajax({
-                        type: 'GET',
-                        url: downloadFailureUrl,
-                        data : datatem,
-                        dataType : 'json',
-                        success: function (data) {
-                            if(!data.load) {
-                                $scope.$apply(function () {
-                                    Loading.hide();
-                                    /*toaster.pop('success', '数据处理完毕,正在下载文件,请稍等。');*/
-                                });
-                                clearInterval(intervalId);
-                            }
+                $modal.open({
+                    animation : true,
+                    templateUrl : 'static/view/common/modal/product_upload_modal.html',
+                    controller : 'rule_tip_ctrl',
+                    resolve : {
+                        type : function() {
+                            return 'upload';
+                        },
+                        tipModal : function() {
+                            return true;
                         },
-                        error: function () {
-                            Loading.hide();
+                        success : function () {
+                            return false;
+                        },
+                        uuid: function () {
+                            return null;
+                        }
+                    }
+                });
+                return ;
+            }
+            // toaster.pop("success", "提示", "发布成功 :" + data.data + "条");
+            $scope.personMedol = true;
+            $scope.relTableParams.page(1);
+            $scope.relTableParams.reload();
+            //$scope.result.success = 0;//设置成0,让前端用户不能点击
+            /*$scope.hadImport = true; //上架后隐藏提示语*/ // 个人上传不隐藏
+        }, function(res) {
+            toaster.pop("error", "发布失败", res.data);
+        });
+    }
+
+    //下载未匹配成功的数据
+    $scope.downloadExcel = function(){
+        if ($rootScope.$$productOn.tab === 'bathOnPerson') {
+            var datatem = {isAjax : true, batch : $scope.result.batch, isPerson : 1};
+        } else {
+            var datatem = {isAjax : true, batch : $scope.result.batch};
+        }
+        var downloadFailureUrl = $rootScope.isPcbStore ? 'release/product/release/failure/pcb/xls' : 'release/product/release/failure/xls';
+        if($scope.result && $scope.result.batch && $scope.result.filter) {
+            var form = document.getElementById('load-error');
+            form.action= downloadFailureUrl;
+            form.submit();
+            Loading.show();
+            var intervalId = null;
+            var getDownLoadStatus = function () {
+                $.ajax({
+                    type: 'GET',
+                    url: downloadFailureUrl,
+                    data : datatem,
+                    dataType : 'json',
+                    success: function (data) {
+                        if(!data.load) {
+                            $scope.$apply(function () {
+                                Loading.hide();
+                                /*toaster.pop('success', '数据处理完毕,正在下载文件,请稍等。');*/
+                            });
                             clearInterval(intervalId);
                         }
-                    });
-                };
-                intervalId= setInterval(function () {
-                    getDownLoadStatus();
-                }, 500);
-            }else {
-                if(!$scope.result || !$scope.result.batch) {
-                    toaster.pop('info', '提示', '您没有上传信息');
-                }else if(!$scope.result.filter) {
-                    toaster.pop('info', '提示', '您没有匹配不成功的数据');
-                }
+                    },
+                    error: function () {
+                        Loading.hide();
+                        clearInterval(intervalId);
+                    }
+                });
+            };
+            intervalId= setInterval(function () {
+                getDownLoadStatus();
+            }, 500);
+        }else {
+            if(!$scope.result || !$scope.result.batch) {
+                toaster.pop('info', '提示', '您没有上传信息');
+            }else if(!$scope.result.filter) {
+                toaster.pop('info', '提示', '您没有匹配不成功的数据');
             }
-        };
+        }
+    };
+
+    var RandomNumber = function() {
+      return Math.random()
+    }
+    /**
+     * 创建canvas环境*/
+    var canvas = document.getElementById('canvas'), // 获取canvas元素
+        context = canvas.getContext('2d'), // 设置画图环境
+        contextX = canvas.width / 2, // 获取canvas中心点X轴坐标
+        contextY = canvas.height / 2,  // 获取canvas中心点Y轴坐标
+        rad = Math.PI * 2 / 100, // //将360度分成100份,那么每一份就是rad度
+        speed = 1, // 当前数值
+        speed_step = 0.3; // 加载速度
+    //绘制5像素宽的运动外圈
+    function blueCircle(n) {
+      context.save(); // 保存状态
+      // context.strokeStyle = '#fff'; //设置描边样式
+      context.lineWidth = 5; //设置线宽
+      context.beginPath();//路径开始
+      context.arc(contextX, contextY, 100, -Math.PI / 2, -Math.PI / 2 + n * rad, false);
+
+      // 渐变色 - 可自定义
+      var linGrad = context.createLinearGradient(
+          contextX-100-5, contextY, contextX+100+5, contextY
+      );
+      linGrad.addColorStop(0.0, '#06a8f3');
+      //linGrad.addColorStop(0.5, '#9bc4eb');
+      linGrad.addColorStop(1.0, '#00f8bb');
+      context.strokeStyle = linGrad;
+      context.lineCap = 'round';
+      // 用于绘制圆弧context.arc(x坐标,y坐标,半径,起始角度,终止角度,顺时针/逆时针)
+      context.stroke();//绘制
+      context.closePath();//路径结束
+      context.lineJoin = 'round'
+      context.restore();// 获取保存的状态
+    }
+    //绘制2像素宽的背景白色外圈
+    function whiteCirecle() {
+      context.save();
+      context.beginPath();
+      context.lineWidth = 2
+      context.strokeStyle = 'red'
+      context.arc(contextX, contextY, 100, 0, Math.PI * 2, false)
+      context.stroke();
+      context.closePath();
+      context.restore()
+    }
+    function text(n) {
+      context.save();
+      context.strokeStyle = '#fff';
+      context.font = '40px Arial';
+      context.strokeText(n.toFixed(0) + "%", contextX - 40, contextY + 10)
+      context.stroke()
+      context.restore()
+    }
+
+    function drawFrame(speed) {
+      context.clearRect(0, 0, canvas.width, canvas.height);
+      whiteCirecle()
+      text(speed)
+      blueCircle(speed)
+    }
+
 	}]);
 
 	//批量上架的Ctrl

+ 30 - 1
src/main/webapp/resources/view/vendor/forstore/vendor_upload.html

@@ -776,4 +776,33 @@
             <div class="img"><img src=""></div>
         </div>
     </div>
-</div>
+</div>
+
+<!-- 弹窗进度条加载 -->
+<div class="FixedCanvas" ng-show="showCanvas">
+    <canvas id="canvas" width="300" height="300"></canvas>
+    <div class="infoTEXT">上传中,请不要离开....</div>
+</div>
+
+<style>
+    .FixedCanvas {
+        position: fixed;
+        left: 0;
+        top: 0;
+        z-index: 111;
+        width: 100%;
+        height: 100%;
+        background: rgba(0, 0, 0, 0.3);
+        text-align: center;
+        /*transition: all 0.3s;*/
+    }
+    #canvas {
+        margin: 0 auto;
+        margin-top: 5%;
+    }
+    .infoTEXT {
+        font-size: 28px;
+        color: #f3f3f3;
+        margin-top: 10px;
+    }
+</style>