|
|
@@ -2513,6 +2513,26 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.linearLength = 1
|
|
|
$scope.isInCodeList = [false];
|
|
|
$scope.isInBrandList = [false];
|
|
|
+ } else if ($scope.linearLength == 0) {
|
|
|
+ $scope.replaceMaterialList.splice(0, 0, {
|
|
|
+ ptrCmpcode: '',
|
|
|
+ ptrBranden: '',
|
|
|
+ showSimilarCodeList: false,
|
|
|
+ showSimilarBrandList: false,
|
|
|
+ editable: true,
|
|
|
+ productId: $scope.replaceMaterialList[0].productId
|
|
|
+ })
|
|
|
+ $scope.errorObj.splice(0, 0, {
|
|
|
+ code: 0,
|
|
|
+ brand: 0
|
|
|
+ });
|
|
|
+ $scope.isInCodeList.splice(0, 0, false);
|
|
|
+ $scope.isInBrandList.splice(0, 0, false);
|
|
|
+ $scope.linearLength++;
|
|
|
+
|
|
|
+ if ($scope.replaceMaterialList.length > 5) {
|
|
|
+ $scope.ngLastFinished = true
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
$scope.errorObj = [{
|
|
|
@@ -2569,14 +2589,11 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.isInCodeList.splice(index + 1, 0, false);
|
|
|
$scope.isInBrandList.splice(index + 1, 0, false);
|
|
|
$scope.linearLength++;
|
|
|
- if ($scope.replaceMaterialList.length > 5) {
|
|
|
- var el = angular.element('.edit-replace-box .content')
|
|
|
- el.scrollTop(el.scrollTop() + 42)
|
|
|
- }
|
|
|
+ $scope.ngLastFinished = true
|
|
|
} else {
|
|
|
toaster.pop('error', '请填完整信息');
|
|
|
}
|
|
|
- } else if (type === 'sub' && $scope.replaceMaterialList.length > 0) {
|
|
|
+ } else if (type === 'sub' && $scope.replaceMaterialList.length > 1) {
|
|
|
$scope.linearLength--;
|
|
|
$scope.replaceMaterialList.splice(index, 1);
|
|
|
$scope.errorObj.splice(index, 1);
|
|
|
@@ -2712,45 +2729,31 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.replaceMaterialList[index].ptrBranden = brand;
|
|
|
$scope.setShowSimilarBrandList(false, index);
|
|
|
}
|
|
|
+
|
|
|
// 计算下拉的ul 位置
|
|
|
+ $scope.ulEl = null
|
|
|
+ $scope.ultype = ''
|
|
|
+ $scope.inputEl = null
|
|
|
+ $scope.inputkey = null
|
|
|
$scope.onFocus = function($event, index, type, key) {
|
|
|
- var el = angular.element('.'+index);
|
|
|
+ $scope.ulEl = angular.element('.'+index);
|
|
|
+ $scope.ultype = type
|
|
|
+ $scope.inputEl = $event
|
|
|
key+=1
|
|
|
- var X;
|
|
|
- var Y;
|
|
|
- var _scrollTop = angular.element('.edit-replace-box .content').scrollTop()
|
|
|
- if(type == 'brand') {
|
|
|
- var _t = angular.element('.com-modal-wrap').height() * 0.2 + angular.element('.edit-replace-box .title').height() + angular.element('.edit-replace-box .content .content-line')[key].offsetTop + 28
|
|
|
- Y = _t - _scrollTop
|
|
|
- X = (angular.element('body').width() - angular.element('.edit-replace-box').width()) / 2 + angular.element('.edit-replace-box').width() / 2 + $event.currentTarget.offsetLeft + 20
|
|
|
- }else {
|
|
|
- var _t = angular.element('.com-modal-wrap').height() * 0.2 + angular.element('.edit-replace-box .title').height() + angular.element('.edit-replace-box .content .content-line')[key].offsetTop + 28
|
|
|
- Y = _t - _scrollTop
|
|
|
- X = (angular.element('body').width() - angular.element('.edit-replace-box').width()) / 2 + $event.currentTarget.offsetLeft + 23
|
|
|
- }
|
|
|
- el.css({
|
|
|
- left: X,
|
|
|
- top: Y
|
|
|
- })
|
|
|
+ $scope.inputkey = key
|
|
|
+ caleUllist($scope.inputEl,$scope.ultype,$scope.inputkey,$scope.ulEl)
|
|
|
}
|
|
|
- // $scope.resetSimilar = function (index, type) {
|
|
|
- // for (var i = 0; i < $scope.replaceMaterialList.length; i++) {
|
|
|
- // if (index != i) {
|
|
|
- // $scope.replaceMaterialList[i].showSimilarCodeList = false;
|
|
|
- // $scope.replaceMaterialList[i].showSimilarBrandList = false;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
// 针对当前人员权限重组list
|
|
|
var normalChangeArr = function(arr) {
|
|
|
+ $scope.ShowReminfo = false
|
|
|
var _arr = arr.slice()
|
|
|
var _headArr = [];
|
|
|
var _lastArr = [];
|
|
|
_arr.forEach(function(obj, index){
|
|
|
if (!obj.editable) {
|
|
|
_lastArr.push(obj)
|
|
|
- } else {
|
|
|
$scope.ShowReminfo = true
|
|
|
+ } else {
|
|
|
_headArr.push(obj)
|
|
|
}
|
|
|
})
|
|
|
@@ -2760,8 +2763,47 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ angular.element(window).resize(function() {
|
|
|
+ if(!$scope.inputEl){ return false}
|
|
|
+ caleUllist($scope.inputEl,$scope.ultype,$scope.inputkey,$scope.ulEl)
|
|
|
+ })
|
|
|
|
|
|
- }]);
|
|
|
+ function caleUllist($event,type,key,el){
|
|
|
+ var _scrollTop = angular.element('.edit-replace-box .content').scrollTop()
|
|
|
+ var Y, X;
|
|
|
+ if(type == 'brand') {
|
|
|
+ var _t = angular.element(window).height() * 0.2 + angular.element('.edit-replace-box .title').height() + angular.element('.edit-replace-box .content .content-line')[key].offsetTop + 28
|
|
|
+ Y = _t - _scrollTop
|
|
|
+ X = (angular.element('body').width() - angular.element('.edit-replace-box').width()) / 2 + $event.currentTarget.offsetLeft - 11
|
|
|
+ el.css({
|
|
|
+ right: X,
|
|
|
+ top: Y
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ var _t = angular.element(window).height() * 0.2
|
|
|
+ + angular.element('.edit-replace-box .title').height()
|
|
|
+ + angular.element(
|
|
|
+ '.edit-replace-box .content .content-line')[key].offsetTop
|
|
|
+ + 28
|
|
|
+ Y = _t - _scrollTop
|
|
|
+ X = (angular.element('body').width() - angular.element(
|
|
|
+ '.edit-replace-box').width()) / 2
|
|
|
+ + $event.currentTarget.offsetLeft
|
|
|
+ el.css({
|
|
|
+ left: X,
|
|
|
+ top: Y
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
|
|
|
+ if ($scope.replaceMaterialList.length > 5 && $scope.ngLastFinished == true) {
|
|
|
+ var el = angular.element('.edit-replace-box .content')
|
|
|
+ el.scrollTop(el.scrollTop() + 42)
|
|
|
+ $scope.ngLastFinished = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }])
|
|
|
|
|
|
//类目选择模态框
|
|
|
app.register.controller('KindChooseCtrl', ['$scope', 'KindAPI', 'actives', 'toaster', '$modalInstance', function($scope, KindAPI, actives, toaster, $modalInstance) {
|
|
|
@@ -2969,4 +3011,4 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
}
|
|
|
};
|
|
|
}]);
|
|
|
-});
|
|
|
+})
|