define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'fc/financeflow/index' + location.search, add_url: 'fc/financeflow/add', edit_url: 'fc/financeflow/edit', del_url: 'fc/financeflow/del', multi_url: 'fc/financeflow/multi', import_url: 'fc/financeflow/import', table: 'fc_finance_flow', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {checkbox: true}, {field: 'id', title: __('Id'), visible: false}, {field: 'flow_no', title: __('Flow_no'), operate: 'LIKE'}, { field: 'type', title: __('Type'), searchList: {income: __('收入'), expense: __('支出')}, formatter: function (value) { var m = {income: __('收入'), expense: __('支出')}; return m[value] !== undefined ? m[value] : '-'; } }, {field: 'scene', title: __('Scene'), operate: 'LIKE'}, { field: 'amount', title: __('Amount'), operate: 'BETWEEN', formatter: function (value) { return value === '' || value === null ? '-' : '¥' + parseFloat(value).toFixed(2); } }, { field: 'balance', title: __('Balance'), operate: 'BETWEEN', formatter: function (value) { return value === '' || value === null ? '-' : '¥' + parseFloat(value).toFixed(2); } }, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'related_id', title: __('Related_id')}, {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {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; });