printsync.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/printsync/index' + location.search,
  8. add_url: '',
  9. edit_url: '',
  10. del_url: '',
  11. multi_url: '',
  12. table: 'print_sync',
  13. }
  14. });
  15. var table = $("#table");
  16. var common_filter = {};
  17. var common_op = {};
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. showToggle: false,
  24. showColumns: false,
  25. exportDataType: "all",
  26. pageList: [10, 15, 25, 50],
  27. queryParams: function (params) {
  28. let filter = JSON.parse(params.filter);
  29. if(filter.print_time)
  30. {
  31. let time1 = filter.print_time.split(',')[0] + ' ' + '00:00:00';
  32. let time2 = filter.print_time.split(',')[1] + ' ' + '23:59:59';
  33. filter.print_time = time1+','+time2;
  34. }
  35. params.filter = JSON.stringify(filter);
  36. common_filter = params.filter;
  37. common_op = params.op;
  38. return params;
  39. },
  40. columns: [
  41. [
  42. {checkbox: true},
  43. {field: 'name', title:'姓名'},
  44. {field: 'times', title:'胶片数量',searchable:false},
  45. {field: 'code', title: '同步号'},
  46. {field: 'print_time', title: '打印时间',
  47. operate: 'BETWEEN',
  48. addclass: 'datetimepicker',
  49. data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',
  50. visible: false
  51. },
  52. {field: 'c', title:'打印时间', searchable:false},
  53. {field: 'institution_id', title:'医院', visible: false},
  54. {
  55. field: 'ins_name', title: __('医院名称'),
  56. searchable: false,
  57. align: 'left',
  58. formatter: Table.api.formatter.bold
  59. }
  60. ]
  61. ]
  62. });
  63. // 为表格绑定事件
  64. Table.api.bindevent(table);
  65. $.ajax({
  66. url: 'institution/institution/institutionSelectList',
  67. type: 'post',
  68. dataType: 'json',
  69. success: function success(res) {
  70. let data = res.rows;
  71. $('#institution_id').selectPage({
  72. data : data,
  73. orderBy: 'index'
  74. });
  75. }
  76. });
  77. $('.btn-times').click(function () {
  78. Fast.api.ajax({
  79. type: 'GET',
  80. url: 'statistics/printsync/getAllTimes',
  81. data: {
  82. filter : common_filter
  83. },
  84. loading:true
  85. }, function (data) {
  86. // $("#centage").text(data.centage)
  87. // $("#centage").data('total', data.positive);
  88. layer.alert('胶片数量:' + data);
  89. return false;
  90. });
  91. });
  92. },
  93. api: {
  94. bindevent: function () {
  95. Form.api.bindevent($("form[role=form]"));
  96. }
  97. }
  98. };
  99. return Controller;
  100. });