"use strict"; var common_vendor = require("../common/vendor.js"); var api_patient = require("../api/patient.js"); require("../common/request.js"); const _sfc_main = { data() { return { patient: [] }; }, onLoad() { this.getPatientList(); common_vendor.index.$on("refreshPatient", () => { this.getPatientList(); }); }, methods: { selectPatient(item) { common_vendor.index.$emit("refreshOrderPatient", item); common_vendor.index.navigateBack({ delta: 1 }); }, editPatient(item) { common_vendor.index.navigateTo({ url: "./addEditPatient?type=edit&patientId=" + item.patientId }); }, delPatient(item) { common_vendor.index.showModal({ title: "\u63D0\u793A", content: "\u786E\u8BA4\u5220\u9664\u5417?", showCancel: true, cancelText: "\u53D6\u6D88", confirmText: "\u786E\u5B9A", success: (res) => { if (res.confirm) { var data = { patientId: item.patientId }; api_patient.delPatient(data).then((res2) => { if (res2.code == 200) { common_vendor.index.showToast({ icon: "success", title: "\u64CD\u4F5C\u6210\u529F" }); this.getPatientList(); } else { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); } } }); }, getPatientList() { api_patient.getPatientList().then((res) => { common_vendor.index.hideLoading(); if (res.code == 200) { this.patient = res.data; } else { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); }, addPatient() { common_vendor.index.navigateTo({ url: "./addEditPatient?type=add" }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.f($data.patient, (item, index, i0) => { return common_vendor.e({ a: common_vendor.t(item.patientName), b: item.sex == 1 }, item.sex == 1 ? {} : {}, { c: item.sex == 2 }, item.sex == 2 ? {} : {}, { d: common_vendor.t(_ctx.$getAge(item.birthday)), e: common_vendor.t(_ctx.$parseIdCard(item.idCard)), f: common_vendor.o(($event) => $options.delPatient(item)), g: common_vendor.o(($event) => $options.editPatient(item)), h: index, i: common_vendor.o(($event) => $options.selectPatient(item), index) }); }), b: $data.patient.length == 0 }, $data.patient.length == 0 ? { c: common_vendor.o(($event) => $options.getPatientList()) } : {}, { d: common_vendor.o((...args) => $options.addPatient && $options.addPatient(...args)) }); } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/patient.vue"]]); wx.createPage(MiniProgramPage);