define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置(开票申请仅用户/商户端发起,后台只提供开票处理) Table.api.init({ extend: { index_url: 'invoice/index' + location.search, edit_url: 'invoice/edit', table: 'invoice', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', sortOrder: 'desc', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {field: 'index', title: '序号', operate: false, formatter: Table.api.formatter.index, width: '60px'}, {field: 'title', title: '开票抬头', operate: 'LIKE'}, {field: 'type', title: '发票类型', searchList: {"normal":__('Ordinary'),"special":__('Special')}, formatter: Table.api.formatter.normal}, {field: 'amount', title: '开票金额', operate: 'BETWEEN'}, {field: 'merchant.name', title: '开票主体', operate: 'LIKE', formatter: function (value) { return value ? value : '个人用户'; }}, {field: 'user.username', title: '申请用户', operate: 'LIKE'}, {field: 'tax_no', title: '税号', operate: 'LIKE'}, {field: 'email', title: '接收邮箱', operate: 'LIKE'}, {field: 'status', title: '处理状态', searchList: {"wait":__('Wait'),"issued":__('Issued'),"reject":__('Reject')}, formatter: Table.api.formatter.status}, {field: 'invoice_no', title: '发票号码', operate: 'LIKE'}, {field: 'audit_msg', title: '处理说明', operate: 'LIKE', class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'createtime', title: '申请时间', operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime, width: '150px'}, {field: 'operate', title: '开票处理', table: table, events: Table.api.events.operate, buttons: [ {name: 'edit', text: '处理', title: '财务开票处理', icon: '', classname: 'btn btn-xs btn-success btn-editone'} ], formatter: Table.api.formatter.operate} ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });