ykt-wxapp/pages/work/work.vue

376 lines
12 KiB
Vue
Raw Normal View History

2026-01-20 10:49:33 +08:00
<template>
2026-01-23 14:36:28 +08:00
<full-page :showSafeArea="false" :customScroll="true">
<template #header>
<view class="user-header bg-white px-15 py-15">
2026-01-27 17:09:31 +08:00
<view class="flex items-center justify-between">
2026-01-23 14:36:28 +08:00
<view class="flex items-center flex-grow">
2026-01-27 17:09:31 +08:00
<view class="relative user-avatar mr-10" @click="editProfile()">
2026-01-23 14:36:28 +08:00
<image v-if="doctorInfo && doctorInfo.avatar" class="avatar-img rounded-full overflow-hidden"
:src="doctorInfo.avatar" mode="aspectFill" />
2026-02-02 14:12:46 +08:00
<image v-else class="avatar-img rounded-full overflow-hidden" src="/static/home/avatar.svg"
2026-01-23 14:36:28 +08:00
mode="aspectFill" />
<view v-if="doctorInfo" class="edit-sub flex items-center justify-center rounded-full bg-primary">
<image class="edit-icon" src="/static/work/pen.svg" mode="aspectFill" />
2026-01-20 16:30:03 +08:00
</view>
2026-01-23 14:36:28 +08:00
</view>
<view class="flex-col">
<text v-if="doctorInfo && doctorInfo.anotherName" class="user-name text-dark text-lg font-semibold">
{{ doctorInfo.anotherName }}
</text>
2026-01-27 17:09:31 +08:00
<text v-else class="user-name text-black text-lg font-semibold" @click="editProfile()">请完善信息</text>
2026-01-23 14:36:28 +08:00
<view class="flex items-center mt-5">
<view v-if="!doctorInfo || !doctorInfo.anotherName" class="status-tag tag-orange mr-10">
<text class="tag-text text-white">信息待完善</text>
</view>
<view v-if="certStatus" class="px-10 py-3 text-sm rounded-full" :class="certStatus.classnames"
2026-01-26 14:52:33 +08:00
@click.stop="handleCert()">
2026-01-23 14:36:28 +08:00
{{ certStatus.text }}
</view>
2026-01-20 16:30:03 +08:00
</view>
</view>
</view>
2026-01-23 14:36:28 +08:00
<!-- 右侧操作按钮 -->
<view class="flex items-center">
2026-01-27 17:09:31 +08:00
<view class="action-btn flex-col items-center mr-10" @click="invitePatient()">
2026-01-23 14:36:28 +08:00
<image class="mb-5 qrcode-icon" src="/static/work/qrcode.svg" />
<text class="action-text text-dark text-sm">邀请</text>
</view>
<view class="action-btn flex-col items-center" @click="handleMore">
<image class="mb-5 qrcode-icon" src="/static/work/more.svg" />
<text class="action-text text-dark text-sm">更多</text>
2026-01-20 16:30:03 +08:00
</view>
</view>
</view>
</view>
2026-01-29 09:41:51 +08:00
<view class="mt-15 px-15 py-12 flex items-center justify-between bg-white">
<view class="text-dark text-lg font-semibold">待办列表</view>
<view class="flex text-base rounded-full bg-gray">
2026-02-02 08:52:42 +08:00
<view class="py-5 px-15 rounded-full" :class="followUpType === 'person' ? 'bg-primary text-white' : ''"
@click="changeFollowType('person')">
个人
</view>
<view class="py-5 px-15 rounded-full" :class="followUpType === 'team' ? 'bg-primary text-white' : ''"
@click="changeFollowType('team')">
团队
</view>
2026-01-29 09:41:51 +08:00
</view>
</view>
<view class="py-10 px-15 flex items-center">
<view class="flex-shrink-0 text-sm mr-10">
<text class="text-dark"></text>
2026-02-02 08:52:42 +08:00
<text class="text-danger">{{ total }}</text>
2026-01-29 09:41:51 +08:00
<text class="text-dark"></text>
</view>
<view class="flex">
<view v-for="i in statusList" :key="i.value" class="mr-5 py-5 px-10 bg-white text-sm rounded-sm"
2026-02-02 08:52:42 +08:00
:class="filterData.eventStatus == i.value ? 'text-primary' : 'text-dark'" @click="changeStatus(i.value)">
2026-01-29 09:41:51 +08:00
{{ i.label }}
</view>
</view>
2026-02-02 08:52:42 +08:00
<view class="flex-shrink-0 flex-grow flex justify-end" @click="filterVisible = !filterVisible">
2026-01-29 09:41:51 +08:00
<image class="icon-filter" :src="`/static/work/icon-filter${filtered ? 'ed' : ''}.svg`" />
</view>
2026-01-20 16:30:03 +08:00
</view>
2026-01-23 14:36:28 +08:00
</template>
2026-01-20 16:30:03 +08:00
2026-01-29 09:41:51 +08:00
<scroll-view v-if="list.length" scroll-y="true" class="h-full">
2026-02-02 17:49:17 +08:00
<view v-for="i in list" :key="i._id" class="mb-10 shadow-lg bg-white" @click="toTodoDetail(i._id)">
2026-01-29 09:41:51 +08:00
<view class="flex items-center justify-between px-15 py-10 border-b">
2026-02-02 08:52:42 +08:00
<view class="text-base text-dark">计划执行: {{ i.planDate }}</view>
2026-02-02 17:49:17 +08:00
<view class="flex items-center" @click.stop="toTodoDetail(i._id, true)">
<view class="mr-5 text-base text-dark">患者: {{ i.customerName }}</view>
<image class="icon-edit" src="/static/work/edit-pen.svg" />
2026-01-29 09:41:51 +08:00
</view>
</view>
<view class="py-10 px-15 flex items-center">
2026-02-02 08:52:42 +08:00
<view class="mr-5 text-lg font-semibold">{{ i.eventTypeLabel }}</view>
2026-02-02 17:49:17 +08:00
<view class="bg-light-text-color px-10 py-3 leading-normal text-base rounded overflow-hidden"
2026-02-02 08:52:42 +08:00
:class="statusClassNames[i.eventStatus] || 'text-gray'">
{{ i.eventStatusLabel }}
2026-01-29 09:41:51 +08:00
</view>
</view>
2026-02-02 08:52:42 +08:00
<view v-if="i.sendContent" class="px-15 text-base leading-normal text-gray">{{ i.sendContent }}</view>
<view v-if="i.enableSend && i.fileList.length" class="mt-10 px-15 flex items-center">
<view class="mr-5 w-0 flex-grow">
<view v-for="(file, idx) in i.fileList" :key="idx" class="truncate text-base leading-normal text-dark">
发送内容{{ file.file.name }}
</view>
2026-01-29 09:41:51 +08:00
</view>
2026-02-02 17:49:17 +08:00
<view v-if="doctorInfo && doctorInfo.userid && i.executorUserId && doctorInfo.userid === i.executorUserId"
class="bg-primary px-10 py-3 text-base text-white rounded-sm">发送</view>
2026-01-29 09:41:51 +08:00
</view>
2026-02-02 08:52:42 +08:00
<view class="mt-10 px-15 text-base leading-normal text-gray truncate">
{{ i.executorUserName }}{{ i.executeTeamName }}
</view>
<view class="px-15 pb-10 text-base leading-normal text-gray truncate">
创建{{ i.createTime }} {{ i.creatorUserName }}
</view>
2026-01-20 16:30:03 +08:00
</view>
2026-01-23 14:36:28 +08:00
</scroll-view>
<view v-else class="flex flex-col items-center justify-center h-full bg-white">
<empty-data text="暂无记录" />
2026-01-20 16:30:03 +08:00
</view>
2026-01-23 14:36:28 +08:00
<template #footer>
<view class="border-b"></view>
</template>
</full-page>
<cert-popup :visible="visible" @close="visible = false" />
2026-02-02 08:52:42 +08:00
<filter-popup :data="filterData" :visible="filterVisible" @close="filterVisible = false"
@confirm="changeFilterData($event)" />
2026-01-20 10:49:33 +08:00
</template>
2026-01-20 16:30:03 +08:00
<script setup>
2026-01-23 14:36:28 +08:00
import { computed, ref } from 'vue';
import { storeToRefs } from "pinia";
2026-02-02 08:52:42 +08:00
import { statusNames, ToDoEventType, statusClassNames } from '@/baseData';
2026-01-20 16:30:03 +08:00
import useGuard from "@/hooks/useGuard.js";
2026-01-27 17:09:31 +08:00
import useInfoCheck from '@/hooks/useInfoCheck';
2026-02-02 08:52:42 +08:00
import usePageList from '@/hooks/usePageList';
2026-01-23 14:36:28 +08:00
import useAccountStore from "@/store/account.js";
2026-02-02 08:52:42 +08:00
import useTeamStore from "@/store/team.js";
import api from '@/utils/api';
import { toast } from '@/utils/widget';
2026-01-20 16:30:03 +08:00
2026-02-02 18:22:22 +08:00
import certPopup from "../home/components/cert-popup.vue";
import filterPopup from '../home/components/filter-popup.vue';
2026-01-23 14:36:28 +08:00
import EmptyData from "@/components/empty-data.vue";
import fullPage from '@/components/full-page.vue';
2026-02-02 08:52:42 +08:00
import dayjs from 'dayjs';
2026-01-20 16:30:03 +08:00
2026-01-23 14:36:28 +08:00
const certConfig = {
2026-01-26 14:52:33 +08:00
failed: { text: '认证失败', classnames: 'bg-danger text-white' },
2026-01-23 14:36:28 +08:00
verified: { text: '已认证', classnames: 'bg-success text-white' },
2026-01-23 18:08:14 +08:00
verifying: { text: '认证中', classnames: 'bg-warning text-white' },
2026-01-23 14:36:28 +08:00
unverified: { text: '未认证', classnames: 'bg-gray text-dark' },
2026-01-20 16:30:03 +08:00
};
2026-02-02 08:52:42 +08:00
const statusList = [{ label: '全部', value: 'all' }, { label: '待处理', value: 'processing' }, { label: '未开始', value: 'notStart' }]
2026-01-23 14:36:28 +08:00
const { useLoad, useShow } = useGuard();
const { getDoctorInfo } = useAccountStore();
2026-02-02 08:52:42 +08:00
const { account, doctorInfo } = storeToRefs(useAccountStore());
const { chargeTeams } = storeToRefs(useTeamStore());
const { getTeams } = useTeamStore();
2026-01-27 17:09:31 +08:00
const { withInfo } = useInfoCheck();
2026-01-23 14:36:28 +08:00
const visible = ref(false);
2026-02-02 08:52:42 +08:00
const filtered = ref(false);
const filterVisible = ref(false);
const filterData = ref({ eventStatus: 'processing' });
const followUpType = ref('person') // person team
const { total, list, page, pages, pageSize, changePage } = usePageList(getList)
2026-01-23 14:36:28 +08:00
2026-01-23 18:08:14 +08:00
const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : null)
2026-01-23 14:36:28 +08:00
2026-01-20 16:30:03 +08:00
// 邀请患者
2026-01-27 17:09:31 +08:00
const invitePatient = withInfo(() => uni.navigateTo({ url: '/pages/work/team/invite/invite-patient' }));
2026-01-20 16:30:03 +08:00
2026-01-29 09:41:51 +08:00
const handleMore = withInfo(() => {
2026-01-20 16:30:03 +08:00
uni.showActionSheet({
2026-01-29 09:41:51 +08:00
itemList: ["我的团队", "联系客服"], //, "关于"
2026-01-20 16:30:03 +08:00
success: (res) => {
2026-01-29 09:41:51 +08:00
const url = res.tapIndex === 0 ? '/pages/work/team/list/team-list' : '/pages/work/service/contact-service';
uni.navigateTo({ url });
2026-01-20 16:30:03 +08:00
},
});
2026-01-29 09:41:51 +08:00
})
2026-01-20 16:30:03 +08:00
2026-02-02 08:52:42 +08:00
function changeFilterData(data) {
filterData.value = data;
const case1 = Object.keys(data).filter(i => i != 'eventStatus').length > 0;
const case2 = statusList.some(i => i.value === data.eventStatus);
filtered.value = case1 || !case2;
changePage(1);
}
function changeFollowType(type) {
if (followUpType.value === type) return;
followUpType.value = type;
changePage(1);
}
function changeStatus(val) {
if (filterData.value.eventStatus === val) return;
filterData.value.eventStatus = val;
changePage(1);
}
2026-01-23 14:36:28 +08:00
function editProfile() {
uni.navigateTo({
url: "/pages/work/profile",
});
}
2026-01-26 14:52:33 +08:00
function handleCert() {
if (doctorInfo.value.verifyStatus === 'verifying') {
toast('信息认证中,请耐心等待!')
} else {
visible.value = true
}
2026-01-23 14:36:28 +08:00
}
2026-02-02 17:49:17 +08:00
function toTodoDetail(id, editMode = false) {
uni.navigateTo({
url: `/pages/work/todo/todo-detail?id=${id}&editMode=${editMode ? 'YES' : ''}`
})
}
2026-02-02 08:52:42 +08:00
async function getList() {
if (!doctorInfo.value || !doctorInfo.value.userid) {
return
}
const data = {
corpId: account.value.corpId,
startDate: filterData.value.startDate,
endDate: filterData.value.endDate,
page: page.value,
pageSize: pageSize.value
}
if (followUpType.value === 'person') {
data.executorUserId = doctorInfo.value.userid;
} else {
data.teamIds = chargeTeams.value.map(i => i.teamId);
}
if (filterData.value.eventStatus !== 'all') {
data.statusList = [filterData.value.eventStatus]
}
if (filterData.value.eventType) {
data.eventType = filterData.value.eventType;
}
const res = await api('getTeamTodos', data);
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
...i,
eventTypeLabel: ToDoEventType[i.eventType],
planDate: i.plannedExecutionTime && dayjs(i.plannedExecutionTime).isValid() ? dayjs(i.plannedExecutionTime).format("YYYY-MM-DD") : "",
endTime: i.endTime && dayjs(i.endTime).isValid() ? dayjs(i.endTime).format("YYYY-MM-DD HH:mm") : "",
createTime: i.createTime && dayjs(i.createTime).isValid() ? dayjs(i.createTime).format("YYYY-MM-DD HH:mm") : "",
eventStatusLabel: statusNames[i.eventStatus],
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : []
})) : [];
list.value = page.value === 1 ? arr : [...list.value, ...arr];
total.value = res && res.total > 0 ? res.total : 0;
pages.value = res && res.pages > 0 ? res.pages : 0;
if (!res && !res.success) {
toast(res?.message || '查询待办失败')
}
}
2026-01-20 16:30:03 +08:00
useLoad(() => {
console.log("工作台页面加载");
});
2026-01-23 14:36:28 +08:00
2026-02-02 08:52:42 +08:00
useShow(async () => {
await getDoctorInfo();
changePage(1)
2026-01-23 14:36:28 +08:00
})
2026-01-20 10:49:33 +08:00
</script>
2026-01-20 16:30:03 +08:00
<style lang="scss" scoped>
2026-01-23 14:36:28 +08:00
.edit-sub {
width: 36rpx;
height: 36rpx;
position: absolute;
right: 0;
bottom: 0;
}
.edit-icon {
width: 24rpx;
height: 24rpx;
2026-01-20 16:30:03 +08:00
}
.user-header {
border-bottom: 1px solid #eee;
}
.user-avatar {
width: 80rpx;
height: 80rpx;
.avatar-img {
width: 100%;
height: 100%;
}
}
.user-name {
line-height: 1.5;
}
2026-01-23 14:36:28 +08:00
.py-3 {
padding-top: 6rpx;
padding-bottom: 6rpx;
}
2026-01-20 16:30:03 +08:00
.status-tag {
padding: 6rpx 16rpx;
border-radius: 20rpx;
display: inline-flex;
align-items: center;
&.tag-orange {
background: #ff6b35;
border: 1px solid #fff;
}
&.tag-gray {
background: #f5f5f5;
border: 1px solid #ddd;
}
.tag-text {
font-size: 22rpx;
line-height: 1;
}
}
.action-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.qrcode-icon {
2026-01-23 14:36:28 +08:00
width: 40rpx;
height: 40rpx;
2026-01-20 16:30:03 +08:00
}
.action-text {
line-height: 1.2;
}
}
.more-btn {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
.more-icon {
font-size: 48rpx;
color: #333;
line-height: 1;
font-weight: bold;
}
}
.todo-section {
.section-title {
padding-top: 20rpx;
}
}
2026-01-29 09:41:51 +08:00
.icon-filter {
width: 42rpx;
height: 42rpx;
}
2026-02-02 17:49:17 +08:00
.icon-edit {
width: 24rpx;
height: 24rpx;
2026-01-29 09:41:51 +08:00
}
</style>