index.js 2.7 KB

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