define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'statistics/dispatcher/index' + location.search, add_url: 'statistics/dispatcher/add', edit_url: 'statistics/dispatcher/edit', del_url: 'statistics/dispatcher/del', multi_url: 'statistics/dispatcher/multi', import_url: 'statistics/dispatcher/import', table: 'order', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'order_no', title: __('Order_no'), operate: 'LIKE'}, {field: 'customer', title: __('Customer'), operate: 'LIKE'}, {field: 'tel', title: __('Tel'), operate: 'LIKE'}, {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"10":__('Status 10'),"20":__('Status 20'),"30":__('Status 30'),"40":__('Status 40'),"50":__('Status 50'),"60":__('Status 60'),"-10":__('Status -10')}, formatter: Table.api.formatter.status}, {field: 'area_id', title: __('Area_id'), operate: 'LIKE'}, {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'lng', title: __('Lng'), operate:'BETWEEN'}, {field: 'lat', title: __('Lat'), operate:'BETWEEN'}, {field: 'work_tel_id', title: __('Work_tel_id')}, {field: 'source_shop', title: __('Source_shop'), operate: 'LIKE'}, {field: 'source', title: __('Source')}, {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'}, {field: 'item_id', title: __('Item_id')}, {field: 'item_title', title: __('Item_title'), operate: 'LIKE'}, {field: 'detail', title: __('Detail'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, {field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'admin_id', title: __('Admin_id')}, {field: 'coupon_id', title: __('Coupon_id')}, {field: 'total', title: __('Total'), operate:'BETWEEN'}, {field: 'online_amount', title: __('Online_amount'), operate:'BETWEEN'}, {field: 'offline_amount', title: __('Offline_amount'), operate:'BETWEEN'}, {field: 'online_amount_last', title: __('Online_amount_last'), operate:'BETWEEN'}, {field: 'offline_amount_type', title: __('Offline_amount_type'), searchList: {"1":__('Offline_amount_type 1'),"2":__('Offline_amount_type 2')}, formatter: Table.api.formatter.normal}, {field: 'discount_amount', title: __('Discount_amount'), operate:'BETWEEN'}, {field: 'refund_amount', title: __('Refund_amount'), operate:'BETWEEN'}, {field: 'worker_refund_amount', title: __('Worker_refund_amount'), operate:'BETWEEN'}, {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'}, {field: 'cost', title: __('Cost'), operate:'BETWEEN'}, {field: 'material_cost', title: __('Material_cost'), operate:'BETWEEN'}, {field: 'performance', title: __('Performance'), operate:'BETWEEN'}, {field: 'cancel_reason_id', title: __('Cancel_reason_id')}, {field: 'cancel_detail', title: __('Cancel_detail'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'audit_remark', title: __('Audit_remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'audit_admin_id', title: __('Audit_admin_id')}, {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'delete_time', title: __('Delete_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'dispatch_type', title: __('Dispatch_type')}, {field: 'receive_type', title: __('Receive_type')}, {field: 'revisit_id', title: __('Revisit_id')}, {field: 'dispatch_admin_id', title: __('Dispatch_admin_id')}, {field: 'dispatch_admin_user', title: __('Dispatch_admin_user'), operate: 'LIKE'}, {field: 'dispatch_time', title: __('Dispatch_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'aftersale_id', title: __('Aftersale_id')}, {field: 'amount_images', title: __('Amount_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, {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; });