define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'imlogc2c/index' + location.search, add_url: 'imlogc2c/add', // edit_url: 'imlogc2c/edit', del_url: 'imlogc2c/del', multi_url: 'imlogc2c/multi', import_url: 'imlogc2c/import', table: 'imlog_c2c', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'ClientIP', title: __('Clientip'), operate: 'LIKE'}, {field: 'From_Account', title: __('From_account')}, {field: 'fromuser.nickname', title: __('fromuser.nickname'), operate: 'LIKE'}, {field: 'MsgFromPlatform', title: __('Msgfromplatform'), operate: 'LIKE'}, // {field: 'MsgRandom', title: __('Msgrandom'), operate: 'LIKE'}, // {field: 'MsgSeq', title: __('Msgseq'), operate: 'LIKE'}, {field: 'MsgTimestamp', title: __('Msgtimestamp'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'To_Account', title: __('To_account')}, {field: 'touser.nickname', title: __('touser.nickname'), operate: 'LIKE'}, {field: 'MsgType', title: '类型', searchList: Config.typeList, formatter: Table.api.formatter.status}, {field: 'MsgInfo', title: __('MsgInfo'), operate: false,events: Table.api.events.image,formatter: function (value,row,index){ if (row.MsgType == 'TIMTextElem'){ return value; } if (row.MsgType == 'TIMCustomElem'){ return value; } if (row.MsgType == 'TIMSoundElem'){ return Table.api.formatter.audio(value,row,index); } if (row.MsgType == 'TIMImageElem'){ return Table.api.formatter.image(value,row,index); } if (row.MsgType == 'TIMVideoFileElem'){ return Table.api.formatter.video(value,row,index); } return value; }, cellStyle: {css: { "white-space": "break-spaces", "max-width": "200px", "min-width": "200px", "line-height": "24px", "text-align": "left !important" } } }, {field: 'operate', title: __('Operate'), /*buttons:[ { name:'showbody', text:'消息体', title:'消息体', icon:'fa fa-exclamation-circle', classname:'btn btn-xs btn-info btn-dialog', url:'imlogc2c/showbody/id/{ids}?dialog=1', target:'_self', extend: 'data-area=["90%","90%"]' }, ],*/ 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(); }, showbody: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });