Compare commits
No commits in common. "9cbe4543381d7a20a6e4a328496d7c516c3b155b" and "5b21ba22d23091c547f4a04c21acbfccac25b311" have entirely different histories.
9cbe454338
...
5b21ba22d2
@ -398,7 +398,7 @@
|
||||
"pagePath": "pages/home/case-home",
|
||||
"iconPath": "static/tabbar/cart.png",
|
||||
"selectedIconPath": "static/tabbar/cart_selected.png",
|
||||
"text": "档案"
|
||||
"text": "病历"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/home/work-home",
|
||||
|
||||
@ -1,19 +1,37 @@
|
||||
<template>
|
||||
<view class="message-page">
|
||||
<!-- 头部组件 -->
|
||||
<message-header v-model:activeTab="activeTab" @team-change="handleTeamChange" @add-patient="handleAddPatient" />
|
||||
<message-header
|
||||
v-model:activeTab="activeTab"
|
||||
@team-change="handleTeamChange"
|
||||
@add-patient="handleAddPatient"
|
||||
/>
|
||||
<!-- 消息列表 -->
|
||||
<scroll-view class="message-list" scroll-y="true" refresher-enabled :refresher-triggered="refreshing"
|
||||
@refresherrefresh="handleRefresh" @scrolltolower="handleLoadMore">
|
||||
<scroll-view
|
||||
class="message-list"
|
||||
scroll-y="true"
|
||||
refresher-enabled
|
||||
:refresher-triggered="refreshing"
|
||||
@refresherrefresh="handleRefresh"
|
||||
@scrolltolower="handleLoadMore"
|
||||
>
|
||||
<!-- 消息列表项 -->
|
||||
<view v-for="conversation in filteredConversationList" :key="conversation.groupID || conversation.conversationID"
|
||||
class="message-item" @click="handleClickConversation(conversation)">
|
||||
<view
|
||||
v-for="conversation in filteredConversationList"
|
||||
:key="conversation.groupID || conversation.conversationID"
|
||||
class="message-item"
|
||||
@click="handleClickConversation(conversation)"
|
||||
>
|
||||
<view class="avatar-container">
|
||||
<image class="avatar" :src="conversation.avatar || '/static/default-patient-avatar.png'" mode="aspectFill" />
|
||||
<image
|
||||
class="avatar"
|
||||
:src="conversation.avatar || '/static/default-patient-avatar.png'"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view v-if="conversation.unreadCount > 0" class="unread-badge">
|
||||
<text class="unread-text">{{
|
||||
conversation.unreadCount > 99 ? "99+" : conversation.unreadCount
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -21,39 +39,51 @@
|
||||
<view class="header">
|
||||
<view class="name-info">
|
||||
<text class="name">{{ formatPatientName(conversation) }}</text>
|
||||
<text v-if="conversation.patientSex || conversation.patientAge" class="patient-info">
|
||||
<text
|
||||
v-if="conversation.patientSex || conversation.patientAge"
|
||||
class="patient-info"
|
||||
>
|
||||
{{ formatPatientInfo(conversation) }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="time">{{
|
||||
formatMessageTime(conversation.lastMessageTime)
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
<view class="message-preview">
|
||||
<text class="preview-text">{{
|
||||
cleanMessageText(conversation.lastMessage) || "暂无消息"
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view v-if="!loading && conversationList.length === 0" class="empty-container">
|
||||
<view
|
||||
v-if="!loading && conversationList.length === 0"
|
||||
class="empty-container"
|
||||
>
|
||||
<image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
|
||||
<text class="empty-text">暂无会话</text>
|
||||
</view>
|
||||
<view v-else-if="!loading && filteredConversationList.length === 0" class="empty-container">
|
||||
<view
|
||||
v-else-if="!loading && filteredConversationList.length === 0"
|
||||
class="empty-container"
|
||||
>
|
||||
<image class="empty-image" src="/static/empty.svg" mode="aspectFit" />
|
||||
<text class="empty-text">{{
|
||||
activeTab === "processing" ? "暂无处理中的会话" : "暂无已结束的会话"
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-if="hasMore && filteredConversationList.length > 0" class="load-more">
|
||||
<view
|
||||
v-if="hasMore && filteredConversationList.length > 0"
|
||||
class="load-more"
|
||||
>
|
||||
<text class="load-more-text">{{
|
||||
loadingMore ? "加载中..." : "上拉加载更多"
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
@ -363,51 +393,28 @@ const setupConversationListener = () => {
|
||||
globalTimChatManager.setCallback("onConversationListUpdated", (eventData) => {
|
||||
console.log("会话列表更新事件:", eventData);
|
||||
|
||||
// 兼容单个会话更新,以及 { reason, conversation, message } 的增量事件结构。
|
||||
const conversationUpdate = eventData?.conversation || eventData;
|
||||
if (
|
||||
conversationUpdate &&
|
||||
!Array.isArray(conversationUpdate) &&
|
||||
conversationUpdate.conversationID
|
||||
) {
|
||||
const conversationID = conversationUpdate.conversationID;
|
||||
// 处理单个会话更新(标记已读的情况)
|
||||
if (eventData && !Array.isArray(eventData) && eventData.conversationID) {
|
||||
const conversationID = eventData.conversationID;
|
||||
const existingIndex = conversationList.value.findIndex(
|
||||
(conv) => conv.conversationID === conversationID
|
||||
);
|
||||
|
||||
if (existingIndex !== -1) {
|
||||
const conversation = conversationList.value[existingIndex];
|
||||
const lastMessageTimeChanged =
|
||||
conversationUpdate.lastMessageTime !== undefined &&
|
||||
conversation.lastMessageTime !== conversationUpdate.lastMessageTime;
|
||||
|
||||
if (conversationUpdate.lastMessage !== undefined) {
|
||||
conversation.lastMessage = conversationUpdate.lastMessage;
|
||||
}
|
||||
if (conversationUpdate.lastMessageTime !== undefined) {
|
||||
conversation.lastMessageTime = conversationUpdate.lastMessageTime;
|
||||
}
|
||||
if (conversationUpdate.unreadCount !== undefined) {
|
||||
conversation.unreadCount = conversationUpdate.unreadCount;
|
||||
}
|
||||
|
||||
if (lastMessageTimeChanged) {
|
||||
conversationList.value.sort(
|
||||
(a, b) => b.lastMessageTime - a.lastMessageTime
|
||||
// 直接更新未读数,避免触发整个对象的响应式更新
|
||||
if (eventData.unreadCount !== undefined) {
|
||||
conversationList.value[existingIndex].unreadCount =
|
||||
eventData.unreadCount;
|
||||
console.log(
|
||||
`已清空会话未读数: ${conversationList.value[existingIndex].name}, unreadCount: ${eventData.unreadCount}`
|
||||
);
|
||||
}
|
||||
console.log(`已更新会话: ${conversation.name}`, conversationUpdate);
|
||||
} else {
|
||||
// 增量事件未携带患者、团队等展示信息,重新拉取完整列表。
|
||||
loadConversationList();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!eventData || !Array.isArray(eventData)) {
|
||||
console.warn("会话列表更新事件数据格式错误");
|
||||
console.log('eventData: ', typeof eventData)
|
||||
console.log(typeof eventData === 'object' && eventData ? JSON.stringify(eventData) : eventData);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -107,7 +107,6 @@
|
||||
{{ i.eventStatusLabel }}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="i.taskContent" class="px-15 text-base leading-normal text-dark">{{ i.taskContent }}</view>
|
||||
<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">
|
||||
@ -254,9 +253,7 @@ function editProfile() {
|
||||
|
||||
function handleCert() {
|
||||
if (doctorInfo.value.verifyStatus === 'verifying') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/work/profile?type=cert',
|
||||
})
|
||||
toast('信息认证中,请耐心等待!')
|
||||
} else {
|
||||
visible.value = true
|
||||
}
|
||||
@ -317,8 +314,6 @@ async function getList() {
|
||||
const newItems = arr.filter(item => !item._id || !existingIds.has(item._id));
|
||||
list.value = [...list.value, ...newItems];
|
||||
}
|
||||
console.clear()
|
||||
console.log(list.value)
|
||||
total.value = res && res.total > 0 ? res.total : 0;
|
||||
pages.value = res && res.pages > 0 ? res.pages : 0;
|
||||
if (!res || !res.success) {
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
<view class="field-group">
|
||||
<view class="field-label">开单科室</view>
|
||||
<view class="project-input" :class="{ 'disabled-input': hasBenefitEntries }" @tap="openBillDeptPicker">
|
||||
<view class="project-input" @tap="openBillDeptPicker">
|
||||
<text :class="billDeptId ? 'value-text' : 'placeholder-text'">{{ billDeptName || "请选择开单科室" }}</text>
|
||||
<uni-icons type="right" size="18" color="#999" />
|
||||
</view>
|
||||
@ -127,15 +127,15 @@
|
||||
<view v-if="projectEntry.selected && Number(projectEntry.validDays || 0) > 0" class="field-group">
|
||||
<view class="field-label">有效期</view>
|
||||
<view class="valid-time-wrap">
|
||||
<view class="valid-time-picker" @tap="prepareValidTimePicker(projectEntry)">
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex"
|
||||
<view class="valid-time-picker disabled-picker">
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex" disabled
|
||||
@columnchange="onValidTimeColumnChange" @change="changeValidTime($event, projectEntry)">
|
||||
<view class="picker-value" :class="projectEntry.validTime ? 'value-text' : 'placeholder-text'">
|
||||
{{ projectEntry.validTime || "选择日期/长期" }}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="unlimited-button" @tap="clearValidTime(projectEntry)">长期</view>
|
||||
<view class="valid-time-locked-tip">套餐有效期已锁定</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="projectEntry.selected" class="todo-switch-row">
|
||||
@ -339,47 +339,15 @@
|
||||
<view v-if="batchTodoVisible" class="picker-mask" @tap="closeBatchTodoPicker">
|
||||
<view class="batch-todo-picker" @tap.stop>
|
||||
<view class="picker-header">
|
||||
<text class="picker-title">权益批量操作</text>
|
||||
<text class="picker-title">生成待办批量操作</text>
|
||||
<uni-icons type="closeempty" size="22" color="#666" @tap="closeBatchTodoPicker" />
|
||||
</view>
|
||||
<view class="batch-todo-row" @tap.stop>
|
||||
<text>批量生成待办</text>
|
||||
<switch :checked="batchTodoConfig.todoEnabled" color="#0877f1"
|
||||
@change="batchTodoConfig.todoEnabled = $event.detail.value; batchTodoConfig.todoEnabledTouched = true" />
|
||||
</view>
|
||||
<view class="batch-todo-row">
|
||||
<text>批量设置项目有效期</text>
|
||||
<switch :checked="batchTodoConfig.setBenefitValidTime" color="#0877f1"
|
||||
@change="batchTodoConfig.setBenefitValidTime = $event.detail.value" />
|
||||
</view>
|
||||
<view v-if="batchTodoConfig.setBenefitValidTime" class="batch-todo-field">
|
||||
<text>项目有效期:</text>
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex"
|
||||
@tap="openBatchDatePicker('benefitValidTime')" @columnchange="onValidTimeColumnChange"
|
||||
@change="changeTodoDate($event)">
|
||||
<text :class="batchTodoConfig.benefitValidTime ? 'value-text' : 'placeholder-text'">
|
||||
{{ batchTodoConfig.benefitValidTime || "选择日期" }}
|
||||
</text>
|
||||
</picker>
|
||||
<text class="batch-unlimited" @tap.stop="batchTodoConfig.benefitValidTime = ''">长期</text>
|
||||
@change="batchTodoConfig.todoEnabled = $event.detail.value" />
|
||||
</view>
|
||||
<template v-if="batchTodoConfig.todoEnabled">
|
||||
<view class="batch-todo-row">
|
||||
<text>批量设置回访计划有效期</text>
|
||||
<switch :checked="batchTodoConfig.setTodoExpireDate" color="#0877f1"
|
||||
@change="batchTodoConfig.setTodoExpireDate = $event.detail.value" />
|
||||
</view>
|
||||
<view v-if="batchTodoConfig.setTodoExpireDate" class="batch-todo-field">
|
||||
<text>截止日期:</text>
|
||||
<picker mode="multiSelector" :range="validTimeRange" :value="validTimeIndex"
|
||||
@tap="openBatchDatePicker('todoExpireDate')" @columnchange="onValidTimeColumnChange"
|
||||
@change="changeTodoDate($event)">
|
||||
<text :class="batchTodoConfig.todoExpireDate ? 'value-text' : 'placeholder-text'">
|
||||
{{ batchTodoConfig.todoExpireDate || "请选择截止日期" }}
|
||||
</text>
|
||||
</picker>
|
||||
<uni-icons type="right" size="16" color="#999" />
|
||||
</view>
|
||||
<view class="batch-todo-row">
|
||||
<text>待办完成后关联核销权益</text>
|
||||
<switch :checked="batchTodoConfig.deductBenefit" color="#0877f1"
|
||||
@ -561,11 +529,6 @@ const billDeptKeyword = ref("");
|
||||
const billDeptPickerVisible = ref(false);
|
||||
const billDeptExpanded = ref(new Set());
|
||||
const entries = ref([]);
|
||||
const hasBenefitEntries = computed(() => entries.value.some((entry) => (
|
||||
entry.isPackage
|
||||
|| entry.project?._id
|
||||
|| (Array.isArray(entry.projects) && entry.projects.some((project) => project?.project?._id || project?.selected))
|
||||
)));
|
||||
const saving = ref(false);
|
||||
const projectPickerVisible = ref(false);
|
||||
const projectPickerIndex = ref(-1);
|
||||
@ -597,11 +560,6 @@ const batchTodoConfig = ref({
|
||||
executorName: "",
|
||||
executeTeamId: "",
|
||||
executeTeamName: "",
|
||||
todoEnabledTouched: false,
|
||||
setBenefitValidTime: false,
|
||||
benefitValidTime: "",
|
||||
setTodoExpireDate: false,
|
||||
todoExpireDate: "",
|
||||
});
|
||||
const batchExecutorTarget = ref(null);
|
||||
const benefitDetailVisible = ref(false);
|
||||
@ -959,21 +917,6 @@ function changeBillDoctor(event) {
|
||||
const doctor = getBillDoctors()[Number(event.detail.value)] || null;
|
||||
billDoctorUserId.value = doctor?.userid || "";
|
||||
billDoctorName.value = doctor?.anotherName || doctor?.name || "";
|
||||
refreshTreatmentDoctorDefaults();
|
||||
}
|
||||
|
||||
function refreshTreatmentDoctorDefaults() {
|
||||
entries.value.forEach((entry) => {
|
||||
if (entry.isPackage) {
|
||||
entry.projects.forEach((project) => {
|
||||
if (project.selected && String(project.dept?._id || "") === String(billDeptId.value || "")) {
|
||||
applyTreatmentDefaults(project);
|
||||
}
|
||||
});
|
||||
} else if (entry.project?._id && String(entry.dept?._id || "") === String(billDeptId.value || "")) {
|
||||
applyTreatmentDefaults(entry);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const filteredBillDeptOptions = computed(() => {
|
||||
@ -1001,10 +944,6 @@ const filteredBillDeptOptions = computed(() => {
|
||||
});
|
||||
|
||||
function openBillDeptPicker() {
|
||||
if (hasBenefitEntries.value) {
|
||||
uni.showToast({ title: "已有权益项目,请先清空后修改开单科室", icon: "none" });
|
||||
return;
|
||||
}
|
||||
billDeptPickerVisible.value = true;
|
||||
billDeptKeyword.value = "";
|
||||
billDeptExpanded.value = new Set(billDeptOptions.value.filter((item) => item.children?.length).map((item) => String(item._id)));
|
||||
@ -1023,16 +962,11 @@ function toggleBillDept(item) {
|
||||
}
|
||||
|
||||
function selectBillDept(dept) {
|
||||
if (hasBenefitEntries.value) {
|
||||
uni.showToast({ title: "已有权益项目,请先清空后修改开单科室", icon: "none" });
|
||||
return;
|
||||
}
|
||||
billDeptId.value = String(dept._id || "");
|
||||
billDeptName.value = dept.deptName || dept.name || "";
|
||||
billDeptValue.value = billDeptId.value;
|
||||
billDoctorUserId.value = "";
|
||||
billDoctorName.value = "";
|
||||
refreshTreatmentDoctorDefaults();
|
||||
closeBillDeptPicker();
|
||||
}
|
||||
|
||||
@ -1237,7 +1171,9 @@ function selectProject(project) {
|
||||
entry.discount = normalizeDiscount({ ...entry, discount: 10 });
|
||||
entry.isFree = false;
|
||||
calculateTotalPrice(entry);
|
||||
applyTreatmentDefaults(entry);
|
||||
entry.dept = getProjectDepts(entry).length === 1 ? getProjectDepts(entry)[0] : null;
|
||||
entry.treatmentDoctorUserId = "";
|
||||
entry.treatmentDoctorName = "";
|
||||
closeProjectPicker();
|
||||
}
|
||||
|
||||
@ -1248,7 +1184,7 @@ function createPackageProjectEntry(project = {}, packageItem = {}) {
|
||||
const validDate = hasValidDays && validDays > 0
|
||||
? formatDate(new Date(Date.now() + validDays * 24 * 60 * 60 * 1000))
|
||||
: "";
|
||||
const entry = {
|
||||
return {
|
||||
...createEntry(),
|
||||
project: normalizedProject,
|
||||
price: Number(normalizedProject.price ?? project.price ?? 0),
|
||||
@ -1260,26 +1196,11 @@ function createPackageProjectEntry(project = {}, packageItem = {}) {
|
||||
totalPrice: Number(project.totalPrice || 0),
|
||||
selected: packageItem.packageType === "fixed" || project.required === true,
|
||||
required: project.required === true,
|
||||
packageId: packageItem._id || "",
|
||||
packageName: packageItem.name || "",
|
||||
packageType: packageItem.packageType || "",
|
||||
hasValidDays,
|
||||
validDays,
|
||||
validTime: validDate,
|
||||
dept: null,
|
||||
dept: normalizedProject.depts?.length === 1 ? normalizedProject.depts[0] : null,
|
||||
};
|
||||
applyTreatmentDefaults(entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
function applyTreatmentDefaults(entry) {
|
||||
const depts = getProjectDepts(entry);
|
||||
entry.dept = depts.length === 1
|
||||
? depts[0]
|
||||
: depts.find((dept) => String(dept._id) === String(billDeptId.value)) || null;
|
||||
const doctor = getTreatmentDoctors(entry).find((item) => String(item.userid) === String(billDoctorUserId.value));
|
||||
entry.treatmentDoctorUserId = doctor?.userid || "";
|
||||
entry.treatmentDoctorName = doctor?.anotherName || doctor?.name || "";
|
||||
}
|
||||
|
||||
async function selectPackage(packageItem) {
|
||||
@ -1379,11 +1300,6 @@ function openBatchTodoPicker() {
|
||||
batchTodoVisible.value = true;
|
||||
}
|
||||
|
||||
function openBatchDatePicker(field) {
|
||||
todoDateTarget.value = { entry: batchTodoConfig.value, field };
|
||||
prepareValidTimePicker({ validTime: batchTodoConfig.value[field] });
|
||||
}
|
||||
|
||||
function closeBatchTodoPicker() {
|
||||
batchTodoVisible.value = false;
|
||||
}
|
||||
@ -1397,39 +1313,15 @@ function openBatchExecutorPicker() {
|
||||
}
|
||||
|
||||
function applyBatchTodoConfig() {
|
||||
let skippedValidityCount = 0;
|
||||
const applyConfig = (entry) => {
|
||||
if (!entry?.project?._id) return;
|
||||
if (batchTodoConfig.value.setBenefitValidTime) {
|
||||
if (entry.packageId && entry.hasValidDays !== true) {
|
||||
skippedValidityCount += 1;
|
||||
} else {
|
||||
entry.validTime = batchTodoConfig.value.benefitValidTime || "";
|
||||
}
|
||||
}
|
||||
if (batchTodoConfig.value.todoEnabledTouched) {
|
||||
entry.todoEnabled = Boolean(batchTodoConfig.value.todoEnabled);
|
||||
}
|
||||
const shouldApplyTodoSettings = batchTodoConfig.value.todoEnabledTouched
|
||||
|| batchTodoConfig.value.setTodoExpireDate
|
||||
|| Boolean(batchTodoConfig.value.executorUserId);
|
||||
if (!shouldApplyTodoSettings) return;
|
||||
entry.todoEnabled = Boolean(batchTodoConfig.value.todoEnabled);
|
||||
if (!entry.todoEnabled) {
|
||||
if (batchTodoConfig.value.setTodoExpireDate && batchTodoConfig.value.todoExpireDate) {
|
||||
entry.todoConfig = entry.todoConfig || getDefaultTodoConfig(entry);
|
||||
entry.todoConfig.expireDate = batchTodoConfig.value.todoExpireDate;
|
||||
entry.todoConfig.expireDateManual = true;
|
||||
} else if (batchTodoConfig.value.todoEnabledTouched) {
|
||||
entry.todoConfig = null;
|
||||
}
|
||||
entry.todoConfig = null;
|
||||
return;
|
||||
}
|
||||
entry.todoConfig = entry.todoConfig || getDefaultTodoConfig(entry);
|
||||
entry.todoConfig.deductBenefit = Boolean(batchTodoConfig.value.deductBenefit);
|
||||
if (batchTodoConfig.value.setTodoExpireDate && batchTodoConfig.value.todoExpireDate) {
|
||||
entry.todoConfig.expireDate = batchTodoConfig.value.todoExpireDate;
|
||||
entry.todoConfig.expireDateManual = true;
|
||||
}
|
||||
if (batchTodoConfig.value.executorUserId) {
|
||||
Object.assign(entry.todoConfig, {
|
||||
executorUserId: batchTodoConfig.value.executorUserId,
|
||||
@ -1447,9 +1339,6 @@ function applyBatchTodoConfig() {
|
||||
applyConfig(entry);
|
||||
}
|
||||
});
|
||||
if (skippedValidityCount) {
|
||||
uni.showToast({ title: `${skippedValidityCount}个套餐项目不支持有效期`, icon: "none" });
|
||||
}
|
||||
closeBatchTodoPicker()
|
||||
}
|
||||
|
||||
@ -1542,12 +1431,6 @@ function changeTodoDate(event) {
|
||||
const month = Number(validTimeRange.value[1][monthIndex].replace("月", ""));
|
||||
const day = Number(validTimeRange.value[2][dayIndex].replace("日", ""));
|
||||
const selectedDate = `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
||||
if (target.entry === batchTodoConfig.value) {
|
||||
batchTodoConfig.value[target.field] = selectedDate;
|
||||
validTimeIndex.value = [yearIndex, monthIndex, dayIndex];
|
||||
todoDateTarget.value = null;
|
||||
return;
|
||||
}
|
||||
target.entry.todoConfig[target.field] = selectedDate;
|
||||
validTimeIndex.value = [yearIndex, monthIndex, dayIndex];
|
||||
if (target.field === "planDate" && !target.entry.validTime) {
|
||||
@ -1572,9 +1455,8 @@ function syncPackageTotals(entry) {
|
||||
|
||||
function changeDept(event, entry) {
|
||||
entry.dept = getProjectDepts(entry)[Number(event.detail.value)] || null;
|
||||
const doctor = getTreatmentDoctors(entry).find((item) => String(item.userid) === String(billDoctorUserId.value));
|
||||
entry.treatmentDoctorUserId = doctor?.userid || "";
|
||||
entry.treatmentDoctorName = doctor?.anotherName || doctor?.name || "";
|
||||
entry.treatmentDoctorUserId = "";
|
||||
entry.treatmentDoctorName = "";
|
||||
}
|
||||
|
||||
function changeTreatmentDoctor(event, entry) {
|
||||
@ -2273,8 +2155,6 @@ async function submitEntries() {
|
||||
left: 0;
|
||||
z-index: 10001;
|
||||
box-sizing: border-box;
|
||||
max-height: calc(100vh - var(--keyboard-height));
|
||||
overflow-y: auto;
|
||||
padding: 28rpx 28rpx 32rpx;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
background: #fff;
|
||||
@ -2319,19 +2199,6 @@ async function submitEntries() {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.batch-todo-field picker {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.batch-todo-field picker text {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.batch-todo-actions {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
<template>
|
||||
<view class="ai-assistant-buttons">
|
||||
<view v-for="button in buttons" :key="button.id" class="ai-button" :class="{ loading: button.loading }"
|
||||
@click="handleButtonClick(button)">
|
||||
<view
|
||||
v-for="button in buttons"
|
||||
:key="button.id"
|
||||
class="ai-button"
|
||||
:class="{ loading: button.loading }"
|
||||
@click="handleButtonClick(button)"
|
||||
>
|
||||
<image class="button-icon" :src="button.icon" mode="aspectFit" />
|
||||
<text class="button-text">{{
|
||||
button.loading && button.loadingText ? button.loadingText : button.text
|
||||
}}</text>
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -57,32 +62,25 @@ const emit = defineEmits([
|
||||
const isGenerating = ref(false);
|
||||
|
||||
const buttons = ref([
|
||||
// {
|
||||
// id: "followUp",
|
||||
// text: "追问病情",
|
||||
// loadingText: "AI分析中,正在为您生成追问建议…",
|
||||
// icon: "/static/icon/zhuiwen.png",
|
||||
// loading: false,
|
||||
// },
|
||||
{
|
||||
id: "followUp",
|
||||
text: "追问病情",
|
||||
loadingText: "AI分析中,正在为您生成追问建议…",
|
||||
icon: "/static/icon/zhuiwen.png",
|
||||
loading: false,
|
||||
},
|
||||
// {
|
||||
// id: "aiAssistant",
|
||||
// text: "推荐回复",
|
||||
// text: "开启AI助手",
|
||||
// icon: "/static/icon/kaiqiAI.png",
|
||||
// loading: false,
|
||||
// },
|
||||
// {
|
||||
// id: "supplementRecord",
|
||||
// text: "补充档案",
|
||||
// icon: "/static/icon/buchong.png",
|
||||
// loading: false,
|
||||
// },
|
||||
{
|
||||
id: "aiAssistant",
|
||||
text: "推荐回复",
|
||||
loadingText: "AI分析中,正在为您生成回复建议…",
|
||||
icon: "/static/icon/kaiqiAI.png",
|
||||
id: "supplementRecord",
|
||||
text: "补充档案",
|
||||
icon: "/static/icon/buchong.png",
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
||||
// 处理按钮点击
|
||||
@ -208,72 +206,11 @@ const streamTextToInput = (text) => {
|
||||
};
|
||||
|
||||
// 处理AI助手
|
||||
const handleAIAssistant = async (button) => {
|
||||
try {
|
||||
button.loading = true;
|
||||
|
||||
let finalPatientAccountId = props.patientAccountId;
|
||||
if (!finalPatientAccountId) {
|
||||
const chatRecordsResult = await api("getChatRecordsByGroupId", {
|
||||
groupID: props.groupId,
|
||||
count: 5,
|
||||
});
|
||||
|
||||
if (
|
||||
chatRecordsResult.success &&
|
||||
chatRecordsResult.data &&
|
||||
chatRecordsResult.data.records
|
||||
) {
|
||||
const currentUserId = uni.getStorageSync("openid") || "";
|
||||
const patientMessage = chatRecordsResult.data.records.find(
|
||||
(record) =>
|
||||
record.From_Account && record.From_Account !== currentUserId
|
||||
);
|
||||
if (patientMessage) {
|
||||
finalPatientAccountId = patientMessage.From_Account;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!finalPatientAccountId) {
|
||||
uni.showToast({
|
||||
title: "无法获取患者信息",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await request(
|
||||
{
|
||||
url: "/getYoucanData/im",
|
||||
data: {
|
||||
type: "recommendReply",
|
||||
groupId: props.groupId,
|
||||
patientAccountId: finalPatientAccountId,
|
||||
corpId: props.corpId,
|
||||
},
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
if (result.success && result.data && result.data.suggestion) {
|
||||
streamTextToInput(result.data.suggestion);
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: result.message || "获取推荐回复失败",
|
||||
icon: "none",
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("获取推荐回复失败:", error);
|
||||
uni.showToast({
|
||||
title: "操作失败,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
} finally {
|
||||
button.loading = false;
|
||||
}
|
||||
const handleAIAssistant = (button) => {
|
||||
uni.showToast({
|
||||
title: "AI助手功能开发中",
|
||||
icon: "none",
|
||||
});
|
||||
};
|
||||
|
||||
// 处理补充病历
|
||||
@ -370,7 +307,6 @@ defineExpose({
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<!-- :hold-keyboard="true" -->
|
||||
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
||||
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput" :auto-height="true"
|
||||
:show-confirm-bar="false" :maxlength="-1" :cursor-spacing="40" ref="textareaRef" />
|
||||
:show-confirm-bar="false" :cursor-spacing="40" ref="textareaRef" />
|
||||
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
|
||||
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord"
|
||||
:placeholder="isRecording ? '松开发送' : '按住说话'" disabled />
|
||||
@ -295,21 +295,18 @@ const sendVoiceMessage = async (voiceFile, duration) => {
|
||||
|
||||
// 发送消息的通用方法(文本、图片、语音)
|
||||
const sendMessage = async (messageType, data) => {
|
||||
const result = await sendMessageUtil(
|
||||
await sendMessageUtil(
|
||||
messageType,
|
||||
data,
|
||||
props.timChatManager,
|
||||
() => validateBeforeSend(false, false, props.timChatManager),
|
||||
() => {
|
||||
showMorePanel.value = false;
|
||||
// 发送成功后滚动到底部
|
||||
emit("messageSent");
|
||||
},
|
||||
cloudCustomData.value
|
||||
);
|
||||
|
||||
if (result?.success) {
|
||||
// 让页面直接将本地消息加入列表,避免依赖全局 IM 回调的注册时机。
|
||||
emit("messageSent", result.message);
|
||||
}
|
||||
};
|
||||
|
||||
// 发送自定义消息的通用方法
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- 文本消息 -->
|
||||
<text v-if="message.type === 'TIMTextElem'" class="message-text" @longpress="copyText(message.payload.text)">
|
||||
<text v-if="message.type === 'TIMTextElem'" class="message-text">
|
||||
{{ message.payload.text }}
|
||||
</text>
|
||||
|
||||
@ -290,22 +290,6 @@ function isWechatChannels(data) {
|
||||
const wechatChannels = data.wechatChannels || {};
|
||||
return typeof wechatChannels.finderUserName === 'string' && wechatChannels.finderUserName.trim() && typeof wechatChannels.feedId === 'string' && wechatChannels.feedId.trim();
|
||||
}
|
||||
|
||||
function copyText(text) {
|
||||
if (typeof text !== 'string' || text.trim() === '') return;
|
||||
console.log('11122')
|
||||
uni.showActionSheet({
|
||||
itemList: ['复制'],
|
||||
success: (res) => {
|
||||
console.log(res.tapIndex)
|
||||
if (res.tapIndex === 0) {
|
||||
uni.setClipboardData({ data: text.trim(), success: () => toast('复制成功') })
|
||||
}
|
||||
},
|
||||
fail: res => console.log(res)
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -340,7 +324,7 @@ function copyText(text) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.benefit-item+.benefit-item {
|
||||
.benefit-item + .benefit-item {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@
|
||||
" :userId="openid" :teamId="teamId" :patientId="patientId" :corpId="corpId" :patientInfo="patientInfo"
|
||||
:orderStatus="orderStatus" :isGenerating="isGenerating"
|
||||
:canBenefitEntry="isBenefitEntryEnabled"
|
||||
@scrollToBottom="() => scrollToBottom(true)" @messageSent="handleMessageSent"
|
||||
@scrollToBottom="() => scrollToBottom(true)" @messageSent="() => scrollToBottom(true)"
|
||||
@endConsult="handleEndConsult" @openConsult="handleOpenConsult">
|
||||
<!-- AI助手按钮组插槽 -->
|
||||
<template #ai-assistant>
|
||||
@ -124,7 +124,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onUnmounted, nextTick, watch, computed } from "vue";
|
||||
import { onLoad, onShow, onHide, onUnload } from "@dcloudio/uni-app";
|
||||
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
|
||||
import { storeToRefs } from "pinia";
|
||||
import useAccountStore from "@/store/account.js";
|
||||
import { globalTimChatManager } from "@/utils/tim-chat.js";
|
||||
@ -766,29 +766,6 @@ const scrollToBottom = (immediate = false) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 发送成功后直接写入当前页面列表,避免全局 IM 回调被其他页面覆盖时消息不显示。
|
||||
const handleMessageSent = (message) => {
|
||||
if (
|
||||
!message ||
|
||||
!message.ID ||
|
||||
message.conversationID !== chatInfo.value.conversationID
|
||||
) {
|
||||
scrollToBottom(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const existingMessage = messageList.value.find(
|
||||
(item) => item.ID === message.ID
|
||||
);
|
||||
if (!existingMessage) {
|
||||
messageList.value.push(message);
|
||||
} else {
|
||||
existingMessage.status = message.status;
|
||||
}
|
||||
|
||||
nextTick(() => scrollToBottom(true));
|
||||
};
|
||||
|
||||
// 关闭功能栏
|
||||
const closeMorePanel = () => {
|
||||
uni.$emit("closeMorePanel");
|
||||
@ -941,14 +918,9 @@ const handleSendFollowUpMessage = async (data) => {
|
||||
// 页面隐藏
|
||||
onHide(() => {
|
||||
stopIMMonitoring();
|
||||
});
|
||||
|
||||
// 仅在真正离开页面时清空会话,息屏/切后台触发 onHide 时仍需接收当前会话的新消息。
|
||||
onUnload(() => {
|
||||
if (timChatManager.currentConversationID === chatInfo.value.conversationID) {
|
||||
timChatManager.currentConversationID = null;
|
||||
console.log("✓ 页面卸载,已清空当前会话ID");
|
||||
}
|
||||
// 清空当前会话ID,避免离开页面后收到的消息被错误标记为已读
|
||||
timChatManager.currentConversationID = null;
|
||||
console.log("✓ 页面隐藏,已清空当前会话ID");
|
||||
});
|
||||
|
||||
const sendCommonPhrase = async (phraseOrContent) => {
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
<full-page>
|
||||
<view class="p-15">
|
||||
<view class="bg-white px-10 mb-10 rounded">
|
||||
<form-input :form="formData" :required="rule.anotherName.required" :disableChange="rule.anotherName.disabled"
|
||||
wordLimit="10" title="anotherName" :name="rule.anotherName.name" @change="onChange($event)" />
|
||||
<form-input :form="formData" :required="rule.anotherName.required" wordLimit="10" title="anotherName"
|
||||
:name="rule.anotherName.name" @change="onChange($event)" />
|
||||
<common-cell title="avatar" name="头像">
|
||||
<view class="flex-grow flex items-center justify-end">
|
||||
<image v-if="formData.avatar" class="avatar mr-5 rounded-full" :src="formData.avatar" />
|
||||
@ -116,7 +116,7 @@ const rule = computed(() => {
|
||||
title: { name: "职称", disabled: false },
|
||||
dept: { name: "科室", disabled: false },
|
||||
}
|
||||
if (doctorInfo.value?.verifyStatus === "verified") {
|
||||
if (doctorInfo.value) {
|
||||
data.job.name = "岗位 (不可修改)";
|
||||
data.job.disabled = true;
|
||||
}
|
||||
@ -232,10 +232,7 @@ async function save() {
|
||||
) {
|
||||
return toast("请输入姓名");
|
||||
}
|
||||
if (
|
||||
type.value === "cert" &&
|
||||
(!Array.isArray(formData.value.job) || formData.value.job.length === 0)
|
||||
) {
|
||||
if (type.value === "cert" && !jobStr.value) {
|
||||
return toast("请选择岗位信息");
|
||||
}
|
||||
const apiName = doctorInfo.value
|
||||
@ -258,12 +255,7 @@ async function save() {
|
||||
await getDoctorInfo({ withHlwDeptInfo: true });
|
||||
form.value = {};
|
||||
if (type.value === "cert") {
|
||||
if (["医生", "医生助理"].includes(jobStr.value)) {
|
||||
toCert();
|
||||
} else {
|
||||
await toast("保存成功");
|
||||
back();
|
||||
}
|
||||
toCert();
|
||||
} else {
|
||||
await toast("保存成功");
|
||||
back();
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
</view>
|
||||
<template #footer>
|
||||
<button-footer cancelText="上一步" :confirmText="submitText" @confirm="save()" @cancel="back()" />
|
||||
<button-footer cancelText="上一步" confirmText="提交审核" @confirm="save()" @cancel="back()" />
|
||||
</template>
|
||||
</full-page>
|
||||
</template>
|
||||
@ -81,8 +81,6 @@ useGuard();
|
||||
const { account, doctorInfo } = storeToRefs(useAccountStore());
|
||||
const form = ref({})
|
||||
const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value }))
|
||||
const isResubmitting = computed(() => doctorInfo.value?.verifyStatus === 'verifying')
|
||||
const submitText = computed(() => isResubmitting.value ? '重新提交审核' : '提交审核')
|
||||
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
@ -121,7 +119,7 @@ async function save() {
|
||||
}
|
||||
const res = await api('submitCertProfile', data);
|
||||
if (res && res.success) {
|
||||
await toast(isResubmitting.value ? '重新提交成功' : '提交成功');
|
||||
await toast('提交成功');
|
||||
uni.navigateBack({ delta: 2 })
|
||||
} else {
|
||||
toast(res.message || '提交失败')
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<template #footer>
|
||||
<button-footer cancelText="上一步" :confirmText="submitText" @confirm="save()" @cancel="back()" />
|
||||
<button-footer cancelText="上一步" confirmText="提交审核" @confirm="save()" @cancel="back()" />
|
||||
</template>
|
||||
</full-page>
|
||||
</template>
|
||||
@ -63,8 +63,6 @@ useGuard();
|
||||
const { account, doctorInfo } = storeToRefs(useAccountStore());
|
||||
const form = ref({});
|
||||
const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value }))
|
||||
const isResubmitting = computed(() => doctorInfo.value?.verifyStatus === 'verifying')
|
||||
const submitText = computed(() => isResubmitting.value ? '重新提交审核' : '提交审核')
|
||||
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
@ -128,7 +126,7 @@ async function save() {
|
||||
}
|
||||
const res = await api('submitCertProfile', data);
|
||||
if (res && res.success) {
|
||||
await toast(isResubmitting.value ? '重新提交成功' : '提交成功');
|
||||
await toast('提交成功');
|
||||
uni.navigateBack({ delta: 2 })
|
||||
} else {
|
||||
toast(res.message || '提交失败')
|
||||
|
||||
@ -206,9 +206,7 @@ function editProfile() {
|
||||
|
||||
function handleCert() {
|
||||
if (doctorInfo.value.verifyStatus === 'verifying') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/work/profile?type=cert',
|
||||
})
|
||||
toast('信息认证中,请耐心等待!')
|
||||
} else {
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
@ -513,8 +513,6 @@ export const sendMessage = async (messageType, data, timChatManager, validateBef
|
||||
console.error('发送消息失败:', result?.error);
|
||||
showMessage('发送失败,请重试');
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// ==================== 状态检查相关工具方法 ====================
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user