|
|
@@ -213,12 +213,12 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
if (data && typeof data.fluctuateRate != 'undefined') {
|
|
|
$scope.uasBatchPutOnProperty = data;
|
|
|
$scope.uasBatchPutOnProperty.editFluctuateRate = NumberService.mul($scope.uasBatchPutOnProperty.fluctuateRate, 100) || 100;
|
|
|
- $scope.uasBatchPutOnProperty.editMaxDelivery = $scope.uasBatchPutOnProperty.maxDelivery || 1;
|
|
|
+ $scope.uasBatchPutOnProperty.editMaxDelivery = $scope.uasBatchPutOnProperty.maxDelivery || 10;
|
|
|
$scope.uasBatchPutOnProperty.editMinDelivery = $scope.uasBatchPutOnProperty.minDelivery || 1;
|
|
|
} else {
|
|
|
$scope.uasBatchPutOnProperty = {};
|
|
|
$scope.uasBatchPutOnProperty.editFluctuateRate = 100;
|
|
|
- $scope.uasBatchPutOnProperty.editMaxDelivery = 1;
|
|
|
+ $scope.uasBatchPutOnProperty.editMaxDelivery = 10;
|
|
|
$scope.uasBatchPutOnProperty.editMinDelivery = 1;
|
|
|
}
|
|
|
}, function (response) {
|
|
|
@@ -230,8 +230,14 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
* @param isStandard
|
|
|
*/
|
|
|
$scope.toggleStandard = function (isStandard) {
|
|
|
+ if ($scope.standard_tab == 'matchResult') {
|
|
|
+ $scope.lastMaterial = $scope.currenctMaterial;
|
|
|
+ }
|
|
|
$scope.standard_tab = isStandard;
|
|
|
$scope.param.keyword = '';
|
|
|
+ if ($scope.chooseAllPage) {
|
|
|
+ $scope.chooseAllPage = false;
|
|
|
+ }
|
|
|
if (isStandard == 'standard')
|
|
|
$scope.param.type = "standard";
|
|
|
if (isStandard == 'unstandard')
|
|
|
@@ -270,21 +276,41 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
};
|
|
|
|
|
|
// 全选
|
|
|
- $scope.chooseAll = function () {
|
|
|
- $scope.isChoosedAll = !$scope.isChoosedAll;
|
|
|
+ $scope.chooseAllItem = function () {
|
|
|
+ $scope.chooseAll = !$scope.chooseAll;
|
|
|
+ angular.forEach($scope.currenctMaterial, function (material) {
|
|
|
+ material.isChoosed = $scope.chooseAll;
|
|
|
+ });
|
|
|
+ if (!$scope.chooseAll) {
|
|
|
+ $scope.chooseAllPage = false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.turnAllPage = function () {
|
|
|
+ if ($scope.chooseAll) {
|
|
|
+ $scope.chooseAllPage = true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancelAllPage = function () {
|
|
|
+ $scope.chooseAllPage = false;
|
|
|
+ $scope.chooseAll = false;
|
|
|
angular.forEach($scope.currenctMaterial, function (material) {
|
|
|
- material.isChoosed = $scope.isChoosedAll;
|
|
|
+ material.isChoosed = false;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 检查是否全选
|
|
|
var checkChoosedAll = function () {
|
|
|
- $scope.isChoosedAll = true;
|
|
|
+ $scope.chooseAll = true;
|
|
|
angular.forEach($scope.currenctMaterial, function (material) {
|
|
|
if (!material.isChoosed) {
|
|
|
- $scope.isChoosedAll = false;
|
|
|
+ $scope.chooseAll = false;
|
|
|
}
|
|
|
});
|
|
|
+ if (!$scope.chooseAll) {
|
|
|
+ $scope.chooseAllPage = false;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 单选
|
|
|
@@ -309,6 +335,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
|
|
|
//获取选中之后的信息
|
|
|
$scope.getChoosedInfo = function () {
|
|
|
+ $scope.choosedIds = [];
|
|
|
angular.forEach($scope.currenctMaterial, function (material) {
|
|
|
if (material.isChoosed) {
|
|
|
$scope.choosedIds.push(material.id);
|
|
|
@@ -400,7 +427,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
// 批量删除
|
|
|
$scope.deleteBatch = function () {
|
|
|
$scope.getChoosedInfo();
|
|
|
- if(!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
+ if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
toaster.pop('warning', '提示','请选择要删除的信息');
|
|
|
return ;
|
|
|
}
|
|
|
@@ -414,19 +441,19 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
|
|
|
// 单个删除
|
|
|
$scope.deleteMaterial = function(material) {
|
|
|
- if(!material || !material.id) {
|
|
|
+ if (!material || !material.id) {
|
|
|
return ;
|
|
|
}
|
|
|
Goods.getDeleteProductMessage({productid: material.id}, function (data) {
|
|
|
console.log(data);
|
|
|
- if(data.code == 1) {
|
|
|
+ if (data.code == 1) {
|
|
|
$scope.$$nonProduct.deleteMessage = data.message;
|
|
|
$scope.choosedIds = [];
|
|
|
$scope.choosedIds.push(material.id);
|
|
|
$scope.$$nonProduct.deleteGoods = false;
|
|
|
$scope.$$nonProduct.deleteMaterial = true;
|
|
|
$scope.opendeleteModal();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
toaster.pop('warning', '提示', data.message);
|
|
|
}
|
|
|
}, function (response) {
|
|
|
@@ -453,7 +480,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
return $scope.$$nonProduct.deleteGoods;
|
|
|
},
|
|
|
selectAll : function () {
|
|
|
- return $scope.isChoosedAll;
|
|
|
+ return $scope.chooseAllPage;
|
|
|
},
|
|
|
standard_tab : function () {
|
|
|
return $scope.standard_tab;
|
|
|
@@ -800,50 +827,113 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.toggleTab = function (status) {
|
|
|
$scope.param.type = 'nStandard';
|
|
|
$scope.param.count = $scope.$$nonProduct.count;
|
|
|
- loadData();
|
|
|
+ if (status == 'matchResult') {
|
|
|
+ $scope.currenctMaterial = $scope.lastMaterial;
|
|
|
+ $scope.materialAll = {};
|
|
|
+ } else {
|
|
|
+ loadData();
|
|
|
+ }
|
|
|
$scope.standard_tab = status;
|
|
|
};
|
|
|
|
|
|
$scope.closeResultFrame = function (status) {
|
|
|
$scope.standard_tab = status;
|
|
|
$scope.resultFrame = false;
|
|
|
+ $scope.param.type = 'nStandard';
|
|
|
+ loadData();
|
|
|
};
|
|
|
|
|
|
$scope.closeTip = function () {
|
|
|
$scope.resultTip = false;
|
|
|
};
|
|
|
|
|
|
+ var loadSelectedData = function () {
|
|
|
+ $scope.materialAll = {};
|
|
|
+ Material.getDataByBatch({batch:$scope.batch}, function (data) {
|
|
|
+ $scope.currenctMaterial = data;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
// 一键匹配
|
|
|
$scope.matchAll = function () {
|
|
|
- Material.matchNonProduct({}, {}, function (data) {
|
|
|
- if (data.success){
|
|
|
- $scope.resultFrame = true;
|
|
|
- $scope.matchTotal = data.data.total;
|
|
|
- $scope.matchSuccess = data.data.success;
|
|
|
- $scope.matchFail = data.data.fail;
|
|
|
- $scope.standard_tab = 'matchResult';
|
|
|
- $scope.param.type = "nStandard";
|
|
|
- loadData();
|
|
|
- }else {
|
|
|
- toaster.pop("info", data.message);
|
|
|
+ if ($scope.chooseAllPage) {
|
|
|
+ Material.matchNonProduct({}, {}, function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ $scope.resultFrame = true;
|
|
|
+ $scope.matchTotal = data.data.total;
|
|
|
+ $scope.matchSuccess = data.data.success;
|
|
|
+ $scope.matchFail = data.data.fail;
|
|
|
+ $scope.standard_tab = 'matchResult';
|
|
|
+ $scope.param.type = "nStandard";
|
|
|
+ loadData();
|
|
|
+ } else {
|
|
|
+ toaster.pop("info", data.message);
|
|
|
+ }
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop("error", "匹配操作失败!")
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $scope.getChoosedInfo();
|
|
|
+ if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
+ toaster.pop("info", "您尚未选中任何产品");
|
|
|
+ return ;
|
|
|
}
|
|
|
- }, function (error) {
|
|
|
- toaster.pop("error", "匹配操作失败!")
|
|
|
- });
|
|
|
+ Material.matchSelected({}, $scope.choosedIds, function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ $scope.resultFrame = true;
|
|
|
+ $scope.matchTotal = data.data.total;
|
|
|
+ $scope.matchSuccess = data.data.success;
|
|
|
+ $scope.matchFail = data.data.fail;
|
|
|
+ $scope.standard_tab = 'matchResult';
|
|
|
+ $scope.batch = data.data.batch;
|
|
|
+ $scope.currenctMaterial = [];
|
|
|
+ loadSelectedData();
|
|
|
+ } else {
|
|
|
+ toaster.pop("error", data.message);
|
|
|
+ }
|
|
|
+ }, function (error) {
|
|
|
|
|
|
- // Material.matchAll({}, function (data) {
|
|
|
- // if (data.updateCount > 0) {
|
|
|
- // toaster.pop('success', '匹配完成, 本次匹配成功 ' + data.updateCount +' 个,可前往“标准产品”中 , 编辑上架。');
|
|
|
- // }
|
|
|
- // else {
|
|
|
- // toaster.pop('success', '匹配完成, 暂无匹配成功产品,可前往“品牌申请/器件申请”中 , 提出申请。');
|
|
|
- // }
|
|
|
- // loadDataReload();
|
|
|
- // }, function (response) {
|
|
|
- // toaster.pop('info', response.data);
|
|
|
- // });
|
|
|
+ })
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
+ // 一键添加到个人产品库
|
|
|
+ $scope.setAllInPerson = function () {
|
|
|
+ if ($scope.chooseAllPage) {
|
|
|
+ if ('standard' == $scope.standard_tab) {
|
|
|
+ $scope.setPrArg = {isAll : 1, isStardand : 1};
|
|
|
+ } else {
|
|
|
+ $scope.setPrArg = {isAll : 1, isStardand : 0};
|
|
|
+ }
|
|
|
+ Material.setAllProductsByPerson( $scope.setPrArg ,{}, function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ toaster.pop("info", "绑定成功!");
|
|
|
+ loadData();
|
|
|
+ } else {
|
|
|
+ toaster.pop("info", data.message);
|
|
|
+ }
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop("error", "绑定失败!")
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $scope.getChoosedInfo();
|
|
|
+ if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
+ toaster.pop("info", "您尚未选中任何产品");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ Material.setAllProductsByPerson({},$scope.choosedIds,function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ toaster.pop("info", "绑定成功!");
|
|
|
+ loadData();
|
|
|
+ } else {
|
|
|
+ toaster.pop("error", data.message);
|
|
|
+ }
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop("error", "绑定失败!")
|
|
|
+ })
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
function downloadByJs(url, keyword, type) {
|
|
|
var form = $("<form>"); //定义一个form表单
|
|
|
form.attr('style', 'display:none'); //在form表单中添加查询参数
|
|
|
@@ -867,16 +957,43 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
form.submit();
|
|
|
}
|
|
|
|
|
|
+ function downloadSelectedByJs(url, idList) {
|
|
|
+ var form = $("<form>"); //定义一个form表单
|
|
|
+ form.attr('style', 'display:none'); //在form表单中添加查询参数
|
|
|
+ form.attr('target', '');
|
|
|
+ form.attr('method', 'get');
|
|
|
+ form.attr('action', url);
|
|
|
+
|
|
|
+ var input1 = $('<input>');
|
|
|
+ input1.attr('type', 'hidden');
|
|
|
+ input1.attr('name', 'idList');
|
|
|
+ input1.attr('value', idList);
|
|
|
+
|
|
|
+ $('body').append(form); //将表单放置在web中
|
|
|
+ form.append(input1); //将查询参数控件提交到表单上
|
|
|
+ form.submit();
|
|
|
+ }
|
|
|
+
|
|
|
// 下载模板
|
|
|
$scope.download = function() {
|
|
|
if ($scope.currenctMaterial && $scope.currenctMaterial.length == 0) {
|
|
|
toaster.pop('info', '当前产品列表为空,无法下载');
|
|
|
return;
|
|
|
}
|
|
|
- if ('standard' == $scope.standard_tab)
|
|
|
- downloadByJs('trade/products/template/download/type', $scope.param.keyword, 'standard');
|
|
|
- if ('unstandard' == $scope.standard_tab)
|
|
|
- downloadByJs('trade/products/template/download/type', $scope.param.keyword, 'nStandard');
|
|
|
+ if ($scope.chooseAllPage) {
|
|
|
+ if ('standard' == $scope.standard_tab)
|
|
|
+ downloadByJs('trade/products/template/download/type', $scope.param.keyword, 'standard');
|
|
|
+ if ('unstandard' == $scope.standard_tab)
|
|
|
+ downloadByJs('trade/products/template/download/type', $scope.param.keyword, 'nStandard');
|
|
|
+ } else {
|
|
|
+ $scope.getChoosedInfo();
|
|
|
+ if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
+ toaster.pop("info", "您尚未选中任何产品");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var idStr = $scope.choosedIds.join(',');
|
|
|
+ downloadSelectedByJs('trade/products/template/selected/data', idStr);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
//初始化页数信息
|
|
|
@@ -1071,8 +1188,15 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.materialAll = data;
|
|
|
$scope.currenctMaterial = data.content;
|
|
|
updateTagCount();
|
|
|
+ if ($scope.currenctMaterial.length == 0) {
|
|
|
+ $scope.chooseAllPage = false;
|
|
|
+ }
|
|
|
angular.forEach($scope.currenctMaterial, function (material, index) {
|
|
|
- material.isChoosed = false;
|
|
|
+ if ($scope.chooseAllPage) {
|
|
|
+ material.isChoosed = true;
|
|
|
+ } else {
|
|
|
+ material.isChoosed = false;
|
|
|
+ }
|
|
|
material.submitProduct = {
|
|
|
brand: {},
|
|
|
commponent: {},
|
|
|
@@ -1087,8 +1211,8 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
});
|
|
|
$scope.param.currentPage = data.number;
|
|
|
$scope.acculatePages(data.number, data.totalPages);
|
|
|
- $scope.isChoosedAll = false;
|
|
|
$scope.choosedIds = [];
|
|
|
+ $scope.chooseAll = false;
|
|
|
}, function (response) {
|
|
|
|
|
|
})
|
|
|
@@ -1731,7 +1855,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.goods.editPackaging = (data && data.packaging) || product.packaging || '无';
|
|
|
$scope.goods.editProduceDate = (data && data.produceDate) || product.produceDate;
|
|
|
$scope.goods.editMinPackQty = (data && data.minPackQty) || product.minPackQty || $scope.goods.minBuyQty || 1;
|
|
|
- $scope.goods.editMinBuyQty = (data && data.minBuyQty) || $scope.goods.minPackQty;
|
|
|
+ $scope.goods.editMinBuyQty = (data && data.minBuyQty) || $scope.goods.minPackQty || $scope.goods.editMinPackQty;
|
|
|
$scope.goods.editMinBuyQty = $scope.goods.editMinBuyQty - ($scope.goods.editMinBuyQty % $scope.goods.editMinPackQty);
|
|
|
if ($scope.goods.editMinBuyQty < $scope.goods.editMinPackQty) {
|
|
|
$scope.goods.editMinBuyQty = $scope.goods.editMinPackQty;
|
|
|
@@ -2777,13 +2901,13 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
|
|
|
// 确认删除
|
|
|
$scope.confirmDelete = function () {
|
|
|
- if(deleteMaterial) {
|
|
|
- if(selectAll) {
|
|
|
- if(standard_tab == 'standard') {
|
|
|
+ if (deleteMaterial) {
|
|
|
+ if (selectAll) {
|
|
|
+ if (standard_tab == 'standard') {
|
|
|
Material.deleteStandardAll(null, null, function (data) {
|
|
|
- if(data.code != 1) {
|
|
|
+ if (data.code != 1) {
|
|
|
toaster.pop('error','错误' ,data.message);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
toaster.pop('success', '删除成功');
|
|
|
$scope.deleteModal = false;
|
|
|
$modalInstance.close(data);
|
|
|
@@ -2791,7 +2915,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
}, function (response) {
|
|
|
toaster.pop('error', '错误', response.data);
|
|
|
});
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
Material.deleteUnstandardAll(null, null, function (data) {
|
|
|
if(data.code != 1) {
|
|
|
toaster.pop('error', '错误', data.message);
|
|
|
@@ -2804,7 +2928,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
toaster.pop('error', '错误', response.data);
|
|
|
});
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
if(!$scope.ids || $scope.ids.length == 0) {
|
|
|
toaster.pop('warning', '提示','请选择要删除的信息');
|
|
|
return ;
|
|
|
@@ -2818,8 +2942,8 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
toaster.pop('error', response.data);
|
|
|
});
|
|
|
}
|
|
|
- }else if(deleteGoods){
|
|
|
- if(!$scope.ids || $scope.ids.length < 1) {
|
|
|
+ } else if (deleteGoods) {
|
|
|
+ if (!$scope.ids || $scope.ids.length < 1) {
|
|
|
return ;
|
|
|
}
|
|
|
Goods.deleteGoodsById({id: $scope.ids[0]}, function (data) {
|