define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { $(".btn-add").data("area",["100%","100%"]); $(".btn-edit").data("area",["100%","100%"]); // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'order_main/index' + location.search, add_url: 'order_main/add', edit_url: 'order_main/edit', del_url: 'order_main/del', multi_url: 'order_main/multi', import_url: 'order_main/import', table: 'order_main', } }); var table = $("#table"); table.on('post-body.bs.table',function(){ $(".btn-editone").data("area",["100%","100%"]); }); table.on('post-common-search.bs.table', function (event, table) { var form = $("form", table.$commonsearch); $("input[name='channel_name']", form).addClass("selectpage").data("source", "cf_channel_info/index").data("primaryKey", "channel_name").data("field", "channel_name").data("orderBy", "id desc"); $("input[name='commissioner']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc"); $("input[name='hbp_admin.nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc"); Form.events.cxselect(form); Form.events.selectpage(form); }); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {field: 'id', title: __('Id'),operate:"false"}, {field: 'commissioner', title: __('Commissioner'),formatter: Table.api.formatter.search}, {field: 'channel_name', title: __('下单渠道'), operate: 'LIKE'}, {field: 'channel_order_no', title: __('Channel_order_no'), operate: 'LIKE'}, {field: 'hbp_admin.nickname', title: __('订单提交人'), operate: 'LIKE'}, {field: 'user_name', title: __('订单联系人'), operate: 'LIKE'}, {field: 'user_phone', title: __('User_phone'), operate: 'LIKE'}, {field: 'total_amount', title: __('Total_amount'), operate:'BETWEEN'}, {field: 'cost_amount', title: __('Cost_amount'), operate:'BETWEEN'}, {field: 'profit_amount', title: __('Profit_amount'), operate:'BETWEEN'}, {field: 'order_status', title: __('订单状态')}, {field: 'order_memo', title: __('Order_memo'), operate: 'LIKE'}, {field: 'success_time', title: __('Success_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'create_time', title: __('下单时间'), 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; });