|
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'cf_item/index' + location.search,
- add_url: 'cf_item/add',
- edit_url: 'cf_item/edit',
- del_url: 'cf_item/del',
- multi_url: 'cf_item/multi',
- import_url: 'cf_item/import',
- table: 'cf_item',
- }
- });
-
- var table = $("#table");
- table.on('post-common-search.bs.table', function (event, table) {
- var form = $("form", table.$commonsearch);
- $("input[name='nickname']", form).addClass("selectpage").data("source", "auth/admin/index").data("primaryKey", "nickname").data("field", "nickname").data("orderBy", "id desc");
- Form.events.cxselect(form);
- Form.events.selectpage(form);
- });
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'id', title: __('Id')},
- {field: 'item_type', title: __('Item_type'),
- searchList: {"1":"一日游","2":"交通接驳","3":"租车","4":"门票"}},
- {field: 'item_name', title: __('Item_name'), operate: 'LIKE'},
- {field: 'item_unit', title: __('计价单位'),
- searchList: {"1":"件","2":"份","3":"匝","4":"张"}},
- {field: 'item_memo', title: __('Item_memo'), operate: 'LIKE',visible: false},
- {field: 'province_name', title: __('Province_name'), operate: 'LIKE'},
- {field: 'city_name', title: __('City_name'), operate: 'LIKE'},
- {field: 'area_name', title: __('地区名'), operate: 'LIKE'},
- {field: 'detail_address', title: __('Detail_address'), operate: 'LIKE'},
- {field: 'nickname', title: __('采购负责人')},
- {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);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|