wechat.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form','selectpage'], function ($, undefined, Backend, Table, Form,Selectpage) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'statistics/wechat/index' + location.search
  8. }
  9. });
  10. var table = $("#table");
  11. // 初始化表格
  12. table.bootstrapTable({
  13. url: $.fn.bootstrapTable.defaults.extend.index_url,
  14. pk: 'id',
  15. sortName: 'id',
  16. columns: [
  17. [
  18. {field: 't', title: __('访问时间'),
  19. addclass: 'datetimepicker',
  20. data: 'data-date-format="YYYY-MM-DD" autocomplete="off"'},
  21. {field: 'institution_id', title: __('医院'),visible: false},
  22. {field: 'id', title: __('id'),visible: false,searchable:false},
  23. {field: 'institution_name', title: __('医院'),searchable:false},
  24. {field: 'c', title: __('微信访问数量'),searchable:false},
  25. {
  26. field: 'operate',
  27. export:false,
  28. title: __('Operate'),
  29. table: table,
  30. buttons: [
  31. {
  32. name : 'visitInfo',
  33. title : '查看详情',
  34. text : '查看详情',
  35. icon : 'fa fa-calendar-o',
  36. classname: 'btn btn-xs btn-info btn-dialog',
  37. url : 'statistics/wechat/visitList',
  38. extend : 'data-toggle="tooltip" data-area=\'["1100px","600px"]\'',
  39. }
  40. ],
  41. events: Table.api.events.operate,
  42. formatter: Table.api.formatter.operate,
  43. }
  44. ]
  45. ]
  46. });
  47. // 为表格绑定事件
  48. Table.api.bindevent(table);
  49. $.ajax({
  50. url: 'institution/institution/institutionSelectList',
  51. type: 'post',
  52. dataType: 'json',
  53. success: function success(res) {
  54. let data = res.rows;
  55. $('#institution_id').selectPage({
  56. data : data,
  57. orderBy: 'index'
  58. });
  59. }
  60. });
  61. },
  62. visitlist: function () {
  63. // 初始化表格参数配置
  64. Table.api.init({
  65. extend: {
  66. index_url: 'statistics/wechat/visitLink',
  67. }
  68. });
  69. let table = $("#table");
  70. // 初始化表格
  71. table.bootstrapTable({
  72. url: $.fn.bootstrapTable.defaults.extend.index_url,
  73. showToggle: false,
  74. showColumns: false,
  75. queryParams: function queryParams(params) {
  76. params.ins = $('input[name="institution_id"]').val();
  77. return params;
  78. },
  79. columns: [
  80. [
  81. {field: 'checkbox', checkbox: true},
  82. {field: 'name', title: __('姓名'), searchable: false},
  83. {field: 'patient_num', title: __('病历号'), searchable: false},
  84. {field: 'accession_num', title: __('检查号'), searchable: false},
  85. {field: 'phone', title: __('手机号'), searchable: false},
  86. {field: 'exam_class', title: __('检查类型')},
  87. {field: 'exam_datetime', title: __('检查时间')},
  88. {field: 'createdAt',title: __('查看时间'), addclass:'datetimerange',visible:false},
  89. // {field: 'source',title: __('访问来源'), searchable: false},
  90. ]
  91. ]
  92. });
  93. // $('.btn-manage').click(function (){
  94. // var admin_ids = Table.api.selectedids(table)
  95. // var exam_id = $('input[name="exam_id"]').val()
  96. // Fast.api.ajax({
  97. // url: 'train/exam/manageAdmins',
  98. // data: {
  99. // admin_ids: admin_ids,
  100. // ids: exam_id
  101. // }
  102. // }, function (data) {
  103. // table.bootstrapTable('refresh')
  104. // });
  105. // })
  106. // 为表格绑定事件
  107. Table.api.bindevent(table);
  108. },
  109. api: {
  110. bindevent: function () {
  111. Form.api.bindevent($("form[role=form]"));
  112. }
  113. }
  114. };
  115. return Controller;
  116. });