|
|
@@ -9958,7 +9958,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
/**
|
|
|
* 新增招标单
|
|
|
*/
|
|
|
- app.controller('PurcNewTenderCtrl', ['$scope', '$filter', 'PurcTender', 'ngTableParams', 'toaster', 'BaseService', '$stateParams', '$modal', '$rootScope', '$upload', 'ShipAddress', '$http', function($scope, $filter, PurcTender, ngTableParams, toaster, BaseService, $stateParams, $modal, $rootScope, $upload, ShipAddress, $http) {
|
|
|
+ app.controller('PurcNewTenderCtrl', ['$scope', '$filter', 'PurcTender', 'ngTableParams', 'toaster', 'BaseService', '$stateParams', '$modal', '$rootScope', '$upload', 'ShipAddress', '$http', 'AuthenticationService', 'KindAPI', 'BrandActiveAPI', 'Search', 'ComponentActiveAPI',function($scope, $filter, PurcTender, ngTableParams, toaster, BaseService, $stateParams, $modal, $rootScope, $upload, ShipAddress, $http, AuthenticationService, KindAPI, BrandActiveAPI, Search, ComponentActiveAPI) {
|
|
|
+
|
|
|
+ // 录入人
|
|
|
+ AuthenticationService.getAuthentication().success(function(data) {
|
|
|
+ $scope.user = data;
|
|
|
+ });
|
|
|
+ $scope.time = $filter('date')(new Date, 'yyyy-MM-dd HH:mm');
|
|
|
|
|
|
|
|
|
$scope.loading = false;
|
|
|
@@ -10014,90 +10020,184 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
- // 搜索
|
|
|
- $scope.search = function() {
|
|
|
- if($scope.keyword) {
|
|
|
- if($scope.searchType.brand) {
|
|
|
- SessionService.set('brand', true);
|
|
|
- SessionService.unset('component');
|
|
|
- window.location.href = 'search?w=' + encodeURI(encodeURI($scope.keyword)) + '&type=brand';
|
|
|
- }else if($scope.searchType.isCmp()){
|
|
|
- SessionService.set('component', angular.toJson($scope.searchType));
|
|
|
- SessionService.unset('brand');
|
|
|
- window.location.href = 'search?w=' + encodeURI(encodeURI($scope.keyword)) + '&type=component';
|
|
|
- }else {
|
|
|
- SessionService.unset('component');
|
|
|
- SessionService.unset('brand');
|
|
|
- window.location.href = 'search?w=' + encodeURI(encodeURI($scope.keyword)) + '&type=all';
|
|
|
- }
|
|
|
-
|
|
|
+ // 联想词start
|
|
|
+
|
|
|
+ // 获取品牌联想词
|
|
|
+ $scope.getSimilarBrands = function(value) {
|
|
|
+ if (value) {
|
|
|
+ // 获取品牌联想词
|
|
|
+ return Search.getSimilarBrands({keyword : value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- // 搜索框获得焦点,显示联想框
|
|
|
- $scope.onFocus = function() {
|
|
|
- $scope.associate = true;
|
|
|
- $scope.selectIndex = -1;
|
|
|
- if(!$scope.keyword) $scope.keyword = '';
|
|
|
+ // 获取产品型号联想词
|
|
|
+ $scope.getSimilarCodes = function(value) {
|
|
|
+ if (value) {
|
|
|
+ // 获取产品型号联想词
|
|
|
+ return Search.getSimilarComponents({keyword: value}).$promise.then(function (data) {
|
|
|
+ return data.map(function (item) {
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
- // 搜索框失去焦点,关闭联想框
|
|
|
- $scope.onBlur = function() {
|
|
|
- $scope.associate = false;
|
|
|
- };
|
|
|
+ // // 获取产品类目联想词
|
|
|
+ // $scope.getSimilarKinds = function(value) {
|
|
|
+ // if (value) {
|
|
|
+ // // getSimilarLeafKinds 根据类目名获取末级联想词
|
|
|
+ // // 获取类目联想词
|
|
|
+ // return Search.getSimilarKinds({keyword : value}).$promise.then(function(data) {
|
|
|
+ // return data.map(function(item) {
|
|
|
+ // return item;
|
|
|
+ // })
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // // 点击联想词获取类目信息
|
|
|
+ // $scope.onAssociateKindClick = function(kind, submit) {
|
|
|
+ // KindAPI.getParents({childId : kind.id}, {}, function(data) {
|
|
|
+ // $scope.actives = data;
|
|
|
+ // console.log(data);
|
|
|
+ // var size = data.length;
|
|
|
+ // if (size > 0) {
|
|
|
+ // submit.gradeOneKiName = $scope.actives[0].nameCn;
|
|
|
+ // submit.kiName = submit.gradeOneKiName;
|
|
|
+ // if (size > 1) {
|
|
|
+ // submit.gradeTwoKiName = $scope.actives[1].nameCn;
|
|
|
+ // submit.kiName = submit.gradeTwoKiName;
|
|
|
+ // if (kind.level < 3) {
|
|
|
+ // submit.gradeThreeKiName = null;
|
|
|
+ // } else if (size > 2) {
|
|
|
+ // submit.gradeThreeKiName = $scope.actives[2].nameCn;
|
|
|
+ // submit.kiName = submit.gradeThreeKiName;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // console.log(submit);
|
|
|
+ // })
|
|
|
+ // };
|
|
|
|
|
|
- // 搜索框通过按键选取想要的联想词
|
|
|
- $scope.onKeyup = function() {
|
|
|
- if($scope.associates && $scope.associates.length) {
|
|
|
- if(event.keyCode == 40) { //监听到按下键
|
|
|
- $scope.selectIndex ++;
|
|
|
- if($scope.selectIndex >= $scope.associates.length) $scope.selectIndex = 0;
|
|
|
- $scope.keyword = $scope.associates[$scope.selectIndex];
|
|
|
- } else if(event.keyCode == 38) { //监听到按上键
|
|
|
- $scope.selectIndex --;
|
|
|
- if($scope.selectIndex < 0) $scope.selectIndex = $scope.associates.length - 1;
|
|
|
- $scope.keyword = $scope.keyword = $scope.associates[$scope.selectIndex];
|
|
|
- } else if(event.keyCode == 13) { //确定键
|
|
|
- $scope.search();
|
|
|
+ // 选择类目
|
|
|
+ $scope.selectKind = function(prod) {
|
|
|
+ var submit = [];
|
|
|
+ $modal.open({
|
|
|
+ animation: true,
|
|
|
+ size: 'lg',
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/product_kindChoose_modal.html',
|
|
|
+ controller: 'KindChooseCtrl',
|
|
|
+ resolve: {
|
|
|
+ actives: function() {
|
|
|
+ return $scope.actives;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }).result.then(function(data){
|
|
|
+ $scope.actives = data.actives;
|
|
|
+ var size = data.actives.length;
|
|
|
+ submit.gradeOneKiName = '';
|
|
|
+ submit.gradeTwoKiName = '';
|
|
|
+ submit.gradeThreeKiName = '';
|
|
|
+ if (size > 0) {
|
|
|
+ submit.gradeOneKiName = $scope.actives[0].nameCn;
|
|
|
+ prod.prodTitle = submit.gradeOneKiName;
|
|
|
+ if (size > 1) {
|
|
|
+ submit.gradeTwoKiName = $scope.actives[1].nameCn;
|
|
|
+ prod.prodTitle = submit.gradeTwoKiName;
|
|
|
+ if (size > 2) {
|
|
|
+ submit.gradeThreeKiName = $scope.actives[2].nameCn;
|
|
|
+ prod.prodTitle = submit.gradeThreeKiName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
- // 输入框内容变化,获取新的联想词
|
|
|
- $scope.onChange = function(prodCode) {
|
|
|
- if (prodCode) {
|
|
|
- var params = {
|
|
|
- keyword: prodCode
|
|
|
- };
|
|
|
- $http.get('tender/similarKeywords', {
|
|
|
- params : params
|
|
|
- }).success(function(data){
|
|
|
- $scope.associates = data;// 联想词数组
|
|
|
- }).error(function(response) {
|
|
|
+ // // 验证分类信息
|
|
|
+ // $scope.checkKind = function() {
|
|
|
+ // setTimeout(function() {
|
|
|
+ // if($scope.activesString == null) {
|
|
|
+ // $scope.component.kindid = null;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // KindAPI.getKindByName({name : encodeURIComponent($scope.activesString)}, function(kind) {
|
|
|
+ // $scope.component.kind = kind;
|
|
|
+ // $scope.component.kindid = kind.id;
|
|
|
+ // $scope.activesString = $scope.component.kind.nameCn;
|
|
|
+ // KindAPI.getPropertiesValues({kindId: $scope.component.kindid}, function(data) {
|
|
|
+ // $scope.kindProperties = data;
|
|
|
+ // angular.forEach($scope.kindProperties, function(kp) {
|
|
|
+ // angular.forEach($scope.component.properties, function(pro) {
|
|
|
+ // if (pro.value && (kp.propertyId == pro.propertyid)) {
|
|
|
+ // kp.value = pro.value;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // }, function(response) {
|
|
|
+ // });
|
|
|
+ // }, function (response) {
|
|
|
+ // $scope.component.kindid = null;
|
|
|
+ // toaster.pop('error', response.data);
|
|
|
+ // });
|
|
|
+ // }, 500);
|
|
|
+ // };
|
|
|
|
|
|
- });
|
|
|
- } else {
|
|
|
- $scope.associates = [];// 联想词数组
|
|
|
- }
|
|
|
|
|
|
+ // 点击联想词获取品牌信息
|
|
|
+ $scope.onAssociateBrandClick = function(brand, prod) {
|
|
|
+ // $scope.component.brand = brand;
|
|
|
+ // $scope.component.brandid = brand.id;
|
|
|
+ prod.brand = brand;
|
|
|
};
|
|
|
|
|
|
- // 点击联想词
|
|
|
- $scope.onAssociateClick = function(component) {
|
|
|
- $scope.keyword = component;
|
|
|
- $scope.search();
|
|
|
- };
|
|
|
+ // 打开品牌选择的模态框
|
|
|
+ $scope.selectBrand = function(prod){ //打开模态
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl : 'static/tpl/index/purc/modal/product_brandChoose_modal.html', //指向上面创建的视图
|
|
|
+ controller : 'BrandModalInstanceCtrl' // 初始化模态范围
|
|
|
+ });
|
|
|
+ modalInstance.opened.then(function(){// 模态窗口打开之后执行的函数
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function(brand){
|
|
|
+ console.log(brand);
|
|
|
+ prod.brand = brand.nameCn;
|
|
|
+ }, function(reason){
|
|
|
|
|
|
- // 鼠标进入联想词框,不能关闭联想词框
|
|
|
- $scope.onAssociateEnter = function() {
|
|
|
- $scope.associateEnter = true;
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
- // 鼠标离开联想词框,可以关闭联想词框
|
|
|
- $scope.onAssociateLeave = function() {
|
|
|
- $scope.associateEnter = false;
|
|
|
+ // // 验证品牌是否正确
|
|
|
+ // $scope.checkBrand = function () {
|
|
|
+ // setTimeout(function () {
|
|
|
+ // BrandActiveAPI.findByName({name : encodeURIComponent($scope.component.brand.nameCn)}, function (data) {
|
|
|
+ // // $scope.component.brand = brand;
|
|
|
+ // // $scope.component.brandid = brand.id;
|
|
|
+ // }, function (response) {
|
|
|
+ // // $scope.component.brandid = null;
|
|
|
+ // toaster.pop('error', response.data);
|
|
|
+ // })
|
|
|
+ // } , 500);
|
|
|
+ // };
|
|
|
+
|
|
|
+
|
|
|
+ // 点击联想词获取器件信息 带入产品分类和品牌
|
|
|
+ $scope.onAssociateCmpClick = function(cmp, prod) {
|
|
|
+ ComponentActiveAPI.get({uuid : cmp.uuid}, {}, function(data) {
|
|
|
+ $scope.component = data;
|
|
|
+ prod.prodCode = data.code;
|
|
|
+ prod.prodTitle = data.kind.nameCn;
|
|
|
+ prod.brand = data.brand.nameCn;
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '提示', '产品信息加载失败,请刷新页面');
|
|
|
+ })
|
|
|
};
|
|
|
+ //联想词end
|
|
|
|
|
|
$scope.condition = {dateZone: 1};
|
|
|
$scope.tenderProd = [];
|
|
|
@@ -10182,8 +10282,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
}
|
|
|
|
|
|
if(angular.isUndefined($stateParams.id)) { // 发布招标单之后,再次新增招标单时,新增供应商时不会勾选上一个单据选择的供应商
|
|
|
- $scope.tenderProd.enterpriseBaseInfo = [{}];
|
|
|
- $rootScope.tenderVendor = $scope.tenderProd.enterpriseBaseInfo;
|
|
|
+ $rootScope.tenderVendor = [{}];
|
|
|
}
|
|
|
|
|
|
$scope.changeShipAddress = false;
|
|
|
@@ -10403,6 +10502,150 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
}]);
|
|
|
|
|
|
|
|
|
+ //类目选择模态框
|
|
|
+ app.controller('KindChooseCtrl', ['$scope', 'KindAPI', 'actives', 'toaster', '$modalInstance', function($scope, KindAPI, actives, toaster, $modalInstance) {
|
|
|
+ $scope.actives = actives;
|
|
|
+ $scope.kinds = [[], [], [], []];
|
|
|
+ // 获取子类目
|
|
|
+ var getChildren = function(pid, deep) {
|
|
|
+ KindAPI.getChildren({parentId: pid}, function(data) {
|
|
|
+ $scope.kinds[deep] = data;
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '获取子类目失败', response.data);
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 改变节点选中状态
|
|
|
+ var changeStatus = function(item, deep) {
|
|
|
+ var actives = [], level = 0;
|
|
|
+ angular.forEach($scope.kinds, function(ks, i) {
|
|
|
+ if(i > deep) {
|
|
|
+ $scope.kinds[i] = [];
|
|
|
+ } else {
|
|
|
+ angular.forEach(ks, function(k, j) {
|
|
|
+ if(i == deep) {
|
|
|
+ if(k.id == item.id) {
|
|
|
+ $scope.kinds[i][j].$active = true;
|
|
|
+ actives.push(k);
|
|
|
+ } else {
|
|
|
+ k.$active = null;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(k.$active) {
|
|
|
+ actives.push(k);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 选择的节点
|
|
|
+ $scope.actives = actives;
|
|
|
+ $scope.active = item;
|
|
|
+ // 当前可操作的层级
|
|
|
+ if(deep < 3) {
|
|
|
+ $scope.activeDeep = deep + 1;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 节点点击后获取子类目,节点被选中
|
|
|
+ $scope.onItemClick = function(item, deep) {
|
|
|
+ changeStatus(item, deep);
|
|
|
+ if (!item.isLeaf) {
|
|
|
+ getChildren(item.id, deep + 1);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 重新加载数据
|
|
|
+ function reload(deep) {
|
|
|
+ var pid;
|
|
|
+ if(deep) {
|
|
|
+ pid = $scope.actives[deep - 1].id;
|
|
|
+ } else {
|
|
|
+ pid = 0;
|
|
|
+ deep = 0;
|
|
|
+ }
|
|
|
+ getChildren(pid, deep);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 初始加载数据,获取第一层的类目
|
|
|
+ if($scope.actives) {
|
|
|
+ angular.forEach($scope.actives, function(v, k) {
|
|
|
+ KindAPI.getChildren({parentId: v.parentid}, function(data) {
|
|
|
+ $scope.kinds[k] = data;
|
|
|
+ angular.forEach($scope.kinds[k], function(kind, i){
|
|
|
+ if(kind.id == v.id) {
|
|
|
+ $scope.kinds[k][i].$active = true;
|
|
|
+ $scope.actives[k] = $scope.kinds[k][i];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '获取子类目失败', response.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取消
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ };
|
|
|
+
|
|
|
+ // 确认选择
|
|
|
+ $scope.check = function() {
|
|
|
+ var a = {
|
|
|
+ active: $scope.active,
|
|
|
+ actives: $scope.actives
|
|
|
+ };
|
|
|
+ $modalInstance.close(a);
|
|
|
+ };
|
|
|
+ }]);
|
|
|
+
|
|
|
+ //品牌选择模态框的controller
|
|
|
+ app.controller('BrandModalInstanceCtrl', ['$scope', '$modalInstance', 'ngTableParams', 'BrandActiveAPI', 'BaseService', function($scope, $modalInstance, ngTableParams, BrandActiveAPI, BaseService) {
|
|
|
+ $scope.filter = {};
|
|
|
+ $scope.brandsTableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 10,
|
|
|
+ sorting : {
|
|
|
+ nameCn: 'asc'
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts : [],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ var param = BaseService.parseParams(params.url());
|
|
|
+ param.keyword = $scope.filter.keyword;
|
|
|
+ var keyword = $scope.filter.keyword;
|
|
|
+ // param.keyword = $scope.filter.keyword;
|
|
|
+ BrandActiveAPI.getSimpleInfoPage(param, {}, function(page) {
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ }
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 搜索
|
|
|
+ $scope.search = function() {
|
|
|
+ // $scope.brandsTableParams.filter({$: $scope.filter.keyword});
|
|
|
+ $scope.brandsTableParams.page(1);
|
|
|
+ $scope.brandsTableParams.reload();
|
|
|
+ };
|
|
|
+ // 选择
|
|
|
+ $scope.select = function(brand){
|
|
|
+ $modalInstance.close(brand);
|
|
|
+ };
|
|
|
+ // 关闭
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ };
|
|
|
+ }]);
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 招标单批量导入
|
|
|
*/
|