Commit 4cef2975 by 杨树贤

优化新增批量主营品牌

parent 01477aa9
......@@ -275,6 +275,7 @@
let brandInitValue = {!! json_encode($brand_init_value?:[])!!};
brandSelector.setValue(brandInitValue);
//批量新增主营品牌
$('#batchAddMainBrands').click(function () {
layer.open({
......@@ -286,6 +287,8 @@
});
$('#confirmBatchAddMainBrands').click(function () {
let brandValue = brandSelector.getValue();
console.log(brandValue);
let standardBrandNames = $('#batchAddMainBrandsTextarea').val();
//请求接口获取返回的数据,并且合并目前选择的主营品牌,重新渲染xm-select
let res = ajax('/api/supplier/getBatchAddMainBrandsData', {standard_brand_names: standardBrandNames});
......@@ -293,16 +296,16 @@
let brandNames = arrayColumn(data, 'brand_name').join(',')
$('#batchAddMainBrandsBlockQuote').text(brandNames);
if (data.length === 0) {
layer.msg('没有匹配到有效的标准品牌',{icon:5});
layer.msg('没有匹配到有效的标准品牌', {icon: 5});
return false;
}else{
brandInitValue = brandInitValue.concat(data);
brandInitValue = multiArrayUnique(brandInitValue);
brandSelector.setValue(brandInitValue);
$('#main_brands').val(arrayColumn(brandInitValue, 'brand_id').join(','));
} else {
brandValue = brandValue.concat(data);
brandValue = multiArrayUnique(brandValue);
brandSelector.setValue(brandValue);
$('#main_brands').val(arrayColumn(brandValue, 'brand_id').join(','));
$('#batchAddMainBrandsTextarea').val('');
$('#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