Commit 4cef2975 by 杨树贤

优化新增批量主营品牌

parent 01477aa9
...@@ -275,6 +275,7 @@ ...@@ -275,6 +275,7 @@
let brandInitValue = {!! json_encode($brand_init_value?:[])!!}; let brandInitValue = {!! json_encode($brand_init_value?:[])!!};
brandSelector.setValue(brandInitValue); brandSelector.setValue(brandInitValue);
//批量新增主营品牌 //批量新增主营品牌
$('#batchAddMainBrands').click(function () { $('#batchAddMainBrands').click(function () {
layer.open({ layer.open({
...@@ -286,6 +287,8 @@ ...@@ -286,6 +287,8 @@
}); });
$('#confirmBatchAddMainBrands').click(function () { $('#confirmBatchAddMainBrands').click(function () {
let brandValue = brandSelector.getValue();
console.log(brandValue);
let standardBrandNames = $('#batchAddMainBrandsTextarea').val(); let standardBrandNames = $('#batchAddMainBrandsTextarea').val();
//请求接口获取返回的数据,并且合并目前选择的主营品牌,重新渲染xm-select //请求接口获取返回的数据,并且合并目前选择的主营品牌,重新渲染xm-select
let res = ajax('/api/supplier/getBatchAddMainBrandsData', {standard_brand_names: standardBrandNames}); let res = ajax('/api/supplier/getBatchAddMainBrandsData', {standard_brand_names: standardBrandNames});
...@@ -293,16 +296,16 @@ ...@@ -293,16 +296,16 @@
let brandNames = arrayColumn(data, 'brand_name').join(',') let brandNames = arrayColumn(data, 'brand_name').join(',')
$('#batchAddMainBrandsBlockQuote').text(brandNames); $('#batchAddMainBrandsBlockQuote').text(brandNames);
if (data.length === 0) { if (data.length === 0) {
layer.msg('没有匹配到有效的标准品牌',{icon:5}); layer.msg('没有匹配到有效的标准品牌', {icon: 5});
return false; return false;
}else{ } else {
brandInitValue = brandInitValue.concat(data); brandValue = brandValue.concat(data);
brandInitValue = multiArrayUnique(brandInitValue); brandValue = multiArrayUnique(brandValue);
brandSelector.setValue(brandInitValue); brandSelector.setValue(brandValue);
$('#main_brands').val(arrayColumn(brandInitValue, 'brand_id').join(',')); $('#main_brands').val(arrayColumn(brandValue, 'brand_id').join(','));
$('#batchAddMainBrandsTextarea').val(''); $('#batchAddMainBrandsTextarea').val('');
$('#batchAddMainBrandsBlockQuote').text(''); $('#batchAddMainBrandsBlockQuote').text('');
layer.msg('批量添加主营品牌成功',{icon:6}); layer.msg('批量添加主营品牌成功', {icon: 6});
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment