define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: async function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'mall_order/index' + location.search, add_url: 'mall_order/add', edit_url: 'mall_order/edit', del_url: 'mall_order/del', multi_url: 'mall_order/multi', import_url: 'mall_order/import', table: 'mall_order', } }); var table = $("#table"); let status = await $.getJSON('mall_order/status') // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', searchFormVisible:true, columns: [ [ //{checkbox: true}, {field: 'id', title: __('ID')}, {field: 'no', title: __('No')}, {field: 'user.nickname', title: __('用户')}, {field: 'goods.name', title: __('商品')}, {field: 'num', title: __('Num')}, {field: 'total_score', title: __('Total_score'), operate: 'BETWEEN'}, { field: 'addr', title: __('Addr'), operate: 'LIKE', formatter(a) { return `${Object.values(a).join("
")}
` } }, {field: 'created_at', title: __('Created_at'),addClass:'datetimerange',formatter:Table.api.formatter.datetime,operate: 'range'}, { field: 'status', title: __('Status'), searchList: status, formatter: Table.api.formatter.label }, {field: 'send_com', title: __('快递公司')}, {field: 'send_no', title: __('快递单号')}, { field: 'buttons', title: '操作', table: table, operate: false, events: Table.api.events.operate, formatter: Table.api.formatter.buttons, buttons: [ { name: 'detail', text: __('发货'), title: __('发货'), classname: 'btn btn-xs btn-info btn-dialog', url: 'mall_order/edit', callback: function (data) { }, visible: function (row) { return row.status === 0; } } ] }, ] ] }); // 为表格绑定事件 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; });