| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <template>
- <view class="container">
- <view class="filtration_scroll_wrapper ptb-12 plr-16">
- <view class="filtration--item" :class="{ actived: !deptId }" @click="selectedDept()">
- 全部
- </view>
- <view
- v-for="item in deptList"
- :key="item.DeptId"
- class="filtration--item"
- :class="{ actived: deptId == item.DeptId }"
- @click="selectedDept(item)"
- >
- {{ item.DeptName }}
- </view>
- </view>
- <view class="timer-list">
- <scroll-view
- v-if="dateline.length"
- scroll-y
- lower-threshold="100"
- bindscrolltolower="getPatientGroupPlanList"
- >
- <view class="timer" v-for="item in dateline">
- <view class="date">
- <text>{{ item.year }}</text>
- <text class="divider">/</text>
- <text>{{ item.mouth }}</text>
- <text class="divider">/</text>
- <text>{{ item.day }}</text>
- </view>
- <view class="list">
- <view
- v-for="(data, index) in datelineData[item.date]"
- :key="data.PlanUuid"
- class="wrapper"
- :class="{ unread: !data.IsRead }"
- @click="toSchemeDetail(data, data.TempType, index)"
- >
- <view>
- <view class="dept">{{ data.DeptName }}</view>
- <view class="desc">{{ schemeTypeEnum[data.TempType] }}</view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- <noData wx:else value="暂无数据"></noData>
- </view>
- </view>
- </template>
- <script lang="ts" setup>
- import { getCurrentInstance, nextTick, ref } from 'vue';
- import { useStore } from 'vuex';
- import { useOnLoad, useGetMemberIdByEncryptData } from '@/hook';
- import { mapState, mapGetters, mapMutations } from '@kasite/uni-app-base/store';
- import { common } from '@kasite/uni-app-base';
- import { schemeTypeEnum } from '../../static/schemeDetail';
- import { lastMsgContentExtract } from '../../static/chatRoom';
- import { GetPatientExecPlanDeptList, GetPatientExecPlanList } from '../../service';
- const { proxy } = getCurrentInstance();
- const store = useStore();
- const cardInfo = ref({} as any);
- const deptList = ref([]);
- const deptId = ref('');
- const dateline = ref([]);
- const datelineData = ref({});
- const pIndex = ref(1);
- const noMore = ref(false);
- const { memberList, currentUser = {} } = mapState({
- memberList: 'memberList',
- currentUser: 'currentUser',
- });
- const { setCurrentUser } = mapMutations({
- setCurrentUser: 'setCurrentUser',
- });
- const main = (options) => {
- /**默认查全部记录 */
- refresh(options);
- };
- /** 刷新 */
- const refresh = async (options: any = {}) => {
- try {
- if(!currentUser.value) {
- // common.showModal("getEncryptData - home - start")
- await getEncryptData();
- // common.showModal("getEncryptData - home - end")
- }
-
-
- // common.showModal("currentUser" + JSON.stringify(currentUser.value))
- 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.isEmpty(user)) user = memberList.value[0];
- setCurrentUser(user);
- cardInfo.value = user;
- console.log(user);
- } else {
- cardInfo.value = currentUser.value;
- }
-
- noMore.value = false;
- getPatientExecPlanDeptList();
- // getMemberChatList()
- await getPatientExecPlanList();
- uni.stopPullDownRefresh();
- } catch (e) {
- // outputInfo("[Error]", e.message)
- }
- };
- /** 查询患者执行计划科室列表 */
- const getPatientExecPlanDeptList = async () => {
- if (!cardInfo.value.MemberId) return;
- const resp = await GetPatientExecPlanDeptList({
- MemberId: cardInfo.value.MemberId,
- });
- deptList.value = resp;
- };
- /** 查询患者组内执行计划列表 */
- const getPatientExecPlanList = async (e = undefined) => {
- if (!cardInfo.value.MemberId) return;
- if (noMore.value) return;
- let PIndex = pIndex.value;
- if (!e) {
- PIndex = 1;
- } else {
- PIndex++;
- }
- const resp = await GetPatientExecPlanList({
- MemberId: cardInfo.value.MemberId,
- DeptId: deptId.value,
- Page: {
- PIndex,
- PSize: 100,
- },
- });
- 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: string) => {
- 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: any = {}) => {
- const { DeptCode, DeptId = '' } = item;
- deptId.value = DeptId;
- noMore.value = false;
- nextTick(() => 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.goToUrl(path);
- };
- const changeItemReadStatus = (date, index, status) => {
- datelineData.value[date][index].IsRead = status;
- };
- /** 解密 */
- const getEncryptData = async () => {
- // 只在 H5/WEB 端解析 URL 上的 EncryptData,兼容外部跳转进来的完整地址
- let encryptData = '';
- // #ifdef H5 || WEB
- try {
- // 例: https://fzsclqyy.com/KasiteWeb/module/hcrmUserCenter/index.html?EncryptData=xxx&token=xxx&openid=xxx#/
- // 先截掉 hash 部分,再解析 ? 后面的查询参数
- const url = (typeof window !== 'undefined' && window.location && window.location.href) ? window.location.href : '';
- const queryPart = url.split('?')[1]?.split('#')[0] || '';
- if (queryPart) {
- const params = new URLSearchParams(queryPart);
- encryptData = params.get('EncryptData') || '';
- }
- } catch (e) {
- console.error('解析 EncryptData 失败', e);
- }
- // #endif
-
- await useGetMemberIdByEncryptData(encryptData);
- }
- /**
- * 输出异常
- */
- const outputInfo = (key, data) => {
- if(key && !!!data) {
- data = key;
- key = "";
- }
- console.log(key, data)
- const str = typeof(data) != "string" ? JSON.stringify(data) : data;
- uni.showModal({
- title: key,
- content: str,
- })
- }
- useOnLoad((options) => {
- main(options);
- // 兜底:监听事件总线的状态更新
- uni.$on('changeItemReadStatus', ({ date, index, status }) => {
- if (datelineData.value[date] && datelineData.value[date][index]) {
- datelineData.value[date][index].IsRead = status;
- }
- });
- });
- defineExpose({
- changeItemReadStatus,
- });
- </script>
- <style lang="scss" scoped>
- .container {
- display: flex;
- flex-direction: column;
- padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx);
- padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
- }
- .filtration {
- padding: 0 20rpx;
- }
- .filtration_scroll_wrapper {
- display: flex;
- overflow: auto;
- }
- .filtration--item {
- padding: 20rpx 40rpx;
- background-color: #d3d3d3;
- border-radius: 8rpx;
- word-break: keep-all;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .filtration--item + .filtration--item {
- margin-left: 20rpx;
- }
- .filtration--item.actived {
- background-color: var(--uni-color-primary);
- color: #fff;
- font-weight: bold;
- }
- .timer-list {
- height: 100%;
- overflow: auto;
- }
- .timer + .timer {
- margin-top: 20rpx;
- }
- .date {
- --height: 46rpx;
- margin: 20rpx;
- padding: 0 20rpx 0 56rpx;
- position: relative;
- font-weight: bold;
- height: var(--height);
- align-items: center;
- background-color: #e8e8e8;
- border-radius: var(--height);
- display: inline-flex;
- }
- .date::before {
- content: '';
- height: 12rpx;
- width: 12rpx;
- border-radius: 100%;
- border: 16rpx solid #b7bbca;
- position: absolute;
- left: 0;
- z-index: 1;
- }
- .date::after {
- content: '';
- width: 1rpx;
- height: calc(100% + 20rpx);
- position: absolute;
- left: 20rpx;
- bottom: -100%;
- background-color: #dee0e9;
- }
- .date .divider {
- color: var(--uni-color-primary);
- margin: 0 8rpx;
- }
- .timer .wrapper {
- padding: 24rpx 24rpx 24rpx 76rpx;
- position: relative;
- align-items: center;
- background-color: #fff;
- display: flex;
- justify-content: space-between;
- }
- .wrapper::before {
- content: '';
- height: 18rpx;
- width: 18rpx;
- border-radius: 100%;
- background-color: #dee0e9;
- position: absolute;
- left: 32rpx;
- }
- .wrapper::after {
- content: '';
- width: 1rpx;
- height: calc(100% + 20rpx);
- position: absolute;
- left: calc(32rpx + 8rpx);
- top: 0;
- background-color: #dee0e9;
- }
- .wrapper:last-child::after {
- height: 50%;
- }
- .wrapper + .wrapper {
- margin-top: 20rpx;
- }
- .arrow_right {
- width: 30rpx;
- height: 30rpx;
- }
- .dept {
- color: #909399;
- margin-bottom: 24rpx;
- font-size: 26rpx;
- position: relative;
- display: inline-block;
- }
- .unread .dept::before {
- content: '';
- height: 14rpx;
- width: 14rpx;
- border-radius: 100%;
- position: absolute;
- right: -20rpx;
- top: -5rpx;
- background-color: #fa4844;
- }
- </style>
|