feat: 新增团队ID支持,更新相关组件以传递团队信息

This commit is contained in:
Jafeng 2026-02-04 18:39:53 +08:00
parent 959da07a05
commit 4cd0953b0f
4 changed files with 86 additions and 36 deletions

View File

@ -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(() => {

View File

@ -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}`,
});
};

View File

@ -160,6 +160,7 @@
: ''
"
:userId="openid"
:teamId="teamId"
:patientId="patientId"
:corpId="corpId"
:patientInfo="patientInfo"
@ -247,6 +248,7 @@ const patientInfo = ref({
// ID
const patientId = ref("");
const teamId = ref("");
// - pending
const showConsultAccept = computed(() => orderStatus.value === "pending");
@ -312,6 +314,8 @@ const fetchGroupOrderStatus = async () => {
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) {
patientInfo.value = {

View File

@ -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) {