123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- import history from "../../utils/history";
- import { getHospitalDistrictList } from "./service";
- import { getRegisteredAnnouncement } from "../../../../core/utils/ywtService";
- 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);
- },
- async toNextPage(item, replace) {
- console.log("item ===>", item);
- const { name, hospitalDistrictId, extInfo, address } = item;
- const { isNotice = "Y" } = this.getExtInfo();
- /* 如果没有就诊须知跳转选择科室页面 */
- const pageType =
- isNotice === "N" ? "select-department" : "follow-up-notice";
- const [err, result] = await getRegisteredAnnouncement({
- hospitalId: Number(hospitalDistrictId),
- });
- if (!err && result && result.id > 0) {
- history[replace ? "replace" : "push"]({
- pageType,
- title: "挂号须知",
- componentData: {
- area: item,
- },
- query: {
- name,
- hospitalDistrictId,
- hospitalId: extInfo.hospitalId || "",
- subHospitalId: extInfo.subHospitalId || "",
- subHospitalTitle: `${name}(${address})`,
- },
- });
- } else {
- const { componentData } = this.props;
- const { query = {} } = this.$page.data;
- history[replace ? "replace" : "push"]({
- query: {
- ...query,
- name,
- hospitalDistrictId,
- hospitalId: extInfo.hospitalId || "",
- subHospitalId: extInfo.subHospitalId || "",
- subHospitalTitle: `${name}(${address})`,
- },
- componentData,
- title: "选择科室",
- pageType: "select-department",
- });
- }
- return;
- },
- },
- });
|