index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import history from '../../utils/history';
  2. import { getHospitalRecordList } from '../admission-record/service';
  3. import { getDailyBill } from './service';
  4. Component({
  5. data: {
  6. hospitalRecordList: [],
  7. dailyBillList: [],
  8. tabs: [],
  9. activeIndex: 0
  10. },
  11. props: {
  12. componentData: {}
  13. },
  14. didMount() {
  15. this.getHospitalRecordLists();
  16. this.getDailyBillData();
  17. const {
  18. inpatientIndexTab
  19. } = this.props.componentData.componentExtInfo;
  20. this.setData({
  21. tabs: inpatientIndexTab ? JSON.parse(inpatientIndexTab) : []
  22. });
  23. },
  24. methods: {
  25. handleTabClick({
  26. index,
  27. tabsName
  28. }) {
  29. this.setData({
  30. [tabsName]: index,
  31. activeIndex: index
  32. });
  33. },
  34. // 获取首页日清列表
  35. async getDailyBillData() {
  36. const dailyBillList = await getDailyBill();
  37. this.setData({
  38. dailyBillList
  39. });
  40. },
  41. // 获取住院人列表
  42. async getHospitalRecordLists() {
  43. // 调用接口 - 获取就住院人列表
  44. const hospitalRecordList = await getHospitalRecordList();
  45. this.setData({
  46. hospitalRecordList: hospitalRecordList || []
  47. });
  48. },
  49. // 功能选项点击
  50. onClickFunction(e) {
  51. // 获取当前选中项类型
  52. const {
  53. hospitalRecordList
  54. } = this.data;
  55. const {
  56. itemName,
  57. pagePath
  58. } = e.target.dataset.item; // eslint-disable-next-line default-case
  59. switch (pagePath) {
  60. // 入院登记
  61. case 'admission-record':
  62. history.push({
  63. title: itemName,
  64. pageType: pagePath,
  65. query: {
  66. color: '#000',
  67. backBtnColor: '#000',
  68. background: '#fff'
  69. }
  70. });
  71. break;
  72. // 押金缴纳 || 日清单查询 || 出院结算
  73. case 'deposit':
  74. case 'inventory-day':
  75. case 'settlement':
  76. // 无住院人数据,跳转至住院人页
  77. if (!(hospitalRecordList && hospitalRecordList.length > 0)) {
  78. my.showToast({
  79. content: '请先进行入院登记',
  80. duration: 1500,
  81. success: () => {
  82. history.push({
  83. title: itemName,
  84. pageType: 'admission-record',
  85. query: {
  86. color: '#000',
  87. backBtnColor: '#000',
  88. background: '#fff'
  89. }
  90. });
  91. }
  92. });
  93. } else {
  94. history.push({
  95. title: itemName,
  96. pageType: pagePath,
  97. query: {
  98. color: '#000',
  99. backBtnColor: '#000',
  100. background: '#fff'
  101. }
  102. });
  103. }
  104. break;
  105. }
  106. },
  107. // 跳转日清单查询
  108. toDailyBill(e) {
  109. const {
  110. inpatientId,
  111. checkInDate
  112. } = e.target.dataset.item;
  113. history.push({
  114. query: {
  115. inpatientId,
  116. billDate: checkInDate.slice(0, 11),
  117. color: '#000',
  118. backBtnColor: '#000',
  119. background: '#fff'
  120. },
  121. title: '日清单查询',
  122. pageType: 'inventory-day'
  123. });
  124. }
  125. }
  126. });