|
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'purchase/index' + location.search,
- add_url: 'purchase/add',
- edit_url: 'purchase/edit',
- del_url: 'purchase/del',
- multi_url: 'purchase/multi',
- import_url: 'purchase/import',
- table: 'purchase',
- }
- });
-
- var table = $("#table");
-
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'del_flag', title: __('Del_flag'), formatter: Table.api.formatter.flag},
- {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'order_id', title: __('Order_id')},
- {field: 'prod_type', title: __('Prod_type'), operate: 'LIKE'},
- {field: 'order_detail_id', title: __('Order_detail_id')},
- {field: 'group_id', title: __('Group_id')},
- {field: 'pro_name', title: __('Pro_name'), operate: 'LIKE'},
- {field: 'item_name', title: __('Item_name'), operate: 'LIKE'},
- {field: 'item_unit', title: __('Item_unit'), operate: 'LIKE'},
- {field: 'check_in_date', title: __('Check_in_date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- {field: 'check_out_date', title: __('Check_out_date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- {field: 'count', title: __('Count')},
- {field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
- {field: 'supplier_name', title: __('Supplier_name'), operate: 'LIKE'},
- {field: 'total_cost', title: __('Total_cost'), operate:'BETWEEN'},
- {field: 'profit', title: __('Profit'), operate:'BETWEEN'},
- {field: 'receipt_status', title: __('Receipt_status')},
- {field: 'receipt_id', title: __('Receipt_id')},
- {field: 'pay_status', title: __('Pay_status')},
- {field: 'payment_id', title: __('Payment_id')},
- {field: 'purchase_user_id', title: __('Purchase_user_id')},
- {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;
- });
|