| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'order/index' + location.search,
- add_url: 'order/add',
- edit_url: 'order/edit',
- del_url: 'order/del',
- multi_url: 'order/multi',
- import_url: 'order/import',
- table: 'order',
- }
- });
- 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: 'user_id', title: __('User_id')},
- {field: 'no', title: __('No'), operate: 'LIKE'},
- {field: 'customer', title: __('Customer'), operate: 'LIKE'},
- {field: 'product', title: __('Product'), operate: 'LIKE'},
- {field: 'specs', title: __('Specs'), operate: 'LIKE'},
- {field: 'unit', title: __('Unit'), operate: 'LIKE'},
- {field: 'number', title: __('Number')},
- {field: 'price', title: __('Price'), operate: 'LIKE'},
- {field: 'delivery_date', title: __('Delivery_date'), operate: 'LIKE'},
- {field: 'remark', title: __('Remark'), operate: 'LIKE'},
- {field: 'date', title: __('Date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- {field: 'user_name', title: __('User_name'), operate: 'LIKE'},
- {field: 'examine', title: __('Examine'), operate: 'LIKE'},
- {field: 'status', title: __('Status'), searchList: {"1":__('计划中'),"2":__('生产中'),"3":__('已完成')}, formatter: Table.api.formatter.status},
- // {field: 'create', title: __('Create'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- // {field: 'update', title: __('Update'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- // {field: 'company_id', title: __('Company_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;
- });
|