"use strict"; const common_vendor = require("../../../common/vendor.js"); const hook_useOnLoad_index = require("../../../hook/use-on-load/index.js"); const pagesCrm_static_schemeDetail = require("../../static/schemeDetail.js"); const pagesCrm_service_home_index = require("../../service/home/index.js"); require("../../../config/globalData.js"); if (!Array) { const _component_noData = common_vendor.resolveComponent("noData"); _component_noData(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "home", setup(__props, { expose: __expose }) { common_vendor.useStore(); const cardInfo = common_vendor.ref({}); const deptList = common_vendor.ref([]); const deptId = common_vendor.ref(""); const dateline = common_vendor.ref([]); const datelineData = common_vendor.ref({}); const pIndex = common_vendor.ref(1); const noMore = common_vendor.ref(false); const { memberList, currentUser = {} } = common_vendor.mapState({ memberList: "memberList", currentUser: "currentUser" }); const { setCurrentUser } = common_vendor.mapMutations({ setCurrentUser: "setCurrentUser" }); const main = (options) => { refresh(options); }; const refresh = async (options = {}) => { if (!currentUser.value) { let [user = {}] = memberList.value.filter((item) => { if (options.memberId) { return item.memberId == options.memberId; } else { return !!item.userMemberList[0].isDefaultMember; } }); if (common_vendor.isEmpty(user)) user = memberList.value[0]; setCurrentUser(user); cardInfo.value = user; common_vendor.index.__f__("log", "at pagesCrm/business/home/home.vue:101", user); } else { cardInfo.value = currentUser.value; } noMore.value = false; getPatientExecPlanDeptList(); await getPatientExecPlanList(); common_vendor.index.stopPullDownRefresh(); }; const getPatientExecPlanDeptList = async () => { if (!cardInfo.value.memberId) return; const resp = await pagesCrm_service_home_index.GetPatientExecPlanDeptList({ MemberId: cardInfo.value.memberId }); deptList.value = resp; }; const getPatientExecPlanList = async (e = void 0) => { if (!cardInfo.value.memberId) return; if (noMore.value) return; let PIndex = pIndex.value; if (!e) { PIndex = 1; } else { PIndex++; } const resp = await pagesCrm_service_home_index.GetPatientExecPlanList({ MemberId: cardInfo.value.memberId, DeptId: deptId.value, Page: { PIndex, PSize: 10 } }); let data = e ? datelineData.value : {}; let line = e ? dateline.value.map((item) => item.date).concat(resp.map((item) => item.ExecDate)) : resp.map((item) => item.ExecDate); resp.map((item) => { if (!data[item.ExecDate]) { data[item.ExecDate] = [item]; } else { data[item.ExecDate].push(item); } }); line = Array.from(new Set(line)).sort((a, b) => { return new Date(b) - new Date(a); }).map((item) => { const [year, mouth, day] = item.split("-"); return { date: item, year, mouth, day }; }); pIndex.value = PIndex; noMore.value = !resp.length; dateline.value = line; datelineData.value = data; }; const selectedDept = (item = {}) => { const { DeptCode, DeptId = "" } = item; deptId.value = DeptId; noMore.value = false; common_vendor.nextTick$1(() => getPatientExecPlanList()); }; const toSchemeDetail = (item, type, index) => { const path = `/pagesCrm/business/schemeDetail/schemeDetail?type=${type}&planuuid=${item.PlanUuid}&date=${item.ExecDate}&index=${index}&id=${item.Id}`; common_vendor.goToUrl(path); }; const changeItemReadStatus = (date, index, status) => { datelineData.value[date][index].IsRead = status; }; hook_useOnLoad_index.useOnLoad((options) => { main(options); }); __expose({ changeItemReadStatus }); return (_ctx, _cache) => { return common_vendor.e({ a: !deptId.value ? 1 : "", b: common_vendor.o(($event) => selectedDept()), c: common_vendor.f(deptList.value, (item, k0, i0) => { return { a: common_vendor.t(item.DeptName), b: item.DeptId, c: deptId.value == item.DeptId ? 1 : "", d: common_vendor.o(($event) => selectedDept(item), item.DeptId) }; }), d: dateline.value.length }, dateline.value.length ? { e: common_vendor.f(dateline.value, (item, k0, i0) => { return { a: common_vendor.t(item.year), b: common_vendor.t(item.mouth), c: common_vendor.t(item.day), d: common_vendor.f(datelineData.value[item.date], (data, index, i1) => { return { a: common_vendor.t(data.DeptName), b: common_vendor.t(common_vendor.unref(pagesCrm_static_schemeDetail.schemeTypeEnum)[data.TempType]), c: data.PlanUuid, d: !data.IsRead ? 1 : "", e: common_vendor.o(($event) => toSchemeDetail(data, data.TempType, index), data.PlanUuid) }; }) }; }) } : {}, { f: common_vendor.p({ ["wx:else"]: true, value: "暂无数据" }) }); }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-516c5459"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../../.sourcemap/mp-weixin/pagesCrm/business/home/home.js.map