consulting-list.js 4.2 KB

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