"use strict";
const common_vendor = require("../../../../common/vendor.js");
const pagesCrm_business_schemeDetail_template_props = require("./props.js");
require("../../../../config/globalData.js");
const pagesCrm_service_schemeDetail_index = require("../../../service/schemeDetail/index.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "return-visit",
  props: pagesCrm_business_schemeDetail_template_props.props,
  setup(__props) {
    const props = __props;
    const option = common_vendor.ref({});
    const pushContent = common_vendor.ref([]);
    const activeTypeName = common_vendor.ref("");
    const init = async (datas) => {
      if (datas && !datas.length)
        return;
      const today = common_vendor.dateFormat(/* @__PURE__ */ new Date()).formatYear;
      activeTypeName.value = "";
      datas.forEach((item) => {
        item.IsActive = item.ExecDate == today;
        if (item.IsActive)
          activeTypeName.value = item.OutPatientPushTypeName;
      });
      let readRes = datas[0].IsRead;
      if (!readRes) {
        const resp = await pagesCrm_service_schemeDetail_index.PatientRead({
          Id: datas[0].Id
        });
        readRes = !!resp;
        let pages = getCurrentPages();
        let parentPage = pages[pages.length - 2];
        parentPage.$vm.changeItemReadStatus(props.date, props.index, 1);
      }
      pushContent.value = datas;
      option.value = datas[0];
    };
    common_vendor.watch(
      () => props.content,
      (v) => {
        init(v);
      },
      {
        immediate: true,
        deep: true
      }
    );
    return (_ctx, _cache) => {
      return {
        a: common_vendor.t(_ctx.memberName),
        b: common_vendor.t(activeTypeName.value),
        c: common_vendor.f(pushContent.value, (item, k0, i0) => {
          return common_vendor.e({
            a: item.IsActive
          }, item.IsActive ? {} : {}, {
            b: common_vendor.t(item.ExecDate),
            c: common_vendor.t(item.OutPatientPushTypeName),
            d: common_vendor.t(item.PushContent),
            e: item.Id,
            f: item.IsActive ? 1 : ""
          });
        })
      };
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-53092011"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/pagesCrm/business/schemeDetail/template/return-visit.js.map
