123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- 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/special_issue/index',
- add_url: '',
- edit_url: '',
- del_url: 'cms/special_issue/del',
- multi_url: 'cms/special_issue/multi',
- table: 'cms_special_issue',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- fixedColumns: true,
- fixedRightNumber: 1,
- exportTypes: ['excel'],
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'user.nickname', title: __('Nickname'), operate: false},
- {field: 'journal.name', title: __('Journal'), formatter: Table.api.formatter.search, operate: 'like'},
- {field: 'editor', title: __('Editor'), operate: 'like'},
- {field: 'issue_name', title: __('Issue name'), operate: false},
- {field: 'publication_cycle', title: __('Publication cycle'), operate: false},
- {field: 'statement_type', title: __('Statement type'), operate: false},
- {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: __('Detail'),
- text: __('Detail'),
- url: function (row) {
- return 'cms/special_issue/edit?ids=' + row.id;
- },
- },
- {
- 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/special_issue/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/special_issue/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);
- },
- 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;
- });
|