define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'product/popular/index' + location.search, add_url: 'product/popular/add', edit_url: 'product/popular/edit', del_url: 'product/popular/del', multi_url: 'product/popular/multi', import_url: 'product/popular/import', table: 'product_popular', } }); 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: 'products_list.zh_name', title: __('Product_id'), operate: false}, {field: 'title', title: __('期数')}, {field: 'price', title: __('Price'), operate: false}, {field: 'cost_price', title: __('Cost_price'), operate:false}, {field: 'min_transfer', title: __('最低转让价'), operate:false}, {field: 'stock', title: __('Stock'), operate:false}, {field: 'weigh', title: __('Weigh'), operate: false}, {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'status', title: __('Status'), searchList: {'0': '未开始','1': '进行中', '2': '已结束'}, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label}, {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'update_time', title: __('Update_time'), 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} ] ] }); // 为表格绑定事件 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; });