define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'school/message_config/index' + location.search, add_url: 'school/message_config/add', edit_url: 'school/message_config/edit', del_url: 'school/message_config/del', multi_url: 'school/message_config/multi', import_url: 'school/message_config/import', table: 'school_message_config', } }); 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: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'event', title: __('Event'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'logo_image', title: __('Logo_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, // {field: 'wechat_wap', title: __('Wechat_wap'), searchList: {"1":__('Wechat_wap 1'),"2":__('Wechat_wap 2')}, formatter: Table.api.formatter.normal}, // {field: 'message', title: __('Message'), searchList: {"1":__('Message 1'),"2":__('Message 2')}, formatter: Table.api.formatter.normal}, // {field: 'selfmail', title: __('Selfmail'), searchList: {"1":__('Selfmail 1'),"2":__('Selfmail 2')}, formatter: Table.api.formatter.normal}, // {field: 'message_id', title: __('Message_id'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, // {field: 'wechat_wap_id', title: __('Wechat_wap_id'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, // {field: 'selfmail_title', title: __('Selfmail_title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'weigh', title: __('Weigh'), operate: false}, {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} {field: 'operate', title: __('Operate'), table: table , buttons: [ { name: 'message_config_item', text: __('设置消息项'), title: __('设置消息项'), classname: 'btn btn-xs btn-warning btn-magic btn-dialog', icon: 'fa fa-list', url: message_config_item_url, callback: function (data) { }, // visible: function (row) { // return row.status == '2'||row.status == '3'; // } }, ], events: Table.api.events.operate, formatter: Table.api.formatter.operate}, ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, recyclebin: function () { // 初始化表格参数配置 Table.api.init({ extend: { 'dragsort_url': '' } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: 'school/message_config/recyclebin' + location.search, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'name', title: __('Name'), align: 'left'}, { field: 'deletetime', title: __('Deletetime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime }, { field: 'operate', width: '140px', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [ { name: 'Restore', text: __('Restore'), classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', icon: 'fa fa-rotate-left', url: 'school/message_config/restore', refresh: true }, { name: 'Destroy', text: __('Destroy'), classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', icon: 'fa fa-times', url: 'school/message_config/destroy', refresh: true } ], 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]")); } } }; var message_config_item_url = function (row,dom) { return 'school/message_config_item/index?event='+row.event + "&name=" + row.name; } return Controller; });