"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
const _sfc_main = {
|
__name: "list",
|
setup(__props) {
|
const patients = common_vendor.ref([
|
{
|
id: 1,
|
name: "张三",
|
idType: "身份证",
|
idNumber: "440************123",
|
cardNo: "1234567890",
|
relation: "self",
|
relationText: "本人",
|
isDefault: true
|
},
|
{
|
id: 2,
|
name: "张小明",
|
idType: "身份证",
|
idNumber: "440************456",
|
cardNo: "0987654321",
|
relation: "child",
|
relationText: "子女",
|
isDefault: false
|
}
|
]);
|
const selectPatient = (patient) => {
|
var _a, _b;
|
const pages = getCurrentPages();
|
const prevPage = pages[pages.length - 2];
|
if ((_b = (_a = prevPage == null ? void 0 : prevPage.$page) == null ? void 0 : _a.path) == null ? void 0 : _b.includes("/appointment/")) {
|
common_vendor.index.$emit("selectPatient", patient);
|
common_vendor.index.navigateBack();
|
}
|
};
|
const addPatient = () => {
|
if (patients.value.length >= 5) {
|
common_vendor.index.showToast({
|
title: "最多添加5个就诊人",
|
icon: "none"
|
});
|
return;
|
}
|
common_vendor.index.navigateTo({
|
url: "/pages/patient/add"
|
});
|
};
|
const editPatient = (patient) => {
|
common_vendor.index.navigateTo({
|
url: `/pages/patient/edit?id=${patient.id}`
|
});
|
};
|
const deletePatient = (patient) => {
|
common_vendor.index.showModal({
|
title: "提示",
|
content: "确定要删除该就诊人吗?",
|
success: (res) => {
|
if (res.confirm) {
|
const index = patients.value.findIndex((p) => p.id === patient.id);
|
if (index > -1) {
|
patients.value.splice(index, 1);
|
common_vendor.index.showToast({
|
title: "删除成功",
|
icon: "success"
|
});
|
}
|
}
|
}
|
});
|
};
|
const setDefault = (patient) => {
|
patients.value.forEach((p) => {
|
p.isDefault = p.id === patient.id;
|
});
|
common_vendor.index.showToast({
|
title: "设置成功",
|
icon: "success"
|
});
|
};
|
return (_ctx, _cache) => {
|
return {
|
a: common_vendor.f(patients.value, (patient, index, i0) => {
|
return common_vendor.e({
|
a: common_vendor.t(patient.name),
|
b: patient.isDefault
|
}, patient.isDefault ? {} : {}, {
|
c: common_vendor.t(patient.relationText),
|
d: common_vendor.n(patient.relation),
|
e: common_vendor.t(patient.idType),
|
f: common_vendor.t(patient.idNumber),
|
g: patient.cardNo
|
}, patient.cardNo ? {
|
h: common_vendor.t(patient.cardNo)
|
} : {}, {
|
i: common_vendor.o(($event) => editPatient(patient), index),
|
j: !patient.isDefault
|
}, !patient.isDefault ? {
|
k: common_vendor.o(($event) => deletePatient(patient), index)
|
} : {}, {
|
l: !patient.isDefault
|
}, !patient.isDefault ? {
|
m: common_vendor.o(($event) => setDefault(patient), index)
|
} : {}, {
|
n: index,
|
o: common_vendor.o(($event) => selectPatient(patient), index)
|
});
|
}),
|
b: common_vendor.o(addPatient),
|
c: common_vendor.gei(_ctx, "")
|
};
|
};
|
}
|
};
|
wx.createPage(_sfc_main);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/patient/list.js.map
|