special_issue.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. //设置弹窗宽高
  3. Fast.config.openArea = ['80%', '80%'];
  4. var Controller = {
  5. index: function () {
  6. // 初始化表格参数配置
  7. Table.api.init({
  8. extend: {
  9. index_url: 'cms/special_issue/index',
  10. add_url: '',
  11. edit_url: 'cms/special_issue/edit',
  12. del_url: 'cms/special_issue/del',
  13. multi_url: 'cms/special_issue/multi',
  14. table: 'cms_special_issue',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. fixedColumns: true,
  24. fixedRightNumber: 1,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field: 'id', title: __('Id')},
  29. {field: 'user.nickname', title: __('Nickname'), operate: false},
  30. {field: 'journal.name', title: __('Journal'), formatter: Table.api.formatter.search, operate: 'like'},
  31. {field: 'editor', title: __('Editor'), operate: 'like'},
  32. {field: 'issue_name', title: __('Issue name'), operate: false},
  33. {field: 'publication_cycle', title: __('Publication cycle'), operate: false},
  34. {field: 'statement_type', title: __('Statement type'), operate: false},
  35. {field: 'status', title: __('Status'), searchList: {"review": __('Review'), "Fault": __('Fault'), "Correct": __('Correct')}, formatter: Table.api.formatter.status},
  36. {field: 'createtime', title: __('Createtime'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
  37. {
  38. field: 'operate',
  39. title: __('Operate'),
  40. clickToSelect: false,
  41. table: table,
  42. events: Table.api.events.operate,
  43. formatter: function (value, row, index) {
  44. var that = $.extend({}, this);
  45. var table = $(this.table).clone(true);
  46. that.table = table;
  47. return Table.api.formatter.operate.call(that, value, row, index);
  48. },
  49. buttons:[
  50. {
  51. name: 'pass',
  52. text: __('Correct'),
  53. title: __('Correct'),
  54. classname: 'btn btn-xs btn-success btn-view btn-ajax',
  55. icon: 'fa fa-check',
  56. url: function (row) {
  57. return 'cms/special_issue/is_adopt?status=correct&ids=' + row.id;
  58. },
  59. visible: function(row){
  60. if(row.status == 'fault' || row.status == 'review'){
  61. return true; //显示
  62. } else {
  63. return false; //隐藏
  64. }
  65. },
  66. refresh: true
  67. },
  68. {
  69. name: 'fault',
  70. text: __('Fault'),
  71. title: __('Fault'),
  72. classname: 'btn btn-xs btn-danger btn-view btn-ajax',
  73. icon: 'fa fa-times',
  74. url: function (row) {
  75. return 'cms/special_issue/is_adopt?status=fault&ids=' + row.id;
  76. },
  77. visible: function(row){
  78. if(row.status == 'fault'){
  79. return false; //不显示
  80. } else if (row.status == 'review') {
  81. return true;
  82. } else {
  83. return true;
  84. }
  85. },
  86. refresh: true
  87. }
  88. ]
  89. }
  90. ]
  91. ]
  92. });
  93. // 为表格绑定事件
  94. Table.api.bindevent(table);
  95. },
  96. add: function () {
  97. Controller.api.bindevent();
  98. },
  99. edit: function () {
  100. Form.api.bindevent($("form[role=form]"));
  101. // 关闭弹窗
  102. $(document).on('click', '.btn-close', function () {
  103. Fast.api.close();
  104. });
  105. Controller.api.bindevent();
  106. },
  107. api: {
  108. bindevent: function () {
  109. Form.api.bindevent($("form[role=form]"));
  110. }
  111. }
  112. };
  113. return Controller;
  114. });