12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'cost/cost_edit/index' + location.search,
- add_url: 'cost/cost_edit/add',
- edit_url: 'cost/cost_edit/edit',
- del_url: 'cost/cost_edit/del',
- multi_url: 'cost/cost_edit/multi',
- table: 'cost_edit',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- search:false,
- showToggle: false,
- showColumns: false,
- visible: false,
- showExport: false,
- commonSearch: false,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'house', title: __('房产')},
- {field: 'item_name', title: __('费用')},
- {field: 'true_price_old', title: __('True_price_old'), operate:'BETWEEN'},
- {field: 'true_price_new', title: __('True_price_new'), operate:'BETWEEN'},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'status', title: __('状态'), searchList: {"1":__('审核中'),"2":__('已通过'),"3":__('已驳回')}, formatter: Table.api.formatter.normal,operate:false},
- // {field: 'property_id', title: __('Property_id')},
- // {field: 'is_delete', title: __('Is_delete')},
- {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;
- });
|