import history from "../../utils/history"; import { getHospitalRecordList } from "../admission-record/service"; import { getDailyBill } from "./service"; Component({ data: { hospitalRecordList: [], dailyBillList: [], tabs: [], activeIndex: 0, }, props: { componentData: {}, }, didMount() { this.getHospitalRecordLists(); this.getDailyBillData(); const { inpatientIndexTab } = this.props.componentData.componentExtInfo; this.setData({ tabs: inpatientIndexTab ? JSON.parse(inpatientIndexTab) : [], }); }, methods: { handleTabClick({ index, tabsName }) { this.setData({ [tabsName]: index, activeIndex: index, }); }, // 获取首页日清列表 async getDailyBillData() { const dailyBillList = await getDailyBill(); this.setData({ dailyBillList, }); }, // 获取住院人列表 async getHospitalRecordLists() { // 调用接口 - 获取就住院人列表 const hospitalRecordList = await getHospitalRecordList(); this.setData({ hospitalRecordList: hospitalRecordList || [], }); }, // 功能选项点击 async onClickFunction(e) { await this.getHospitalRecordLists(); // 获取当前选中项类型 const { hospitalRecordList } = this.data; const { itemName, pagePath } = e.target.dataset.item; // eslint-disable-next-line default-case switch (pagePath) { // 入院登记 case "admission-record": history.push({ title: itemName, pageType: pagePath, query: { color: "#000", backBtnColor: "#000", background: "#fff", }, }); break; // 押金缴纳 || 日清单查询 || 出院结算 case "deposit": case "inventory-day": case "settlement": history.push({ title: itemName, pageType: pagePath, query: { color: "#000", backBtnColor: "#000", background: "#fff", }, }); break; } }, // 跳转日清单查询 toDailyBill(e) { const { inpatientId, checkInDate } = e.target.dataset.item; history.push({ query: { inpatientId, billDate: checkInDate.slice(0, 11), color: "#000", backBtnColor: "#000", background: "#fff", }, title: "日清单查询", pageType: "inventory-day", }); }, }, });