Compare commits
2 Commits
d75b8fb8cf
...
b9385ebf02
| Author | SHA1 | Date | |
|---|---|---|---|
| b9385ebf02 | |||
| fa01c77830 |
@ -279,6 +279,12 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "执行回访计划"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "followup-task-list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "回访任务"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -121,6 +121,7 @@
|
||||
:archiveId="archiveId"
|
||||
:reachBottomTime="reachBottomTime"
|
||||
:floatingBottom="floatingBottom"
|
||||
:fromChat="fromChat"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@ -242,6 +243,7 @@ const tabs = [
|
||||
const currentTab = ref('visitRecord');
|
||||
const reachBottomTime = ref(0);
|
||||
const archiveId = ref('');
|
||||
const fromChat = ref(false);
|
||||
const tabsScrollTop = ref(0);
|
||||
const instanceProxy = getCurrentInstance()?.proxy;
|
||||
|
||||
@ -474,6 +476,7 @@ async function updateArchive(patch) {
|
||||
|
||||
onLoad((options) => {
|
||||
archiveId.value = options?.id ? String(options.id) : String(archive.value.medicalRecordNo || archive.value.outpatientNo || archive.value.inpatientNo || '');
|
||||
fromChat.value = options?.fromChat === 'true' || options?.fromChat === true;
|
||||
|
||||
const cached = uni.getStorageSync(STORAGE_KEY);
|
||||
if (cached && typeof cached === 'object') {
|
||||
|
||||
@ -4,7 +4,10 @@
|
||||
<view class="top">
|
||||
<view class="top-row">
|
||||
<view class="my" @click="toggleMy">
|
||||
<image :src="`/static/checkbox${query.isMy ? '-checked' : ''}.svg`" class="checkbox" />
|
||||
<image
|
||||
:src="`/static/checkbox${query.isMy ? '-checked' : ''}.svg`"
|
||||
class="checkbox"
|
||||
/>
|
||||
<view class="my-text">我的</view>
|
||||
</view>
|
||||
|
||||
@ -25,32 +28,81 @@
|
||||
</view>
|
||||
|
||||
<view class="filter-btn" @click="openFilter">
|
||||
<image class="filter-icon" :src="`/static/icons/icon-filter${filtered ? '-active' : ''}.svg`" />
|
||||
<image
|
||||
class="filter-icon"
|
||||
:src="`/static/icons/icon-filter${filtered ? '-active' : ''}.svg`"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="total">共<text class="total-num">{{ total }}</text>条</view>
|
||||
<view class="total"
|
||||
>共<text class="total-num">{{ total }}</text
|
||||
>条</view
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view v-for="i in list" :key="i._id" class="card" @click="toDetail(i)">
|
||||
<view class="head">
|
||||
<view class="date">计划日期: <text class="date-val">{{ i.planDate }}</text></view>
|
||||
<view class="executor truncate">{{ i.executorName }}<text v-if="i.executeTeamName">({{ i.executeTeamName }})</text></view>
|
||||
<view class="date"
|
||||
>计划日期: <text class="date-val">{{ i.planDate }}</text></view
|
||||
>
|
||||
<view class="executor truncate"
|
||||
>{{ i.executorName
|
||||
}}<text v-if="i.executeTeamName"
|
||||
>({{ i.executeTeamName }})</text
|
||||
></view
|
||||
>
|
||||
</view>
|
||||
<view class="body">
|
||||
<view class="title-row">
|
||||
<view class="type">{{ i.eventTypeLabel }}</view>
|
||||
<view class="status" :class="`st-${i.status}`">{{ i.eventStatusLabel }}</view>
|
||||
<view class="status" :class="`st-${i.status}`">{{
|
||||
i.eventStatusLabel
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="content">{{ i.taskContent || "暂无内容" }}</view>
|
||||
<view v-if="i.sendContent || (i.fileList && i.fileList.length > 0)" class="send-content-wrapper">
|
||||
<view class="send-content-section">
|
||||
<view class="send-content-label">【发送内容】</view>
|
||||
<view class="send-content-body">
|
||||
<view v-if="i.sendContent" class="send-text">{{ i.sendContent }}</view>
|
||||
<view v-if="i.fileList && i.fileList.length > 0" class="file-list">
|
||||
<view v-for="(file, idx) in i.fileList" :key="idx" class="file-item" :class="`file-type-${file.type}`">
|
||||
<view v-if="file.type === 'image'" class="file-icon">🖼️</view>
|
||||
<view v-else-if="file.type === 'article'" class="file-icon">📄</view>
|
||||
<view v-else-if="file.type === 'questionnaire'" class="file-icon">📋</view>
|
||||
<view class="file-name">{{ file.file?.name || file.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button
|
||||
v-if="fromChat"
|
||||
class="action-btn send-btn"
|
||||
@click.stop="sendFollowUp(i)"
|
||||
>
|
||||
发送
|
||||
</button>
|
||||
</view>
|
||||
<view v-if="i.status === 'treated'" class="result"
|
||||
>【处理结果】 {{ i.result || "" }}</view
|
||||
>
|
||||
<view class="footer-row">
|
||||
<view class="footer"
|
||||
>创建: {{ i.createTimeStr }} {{ i.creatorName }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="content">{{ i.taskContent || '暂无内容' }}</view>
|
||||
<view v-if="i.status === 'treated'" class="result">【处理结果】 {{ i.result || '' }}</view>
|
||||
<view class="footer">创建: {{ i.createTimeStr }} {{ i.creatorName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="list.length === 0" class="empty">暂无数据</view>
|
||||
<uni-load-more v-if="list.length" :status="moreStatus" :contentText="loadMoreText" @clickLoadMore="getMore" />
|
||||
<uni-load-more
|
||||
v-if="list.length"
|
||||
:status="moreStatus"
|
||||
:contentText="loadMoreText"
|
||||
@clickLoadMore="getMore"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="fab" :style="{ bottom: `${floatingBottom}px` }" @click="add">
|
||||
@ -99,9 +151,18 @@
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">所属团队</view>
|
||||
<picker mode="selector" :range="teamOptions" range-key="label" @change="pickTeam">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="teamOptions"
|
||||
range-key="label"
|
||||
@change="pickTeam"
|
||||
>
|
||||
<view class="select-row">
|
||||
<view class="select-text" :class="{ muted: teamPicked.value === 'ALL' }">{{ teamPicked.label }}</view>
|
||||
<view
|
||||
class="select-text"
|
||||
:class="{ muted: teamPicked.value === 'ALL' }"
|
||||
>{{ teamPicked.label }}</view
|
||||
>
|
||||
<uni-icons type="right" size="16" color="#999" />
|
||||
</view>
|
||||
</picker>
|
||||
@ -111,11 +172,15 @@
|
||||
<view class="section-title">计划日期</view>
|
||||
<view class="range-row">
|
||||
<picker mode="date" @change="pickStart">
|
||||
<view class="range-pill" :class="{ muted: !planRange[0] }">{{ planRange[0] || '开始日期' }}</view>
|
||||
<view class="range-pill" :class="{ muted: !planRange[0] }">{{
|
||||
planRange[0] || "开始日期"
|
||||
}}</view>
|
||||
</picker>
|
||||
<view class="sep">-</view>
|
||||
<picker mode="date" @change="pickEnd">
|
||||
<view class="range-pill" :class="{ muted: !planRange[1] }">{{ planRange[1] || '结束日期' }}</view>
|
||||
<view class="range-pill" :class="{ muted: !planRange[1] }">{{
|
||||
planRange[1] || "结束日期"
|
||||
}}</view>
|
||||
</picker>
|
||||
<view class="clear" @click="clearPlanRange">
|
||||
<uni-icons type="closeempty" size="16" color="#999" />
|
||||
@ -133,19 +198,23 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import dayjs from 'dayjs';
|
||||
import api from '@/utils/api';
|
||||
import useAccountStore from '@/store/account';
|
||||
import { toast } from '@/utils/widget';
|
||||
import { getTodoEventTypeLabel, getTodoEventTypeOptions } from '@/utils/todo-const';
|
||||
import { computed, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import dayjs from "dayjs";
|
||||
import api from "@/utils/api";
|
||||
import useAccountStore from "@/store/account";
|
||||
import { toast } from "@/utils/widget";
|
||||
import {
|
||||
getTodoEventTypeLabel,
|
||||
getTodoEventTypeOptions,
|
||||
} from "@/utils/todo-const";
|
||||
|
||||
const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
archiveId: { type: String, default: '' },
|
||||
reachBottomTime: { type: [String, Number], default: '' },
|
||||
archiveId: { type: String, default: "" },
|
||||
reachBottomTime: { type: [String, Number], default: "" },
|
||||
floatingBottom: { type: Number, default: 16 },
|
||||
fromChat: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
@ -153,24 +222,27 @@ const { account, doctorInfo } = storeToRefs(accountStore);
|
||||
const { getDoctorInfo } = accountStore;
|
||||
|
||||
const statusTabs = [
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '待处理', value: 'processing' },
|
||||
{ label: '未开始', value: 'notStart' },
|
||||
{ label: '已完成', value: 'treated' },
|
||||
{ label: '已取消', value: 'cancelled' },
|
||||
{ label: '已过期', value: 'expired' },
|
||||
{ label: "全部", value: "all" },
|
||||
{ label: "待处理", value: "processing" },
|
||||
{ label: "未开始", value: "notStart" },
|
||||
{ label: "已完成", value: "treated" },
|
||||
{ label: "已取消", value: "cancelled" },
|
||||
{ label: "已过期", value: "expired" },
|
||||
];
|
||||
|
||||
const typeOptions = [{ label: '全部', value: 'all' }, ...getTodoEventTypeOptions()];
|
||||
const typeOptions = [
|
||||
{ label: "全部", value: "all" },
|
||||
...getTodoEventTypeOptions(),
|
||||
];
|
||||
|
||||
const teamOptions = ref([{ label: '全部', value: 'ALL' }]);
|
||||
const teamOptions = ref([{ label: "全部", value: "ALL" }]);
|
||||
|
||||
const query = reactive({
|
||||
isMy: false,
|
||||
status: 'all',
|
||||
status: "all",
|
||||
eventTypes: [],
|
||||
teamId: 'ALL',
|
||||
planRange: ['', ''],
|
||||
teamId: "ALL",
|
||||
planRange: ["", ""],
|
||||
});
|
||||
|
||||
const list = ref([]);
|
||||
@ -184,20 +256,20 @@ const loading = ref(false);
|
||||
const userNameMap = ref({});
|
||||
|
||||
const moreStatus = computed(() => {
|
||||
if (loading.value) return 'loading';
|
||||
return page.value <= pages.value ? 'more' : 'no-more';
|
||||
if (loading.value) return "loading";
|
||||
return page.value <= pages.value ? "more" : "no-more";
|
||||
});
|
||||
const loadMoreText = {
|
||||
contentdown: '点击加载更多',
|
||||
contentrefresh: '加载中...',
|
||||
contentnomore: '没有更多了',
|
||||
contentdown: "点击加载更多",
|
||||
contentrefresh: "加载中...",
|
||||
contentnomore: "没有更多了",
|
||||
};
|
||||
|
||||
const filtered = ref(false);
|
||||
const typeSelectedMap = computed(() => {
|
||||
const s = new Set(query.eventTypes || []);
|
||||
return typeOptions.reduce((acc, cur) => {
|
||||
if (cur.value === 'all') acc[cur.value] = s.size === 0;
|
||||
if (cur.value === "all") acc[cur.value] = s.size === 0;
|
||||
else acc[cur.value] = s.has(cur.value);
|
||||
return acc;
|
||||
}, {});
|
||||
@ -206,14 +278,18 @@ const typeSelectedMap = computed(() => {
|
||||
function getUserId() {
|
||||
const d = doctorInfo.value || {};
|
||||
const a = account.value || {};
|
||||
return String(d.userid || d.userId || d.corpUserId || a.userid || a.userId || '') || '';
|
||||
return (
|
||||
String(
|
||||
d.userid || d.userId || d.corpUserId || a.userid || a.userId || ""
|
||||
) || ""
|
||||
);
|
||||
}
|
||||
|
||||
function getCorpId() {
|
||||
const t = uni.getStorageSync('ykt_case_current_team') || {};
|
||||
const t = uni.getStorageSync("ykt_case_current_team") || {};
|
||||
const a = account.value || {};
|
||||
const d = doctorInfo.value || {};
|
||||
return String(t.corpId || a.corpId || d.corpId || '') || '';
|
||||
return String(t.corpId || a.corpId || d.corpId || "") || "";
|
||||
}
|
||||
|
||||
async function ensureDoctor() {
|
||||
@ -228,33 +304,37 @@ async function ensureDoctor() {
|
||||
|
||||
function statusLabelFromStatus(status) {
|
||||
const map = {
|
||||
processing: '待处理',
|
||||
notStart: '未开始',
|
||||
treated: '已完成',
|
||||
cancelled: '已取消',
|
||||
expired: '已过期',
|
||||
processing: "待处理",
|
||||
notStart: "未开始",
|
||||
treated: "已完成",
|
||||
cancelled: "已取消",
|
||||
expired: "已过期",
|
||||
};
|
||||
return map[status] || '未知';
|
||||
return map[status] || "未知";
|
||||
}
|
||||
|
||||
function getStatus(todo) {
|
||||
const endOfToday = dayjs().endOf('day').valueOf();
|
||||
const startOfToday = dayjs().startOf('day').valueOf();
|
||||
const endOfToday = dayjs().endOf("day").valueOf();
|
||||
const startOfToday = dayjs().startOf("day").valueOf();
|
||||
const plannedExecutionTime = Number(todo?.plannedExecutionTime || 0) || 0;
|
||||
const expireTime = Number(todo?.expireTime || 0) || 0;
|
||||
const eventStatus = String(todo?.eventStatus || '');
|
||||
const eventStatus = String(todo?.eventStatus || "");
|
||||
|
||||
if (eventStatus === 'treated') return 'treated';
|
||||
if (eventStatus === 'closed') return 'cancelled';
|
||||
if (eventStatus === 'expire') return 'expired';
|
||||
if (eventStatus === "treated") return "treated";
|
||||
if (eventStatus === "closed") return "cancelled";
|
||||
if (eventStatus === "expire") return "expired";
|
||||
|
||||
if (eventStatus === 'untreated') {
|
||||
if (expireTime && expireTime < startOfToday) return 'expired';
|
||||
if (plannedExecutionTime >= endOfToday) return 'notStart';
|
||||
if (plannedExecutionTime <= startOfToday && (!expireTime || expireTime >= endOfToday)) return 'processing';
|
||||
return 'processing';
|
||||
if (eventStatus === "untreated") {
|
||||
if (expireTime && expireTime < startOfToday) return "expired";
|
||||
if (plannedExecutionTime >= endOfToday) return "notStart";
|
||||
if (
|
||||
plannedExecutionTime <= startOfToday &&
|
||||
(!expireTime || expireTime >= endOfToday)
|
||||
)
|
||||
return "processing";
|
||||
return "processing";
|
||||
}
|
||||
return 'processing';
|
||||
return "processing";
|
||||
}
|
||||
|
||||
function eventTypeLabel(eventType) {
|
||||
@ -262,10 +342,10 @@ function eventTypeLabel(eventType) {
|
||||
}
|
||||
|
||||
function resolveUserName(userId) {
|
||||
const id = String(userId || '');
|
||||
if (!id) return '';
|
||||
const id = String(userId || "");
|
||||
if (!id) return "";
|
||||
const map = userNameMap.value || {};
|
||||
return String(map[id] || '') || id;
|
||||
return String(map[id] || "") || id;
|
||||
}
|
||||
|
||||
function formatTodo(todo) {
|
||||
@ -277,8 +357,14 @@ function formatTodo(todo) {
|
||||
status,
|
||||
eventStatusLabel: statusLabelFromStatus(status),
|
||||
eventTypeLabel: eventTypeLabel(todo?.eventType),
|
||||
planDate: plannedExecutionTime && dayjs(plannedExecutionTime).isValid() ? dayjs(plannedExecutionTime).format('YYYY-MM-DD') : '',
|
||||
createTimeStr: createTime && dayjs(createTime).isValid() ? dayjs(createTime).format('YYYY-MM-DD HH:mm') : '',
|
||||
planDate:
|
||||
plannedExecutionTime && dayjs(plannedExecutionTime).isValid()
|
||||
? dayjs(plannedExecutionTime).format("YYYY-MM-DD")
|
||||
: "",
|
||||
createTimeStr:
|
||||
createTime && dayjs(createTime).isValid()
|
||||
? dayjs(createTime).format("YYYY-MM-DD HH:mm")
|
||||
: "",
|
||||
executorName: resolveUserName(todo?.executorUserId),
|
||||
creatorName: resolveUserName(todo?.creatorUserId),
|
||||
};
|
||||
@ -303,7 +389,7 @@ async function getMore() {
|
||||
const corpId = getCorpId();
|
||||
const userId = getUserId();
|
||||
if (!corpId) {
|
||||
toast('缺少 corpId,请先完成登录/团队选择');
|
||||
toast("缺少 corpId,请先完成登录/团队选择");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -314,22 +400,23 @@ async function getMore() {
|
||||
pageSize,
|
||||
};
|
||||
|
||||
if (query.status !== 'all') params.statusList = [query.status];
|
||||
if (query.status !== "all") params.statusList = [query.status];
|
||||
if (query.isMy) params.executorUserId = userId;
|
||||
if (Array.isArray(query.eventTypes) && query.eventTypes.length) params.eventType = query.eventTypes;
|
||||
if (query.teamId && query.teamId !== 'ALL') params.teamId = query.teamId;
|
||||
if (Array.isArray(query.eventTypes) && query.eventTypes.length)
|
||||
params.eventType = query.eventTypes;
|
||||
if (query.teamId && query.teamId !== "ALL") params.teamId = query.teamId;
|
||||
if (query.planRange?.[0]) params.startDate = query.planRange[0];
|
||||
if (query.planRange?.[1]) params.endDate = query.planRange[1];
|
||||
|
||||
const res = await api('getCustomerTodos', params);
|
||||
const res = await api("getCustomerTodos", params);
|
||||
if (!res?.success) {
|
||||
toast(res?.message || '获取回访任务失败');
|
||||
toast(res?.message || "获取回访任务失败");
|
||||
return;
|
||||
}
|
||||
const arr = Array.isArray(res.data) ? res.data : [];
|
||||
const next = arr.map(formatTodo);
|
||||
|
||||
total.value = typeof res.total === 'number' ? res.total : 0;
|
||||
total.value = typeof res.total === "number" ? res.total : 0;
|
||||
pages.value = Math.ceil(total.value / pageSize) || 0;
|
||||
list.value = page.value === 1 ? next : [...list.value, ...next];
|
||||
page.value += 1;
|
||||
@ -352,58 +439,154 @@ async function loadTeams() {
|
||||
const corpId = getCorpId();
|
||||
const userId = getUserId();
|
||||
if (!corpId || !userId) return;
|
||||
const res = await api('getTeamBymember', { corpId, corpUserId: userId });
|
||||
const res = await api("getTeamBymember", { corpId, corpUserId: userId });
|
||||
if (!res?.success) return;
|
||||
const list = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
|
||||
const list = Array.isArray(res?.data)
|
||||
? res.data
|
||||
: Array.isArray(res?.data?.data)
|
||||
? res.data.data
|
||||
: [];
|
||||
const normalized = list
|
||||
.map((raw) => {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const teamId = raw.teamId || raw.id || raw._id || '';
|
||||
const name = raw.name || raw.teamName || raw.team || '';
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const teamId = raw.teamId || raw.id || raw._id || "";
|
||||
const name = raw.name || raw.teamName || raw.team || "";
|
||||
if (!teamId || !name) return null;
|
||||
return { label: String(name), value: String(teamId) };
|
||||
})
|
||||
.filter(Boolean);
|
||||
teamOptions.value = [{ label: '全部', value: 'ALL' }, ...normalized];
|
||||
teamOptions.value = [{ label: "全部", value: "ALL" }, ...normalized];
|
||||
}
|
||||
|
||||
function add() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['+新增任务', '+使用模板', '+回访记录'],
|
||||
itemList: ["+新增任务", "+使用模板", "+回访记录"],
|
||||
success: ({ tapIndex }) => {
|
||||
if (tapIndex === 0) {
|
||||
uni.setStorageSync('new-followup-customer', { _id: props.archiveId, name: props.data?.name || '' });
|
||||
uni.navigateTo({ url: `/pages/case/new-followup?archiveId=${encodeURIComponent(props.archiveId)}` });
|
||||
uni.setStorageSync("new-followup-customer", {
|
||||
_id: props.archiveId,
|
||||
name: props.data?.name || "",
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/new-followup?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}`,
|
||||
});
|
||||
} else if (tapIndex === 1) {
|
||||
uni.setStorageSync('new-followup-plan-customer', { _id: props.archiveId, name: props.data?.name || '' });
|
||||
uni.setStorageSync('select-mamagement-plan', '');
|
||||
uni.navigateTo({ url: `/pages/case/plan-list?archiveId=${encodeURIComponent(props.archiveId)}` });
|
||||
uni.setStorageSync("new-followup-plan-customer", {
|
||||
_id: props.archiveId,
|
||||
name: props.data?.name || "",
|
||||
});
|
||||
uni.setStorageSync("select-mamagement-plan", "");
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/plan-list?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}`,
|
||||
});
|
||||
} else if (tapIndex === 2) {
|
||||
uni.setStorageSync('new-followup-record-customer', { _id: props.archiveId, name: props.data?.name || '' });
|
||||
uni.navigateTo({ url: `/pages/case/new-followup-record?archiveId=${encodeURIComponent(props.archiveId)}` });
|
||||
uni.setStorageSync("new-followup-record-customer", {
|
||||
_id: props.archiveId,
|
||||
name: props.data?.name || "",
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/new-followup-record?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function toDetail(todo) {
|
||||
uni.navigateTo({ url: `/pages/case/followup-detail?archiveId=${encodeURIComponent(props.archiveId)}&mode=edit&id=${encodeURIComponent(todo._id)}` });
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/followup-detail?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}&mode=edit&id=${encodeURIComponent(todo._id)}`,
|
||||
});
|
||||
}
|
||||
|
||||
async function sendFollowUp(todo) {
|
||||
if (!todo.sendContent && (!todo.fileList || todo.fileList.length === 0)) {
|
||||
toast("没有发送内容");
|
||||
return;
|
||||
}
|
||||
|
||||
const messages = [];
|
||||
|
||||
// 1. 发送文字内容
|
||||
if (todo.sendContent) {
|
||||
messages.push({
|
||||
type: "text",
|
||||
content: todo.sendContent,
|
||||
});
|
||||
}
|
||||
|
||||
// 2. 处理文件列表(图片、宣教文章、问卷)
|
||||
if (Array.isArray(todo.fileList)) {
|
||||
for (const file of todo.fileList) {
|
||||
if (file.type === "image" && file.URL) {
|
||||
// 发送图片
|
||||
messages.push({
|
||||
type: "image",
|
||||
content: file.URL,
|
||||
name: file.file?.name || file.name || "图片",
|
||||
});
|
||||
} else if (file.type === "article" && file.file?.url) {
|
||||
// 发送宣教文章
|
||||
messages.push({
|
||||
type: "article",
|
||||
content: {
|
||||
title: file.file?.name || file.name || "宣教文章",
|
||||
url: file.file?.url || file.URL,
|
||||
desc: file.file?.subtitle || "",
|
||||
},
|
||||
});
|
||||
} else if (file.type === "questionnaire" && file.file?.surveryId) {
|
||||
// 发送问卷
|
||||
messages.push({
|
||||
type: "questionnaire",
|
||||
content: {
|
||||
title: file.file?.name || file.name || "问卷",
|
||||
surveryId: file.file?.surveryId || file.surveryId,
|
||||
url: file.file?.url || file.URL,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 触发事件,通知父组件发送消息
|
||||
uni.$emit("send-followup-message", {
|
||||
messages,
|
||||
followupId: todo._id,
|
||||
followupData: todo,
|
||||
});
|
||||
|
||||
toast("消息已发送");
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
// ---- filter popup ----
|
||||
const filterPopupRef = ref(null);
|
||||
const state = ref(null);
|
||||
const teamPicked = ref(teamOptions.value[0]);
|
||||
const planRange = ref(['', '']);
|
||||
const planRange = ref(["", ""]);
|
||||
|
||||
function openFilter() {
|
||||
state.value = {
|
||||
query: { ...query, eventTypes: [...(query.eventTypes || [])], planRange: [...(query.planRange || ['', ''])] },
|
||||
query: {
|
||||
...query,
|
||||
eventTypes: [...(query.eventTypes || [])],
|
||||
planRange: [...(query.planRange || ["", ""])],
|
||||
},
|
||||
team: { ...teamPicked.value },
|
||||
range: [...planRange.value],
|
||||
};
|
||||
planRange.value = [...(query.planRange || ['', ''])];
|
||||
teamPicked.value = teamOptions.value.find((i) => i.value === query.teamId) || teamOptions.value[0];
|
||||
planRange.value = [...(query.planRange || ["", ""])];
|
||||
teamPicked.value =
|
||||
teamOptions.value.find((i) => i.value === query.teamId) ||
|
||||
teamOptions.value[0];
|
||||
filterPopupRef.value?.open?.();
|
||||
}
|
||||
function closeFilter(revert) {
|
||||
@ -416,7 +599,7 @@ function closeFilter(revert) {
|
||||
}
|
||||
|
||||
function toggleType(v) {
|
||||
if (v === 'all') {
|
||||
if (v === "all") {
|
||||
query.eventTypes = [];
|
||||
return;
|
||||
}
|
||||
@ -432,42 +615,50 @@ function pickTeam(e) {
|
||||
}
|
||||
|
||||
function pickStart(e) {
|
||||
planRange.value = [e.detail.value || '', planRange.value[1] || ''];
|
||||
planRange.value = [e.detail.value || "", planRange.value[1] || ""];
|
||||
query.planRange = [...planRange.value];
|
||||
}
|
||||
function pickEnd(e) {
|
||||
planRange.value = [planRange.value[0] || '', e.detail.value || ''];
|
||||
planRange.value = [planRange.value[0] || "", e.detail.value || ""];
|
||||
query.planRange = [...planRange.value];
|
||||
}
|
||||
function clearPlanRange() {
|
||||
planRange.value = ['', ''];
|
||||
query.planRange = ['', ''];
|
||||
planRange.value = ["", ""];
|
||||
query.planRange = ["", ""];
|
||||
}
|
||||
|
||||
function resetFilter() {
|
||||
query.eventTypes = [];
|
||||
query.teamId = 'ALL';
|
||||
query.teamId = "ALL";
|
||||
teamPicked.value = teamOptions.value[0];
|
||||
clearPlanRange();
|
||||
}
|
||||
|
||||
function confirmFilter() {
|
||||
filtered.value = Boolean((query.eventTypes && query.eventTypes.length) || query.teamId !== 'ALL' || query.planRange[0] || query.planRange[1]);
|
||||
filtered.value = Boolean(
|
||||
(query.eventTypes && query.eventTypes.length) ||
|
||||
query.teamId !== "ALL" ||
|
||||
query.planRange[0] ||
|
||||
query.planRange[1]
|
||||
);
|
||||
closeFilter(false);
|
||||
resetList();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const userId = getUserId();
|
||||
const name = String(doctorInfo.value?.anotherName || doctorInfo.value?.name || '');
|
||||
if (userId && name) userNameMap.value = { ...(userNameMap.value || {}), [userId]: name };
|
||||
const name = String(
|
||||
doctorInfo.value?.anotherName || doctorInfo.value?.name || ""
|
||||
);
|
||||
if (userId && name)
|
||||
userNameMap.value = { ...(userNameMap.value || {}), [userId]: name };
|
||||
loadTeams();
|
||||
resetList();
|
||||
uni.$on('archive-detail:followup-changed', resetList);
|
||||
uni.$on("archive-detail:followup-changed", resetList);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
uni.$off('archive-detail:followup-changed', resetList);
|
||||
uni.$off("archive-detail:followup-changed", resetList);
|
||||
});
|
||||
|
||||
watch(
|
||||
@ -523,7 +714,7 @@ watch(
|
||||
}
|
||||
.status-tab.active {
|
||||
background: #dbe6ff;
|
||||
color: #0877F1;
|
||||
color: #0877f1;
|
||||
}
|
||||
.filter-btn {
|
||||
flex-shrink: 0;
|
||||
@ -603,7 +794,7 @@ watch(
|
||||
}
|
||||
.st-notStart {
|
||||
background: #dbe6ff;
|
||||
color: #0877F1;
|
||||
color: #0877f1;
|
||||
}
|
||||
.st-treated {
|
||||
background: #dcfce7;
|
||||
@ -620,15 +811,129 @@ watch(
|
||||
color: #666;
|
||||
line-height: 18px;
|
||||
}
|
||||
.send-content-wrapper {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
.send-content-section {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
background: #f9f9f9;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
.send-content-label {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
flex-shrink: 0;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.send-content-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.send-text {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
line-height: 18px;
|
||||
word-break: break-word;
|
||||
}
|
||||
.file-list {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.file-item {
|
||||
margin-top: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.file-icon {
|
||||
font-size: 14px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.file-name {
|
||||
font-size: 12px;
|
||||
color: #0877f1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
}
|
||||
.file-type-image .file-name {
|
||||
color: #0877f1;
|
||||
}
|
||||
.file-type-article .file-name {
|
||||
color: #16a34a;
|
||||
}
|
||||
.file-type-questionnaire .file-name {
|
||||
color: #f59e0b;
|
||||
}
|
||||
.result {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
}
|
||||
.footer {
|
||||
.footer-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
gap: 10px;
|
||||
}
|
||||
.footer {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
flex: 1;
|
||||
}
|
||||
.footer-row .send-btn {
|
||||
flex: 0 0 auto;
|
||||
width: 60px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
border: none;
|
||||
background: #f5f6f8;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.action-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail-btn {
|
||||
background: #f5f6f8;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
flex: 0 0 auto;
|
||||
width: 60px;
|
||||
background: #0877f1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.empty {
|
||||
@ -644,7 +949,7 @@ watch(
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 26px;
|
||||
background: #0877F1;
|
||||
background: #0877f1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@ -704,8 +1009,8 @@ watch(
|
||||
color: #333;
|
||||
}
|
||||
.chip.active {
|
||||
background: #0877F1;
|
||||
border-color: #0877F1;
|
||||
background: #0877f1;
|
||||
border-color: #0877f1;
|
||||
color: #fff;
|
||||
}
|
||||
.select-row {
|
||||
@ -769,11 +1074,11 @@ watch(
|
||||
}
|
||||
.btn.plain {
|
||||
background: #fff;
|
||||
color: #0877F1;
|
||||
border: 1px solid #0877F1;
|
||||
color: #0877f1;
|
||||
border: 1px solid #0877f1;
|
||||
}
|
||||
.btn.primary {
|
||||
background: #0877F1;
|
||||
background: #0877f1;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
75
pages/case/followup-task-list.vue
Normal file
75
pages/case/followup-task-list.vue
Normal file
@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<view class="followup-task-page">
|
||||
<!-- 回访任务列表组件 -->
|
||||
<FollowUpManageTab
|
||||
:data="patientData"
|
||||
:archiveId="archiveId"
|
||||
:reachBottomTime="reachBottomTime"
|
||||
:floatingBottom="0"
|
||||
:fromChat="true"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import FollowUpManageTab from "./components/archive-detail/follow-up-manage-tab.vue";
|
||||
|
||||
const archiveId = ref("");
|
||||
const patientData = ref({});
|
||||
const reachBottomTime = ref("");
|
||||
|
||||
onLoad((options) => {
|
||||
archiveId.value = options.archiveId || "";
|
||||
patientData.value = {
|
||||
name: options.patientName || "",
|
||||
};
|
||||
});
|
||||
|
||||
const handleBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.followup-task-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background: #f5f6f8;
|
||||
}
|
||||
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 44px;
|
||||
background: #0877f1;
|
||||
padding: 0 14px;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav-back {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: -14px;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nav-placeholder {
|
||||
width: 44px;
|
||||
}
|
||||
</style>
|
||||
@ -315,6 +315,8 @@ const closePreview = () => {
|
||||
const sendArticle = async (article) => {
|
||||
try {
|
||||
const { doctorInfo } = useAccountStore();
|
||||
|
||||
// 1. 调用后端API记录发送
|
||||
const result = await api("sendArticleMessage", {
|
||||
groupId: pageParams.value.groupId,
|
||||
fromAccount: doctorInfo.userid,
|
||||
@ -323,8 +325,46 @@ const sendArticle = async (article) => {
|
||||
imgUrl: article.cover || "",
|
||||
desc: "点击查看详情",
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
// 记录文章发送记录
|
||||
// 2. 通过IM系统发送自定义消息到聊天列表
|
||||
try {
|
||||
// 获取全局IM管理器
|
||||
const { globalTimChatManager } = await import("@/utils/tim-chat.js");
|
||||
|
||||
if (globalTimChatManager && globalTimChatManager.tim && globalTimChatManager.isLoggedIn) {
|
||||
// 重要:设置当前会话ID,确保消息发送到正确的群聊
|
||||
const conversationID = `GROUP${pageParams.value.groupId}`;
|
||||
globalTimChatManager.currentConversationID = conversationID;
|
||||
|
||||
console.log("设置当前会话ID:", conversationID);
|
||||
|
||||
// 构建自定义消息数据
|
||||
const customMessageData = {
|
||||
messageType: "article",
|
||||
title: article.title || "宣教文章",
|
||||
articleId: article._id,
|
||||
cover: article.cover || "",
|
||||
desc: "点击查看详情",
|
||||
content: article.title || "宣教文章"
|
||||
};
|
||||
|
||||
// 发送自定义消息
|
||||
const sendResult = await globalTimChatManager.sendCustomMessage(customMessageData);
|
||||
if (sendResult && sendResult.success) {
|
||||
console.log("✓ 文章消息已通过IM系统发送");
|
||||
} else {
|
||||
console.warn("⚠️ 文章消息发送失败:", sendResult?.error);
|
||||
}
|
||||
} else {
|
||||
console.warn("⚠️ IM系统未就绪,消息可能不会显示在聊天列表");
|
||||
}
|
||||
} catch (imError) {
|
||||
console.error("通过IM系统发送消息失败:", imError);
|
||||
// IM发送失败不影响后端记录,继续返回
|
||||
}
|
||||
|
||||
// 3. 记录文章发送记录
|
||||
try {
|
||||
await api("addArticleSendRecord", {
|
||||
articleId: article._id,
|
||||
|
||||
@ -430,6 +430,15 @@ $primary-color: #0877F1;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.text-input {
|
||||
padding: 16rpx 46rpx;
|
||||
display: block;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.voice-input-btn {
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
||||
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput"
|
||||
:auto-height="true" :show-confirm-bar="false" :adjust-position="true"
|
||||
placeholder-style="line-height: 80rpx;" />
|
||||
/>
|
||||
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
|
||||
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" :placeholder="isRecording ? '松开发送' : '按住说话'" disabled>
|
||||
</input>
|
||||
@ -365,6 +365,13 @@ const goToCommonPhrases = () => {
|
||||
});
|
||||
};
|
||||
|
||||
// 打开回访任务列表
|
||||
const showFollowUpTasks = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/followup-task-list?archiveId=${props.patientId}&patientName=${props.patientInfo.name}`,
|
||||
});
|
||||
};
|
||||
|
||||
// 跳转到宣教文章页面
|
||||
const goToArticleList = () => {
|
||||
uni.navigateTo({
|
||||
@ -402,7 +409,7 @@ const morePanelButtons = [
|
||||
{
|
||||
text: "回访任务",
|
||||
icon: "/static/icon/huifangrenwu.png",
|
||||
action: showImagePicker,
|
||||
action: showFollowUpTasks,
|
||||
},
|
||||
{
|
||||
text: "常用语",
|
||||
|
||||
@ -757,8 +757,34 @@ onShow(() => {
|
||||
}
|
||||
|
||||
startIMMonitoring(30000);
|
||||
|
||||
// 监听回访任务发送事件
|
||||
uni.$on('send-followup-message', handleSendFollowUpMessage);
|
||||
});
|
||||
|
||||
// 处理发送回访任务消息
|
||||
const handleSendFollowUpMessage = async (data) => {
|
||||
try {
|
||||
if (chatInputRef.value) {
|
||||
// 将回访计划内容设置到输入框
|
||||
chatInputRef.value.setInputText(data.content);
|
||||
|
||||
// 延迟后自动发送
|
||||
setTimeout(() => {
|
||||
if (chatInputRef.value) {
|
||||
chatInputRef.value.sendTextMessageFromPhrase(data.content);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('发送回访任务消息失败:', error);
|
||||
uni.showToast({
|
||||
title: '发送失败,请重试',
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 页面隐藏
|
||||
onHide(() => {
|
||||
stopIMMonitoring();
|
||||
@ -945,6 +971,9 @@ onUnmounted(() => {
|
||||
timChatManager.setCallback("onMessageReceived", null);
|
||||
timChatManager.setCallback("onMessageListLoaded", null);
|
||||
timChatManager.setCallback("onError", null);
|
||||
|
||||
// 移除回访任务发送事件监听
|
||||
uni.$off('send-followup-message', handleSendFollowUpMessage);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -723,14 +723,26 @@ class TimChatManager {
|
||||
|
||||
// 判断是否为当前会话的消息
|
||||
// 系统消息:只要会话ID匹配就显示(不要求必须有currentConversationID)
|
||||
// 自定义消息(文章等):如果currentConversationID已设置,则需要匹配;如果未设置,则暂存等待
|
||||
// 普通消息:必须有currentConversationID且匹配才显示
|
||||
const isCurrentConversation = isSystemMsg
|
||||
? messageConversationID === this.currentConversationID
|
||||
: (this.currentConversationID && messageConversationID === this.currentConversationID)
|
||||
let isCurrentConversation = false
|
||||
|
||||
if (isSystemMsg) {
|
||||
// 系统消息:只要会话ID匹配就显示
|
||||
isCurrentConversation = messageConversationID === this.currentConversationID
|
||||
} else if (convertedMessage.type === 'TIMCustomElem') {
|
||||
// 自定义消息(包括文章):如果currentConversationID已设置,则需要匹配;否则也接收
|
||||
// 这样可以确保消息不会丢失,即使用户还没进入聊天页面
|
||||
isCurrentConversation = !this.currentConversationID || messageConversationID === this.currentConversationID
|
||||
} else {
|
||||
// 普通消息:必须有currentConversationID且匹配才显示
|
||||
isCurrentConversation = this.currentConversationID && messageConversationID === this.currentConversationID
|
||||
}
|
||||
|
||||
console.log('消息会话匹配检查:', {
|
||||
isCurrentConversation,
|
||||
isSystemMessage: isSystemMsg,
|
||||
messageType: convertedMessage.type,
|
||||
hasCurrentConversationID: !!this.currentConversationID,
|
||||
conversationIDMatch: messageConversationID === this.currentConversationID
|
||||
})
|
||||
@ -2516,32 +2528,66 @@ class TimChatManager {
|
||||
formatCustomMessage(payload) {
|
||||
try {
|
||||
if (!payload || !payload.data) {
|
||||
console.warn('payload.data 为空:', payload)
|
||||
return '[自定义消息]'
|
||||
}
|
||||
|
||||
const customData = typeof payload.data === 'string'
|
||||
let customData
|
||||
try {
|
||||
customData = typeof payload.data === 'string'
|
||||
? JSON.parse(payload.data)
|
||||
: payload.data
|
||||
} catch (parseError) {
|
||||
console.error('JSON 解析失败:', payload.data, parseError)
|
||||
return payload.description || '[自定义消息]'
|
||||
}
|
||||
|
||||
const messageType = customData.messageType || customData.type
|
||||
|
||||
const messageTypeMap = {
|
||||
system_message: '[系统消息]',
|
||||
symptom: '[病情描述]',
|
||||
prescription: '[处方单]',
|
||||
refill: '[续方申请]',
|
||||
survey: '[问卷调查]',
|
||||
article: '[文章]',
|
||||
consult_pending: '患者向团队发起咨询,请在1小时内接诊',
|
||||
consult_rejected: '咨询已被拒绝',
|
||||
consult_timeout: '咨询已超时自动关闭',
|
||||
consult_accepted: '已接诊,会话已开始',
|
||||
consult_ended: '已结束当前会话',
|
||||
// 使用 switch 语句保持与 getGroupListInternal 中的逻辑一致
|
||||
let messageText = '[自定义消息]'
|
||||
switch (messageType) {
|
||||
case 'system_message':
|
||||
messageText = '[系统消息]'
|
||||
break
|
||||
case 'symptom':
|
||||
messageText = '[病情描述]'
|
||||
break
|
||||
case 'prescription':
|
||||
messageText = '[处方单]'
|
||||
break
|
||||
case 'refill':
|
||||
messageText = '[续方申请]'
|
||||
break
|
||||
case 'survey':
|
||||
messageText = '[问卷调查]'
|
||||
break
|
||||
case 'article':
|
||||
messageText = '[文章]'
|
||||
break
|
||||
case 'consult_pending':
|
||||
messageText = '患者向团队发起咨询,请在1小时内接诊,超时将自动关闭会话'
|
||||
break
|
||||
case 'consult_rejected':
|
||||
messageText = '患者向团队发起咨询,由于有紧急事务要处理暂时无法接受咨询.本次会话已关闭'
|
||||
break
|
||||
case 'consult_timeout':
|
||||
messageText = '患者向团队发起咨询,团队成员均未接受咨询,本次会话已自动关闭'
|
||||
break
|
||||
case 'consult_accepted':
|
||||
messageText = '已接诊,会话已开始'
|
||||
break
|
||||
case 'consult_ended':
|
||||
messageText = '已结束当前会话'
|
||||
break
|
||||
default:
|
||||
messageText = customData.content || '[自定义消息]'
|
||||
}
|
||||
|
||||
return messageTypeMap[messageType] || customData.content || '[自定义消息]'
|
||||
console.log('自定义消息类型:', messageType, '显示文本:', messageText)
|
||||
return messageText
|
||||
} catch (error) {
|
||||
console.error('格式化自定义消息失败:', error)
|
||||
console.error('格式化自定义消息失败:', error, payload)
|
||||
return '[自定义消息]'
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user