|
|
@@ -11026,7 +11026,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
/**
|
|
|
* 新增物料(销售)
|
|
|
*/
|
|
|
- app.controller('NewProdInfoCtrl', ['$scope', 'GetProductInfo', '$upload', 'ngTableParams', '$stateParams', 'toaster', '$modal', 'ComponentActive', 'KindAPI', '$timeout', '$filter', 'AuthenticationService', 'BaseService', function($scope, GetProductInfo, $upload, ngTableParams, $stateParams, toaster, $modal, ComponentActive, KindAPI, $timeout, $filter, AuthenticationService, BaseService) {
|
|
|
+ app.controller('NewProdInfoCtrl', ['$scope', 'GetProductInfo', '$upload', 'ngTableParams', '$stateParams', 'toaster', '$modal', 'ComponentActive', 'KindAPI', '$timeout', '$filter', 'AuthenticationService', 'BaseService', 'Products', function($scope, GetProductInfo, $upload, ngTableParams, $stateParams, toaster, $modal, ComponentActive, KindAPI, $timeout, $filter, AuthenticationService, BaseService, Products) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
// 录入人
|
|
|
AuthenticationService.getAuthentication().success(function(data) {
|
|
|
@@ -11068,6 +11068,51 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ // 联想词 start
|
|
|
+ // 获取类目
|
|
|
+ $scope.getSimilarKinds = function(value) {
|
|
|
+ if (value) {
|
|
|
+ return Products.getSimilarKind({keyword : value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.onAssociateKindClick = function(kind, prodInfo) {
|
|
|
+ $scope.prodInfo.title = kind.kindCn;
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.getSimilarBrands = function(value) {
|
|
|
+ if(value) {
|
|
|
+ return Products.getSimilarBrand({keyword: value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.onAssociateBrandClick = function(brand, prodInfo) {
|
|
|
+ $scope.prodInfo.brand = brand.brandEn;
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.getSimilarComponents = function(value) {
|
|
|
+ if(value) {
|
|
|
+ return Products.getSimilarComponent({keyword: value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.onAssociateComponentClick = function(cmp, prodInfo) {
|
|
|
+ $scope.prodInfo.cmpCode = cmp.code;
|
|
|
+ }
|
|
|
+ // 联想词 end
|
|
|
+
|
|
|
// 删除
|
|
|
$scope.clearfile = function() {
|
|
|
$scope.myFiles = null;
|
|
|
@@ -11075,35 +11120,36 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
//提交
|
|
|
$scope.submit = function(prodInfo){
|
|
|
+ console.log(prodInfo);
|
|
|
$scope.prodInfo.isSale = 1;
|
|
|
- var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
- $upload.upload({
|
|
|
- url: 'product/baseInfo/addNewProduct',
|
|
|
- file: file,
|
|
|
- method: 'POST',
|
|
|
- data: {
|
|
|
- prodInfo: prodInfo
|
|
|
- },
|
|
|
- }).success(function(data) {
|
|
|
- if(data.success) {
|
|
|
- toaster.pop('success', '提示', data.success);
|
|
|
- $timeout(function() {
|
|
|
- //提交后跳转到详情页面,防止重复提交
|
|
|
- window.location.href="#/sale/prodList/"+data.id;
|
|
|
- }, 500);
|
|
|
- }
|
|
|
- if(data.error) {
|
|
|
- toaster.pop('error', '提示', data.error);
|
|
|
- $timeout(function() {
|
|
|
- //提交后跳转到详情页面,防止重复提交
|
|
|
- window.location.href="#/sale/prodList/"+data.id;
|
|
|
- }, 500);
|
|
|
- }
|
|
|
-
|
|
|
- }).error(function(data) {
|
|
|
- $scope.loadingShow = false;
|
|
|
- toaster.pop('error', '操作失败', data.error);
|
|
|
- });
|
|
|
+// var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
+// $upload.upload({
|
|
|
+// url: 'product/baseInfo/addNewProduct',
|
|
|
+// file: file,
|
|
|
+// method: 'POST',
|
|
|
+// data: {
|
|
|
+// prodInfo: prodInfo
|
|
|
+// },
|
|
|
+// }).success(function(data) {
|
|
|
+// if(data.success) {
|
|
|
+// toaster.pop('success', '提示', data.success);
|
|
|
+// $timeout(function() {
|
|
|
+// //提交后跳转到详情页面,防止重复提交
|
|
|
+// window.location.href="#/sale/prodList/"+data.id;
|
|
|
+// }, 500);
|
|
|
+// }
|
|
|
+// if(data.error) {
|
|
|
+// toaster.pop('error', '提示', data.error);
|
|
|
+// $timeout(function() {
|
|
|
+// //提交后跳转到详情页面,防止重复提交
|
|
|
+// window.location.href="#/sale/prodList/"+data.id;
|
|
|
+// }, 500);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }).error(function(data) {
|
|
|
+// $scope.loadingShow = false;
|
|
|
+// toaster.pop('error', '操作失败', data.error);
|
|
|
+// });
|
|
|
};
|
|
|
|
|
|
$scope.previewShow = false;
|
|
|
@@ -17795,7 +17841,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
/**
|
|
|
* 新增物料(采购)
|
|
|
*/
|
|
|
- app.controller('PurcNewProdInfoCtrl', ['$scope', 'GetProductInfo', '$upload', 'ngTableParams', '$stateParams', 'toaster', '$modal', 'ComponentActive', 'KindAPI', '$timeout', '$filter', 'AuthenticationService', 'BaseService', function($scope, GetProductInfo, $upload, ngTableParams, $stateParams, toaster, $modal, ComponentActive, KindAPI, $timeout, $filter, AuthenticationService, BaseService) {
|
|
|
+ app.controller('PurcNewProdInfoCtrl', ['$scope', 'GetProductInfo', '$upload', 'ngTableParams', '$stateParams', 'toaster', '$modal', 'ComponentActive', 'KindAPI', '$timeout', '$filter', 'AuthenticationService', 'BaseService', 'Products', function($scope, GetProductInfo, $upload, ngTableParams, $stateParams, toaster, $modal, ComponentActive, KindAPI, $timeout, $filter, AuthenticationService, BaseService, Products) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
// 录入人
|
|
|
AuthenticationService.getAuthentication().success(function(data) {
|
|
|
@@ -17837,6 +17883,51 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ // 联想词 start
|
|
|
+ // 获取类目
|
|
|
+ $scope.getSimilarKinds = function(value) {
|
|
|
+ if (value) {
|
|
|
+ return Products.getSimilarKind({keyword : value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.onAssociateKindClick = function(kind, prodInfo) {
|
|
|
+ $scope.prodInfo.title = kind.kindCn;
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.getSimilarBrands = function(value) {
|
|
|
+ if(value) {
|
|
|
+ return Products.getSimilarBrand({keyword: value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.onAssociateBrandClick = function(brand, prodInfo) {
|
|
|
+ $scope.prodInfo.brand = brand.brandEn;
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.getSimilarComponents = function(value) {
|
|
|
+ if(value) {
|
|
|
+ return Products.getSimilarComponent({keyword: value}).$promise.then(function(data) {
|
|
|
+ return data.map(function(item) {
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.onAssociateComponentClick = function(cmp, prodInfo) {
|
|
|
+ $scope.prodInfo.cmpCode = cmp.code;
|
|
|
+ }
|
|
|
+ // 联想词 end
|
|
|
+
|
|
|
// 删除
|
|
|
$scope.clearfile = function() {
|
|
|
$scope.myFiles = null;
|