conference.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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/conference/index',
  10. add_url: '',
  11. edit_url: 'cms/conference/edit',
  12. del_url: 'cms/conference/del',
  13. multi_url: 'cms/conference/multi',
  14. table: 'cms_conference',
  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: 'title', title: __('Title'), formatter: Table.api.formatter.search, operate: 'like'},
  31. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  32. {field: 'location', title: __('Location'), formatter: Table.api.formatter.search, operate: 'like'},
  33. {field: 'web_site', title: __('Web site'), formatter: Table.api.formatter.search, operate: 'like'},
  34. {field: 'chair', title: __('Chair'), formatter: Table.api.formatter.search, operate: 'like'},
  35. {field: 'start_time', title: __('Start time'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
  36. {field: 'end_time', title: __('End time'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
  37. {field: 'person_num', title: __('Person num'), formatter: Table.api.formatter.search, operate: 'like'},
  38. {field: 'topics', title: __('Topics'), formatter: Table.api.formatter.search, operate: 'like'},
  39. {field: 'name', title: __('Name'), formatter: Table.api.formatter.search, operate: 'like'},
  40. {field: 'email', title: __('Email'), formatter: Table.api.formatter.search, operate: 'like'},
  41. {field: 'affiliation_address', title: __('Affiliation address'), formatter: Table.api.formatter.search, operate: 'like'},
  42. {field: 'status', title: __('Status'), searchList: {"review": __('Review'), "Fault": __('Fault'), "Correct": __('Correct')}, formatter: Table.api.formatter.status},
  43. {field: 'createtime', title: __('Createtime'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
  44. {
  45. field: 'operate',
  46. title: __('Operate'),
  47. clickToSelect: false,
  48. table: table,
  49. events: Table.api.events.operate,
  50. formatter: function (value, row, index) {
  51. var that = $.extend({}, this);
  52. var table = $(this.table).clone(true);
  53. that.table = table;
  54. return Table.api.formatter.operate.call(that, value, row, index);
  55. },
  56. buttons:[
  57. {
  58. name: 'detail',
  59. classname: 'btn btn-xs btn-warning btn-dialog',
  60. icon: 'fa fa-list',
  61. title: __('Meeting Participation Details'),
  62. text: __('Meeting Participation Details'),
  63. url: function (row) {
  64. return 'cms/conference/detail?ids=' + row.id;
  65. },
  66. callback: function (data) {
  67. Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  68. },
  69. },
  70. {
  71. name: 'pass',
  72. text: __('Correct'),
  73. title: __('Correct'),
  74. classname: 'btn btn-xs btn-success btn-view btn-ajax',
  75. icon: 'fa fa-check',
  76. url: function (row) {
  77. return 'cms/conference/is_adopt?status=correct&ids=' + row.id;
  78. },
  79. visible: function(row){
  80. if(row.status == 'fault' || row.status == 'review'){
  81. return true; //显示
  82. } else {
  83. return false; //隐藏
  84. }
  85. },
  86. refresh: true
  87. },
  88. {
  89. name: 'fault',
  90. text: __('Fault'),
  91. title: __('Fault'),
  92. classname: 'btn btn-xs btn-danger btn-view btn-ajax',
  93. icon: 'fa fa-times',
  94. url: function (row) {
  95. return 'cms/conference/is_adopt?status=fault&ids=' + row.id;
  96. },
  97. visible: function(row){
  98. if(row.status == 'fault'){
  99. return false; //不显示
  100. } else if (row.status == 'review') {
  101. return true;
  102. } else {
  103. return true;
  104. }
  105. },
  106. refresh: true
  107. }
  108. ]
  109. }
  110. ]
  111. ]
  112. });
  113. // 为表格绑定事件
  114. Table.api.bindevent(table);
  115. },
  116. detail: function () {
  117. // 初始化表格参数配置
  118. Table.api.init({
  119. extend: {
  120. index_url: 'cms/conference/detail' + location.search,
  121. table: 'cms_conference_detail',
  122. }
  123. });
  124. var table = $("#table");
  125. // 初始化表格
  126. table.bootstrapTable({
  127. url: $.fn.bootstrapTable.defaults.extend.index_url,
  128. pk: 'id',
  129. sortName: 'id',
  130. fixedColumns: true,
  131. fixedRightNumber: 1,
  132. columns: [
  133. [
  134. {checkbox: true},
  135. {field: 'id', title: __('Id')},
  136. {field: 'user.nickname', title: __('Nickname'), operate: false},
  137. {field: 'conference.title', title: __('Title'), formatter: Table.api.formatter.search, operate: 'like'},
  138. {field: 'email', title: __('Email'), formatter: Table.api.formatter.search, operate: 'like'},
  139. {field: 'first_name', title: __('First name'), formatter: Table.api.formatter.search, operate: 'like'},
  140. {field: 'middle_name', title: __('Middle name'), formatter: Table.api.formatter.search, operate: 'like'},
  141. {field: 'last_name', title: __('Last name'), formatter: Table.api.formatter.search, operate: 'like'},
  142. {field: 'is_email', title: __('Is email'), searchList: {"yes": __('Yes'), "no": __('No')}},
  143. {field: 'is_correspondsing_author', title: __('Is correspondsing author'), searchList: {"yes": __('Yes'), "no": __('No')}},
  144. {field: 'affiliation', title: __('Affiliation'), formatter: Table.api.formatter.search, operate: 'like'},
  145. {field: 'country', title: __('Country'), formatter: Table.api.formatter.search, operate: 'like'},
  146. {field: 'createtime', title: __('Createtime'), sortable: true, operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
  147. ]
  148. ]
  149. });
  150. // 为表格绑定事件
  151. Table.api.bindevent(table);
  152. },
  153. add: function () {
  154. Controller.api.bindevent();
  155. },
  156. edit: function () {
  157. Form.api.bindevent($("form[role=form]"));
  158. // 关闭弹窗
  159. $(document).on('click', '.btn-close', function () {
  160. Fast.api.close();
  161. });
  162. Controller.api.bindevent();
  163. },
  164. api: {
  165. bindevent: function () {
  166. Form.api.bindevent($("form[role=form]"));
  167. }
  168. }
  169. };
  170. return Controller;
  171. });