63 lines
2.9 KiB
JavaScript
63 lines
2.9 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'zy/sign/sign_set/index' + location.search,
|
|
add_url: 'zy/sign/sign_set/add',
|
|
edit_url: 'zy/sign/sign_set/edit',
|
|
del_url: 'zy/sign/sign_set/del',
|
|
multi_url: 'zy/sign/sign_set/multi',
|
|
import_url: 'zy/sign/sign_set/import',
|
|
table: 'zy_sign_set',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{ checkbox: true },
|
|
{ field: 'id', title: __('Id') },
|
|
{ field: 'name', title: __('Name') },
|
|
{ field: 'last', title: __('Last') },
|
|
{ field: 'chance1', title: __('Chance1') },
|
|
{ field: 'coupon1.name', title: __('Coupon1.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'chance2', title: __('Chance2') },
|
|
{ field: 'coupon2.name', title: __('Coupon2.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{field: 'begin_date', title: __('BeginDate')},
|
|
{field: 'end_date', title: __('EndDate')},
|
|
{field: 'intro', title: __('Intro')},
|
|
{ field: 'status', title: __('Status'), formatter: Table.api.formatter.label, searchList: { 0: __('Status0'), 1: __('Status1') } },
|
|
{ field: 'create_time', title: __('Create_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
|
{ field: 'update_time', title: __('Update_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
|
{ 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;
|
|
});
|