|
@@ -0,0 +1,61 @@
|
|
|
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
+
|
|
|
+ var Controller = {
|
|
|
+ index: function () {
|
|
|
+ // 初始化表格参数配置
|
|
|
+ Table.api.init({
|
|
|
+ extend: {
|
|
|
+ index_url: 'topicdongtai/index' + location.search,
|
|
|
+ add_url: 'topicdongtai/add',
|
|
|
+ edit_url: 'topicdongtai/edit',
|
|
|
+ del_url: 'topicdongtai/del',
|
|
|
+ multi_url: 'topicdongtai/multi',
|
|
|
+ import_url: 'topicdongtai/import',
|
|
|
+ table: 'topic_dongtai',
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var table = $("#table");
|
|
|
+
|
|
|
+ // 初始化表格
|
|
|
+ table.bootstrapTable({
|
|
|
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
+ pk: 'id',
|
|
|
+ sortName: 'id',
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {checkbox: true},
|
|
|
+ {field: 'id', title: __('Id')},
|
|
|
+// {field: 'topic_id', title: __('Topic_id')},
|
|
|
+// {field: 'user_id', title: __('User_id')},
|
|
|
+ {field: 'content', title: __('Content'), operate: 'LIKE'},
|
|
|
+ {field: 'goodnum', title: __('Goodnum')},
|
|
|
+ {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: 'longitude', title: __('Longitude'), operate: 'LIKE'},
|
|
|
+ {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
|
|
|
+ {field: 'is_hidden', title: __('Is_hidden'), searchList: {"1":__('Is_hidden 1'),"0":__('Is_hidden 0')}, formatter: Table.api.formatter.normal},
|
|
|
+ {field: 'topichub.name', title: __('Topichub.name'), operate: 'LIKE'},
|
|
|
+ {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
|
|
|
+ {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;
|
|
|
+});
|