allocatr/public/assets/js/backend/order/invoice.js
2025-04-16 17:51:41 +08:00

71 lines
3.7 KiB
JavaScript

define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'order.invoice/index' + location.search,
add_url: 'order.invoice/add',
edit_url: 'order.invoice/edit',
del_url: 'order.invoice/del',
multi_url: 'order.invoice/multi',
import_url: 'order.invoice/import',
table: 'order_invoice',
}
});
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_id', title: __('Order_id')},
{field: 'invoice_type', title: __('Invoice_type')},
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'tax_number', title: __('Tax_number'), operate: 'LIKE'},
{field: 'amount', title: __('Amount'), operate:'BETWEEN'},
{field: 'invoice_method', title: __('Invoice_method')},
{field: 'recipient_email', title: __('Recipient_email'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'company_address', title: __('Company_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'company_phone', title: __('Company_phone'), operate: 'LIKE'},
{field: 'bank_name', title: __('Bank_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'bank_account', title: __('Bank_account'), operate: 'LIKE'},
{field: 'recipient_address', title: __('Recipient_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'recipient_name', title: __('Recipient_name'), operate: 'LIKE'},
{field: 'recipient_phone', title: __('Recipient_phone'), operate: 'LIKE'},
{field: 'issued_at', title: __('Issued_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'status', title: __('Status')},
{field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'updated_at', title: __('Updated_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{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;
});