patient.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_patient = require("../api/patient.js");
  4. require("../common/request.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. patient: []
  9. };
  10. },
  11. onLoad() {
  12. this.getPatientList();
  13. common_vendor.index.$on("refreshPatient", () => {
  14. this.getPatientList();
  15. });
  16. },
  17. methods: {
  18. selectPatient(item) {
  19. common_vendor.index.$emit("refreshOrderPatient", item);
  20. common_vendor.index.navigateBack({
  21. delta: 1
  22. });
  23. },
  24. editPatient(item) {
  25. common_vendor.index.navigateTo({
  26. url: "./addEditPatient?type=edit&patientId=" + item.patientId
  27. });
  28. },
  29. delPatient(item) {
  30. common_vendor.index.showModal({
  31. title: "\u63D0\u793A",
  32. content: "\u786E\u8BA4\u5220\u9664\u5417?",
  33. showCancel: true,
  34. cancelText: "\u53D6\u6D88",
  35. confirmText: "\u786E\u5B9A",
  36. success: (res) => {
  37. if (res.confirm) {
  38. var data = { patientId: item.patientId };
  39. api_patient.delPatient(data).then((res2) => {
  40. if (res2.code == 200) {
  41. common_vendor.index.showToast({
  42. icon: "success",
  43. title: "\u64CD\u4F5C\u6210\u529F"
  44. });
  45. this.getPatientList();
  46. } else {
  47. common_vendor.index.showToast({
  48. icon: "none",
  49. title: "\u8BF7\u6C42\u5931\u8D25"
  50. });
  51. }
  52. }, (rej) => {
  53. });
  54. }
  55. }
  56. });
  57. },
  58. getPatientList() {
  59. api_patient.getPatientList().then((res) => {
  60. common_vendor.index.hideLoading();
  61. if (res.code == 200) {
  62. this.patient = res.data;
  63. } else {
  64. common_vendor.index.showToast({
  65. icon: "none",
  66. title: "\u8BF7\u6C42\u5931\u8D25"
  67. });
  68. }
  69. }, (rej) => {
  70. });
  71. },
  72. addPatient() {
  73. common_vendor.index.navigateTo({
  74. url: "./addEditPatient?type=add"
  75. });
  76. }
  77. }
  78. };
  79. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  80. return common_vendor.e({
  81. a: common_vendor.f($data.patient, (item, index, i0) => {
  82. return common_vendor.e({
  83. a: common_vendor.t(item.patientName),
  84. b: item.sex == 1
  85. }, item.sex == 1 ? {} : {}, {
  86. c: item.sex == 2
  87. }, item.sex == 2 ? {} : {}, {
  88. d: common_vendor.t(_ctx.$getAge(item.birthday)),
  89. e: common_vendor.t(_ctx.$parseIdCard(item.idCard)),
  90. f: common_vendor.o(($event) => $options.delPatient(item)),
  91. g: common_vendor.o(($event) => $options.editPatient(item)),
  92. h: index,
  93. i: common_vendor.o(($event) => $options.selectPatient(item), index)
  94. });
  95. }),
  96. b: $data.patient.length == 0
  97. }, $data.patient.length == 0 ? {
  98. c: common_vendor.o(($event) => $options.getPatientList())
  99. } : {}, {
  100. d: common_vendor.o((...args) => $options.addPatient && $options.addPatient(...args))
  101. });
  102. }
  103. 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"]]);
  104. wx.createPage(MiniProgramPage);