| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'product/synthesis/index' + location.search,
- add_url: 'product/synthesis/add',
- edit_url: 'product/synthesis/edit',
- del_url: 'product/synthesis/del',
- multi_url: 'product/synthesis/multi',
- import_url: 'product/synthesis/import',
- table: 'product_synthesis',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'weigh',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'product_id', title: __('Product_id')},
- {field: 'title', title: __('Title')},
- {field: 'to_lang', title: __('To_lang'), operate: false, searchList: {0:__('中文'), 1:__('英文')}, formatter: Table.api.formatter.flag},
- {field: 'material_one', title: __('Material_one'), operate: 'LIKE'},
- {field: 'material_one_num', title: __('Material_one_num')},
- {field: 'material_two', title: __('Material_two'), operate: 'LIKE'},
- {field: 'material_two_num', title: __('Material_two_num')},
- {field: 'material_three', title: __('Material_three'), operate: 'LIKE'},
- {field: 'material_three_num', title: __('Material_three_num')},
- {field: 'weigh', title: __('Weigh'), operate: false},
- {field: 'status', title: __('Status')},
- {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {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: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $(".btn-add").data("area", ["80%", "80%"]);
- table.on('post-body.bs.table', function () {
- $('.btn-editone').data("area", ["80%", "80%"]);
- });
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|