63 行
2.8 KiB
JavaScript
63 行
2.8 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], function ($, undefined, Backend, Table, Form, Format) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'fc/category/index' + location.search,
|
|
add_url: 'fc/category/add',
|
|
edit_url: 'fc/category/edit',
|
|
del_url: 'fc/category/del',
|
|
multi_url: 'fc/category/multi',
|
|
import_url: 'fc/category/import',
|
|
table: 'fc_category',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'sort',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{field: 'id', title: __('SerialNo'), operate: false, sortable: false, align: 'center', width: '70px', class: 'fc-serial', table: table, formatter: Format.serial},
|
|
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
|
{
|
|
field: 'enabled', title: __('Enabled'),
|
|
searchList: {0: '否', 1: '是'},
|
|
formatter: Format.statusFormatter({0: '否', 1: '是'}, {0: 'default', 1: 'success'})
|
|
},
|
|
{field: 'post_count', title: __('Post_count')},
|
|
{field: 'sort', title: __('Sort')},
|
|
{field: 'color', title: __('Color'), operate: 'LIKE'},
|
|
{field: 'icon_key', title: __('Icon_key'), operate: 'LIKE'},
|
|
{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, visible: 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;
|
|
});
|