meetings.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'meetings/meetings/index' + location.search,
  8. add_url: 'meetings/meetings/add',
  9. edit_url: '',
  10. del_url: '',
  11. multi_url: 'meetings/meetings/multi',
  12. table: 'meetings',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'meeting_id',
  20. sortName: 'meeting_id',
  21. columns: [
  22. [
  23. {field: 'meeting_id', title: __('Meeting_id')},
  24. {field: 'title', title: __('Title')},
  25. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange'},
  26. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange'},
  27. {field: 'organizer', title: __('Organizer_id')},
  28. {field: 'status', title: __('Status'), searchList: {"1":__('已创建'),"2":__('已关闭'),"3":__('已取消')}, formatter: Table.api.formatter.status},
  29. {field: 'created_at', title: __('Created_at'), operate:'RANGE', addclass:'datetimerange'},
  30. {field: 'updated_at', title: __('Updated_at'), operate:'RANGE', addclass:'datetimerange'},
  31. {
  32. field: 'operate',
  33. export:false,
  34. title: __('Operate'),
  35. table: table,
  36. buttons: [
  37. {
  38. name : 'btn_consultation',
  39. title : __('加入会诊'),
  40. text : '加入会诊',
  41. extend : 'data-toggle="tooltip"',
  42. classname: 'btn btn-xs btn-success btn_join_consultation',
  43. visible : function (row){
  44. return row.status == 1 ? true : false
  45. },
  46. },
  47. {
  48. name : 'btn_consultation',
  49. title : __('关闭会诊'),
  50. text : '关闭会诊',
  51. extend : 'data-toggle="tooltip"',
  52. classname: 'btn btn-xs btn-success btn_close_consultation',
  53. visible : function (row){
  54. return row.status == 1 ? true : false
  55. }
  56. },
  57. {
  58. name : 'btn_consultation',
  59. title : __('取消会诊'),
  60. text : '取消会诊',
  61. extend : 'data-toggle="tooltip"',
  62. classname: 'btn btn-xs btn-success btn_cancel_consultation',
  63. visible : function (row){
  64. return row.status == 1 ? true : false
  65. }
  66. },
  67. ],
  68. events: Controller.api.events.assigned,
  69. formatter: Table.api.formatter.operate,
  70. }
  71. ]
  72. ]
  73. });
  74. // 为表格绑定事件
  75. Table.api.bindevent(table);
  76. },
  77. add: function () {
  78. Controller.api.bindevent();
  79. },
  80. edit: function () {
  81. Controller.api.bindevent();
  82. },
  83. api: {
  84. bindevent: function () {
  85. Form.api.bindevent($("form[role=form]"));
  86. },
  87. events: {
  88. assigned: {
  89. 'click .btn_join_consultation': function clickbtnJoinConsultation(e, value, row) {
  90. var date = new Date(row.created_at);
  91. var timestamp = date.getTime();
  92. window.open ('https://hz.pacsonline.cn/?username='+row.title+'&roomid='+row.meeting_id+timestamp);
  93. },
  94. 'click .btn_close_consultation': function clickbtnConsultation(e, value, row) {
  95. Layer.confirm(__('是否关闭会诊'), {
  96. }, function (index) {
  97. $.ajax({
  98. url: "meetings/meetings/close_consultation",
  99. type: 'post',
  100. dataType: 'json',
  101. data: {id:row.meeting_id},
  102. success: function (ret) {
  103. Layer.alert('关闭成功');
  104. $('.btn-refresh').trigger('click');
  105. // Fast.api.refreshmenu();
  106. }
  107. })
  108. });
  109. },
  110. 'click .btn_cancel_consultation': function clickbtnConsultation(e, value, row) {
  111. Layer.confirm(__('是否取消会诊'), {
  112. }, function (index) {
  113. $.ajax({
  114. url: "meetings/meetings/cancel_consultation",
  115. type: 'post',
  116. dataType: 'json',
  117. data: {id:row.meeting_id},
  118. success: function (ret) {
  119. Layer.alert('取消成功');
  120. $('.btn-refresh').trigger('click');
  121. // Fast.api.refreshmenu();
  122. }
  123. })
  124. });
  125. }
  126. }
  127. }
  128. }
  129. };
  130. return Controller;
  131. });