finance.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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/finance/index' + location.search,
  8. table: 'exams',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. pagination:false,
  18. columns: [
  19. [
  20. {checkbox: true},
  21. {field: 'time', title: '日期',
  22. addclass: 'datetimerange',
  23. data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',visible: false},
  24. {field: 'name', title:'医院',searchable:false},
  25. {field: 'institution_id', title:'医院',visible: false},
  26. {field: 'count', title:'检查数',searchable:false},
  27. {field: 'exam_class', title:'检查类型',searchable:false},
  28. {field: 'remote', title:'远程发起数量',searchable:false},
  29. {field: 'pay_status', title:'付费情况',searchList: {
  30. 1 : '已收费'
  31. },formatter: Controller.api.pay_status}
  32. ]
  33. ]
  34. });
  35. // 为表格绑定事件
  36. Table.api.bindevent(table);
  37. $.ajax({
  38. url: 'institution/institution/institutionSelectList',
  39. type: 'post',
  40. dataType: 'json',
  41. success: function success(res) {
  42. let data = res.rows;
  43. $('#institution_id').selectPage({
  44. data : data,
  45. orderBy: 'index'
  46. });
  47. }
  48. });
  49. },
  50. add: function () {
  51. Controller.api.bindevent();
  52. },
  53. edit: function () {
  54. Controller.api.bindevent();
  55. },
  56. api: {
  57. bindevent: function () {
  58. Form.api.bindevent($("form[role=form]"));
  59. },
  60. pay_status: function (value) {
  61. switch (value) {
  62. case '0':
  63. return "未付费";
  64. case '1':
  65. return "已付费";
  66. default:
  67. return '';
  68. }
  69. }
  70. }
  71. };
  72. return Controller;
  73. });