12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'messagets/index' + location.search,
- add_url: 'messagets/add',
- edit_url: 'messagets/edit',
- del_url: 'messagets/del',
- multi_url: 'messagets/multi',
- import_url: 'messagets/import',
- table: 'message_ts',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'title', title: __('Title'), operate: 'LIKE'},
- // {field: 'info', title: __('Info'), operate: 'LIKE'},
- {field: 'times', title: __('Times')},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'operate', title: __('Operate'), table: table,
- buttons:[
- {
- name:'huanxinpush',
- text:'推送',
- title:'推送',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-ajax',
- url:'messagets/huanxinpush/id/{ids}?dialog=1',
- target:'_self',
- refresh:true
- }
- ],events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- huanxinpush: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|