feat: 新增团队ID支持,更新相关组件以传递团队信息
This commit is contained in:
parent
959da07a05
commit
4cd0953b0f
@ -122,8 +122,24 @@ const pageParams = ref({
|
||||
groupId: "",
|
||||
patientId: "",
|
||||
corpId: "",
|
||||
teamId: "",
|
||||
});
|
||||
|
||||
const ensureTeamId = async () => {
|
||||
if (pageParams.value.teamId) return pageParams.value.teamId;
|
||||
if (!pageParams.value.groupId) return "";
|
||||
try {
|
||||
const res = await api("getGroupListByGroupId", { groupId: pageParams.value.groupId }, false);
|
||||
const team = res?.data?.team || {};
|
||||
const resolved = res?.data?.teamId || team.teamId || team._id || "";
|
||||
if (resolved) pageParams.value.teamId = resolved;
|
||||
return pageParams.value.teamId;
|
||||
} catch (err) {
|
||||
console.error("ensureTeamId failed:", err);
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
const isSelectMode = ref(false);
|
||||
const selectEventName = ref("");
|
||||
|
||||
@ -383,11 +399,13 @@ const sendArticle = async (article) => {
|
||||
|
||||
// 3. 记录文章发送记录
|
||||
try {
|
||||
await ensureTeamId();
|
||||
await api("addArticleSendRecord", {
|
||||
articleId: article._id,
|
||||
userId: doctorInfo.userid,
|
||||
customerId: pageParams.value.patientId,
|
||||
corpId: corpId,
|
||||
teamId: pageParams.value.teamId,
|
||||
});
|
||||
} catch (recordError) {
|
||||
console.error("记录文章发送失败:", recordError);
|
||||
@ -426,6 +444,10 @@ onLoad((options) => {
|
||||
if (options.corpId) {
|
||||
pageParams.value.corpId = options.corpId;
|
||||
}
|
||||
if (options.teamId) {
|
||||
pageParams.value.teamId = options.teamId;
|
||||
}
|
||||
ensureTeamId();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@ -76,6 +76,7 @@ const props = defineProps({
|
||||
formatTime: { type: Function, required: true },
|
||||
groupId: { type: String, default: "" },
|
||||
userId: { type: String, default: "" },
|
||||
teamId: { type: String, default: "" },
|
||||
patientId: { type: String, default: "" },
|
||||
corpId: { type: String, default: "" },
|
||||
});
|
||||
@ -375,14 +376,14 @@ const showFollowUpTasks = () => {
|
||||
// 跳转到宣教文章页面
|
||||
const goToArticleList = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/message/article-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}`,
|
||||
url: `/pages/message/article-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}&teamId=${props.teamId}`,
|
||||
});
|
||||
};
|
||||
|
||||
// 跳转到问卷列表页面
|
||||
const goToSurveyList = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/message/survey-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}&customerName=${props.patientInfo.name}`,
|
||||
url: `/pages/message/survey-list?groupId=${props.groupId}&patientId=${props.patientId}&corpId=${props.corpId}&teamId=${props.teamId}&customerName=${props.patientInfo.name}`,
|
||||
});
|
||||
};
|
||||
|
||||
@ -466,4 +467,4 @@ onUnmounted(() => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "../chat.scss";
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@ -149,24 +149,25 @@
|
||||
/>
|
||||
|
||||
<!-- 聊天输入组件 -->
|
||||
<ChatInput
|
||||
v-if="!isEvaluationPopupOpen && !showConsultAccept"
|
||||
ref="chatInputRef"
|
||||
:timChatManager="timChatManager"
|
||||
:formatTime="formatTime"
|
||||
<ChatInput
|
||||
v-if="!isEvaluationPopupOpen && !showConsultAccept"
|
||||
ref="chatInputRef"
|
||||
:timChatManager="timChatManager"
|
||||
:formatTime="formatTime"
|
||||
:groupId="
|
||||
chatInfo.conversationID
|
||||
? chatInfo.conversationID.replace('GROUP', '')
|
||||
: ''
|
||||
"
|
||||
:userId="openid"
|
||||
:patientId="patientId"
|
||||
:corpId="corpId"
|
||||
:patientInfo="patientInfo"
|
||||
@scrollToBottom="() => scrollToBottom(true)"
|
||||
@messageSent="() => scrollToBottom(true)"
|
||||
@endConsult="handleEndConsult"
|
||||
/>
|
||||
:userId="openid"
|
||||
:teamId="teamId"
|
||||
:patientId="patientId"
|
||||
:corpId="corpId"
|
||||
:patientInfo="patientInfo"
|
||||
@scrollToBottom="() => scrollToBottom(true)"
|
||||
@messageSent="() => scrollToBottom(true)"
|
||||
@endConsult="handleEndConsult"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -246,7 +247,8 @@ const patientInfo = ref({
|
||||
});
|
||||
|
||||
// 患者ID
|
||||
const patientId = ref("");
|
||||
const patientId = ref("");
|
||||
const teamId = ref("");
|
||||
|
||||
// 计算弹框显示状态 - 只有 pending 状态才显示接受问诊组件
|
||||
const showConsultAccept = computed(() => orderStatus.value === "pending");
|
||||
@ -299,18 +301,20 @@ function isSystemMessage(message) {
|
||||
}
|
||||
|
||||
// 获取群组订单状态
|
||||
const fetchGroupOrderStatus = async () => {
|
||||
try {
|
||||
const result = await api("getGroupListByGroupId", {
|
||||
groupId: groupId.value,
|
||||
});
|
||||
|
||||
if (result.success && result.data) {
|
||||
orderStatus.value = result.data.orderStatus || "";
|
||||
|
||||
// 更新导航栏标题为团队名称
|
||||
const teamName = result.data.team?.name || "群聊";
|
||||
updateNavigationTitle(teamName);
|
||||
const fetchGroupOrderStatus = async () => {
|
||||
try {
|
||||
const result = await api("getGroupListByGroupId", {
|
||||
groupId: groupId.value,
|
||||
});
|
||||
|
||||
if (result.success && result.data) {
|
||||
orderStatus.value = result.data.orderStatus || "";
|
||||
|
||||
// 更新导航栏标题为团队名称
|
||||
const teamName = result.data.team?.name || "群聊";
|
||||
updateNavigationTitle(teamName);
|
||||
|
||||
teamId.value = result.data.teamId || result.data.team?.teamId || result.data.team?._id || "";
|
||||
|
||||
// 更新患者信息
|
||||
if (result.data.patient) {
|
||||
@ -326,12 +330,12 @@ const fetchGroupOrderStatus = async () => {
|
||||
patientId.value = result.data.patientId.toString();
|
||||
}
|
||||
|
||||
console.log("获取群组订单状态:", {
|
||||
orderStatus: orderStatus.value,
|
||||
teamName: teamName,
|
||||
patientInfo: patientInfo.value,
|
||||
groupId: groupId.value,
|
||||
});
|
||||
console.log("获取群组订单状态:", {
|
||||
orderStatus: orderStatus.value,
|
||||
teamName: teamName,
|
||||
patientInfo: patientInfo.value,
|
||||
groupId: groupId.value,
|
||||
});
|
||||
} else {
|
||||
console.error("获取群组订单状态失败:", result.message);
|
||||
}
|
||||
@ -979,4 +983,4 @@ onUnmounted(() => {
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "./chat.scss";
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@ -101,6 +101,23 @@ const timChatManager = globalTimChatManager;
|
||||
// 从上一页传递的客户信息
|
||||
const customerId = ref("");
|
||||
const customerName = ref("");
|
||||
const teamId = ref("");
|
||||
const groupId = ref("");
|
||||
|
||||
const ensureTeamId = async () => {
|
||||
if (teamId.value) return teamId.value;
|
||||
if (!groupId.value) return "";
|
||||
try {
|
||||
const res = await api("getGroupListByGroupId", { groupId: groupId.value }, false);
|
||||
const team = res?.data?.team || {};
|
||||
const resolved = res?.data?.teamId || team.teamId || team._id || "";
|
||||
if (resolved) teamId.value = resolved;
|
||||
return teamId.value;
|
||||
} catch (err) {
|
||||
console.error("ensureTeamId failed:", err);
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索关键词
|
||||
const searchName = ref("");
|
||||
@ -125,8 +142,11 @@ const selectEventName = ref("");
|
||||
onLoad((options) => {
|
||||
isSelectMode.value = String(options?.select || '') === '1';
|
||||
selectEventName.value = String(options?.eventName || '');
|
||||
groupId.value = options?.groupId || "";
|
||||
customerId.value = options?.patientId || "";
|
||||
customerName.value = options?.customerName || "";
|
||||
teamId.value = options?.teamId || "";
|
||||
ensureTeamId();
|
||||
getCategoryList();
|
||||
loadSurveyList();
|
||||
});
|
||||
@ -337,6 +357,8 @@ const sendSurvey = async (survey) => {
|
||||
// 生成发送ID
|
||||
const sendSurveyId = generateRandomString(10);
|
||||
|
||||
await ensureTeamId();
|
||||
|
||||
// 创建问卷记录
|
||||
const createRecordRes = await api("createSurveyRecord", {
|
||||
corpId: corpId,
|
||||
@ -345,6 +367,7 @@ const sendSurvey = async (survey) => {
|
||||
memberId: customerId.value,
|
||||
customer: customerName.value,
|
||||
sendSurveyId: sendSurveyId,
|
||||
teamId: teamId.value,
|
||||
});
|
||||
|
||||
if (!createRecordRes.success) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user