123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'active/index' + location.search,
- add_url: 'active/add',
- edit_url: 'active/edit',
- del_url: 'active/del',
- multi_url: 'active/multi',
- import_url: 'active/import',
- table: 'active',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'weigh desc, id desc',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
- {field: 'title', title: __('Title'), operate: 'LIKE'},
- {field: 'desc', title: __('Desc'), operate: 'LIKE'},
- {field: 'remark', title: __('Remark'), operate: 'LIKE'},
- {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'price', title: __('Price'), operate: 'LIKE'},
- {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'collectionplace', title: __('Collectionplace'), operate: 'LIKE'},
- {field: 'collectiontime', title: __('Collectiontime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'insurance', title: __('Insurance'), operate: 'LIKE'},
- {field: 'leader', title: __('Leader'), operate: 'LIKE'},
- {field: 'maxperson', title: __('Maxperson')},
- {field: 'minperson', title: __('最低成行人数')},
- {field: 'currentperson', title: __('Currentperson')},
- {field: 'signupendtime', title: __('Signupendtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'refundendtime', title: __('Refundendtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'is_free', title: __('Is_free'), searchList: {"0":__('Is_free 0'),"1":__('Is_free 1')}, formatter: Table.api.formatter.normal},
- {field: 'is_overlying', title: __('Is_overlying'), searchList: {"0":__('Is_overlying 0'),"1":__('Is_overlying 1')}, formatter: Table.api.formatter.normal},
- {field: 'girldiscount', title: __('Girldiscount')},
- {field: 'minage', title: __('Minage')},
- {field: 'maxage', title: __('Maxage')},
- {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
- {field: 'showstatus', title: __('Showstatus'), searchList: {"0":__('Showstatus 0'),"1":__('Showstatus 1')}, formatter: Table.api.formatter.status},
- {field: 'is_autoshow', title: __('Is_autoshow'), searchList: {"0":__('Is_autoshow 0'),"1":__('Is_autoshow 1')}, formatter: Table.api.formatter.status},
- {field: 'showtime', title: __('Showtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'is_banner', title: __('Is_banner'), searchList: {"0":__('Is_banner 0'),"1":__('Is_banner 1')}, formatter: Table.api.formatter.status},
- {field: 'weigh', title: __('Weigh'), operate: false},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'updatetime', title: __('Updatetime'), 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,
- buttons: [
- {
- name: 'activeorder',
- text: '活动订单',
- title: __('活动订单'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-success btn-dialog',
- icon: 'fa fa-list',
- url: 'activeorder/index',
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // }
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- // visible: function (row) {
- // if (row.status == 1 && row.purpose == 3) {
- // return true;
- // } else {
- // return false;
- // }
- // }
- },
- {
- name: 'activeorder',
- text: '报名人员',
- title: __('报名人员'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-success btn-dialog',
- icon: 'fa fa-list',
- url: 'activepeople/index',
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // }
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- // visible: function (row) {
- // if (row.status == 1 && row.purpose == 3) {
- // return true;
- // } else {
- // return false;
- // }
- // }
- },
- {
- name: 'edit',
- text: '',
- title: __('编辑'),
- // extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-success btn-editone',
- icon: 'fa fa-pencil',
- // confirm: '确认删除?',
- url: 'active/edit',
- refresh: true,
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- // visible: function (row) {
- // if (row.status == 0) {
- // return true;
- // } else {
- // return false;
- // }
- // }
- },
- {
- name: 'del',
- text: '',
- title: __('删除'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-danger btn-delone',
- icon: 'fa fa-trash',
- confirm: '确认删除?',
- url: 'active/del',
- refresh: true,
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- visible: function (row) {
- if (row.status == 0) {
- return true;
- } else {
- return false;
- }
- }
- },
- {
- name: 'dragsort',
- text: '',
- title: __('拖动'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-danger btn-delone',
- icon: 'fa fa-trash',
- confirm: '确认删除?',
- url: 'active/del',
- refresh: true,
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- visible: function (row) {
- return false;
- }
- }
- ]
- }
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|