consulting-list.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. var request = getRequest();
  2. var doctor = APIService.userAgent.uid,
  3. reply = request.reply,
  4. status = request.status,
  5. patientName = '',
  6. startDate = '',
  7. endDate = '',
  8. totalCount = 0;
  9. $(function(){
  10. getListData();
  11. bindEvents();
  12. });
  13. function getListData(isRefresh){
  14. var params = {
  15. doctor: doctor,
  16. reply: reply,
  17. status: status,
  18. type: 8,
  19. patientName: patientName,
  20. startTime: startDate,
  21. endTime: endDate
  22. }
  23. consultingAPI.getListCount({data: params}).then(function(res){
  24. if(res.status == 200){
  25. totalCount = res.total;
  26. if(isRefresh){
  27. $("#listTable").bootstrapTable('refresh');
  28. }
  29. var options = $.extend(consultingAPI.getListTableAjaxObj, {
  30. queryParams: queryParams,
  31. queryParamsType: "limit",
  32. pagination: true,
  33. paginationLoop: true,
  34. sidePagination: 'server',
  35. pageNumber: 1,
  36. pageSize: 10,
  37. responseHandler: function (res) {
  38. if(res.status == 200){
  39. return {
  40. rows: res.data,
  41. total: totalCount
  42. }
  43. }else{
  44. return {
  45. rows: [],
  46. total: totalCount
  47. }
  48. }
  49. },
  50. columns:[{
  51. field: 'patientName',
  52. title: '居民姓名'
  53. },{
  54. field: 'create_time',
  55. title: '咨询时间'
  56. },{
  57. field: 'status',
  58. title: '咨询状态',
  59. formatter: function(val, row, index){
  60. var text = "";
  61. if(val == 0){
  62. if(reply == 0){
  63. text = "待回复";
  64. }else{
  65. text = "进行中";
  66. }
  67. }else{
  68. text = "已结束";
  69. }
  70. return text;
  71. }
  72. },{
  73. field: '',
  74. title: '操作',
  75. formatter: function(val, row, index){
  76. return '<a class="c-12b7f5" href="prescription-main.html?sessionId='+row.session_id+'&patiCode='+row.patient+'">查看</a>';
  77. }
  78. }]
  79. });
  80. $("#listTable").bootstrapTable(options);
  81. }
  82. })
  83. }
  84. function queryParams(param){
  85. return {
  86. page: param.offset/param.limit + 1,
  87. pagesize: param.limit,
  88. doctor: doctor,
  89. reply: reply,
  90. status: status,
  91. type: 8,
  92. patientName: patientName,
  93. startTime: startDate,
  94. endTime: endDate
  95. }
  96. }
  97. function bindEvents(){
  98. $(".n-tab").on('click', function(){
  99. if($(this).hasClass("active")){
  100. return false;
  101. }else{
  102. $(this).addClass("active");
  103. $(this).siblings().removeClass("active");
  104. var seDate = getStartEndDate($(this).attr("data-val"));
  105. startDate = seDate.startDate;
  106. endDate = seDate.endDate;
  107. getListData(true);
  108. }
  109. });
  110. $("#searchName").on('keyup', function(){
  111. if (e.which === 13) {
  112. getListData(true);
  113. }
  114. })
  115. $("#searchBtn").on('click', function(){
  116. var $input = $("#searchName"),
  117. text = $.trim($input.val());
  118. patientName = text;
  119. getListData(true);
  120. });
  121. }