123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- 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 || []
- });
- },
- // 功能选项点击
- onClickFunction(e) {
- // 获取当前选中项类型
- 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':
- // 无住院人数据,跳转至住院人页
- if (!(hospitalRecordList && hospitalRecordList.length > 0)) {
- my.showToast({
- content: '请先进行入院登记',
- duration: 1500,
- success: () => {
- history.push({
- title: itemName,
- pageType: 'admission-record',
- query: {
- color: '#000',
- backBtnColor: '#000',
- background: '#fff'
- }
- });
- }
- });
- } else {
- 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'
- });
- }
- }
- });
|