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', fixedColumns: true, fixedRightNumber: 2, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, // {field: 'topic_id', title: __('Topic_id')}, {field: 'topichub.name', title: __('Topichub.name'), operate: 'LIKE'}, {field: 'user_id', title: __('User_id')}, {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, // {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, {field: 'type', title: __('Type'), searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, {field: 'content', title: __('Content'), operate: 'LIKE'}, {field: 'images', title: '图片或视频', operate: false,events: Table.api.events.image,formatter: function (value,row,index){ if (row.type == '0'){ return value; } if (row.type == '1'){ return Table.api.formatter.images(value,row,index); } if (row.type == '2'){ 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: '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: 'is_show_real', title: __('Is_show_real'), searchList: {"0":__('Is_show_real 0'),"1":__('Is_show_real 1')}, formatter: Table.api.formatter.normal}, {field: 'address', title: __('Address'), operate: 'LIKE'}, {field: 'auit_status', title: __('Auit_status'), searchList: {"0":__('Auit_status 0'),"1":__('Auit_status 1'),"2":__('Auit_status 2')}, formatter: Table.api.formatter.normal}, {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; });