Initial commit
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'goods/index' + location.search,
|
||||
add_url: 'goods/add',
|
||||
edit_url: 'goods/edit',
|
||||
del_url: 'goods/del',
|
||||
multi_url: 'goods/multi',
|
||||
import_url: 'goods/import',
|
||||
table: 'goods',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'weigh',
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'spu_id', title: __('Spu_id'), operate: 'LIKE'},
|
||||
{field: 'category_id', title: __('Category_id')},
|
||||
{field: 'category.name', title: __('分类名称'), operate: 'LIKE'},
|
||||
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'primary_image', title: __('Primary_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
{field: 'price', title: __('Price'), operate:'BETWEEN'},
|
||||
{field: 'spu_stock_quantity', title: __('Spu_stock_quantity')},
|
||||
{field: 'sold_num', title: __('Sold_num')},
|
||||
{field: 'weigh', title: __('Weigh'), operate: false},
|
||||
{field: 'is_put_on_sale_switch', title: __('Is_put_on_sale_switch'), searchList: {"1":__('Yes'),"0":__('No')}, table: table, formatter: Table.api.formatter.toggle},
|
||||
{field: 'is_available_switch', title: __('Is_available_switch'), searchList: {"0":__('Is_available_switch 0'),"1":__('Is_available_switch 1')}, table: table, formatter: Table.api.formatter.toggle},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Reference in New Issue
Block a user