|
|
@@ -20,7 +20,36 @@ define(['app/app'], function(app) {
|
|
|
}, function () {
|
|
|
toaster.pop("error", "错误", "获取快递公司列表失败");
|
|
|
});
|
|
|
- }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.initData = function () {
|
|
|
+ Distributor.findAllSelected({},function (data) {
|
|
|
+ if (data){
|
|
|
+ $scope.data_list = data;
|
|
|
+ }
|
|
|
+ angular.forEach($scope.data_list, function (data) {
|
|
|
+ data.isOpen = false;
|
|
|
+ })
|
|
|
+ })
|
|
|
+ };
|
|
|
+ $scope.initData();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化所有的快递鸟列表
|
|
|
+ */
|
|
|
+ $scope.findAllKdnList = function () {
|
|
|
+ KdnLogistics.getCompanyName({}, function (data) {
|
|
|
+ if (data){
|
|
|
+ $scope.allKdnList = data;
|
|
|
+ }
|
|
|
+ angular.forEach($scope.allKdnList, function (data) {
|
|
|
+ data.isChoosed = false;
|
|
|
+ });
|
|
|
+ }, function (error) {
|
|
|
+
|
|
|
+ })
|
|
|
+ };
|
|
|
+ $scope.findAllKdnList();
|
|
|
|
|
|
$scope.showText = function (data) {
|
|
|
document.getElementById("addr").value = data;
|
|
|
@@ -589,7 +618,10 @@ define(['app/app'], function(app) {
|
|
|
size : 'lg',
|
|
|
resolve : {
|
|
|
allKdnList : function () {
|
|
|
- return $scope.kdnList;
|
|
|
+ return $scope.allKdnList;
|
|
|
+ },
|
|
|
+ selectedList : function () {
|
|
|
+ return $scope.data_list;
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function(data){
|
|
|
@@ -679,49 +711,29 @@ define(['app/app'], function(app) {
|
|
|
};
|
|
|
}]);
|
|
|
|
|
|
- app.register.controller('vendorDistributorModalCtrl', ['$scope','$rootScope','$modal','toaster','KdnLogistics','Distributor','BaseService','ngTableParams','allKdnList','$modalInstance','$q', function ($scope, $rootScope, $modal, toaster, KdnLogistics, Distributor, BaseService, ngTableParams, allKdnList, $modalInstance, $q) {
|
|
|
+ app.register.controller('vendorDistributorModalCtrl', ['$scope','$rootScope','$modal','toaster','KdnLogistics','Distributor','BaseService','ngTableParams','$modalInstance','$q','selectedList','allKdnList', function ($scope, $rootScope, $modal, toaster, KdnLogistics, Distributor, BaseService, ngTableParams, $modalInstance, $q, selectedList, allKdnList) {
|
|
|
//获取快递鸟信息
|
|
|
$scope.$$kdnData = {};
|
|
|
+ $scope.selectedList = selectedList;
|
|
|
$scope.allKdnList = allKdnList;
|
|
|
$scope.chooseList = [];
|
|
|
$scope.selectFlag = [];
|
|
|
|
|
|
- var initSelectedList = function () {
|
|
|
- return Distributor.findAllSelected({},function (data) {
|
|
|
- if (data){
|
|
|
- $scope.selectedList = data;
|
|
|
- angular.forEach($scope.selectedList, function (data) {
|
|
|
- data.isOpen = false;
|
|
|
- });
|
|
|
- }
|
|
|
- console.log($scope.selectedList);
|
|
|
- },function (error) {
|
|
|
- toaster.pop('error', '获取数据失败' + error.data);
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
- // var getAllKdnList = function () {
|
|
|
- // return
|
|
|
- // };
|
|
|
-
|
|
|
- $q.all([initSelectedList().$promise]).then(function () {
|
|
|
- console.log(allKdnList);
|
|
|
+ $scope.initArrayData = function () {
|
|
|
angular.forEach(allKdnList, function (data) {
|
|
|
$scope.selectFlag[data.code] = {};
|
|
|
$scope.selectFlag[data.code].isChoosed = false;
|
|
|
});
|
|
|
- if ($scope.selectedList){
|
|
|
- console.log($scope.selectedList);
|
|
|
- angular.forEach($scope.selectedList, function (data, index) {
|
|
|
- $scope.chooseList[index] = {};
|
|
|
- if (data.code){
|
|
|
- $scope.chooseList[index].code = data.code;
|
|
|
- $scope.selectFlag[data.code].isChoosed = true;
|
|
|
- }
|
|
|
- $scope.chooseList[index].companyName = data.companyName;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ angular.forEach(selectedList, function (data, index) {
|
|
|
+ $scope.chooseList[index] = {};
|
|
|
+ if (data.code){
|
|
|
+ $scope.chooseList[index].code = data.code;
|
|
|
+ $scope.selectFlag[data.code].isChoosed = true;
|
|
|
+ }
|
|
|
+ $scope.chooseList[index].companyName = data.companyName;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ $scope.initArrayData();
|
|
|
|
|
|
$scope.distributorTableParams = new ngTableParams({
|
|
|
page : 1,
|