define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'ps/workorder/index' + location.search, add_url: 'ps/workorder/add', edit_url: 'ps/workorder/edit', del_url: 'ps/workorder/del', multi_url: 'ps/workorder/multi', import_url: 'ps/workorder/import', table: 'ps_workorder', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'workorder.id', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'factory.name', title: __('Factory_id'), operate: 'LIKE'}, {field: 'no', title: __('No'), operate: 'LIKE'}, {field: 'product_id', title: __('Product_id')}, {field: 'product_name', title: __('Product_name'), operate: 'LIKE'}, {field: 'qty', title: __('Qty'), operate:'BETWEEN'}, {field: 'batch_no', title: __('Batch_no'), operate: 'LIKE'}, {field: 'plan_date', title: __('Plan_date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, {field: 'customer', title: __('Customer'), operate: 'LIKE'}, {field: 'status', title: __('Status'), searchList: {"draft":__('Draft'),"doing":__('Doing'),"done":__('Done'),"cancel":__('Cancel')}, formatter: Table.api.formatter.status}, {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: '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; });