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