Introduce the `laySearch` option to enable the search functionality on list page search boxes. This improvement allows users to have a more intuitive and interactive way of searching through the list data by providing a search box with clear and concise feedback. When `laySearch` is set to true, the corresponding search box will now be equipped with the `lay-search` class which enhances the user interface and experience.
80 lines
3.3 KiB
PHP
80 lines
3.3 KiB
PHP
define(["jquery", "easy-admin"], function ($, ea) {
|
|
|
|
var init = {
|
|
table_elem: '#currentTable',
|
|
table_render_id: 'currentTableRenderId',
|
|
index_url: 'mall.goods/index',
|
|
add_url: 'mall.goods/add',
|
|
edit_url: 'mall.goods/edit',
|
|
delete_url: 'mall.goods/delete',
|
|
export_url: 'mall.goods/export',
|
|
modify_url: 'mall.goods/modify',
|
|
stock_url: 'mall.goods/stock',
|
|
};
|
|
|
|
return {
|
|
|
|
index: function () {
|
|
ea.table.render({
|
|
init: init,
|
|
toolbar: ['refresh',
|
|
[{
|
|
text: '添加',
|
|
url: init.add_url,
|
|
method: 'open',
|
|
auth: 'add',
|
|
class: 'layui-btn layui-btn-normal layui-btn-sm',
|
|
icon: 'fa fa-plus ',
|
|
}],
|
|
'delete', 'export'],
|
|
cols: [[
|
|
{type: "checkbox"},
|
|
{field: 'id', width: 80, title: 'ID', searchOp: '='},
|
|
{field: 'sort', width: 80, title: '排序', edit: 'text'},
|
|
{field: 'cate_id', minWidth: 80, title: '商品分类', search: 'select', selectList: cateSelects, laySearch: true},
|
|
{field: 'title', minWidth: 80, title: '商品名称'},
|
|
{field: 'logo', minWidth: 80, title: '分类图片', search: false, templet: ea.table.image},
|
|
{field: 'market_price', width: 100, title: '市场价', templet: ea.table.price},
|
|
{field: 'discount_price', width: 100, title: '折扣价', templet: ea.table.price},
|
|
{field: 'total_stock', width: 100, title: '库存统计'},
|
|
{field: 'stock', width: 100, title: '剩余库存'},
|
|
{field: 'virtual_sales', width: 100, title: '虚拟销量'},
|
|
{field: 'sales', width: 80, title: '销量'},
|
|
{field: 'status', title: '状态', width: 85, selectList: {0: '禁用', 1: '启用'}, templet: ea.table.switch},
|
|
{field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
|
|
{
|
|
width: 250,
|
|
title: '操作',
|
|
templet: ea.table.tool,
|
|
operat: [
|
|
[{
|
|
text: '编辑',
|
|
url: init.edit_url,
|
|
method: 'open',
|
|
auth: 'edit',
|
|
class: 'layui-btn layui-btn-xs layui-btn-success',
|
|
}, {
|
|
text: '入库',
|
|
url: init.stock_url,
|
|
method: 'open',
|
|
auth: 'stock',
|
|
class: 'layui-btn layui-btn-xs layui-btn-normal',
|
|
}],
|
|
'delete']
|
|
}
|
|
]],
|
|
});
|
|
|
|
ea.listen();
|
|
},
|
|
add: function () {
|
|
ea.listen();
|
|
},
|
|
edit: function () {
|
|
ea.listen();
|
|
},
|
|
stock: function () {
|
|
ea.listen();
|
|
},
|
|
};
|
|
}); |