index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. async onClickFunction(e) {
  46. await this.getHospitalRecordLists();
  47. // 获取当前选中项类型
  48. const { hospitalRecordList } = this.data;
  49. const { itemName, pagePath } = e.target.dataset.item; // eslint-disable-next-line default-case
  50. switch (pagePath) {
  51. // 入院登记
  52. case "admission-record":
  53. history.push({
  54. title: itemName,
  55. pageType: pagePath,
  56. query: {
  57. color: "#000",
  58. backBtnColor: "#000",
  59. background: "#fff",
  60. },
  61. });
  62. break;
  63. // 押金缴纳 || 日清单查询 || 出院结算
  64. case "deposit":
  65. case "inventory-day":
  66. case "settlement":
  67. history.push({
  68. title: itemName,
  69. pageType: pagePath,
  70. query: {
  71. color: "#000",
  72. backBtnColor: "#000",
  73. background: "#fff",
  74. },
  75. });
  76. break;
  77. }
  78. },
  79. // 跳转日清单查询
  80. toDailyBill(e) {
  81. const { inpatientId, checkInDate } = e.target.dataset.item;
  82. history.push({
  83. query: {
  84. inpatientId,
  85. billDate: checkInDate.slice(0, 11),
  86. color: "#000",
  87. backBtnColor: "#000",
  88. background: "#fff",
  89. },
  90. title: "日清单查询",
  91. pageType: "inventory-day",
  92. });
  93. },
  94. },
  95. });