Commit 6ea2d53e by mushishixian

fix

parent e6fcb2d6
......@@ -73,7 +73,7 @@ class CommonApiController extends Controller
$table = $type == 1 ? 'brand' : 'brand';
$db = DB::connection($connection)->table($table)->where('status', '1');
if ($brandName) {
$db = $db->where('brand_name', 'like', '%' . $brandName . '%');
$db = $db->where('brand_name', 'like', $brandName . '%');
}
$count = $db->count();
$list = $db->select('brand_name', 'brand_id')->paginate(17);
......
......@@ -5,40 +5,94 @@
let element = layui.element;
let xmSelect = layui.xmSelect;
//渲染主营品牌的多选
function getBrandOption(element, brandType) {
let brandUrl = '/api/common/getBrandList?type=' + brandType;
let brandRes = ajax(brandUrl);
let brandList = brandRes.data;
return {
el: '#' + element,
filterable: true,
paging: true,
size: 'small',
radio: true,
height: '250px',
direction: 'auto',
autoRow: true,
prop: {
name: 'brand_name',
value: 'brand_id',
},
pageSize: 30,
data: brandList,
on: function (brandList) {
let arr = brandList.arr;
let brandIds = '';
for (let i in arr) {
brandIds += arr[i].brand_id + ',';
}
let idName = 'brand_ids';
$('#' + idName).val(brandIds);
},
};
}
// //渲染主营品牌的多选
// function getBrandOption(element, brandType) {
// let brandUrl = '/api/common/getBrandList?type=' + brandType;
// let brandRes = ajax(brandUrl);
// let brandList = brandRes.data;
// return {
// el: '#' + element,
// filterable: true,
// paging: true,
// size: 'small',
// radio: true,
// height: '250px',
// direction: 'auto',
// autoRow: true,
// prop: {
// name: 'brand_name',
// value: 'brand_id',
// },
// pageSize: 30,
// data: brandList,
// on: function (brandList) {
// let arr = brandList.arr;
// let brandIds = '';
// for (let i in arr) {
// brandIds += arr[i].brand_id + ',';
// }
// let idName = 'brand_ids';
// $('#' + idName).val(brandIds);
// },
// };
// }
//
// let brandOption = getBrandOption('brand_selector', 2);
// xmSelect.render(brandOption);
let brandOption = getBrandOption('brand_selector', 2);
xmSelect.render(brandOption);
//渲染多选
let brandSelect = xmSelect.render({
el: '#brand_selector',
name: 'brand_id',
size: 'small',
searchTips: '请输入要查找的制造商',
paging: true,
radio: true,
empty: '没有查找到数据',
prop: {
name: 'brand_name',
value: 'brand_id'
},
height: '250px',
remoteSearch: true,
autoRow: true,
pageRemote: true,
filterable: true,
remoteMethod: function (val, cb, show, pageIndex) {
//val: 搜索框的内容, 不开启搜索默认为空, cb: 回调函数, show: 当前下拉框是否展开, pageIndex: 当前第几页
$.ajax({
url: '/api/common/SearchBrand',
type: 'post',
data: {
brand_ids: $('#brand_ids').val(),
brand_name: val,
page: pageIndex
},
dataType: 'json',
timeout: 10000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.errcode === 0) {
cb(res.data, res.last_page);
} else {
layer.msg(res.errmsg, {icon: 6});
}
},
error: function () {
return layer.msg('网络错误,请重试', {icon: 5});
}
});
},
on: function (data) {
let brandIds = '';
for (let x in data.arr) // x 为属性名
{
brandIds = brandIds + data.arr[x].brand_id + ',';
}
$("#brand_ids").val(brandIds);
}
});
// brandSelect.setValue(JSON.parse($('#brand_ids').attr('select_value')));
form.on('submit(batchOffShelf)', function (data) {
......
......@@ -55,7 +55,7 @@
"<a class='layui-btn layui-btn-xs'></a>";
}
},
{field: 'encoded_user_name', title: '内部人员', align: 'center', width: 100},
{field: 'encoded_user_name', title: '内部采购', align: 'center', width: 100},
{field: 'update_time', title: '更新时间', align: 'center', width: 150},
{field: 'mpq', title: '标准包装量', align: 'center', width: 120},
{field: 'batch_sn', title: '批次', align: 'center', width: 80},
......
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