123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- //设置弹窗宽高
- Fast.config.openArea = ['80%', '80%'];
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'cms/conference/index',
- add_url: '',
- edit_url: 'cms/conference/edit',
- del_url: 'cms/conference/del',
- multi_url: 'cms/conference/multi',
- table: 'cms_conference',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'user.nickname', title: __('Nickname'), operate: false},
- {field: 'title', title: __('Title'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
- {field: 'location', title: __('Location'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'web_site', title: __('Web site'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'chair', title: __('Chair'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'start_time', title: __('Start time'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'end_time', title: __('End time'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'person_num', title: __('Person num'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'topics', title: __('Topics'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'name', title: __('Name'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'email', title: __('Email'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'affiliation_address', title: __('Affiliation address'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'status', title: __('Status'), searchList: {"review": __('Review'), "Fault": __('Fault'), "Correct": __('Correct')}, formatter: Table.api.formatter.status},
- {field: 'createtime', title: __('Createtime'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- {
- field: 'operate',
- title: __('Operate'),
- clickToSelect: false,
- table: table,
- events: Table.api.events.operate,
- formatter: function (value, row, index) {
- var that = $.extend({}, this);
- var table = $(this.table).clone(true);
- that.table = table;
- return Table.api.formatter.operate.call(that, value, row, index);
- },
- buttons:[
- {
- name: 'detail',
- classname: 'btn btn-xs btn-warning btn-dialog',
- icon: 'fa fa-list',
- title: __('Meeting Participation Details'),
- text: __('Meeting Participation Details'),
- url: function (row) {
- return 'cms/conference/detail?ids=' + row.id;
- },
- callback: function (data) {
- Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- },
- },
- {
- name: 'pass',
- text: __('Correct'),
- title: __('Correct'),
- classname: 'btn btn-xs btn-success btn-view btn-ajax',
- icon: 'fa fa-check',
- url: function (row) {
- return 'cms/conference/is_adopt?status=correct&ids=' + row.id;
- },
- visible: function(row){
- if(row.status == 'fault' || row.status == 'review'){
- return true; //显示
- } else {
- return false; //隐藏
- }
- },
- refresh: true
- },
- {
- name: 'fault',
- text: __('Fault'),
- title: __('Fault'),
- classname: 'btn btn-xs btn-danger btn-view btn-ajax',
- icon: 'fa fa-times',
- url: function (row) {
- return 'cms/conference/is_adopt?status=fault&ids=' + row.id;
- },
- visible: function(row){
- if(row.status == 'fault'){
- return false; //不显示
- } else if (row.status == 'review') {
- return true;
- } else {
- return true;
- }
- },
- refresh: true
- }
- ]
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- detail: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'cms/conference/detail' + location.search,
- table: 'cms_conference_detail',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'user.nickname', title: __('Nickname'), operate: false},
- {field: 'conference.title', title: __('Title'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'email', title: __('Email'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'first_name', title: __('First name'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'middle_name', title: __('Middle name'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'last_name', title: __('Last name'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'is_email', title: __('Is email'), searchList: {"yes": __('Yes'), "no": __('No')}},
- {field: 'is_correspondsing_author', title: __('Is correspondsing author'), searchList: {"yes": __('Yes'), "no": __('No')}},
- {field: 'affiliation', title: __('Affiliation'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'country', title: __('Country'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'createtime', title: __('Createtime'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Form.api.bindevent($("form[role=form]"));
- // 关闭弹窗
- $(document).on('click', '.btn-close', function () {
- Fast.api.close();
- });
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|