import history from '../../utils/history'; import { getHospitalDistrictList } from './service'; Component({ props: { height: '100vh', componentData: {} }, methods: { getExtInfo() { const { componentData } = this.props; const { componentExtInfo } = componentData; return componentExtInfo || {}; }, async onService() { const list = await getHospitalDistrictList(); /* 如果只有一个院区直接跳转到挂号须知 */ if (list.length === 1) { this.toNextPage(list[0], true); } return { list, pagination: { total: list.length } }; }, onItemTap({ target: { dataset } }) { this.toNextPage(dataset.item); }, toNextPage(item, replace) { const { name, hospitalDistrictId } = item; const { isNotice = 'Y' } = this.getExtInfo(); /* 如果没有就诊须知跳转选择科室页面 */ const pageType = isNotice === 'N' ? 'select-department' : 'follow-up-notice'; history[replace ? 'replace' : 'push']({ pageType, title: '挂号须知', componentData: { area: item }, query: { name, hospitalDistrictId } }); } } });