1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'sos/rescue/index' + location.search,
- add_url: 'sos/rescue/add',
- edit_url: 'sos/rescue/edit',
- del_url: 'sos/rescue/del',
- multi_url: 'sos/rescue/multi',
- import_url: 'sos/rescue/import',
- table: 'rescue',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'cid', title: __('Cid')},
- {field: 'user_id', title: __('User_id')},
- {field: 'volunteer_id', title: __('Volunteer_id')},
- {field: 'institution_id', title: __('Institution_id')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- {field: 'phone', title: __('Phone'), operate: 'LIKE'},
- {field: 'address', title: __('Address'), operate: 'LIKE'},
- {field: 'certificateimage', title: __('Certificateimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'receive', title: __('Receive')},
- {field: 'refuse', title: __('Refuse')},
- {field: 'out', title: __('Out')},
- {field: 'start_hour', title: __('Start_hour')},
- {field: 'end_hour', title: __('End_hour')},
- {field: 'work_week', title: __('Work_week'), searchList: {"1":__('Work_week 1'),"2":__('Work_week 2'),"3":__('Work_week 3'),"4":__('Work_week 4'),"5":__('Work_week 5'),"6":__('Work_week 6'),"7":__('Work_week 7')}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label},
- {field: 'speciali', title: __('Speciali'), operate: 'LIKE'},
- {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
- {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
- {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- $("#c-user_id").data("params", function (obj) {
- return {custom: {cid: $("#c-cid").val()}};
- });
- Controller.api.bindevent();
- },
- edit: function () {
- $("#c-user_id").data("params", function (obj) {
- return {custom: {cid: $("#c-cid").val()}};
- });
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|