12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'wechat/relation/index' + location.search,
- add_url: 'wechat/relation/add',
- edit_url: 'wechat/relation/edit',
- del_url: 'wechat/relation/del',
- multi_url: 'wechat/relation/multi',
- import_url: 'wechat/relation/import',
- table: 'user_relation',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'user_id',
- sortName: 'user_id',
- columns: [
- [
- {checkbox: true},
- {field: 'user_id', title: __('User_id')},
- {field: 'unionid', title: __('Unionid'), operate: 'LIKE'},
- {field: 'openid', title: __('Openid'), operate: 'LIKE'},
- {field: 'routine_openid', title: __('Routine_openid'), operate: 'LIKE'},
- {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
- {field: 'headimgurl', title: __('Headimgurl'), operate: 'LIKE', formatter: Table.api.formatter.url},
- {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal},
- {field: 'city', title: __('City'), operate: 'LIKE'},
- {field: 'language', title: __('Language'), operate: 'LIKE'},
- {field: 'province', title: __('Province'), operate: 'LIKE'},
- {field: 'country', title: __('Country'), operate: 'LIKE'},
- {field: 'remark', title: __('Remark'), operate: 'LIKE'},
- {field: 'groupid', title: __('Groupid')},
- {field: 'tagid_list', title: __('Tagid_list'), operate: 'LIKE'},
- {field: 'subscribe', title: __('Subscribe'), searchList: {"0":__('Subscribe 0'),"1":__('Subscribe 1')}, formatter: Table.api.formatter.normal},
- {field: 'subscribe_time', title: __('Subscribe_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'stair', title: __('Stair')},
- {field: 'second', title: __('Second')},
- {field: 'order_stair', title: __('Order_stair')},
- {field: 'order_second', title: __('Order_second')},
- {field: 'brokerage_price', title: __('Brokerage_price'), operate:'BETWEEN'},
- {field: 'session_key', title: __('Session_key'), operate: 'LIKE'},
- {field: 'user_type', title: __('User_type'), searchList: {"0":__('User_type 0'),"1":__('User_type 1'),"2":__('User_type 2'),"3":__('User_type 3')}, formatter: Table.api.formatter.normal},
- {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;
- });
|