12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'fault/index' + location.search,
- add_url: 'fault/add',
- edit_url: 'fault/edit',
- del_url: 'fault/del',
- multi_url: 'fault/multi',
- import_url: 'fault/import',
- table: 'fault',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'fault_id',
- sortName: 'fault_id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'fault_id', title: __('Fault_id')},
- {field: 'parent_fault_id', title: __('Parent_fault_id')},
- {field: 'sim_type', title: __('Sim_type')},
- {field: 'fault_type', title: __('Fault_type')},
- {field: 'fault_state', title: __('Fault_state')},
- {field: 'conflict_fault_ids', title: __('Conflict_fault_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'replace_part', title: __('Replace_part')},
- {field: 'replace_name', title: __('Replace_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'bind_hardware_msg', title: __('Bind_hardware_msg')},
- {field: 'order_num', title: __('Order_num')},
- {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
- {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
- {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {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;
- });
|