|
|
@@ -1,12 +1,13 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
'use strict';
|
|
|
- app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', '$location', '$stateParams', 'Search', '$modal', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService, $location, $stateParams, Search, $modal) {
|
|
|
+ app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', '$location', '$stateParams', 'Search', '$modal', 'ComponentActiveAPI', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService, $location, $stateParams, Search, $modal, ComponentActiveAPI) {
|
|
|
$rootScope.active = 'vendor_material';
|
|
|
|
|
|
$scope.tab = 'material';
|
|
|
$scope.standard_tab = $stateParams.standardParam?$stateParams.standardParam:'standard';
|
|
|
$scope.choosedIds = [];
|
|
|
$scope.deleteDiv = false;
|
|
|
+ $scope.submitProduct = {};
|
|
|
|
|
|
$scope.param = {
|
|
|
page : 1,
|
|
|
@@ -1048,6 +1049,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 获取品牌联想词
|
|
|
$scope.getSimilarBrands = function(keyword) {
|
|
|
if (keyword) {
|
|
|
return Search.getSimilarBrands({keyword : keyword}).$promise.then(function(data) {
|
|
|
@@ -1058,6 +1060,11 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ // 选择品牌
|
|
|
+ $scope.onAssociateClickBrand = function (brand) {
|
|
|
+ $scope.submitProduct.brand = brand
|
|
|
+ };
|
|
|
+
|
|
|
// 获取器件联想词
|
|
|
$scope.getSimilarCmps = function(code) {
|
|
|
if (code) {
|
|
|
@@ -1068,6 +1075,15 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
+ // 选择器件
|
|
|
+ $scope.onAssociateClickCmp = function (cmp) {
|
|
|
+ $scope.submitProduct.component = cmp;
|
|
|
+ ComponentActiveAPI.get({uuid : cmp.uuid}, {}, function(data) {
|
|
|
+ var component = data;
|
|
|
+ $scope.submitProduct.brand = component.brand;
|
|
|
+ $scope.submitProduct.kind = component.kind;
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
// 获取末级类目联想词
|
|
|
$scope.getSimilarKinds = function(name) {
|
|
|
@@ -1080,6 +1096,10 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ $scope.onAssociateClickKind = function (kind) {
|
|
|
+ $scope.submitProduct.kind = kind;
|
|
|
+ };
|
|
|
+
|
|
|
// 选择类目
|
|
|
$scope.selectKind = function() {
|
|
|
$modal.open({
|
|
|
@@ -1093,18 +1113,44 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
}).result.then(function(data){
|
|
|
- $scope.activesString = data.actives[data.actives.length - 1].nameCn;;
|
|
|
+ $scope.submitProduct.kind = data.actives[data.actives.length - 1];
|
|
|
}, function(){
|
|
|
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ // 提交申请
|
|
|
+ $scope.submit = function () {
|
|
|
+ if (typeof $scope.submitProduct.brand == 'undefined' || $scope.submitProduct.brand.nameEn == null) {
|
|
|
+ toaster.pop('warning', '请填写品牌英文名');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (typeof $scope.submitProduct.component == 'undefined' || $scope.submitProduct.component.code == null) {
|
|
|
+ toaster.pop('warning', '请填写原厂型号');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (typeof $scope.submitProduct.website == 'undefined' || $scope.submitProduct.website == null) {
|
|
|
+ toaster.pop('warning', '请填写品牌官网');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (typeof $scope.submitProduct.kind == 'undefined' || $scope.submitProduct.kind.id == null) {
|
|
|
+ toaster.pop('warning', '请填写或选择商城已有类目');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ($scope.attachName == '') {
|
|
|
+ toaster.pop('warning', '请填上传规格书');
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ $scope.submitProduct.attach = $scope.attachName;
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log($scope.submitProduct);
|
|
|
+ };
|
|
|
+
|
|
|
$scope.attachName = '';
|
|
|
//上传规格书
|
|
|
$scope.onAttachInput = function (event) {
|
|
|
- console.log(event.target.files[0]);
|
|
|
$scope.attachName = event.target.files[0].name;
|
|
|
- console.log($scope.attachName);
|
|
|
}
|
|
|
$scope.deleteAttach = function () {
|
|
|
$scope.attachName = '';
|