From 664b29b37b5e3d21461527bd6d96d5b56cb98ba5 Mon Sep 17 00:00:00 2001 From: ZhaoYang <565837861@qq.com> Date: Fri, 27 Mar 2026 14:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E5=92=A8=E8=AF=A2=EF=BC=8C?= =?UTF-8?q?=E5=85=BD=E5=8C=BB=E7=AB=AF=E8=81=8A=E5=A4=A9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/muhu/consultation/index.vue | 1195 ++++++++--------- .../src/views/system/questions/index.vue | 180 +-- .../src/views/vet/chatManager/index.vue | 482 +++++-- chenhai-ui/src/views/vet/comments/index.vue | 12 +- chenhai-ui/src/views/vet/plan/index.vue | 8 +- 5 files changed, 1006 insertions(+), 871 deletions(-) diff --git a/chenhai-ui/src/views/muhu/consultation/index.vue b/chenhai-ui/src/views/muhu/consultation/index.vue index ceba752..b6ec5f8 100644 --- a/chenhai-ui/src/views/muhu/consultation/index.vue +++ b/chenhai-ui/src/views/muhu/consultation/index.vue @@ -1,18 +1,26 @@ @@ -509,7 +445,7 @@ import { listConsultation, getConsultation, delConsultation, addConsultation, updateConsultation} from "@/api/muhu/consultation" import CommentsList from '@/views/vet/comments/index.vue'; import PlanList from "@/views/vet/plan/index.vue"; -import {addComments} from "@/api/vet/comments" +import { listComments, addComments } from "@/api/vet/comments" import {addPlan} from "@/api/vet/plan" export default { @@ -541,8 +477,6 @@ export default { currentRow: null, // 回复列表弹窗 replyOpen: false, - // 回复表单弹窗 - replyFormOpen: false, // 方案列表弹窗 planOpen: false, // 方案表单弹窗 @@ -554,11 +488,27 @@ export default { detailViews: false, // 当前查看的详情 currentDetail: {}, + // 详情页回复表单数据 + detailReplyForm: { + consultationId: null, + content: null, + images: null + }, + // 评论列表数据(仅用于详情页) + commentsList: [], + commentsTotal: 0, + commentsPageNum: 1, + commentsPageSize: 10, + loadingMore: false, + defaultAvatar: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png', // 查询参数 queryParams: { pageNum: 1, pageSize: 10, farmerId: null, + farmerName:null, + description:null, + status:null, title: null, description: null, animalType: null, @@ -571,12 +521,6 @@ export default { }, // 表单参数 form: {}, - // 回复表单数据 - replyForm: { - consultationId: null, - content: null, - images: null - }, // 方案制定数据 planForm: { consultationId: null, @@ -691,41 +635,61 @@ export default { }, // ==================== 回复相关方法 ==================== - /** 回复按钮操作 - 直接打开回复列表 */ + /** 回复按钮操作 - 直接打开回复列表(保持原样) */ handleReply(row) { this.currentRow = row this.currentConsultationId = row.formId - this.replyOpen = true // 直接打开回复列表 + this.replyOpen = true }, - // 显示新增回复表单 - showAddReplyForm() { - this.replyOpen = false // 先关闭列表弹窗 - this.$nextTick(() => { - // 初始化回复表单数据 - this.replyForm = { - consultationId: this.currentConsultationId, - content: null, - images: null + /** 获取评论列表(仅用于详情页) */ + getCommentsList(reset = true) { + if (reset) { + this.commentsPageNum = 1 + this.commentsList = [] + } + + const params = { + pageNum: this.commentsPageNum, + pageSize: this.commentsPageSize, + consultationId: this.currentConsultationId + } + + listComments(params).then(response => { + if (reset) { + this.commentsList = response.rows || [] + } else { + this.commentsList = [...this.commentsList, ...(response.rows || [])] } - this.replyFormOpen = true // 打开回复表单 + this.commentsTotal = response.total || 0 + this.loadingMore = false + }).catch(() => { + this.loadingMore = false }) }, - // 回复表单提交方法 - submitReply() { - this.$refs["replyForm"].validate(valid => { + /** 加载更多评论 */ + loadMoreComments() { + if (this.commentsList.length >= this.commentsTotal) return + this.commentsPageNum++ + this.loadingMore = true + this.getCommentsList(false) + }, + + /** 详情页提交回复 */ + submitDetailReply() { + this.$refs["detailReplyForm"].validate(valid => { if (valid) { - addComments(this.replyForm).then(response => { + addComments(this.detailReplyForm).then(response => { this.$modal.msgSuccess("回复成功") - this.replyFormOpen = false - this.replyOpen = true // 重新打开回复列表 - // 刷新回复列表 - this.$nextTick(() => { - if (this.$refs.commentsList) { - this.$refs.commentsList.getList() - } - }) + // 清空回复表单 + this.detailReplyForm = { + consultationId: this.currentConsultationId, + content: null, + images: null + } + // 刷新评论列表 + this.getCommentsList(true) }).catch(() => { this.$modal.msgError("回复失败") }) @@ -733,31 +697,18 @@ export default { }) }, - // 回复表单取消方法 - cancelReply() { - this.replyFormOpen = false - this.replyOpen = true // 返回列表 - this.replyForm = { - consultationId: null, - content: null, - images: null - } - this.resetForm("replyForm") - }, - // ==================== 方案相关方法 ==================== // 方案制定按钮操作 - 直接打开方案列表 planFormulation(row) { this.currentConsultationId = row.formId this.currentRow = row - this.planOpen = true // 直接打开方案列表 + this.planOpen = true }, // 显示新增方案表单 showAddPlanForm() { - this.planOpen = false // 先关闭列表弹窗 + this.planOpen = false this.$nextTick(() => { - // 初始化方案表单数据 this.planForm = { consultationId: this.currentConsultationId, planNo: '', @@ -771,7 +722,7 @@ export default { precautions: '', userId: '', } - this.planFormOpen = true // 打开方案制定表单 + this.planFormOpen = true }) }, @@ -782,8 +733,7 @@ export default { addPlan(this.planForm).then(response => { this.$modal.msgSuccess("方案提交成功") this.planFormOpen = false - this.planOpen = true // 重新打开方案列表 - // 刷新方案列表 + this.planOpen = true this.$nextTick(() => { if (this.$refs.planList) { this.$refs.planList.getList() @@ -799,7 +749,7 @@ export default { // 方案表单取消方法 cancelPlan() { this.planFormOpen = false - this.planOpen = true // 返回列表 + this.planOpen = true this.planForm = { consultationId: null, planNo: null, @@ -816,11 +766,19 @@ export default { this.resetForm("planForm") }, - /** 详情按钮操作 */ + /** 详情按钮操作 - 包含回复功能 */ handleView(row) { this.detailViews = true; this.detailLoading = true; this.currentDetail = {}; + this.currentConsultationId = row.formId; + + // 初始化详情页回复表单 + this.detailReplyForm = { + consultationId: row.formId, + content: null, + images: null + } const formId = row.formId; getConsultation(formId).then(response => { @@ -829,6 +787,11 @@ export default { if (!this.currentDetail.farmerName && row.farmerName) { this.$set(this.currentDetail, 'farmerName', row.farmerName); } + if (!this.currentDetail.avatar && row.avatar) { + this.$set(this.currentDetail, 'avatar', row.avatar); + } + // 获取评论列表 + this.getCommentsList(true) } else { this.$modal.msgError("获取详情失败"); } @@ -838,6 +801,14 @@ export default { this.$modal.msgError("获取详情失败"); }); }, + + /** 关闭详情弹窗 */ + closeDetail() { + this.detailViews = false + this.commentsList = [] + this.commentsTotal = 0 + }, + /** 新增按钮操作 */ handleAdd() { this.reset() @@ -890,12 +861,29 @@ export default { this.download('muhu/consultation/export', { ...this.queryParams }, `consultation_${new Date().getTime()}.xlsx`) + }, + + /** 获取专家类型标签样式 */ + getExpertTypeTagType(expertType) { + const typeMap = { + '兽医专家': 'success', + '营养专家': 'warning', + '繁殖专家': 'danger', + '疾病防控专家': 'info', + '养殖专家': 'primary' + } + return typeMap[expertType] || 'info' } } } - + + + \ No newline at end of file diff --git a/chenhai-ui/src/views/system/questions/index.vue b/chenhai-ui/src/views/system/questions/index.vue index e50703b..fd9fd66 100644 --- a/chenhai-ui/src/views/system/questions/index.vue +++ b/chenhai-ui/src/views/system/questions/index.vue @@ -1,59 +1,33 @@ @@ -362,7 +285,7 @@ export default { if (this.currentQuestionId && ids.includes(this.currentQuestionId)) { this.answersDialogVisible = false } - }).catch(() => {}) + }).catch(() => { }) }, /** 导出按钮操作 */ @@ -404,6 +327,11 @@ export default { } } + @@ -499,7 +427,7 @@ export default { transform: translateY(-1px); } -.alter-btn:hover{ +.alter-btn:hover { background-color: rgb(230, 255, 238); transform: translateY(-1px); } diff --git a/chenhai-ui/src/views/vet/chatManager/index.vue b/chenhai-ui/src/views/vet/chatManager/index.vue index 558685d..7a96d94 100644 --- a/chenhai-ui/src/views/vet/chatManager/index.vue +++ b/chenhai-ui/src/views/vet/chatManager/index.vue @@ -50,7 +50,8 @@ :src="session.otherUserAvatar" :style="{ backgroundColor: getAvatarColor(session.otherUserName) }" > - {{ getAvatarText(session.otherUserName) }} + + 已读 发送中 失败 - 未读 @@ -281,7 +281,8 @@ export default { lastHeartbeatTime: null, wsRetryCount: 0, maxRetries: 3, - shouldAutoScroll: true + shouldAutoScroll: true, + baseUrl:process.env.VUE_APP_BASE_API } }, @@ -942,53 +943,110 @@ export default { + \ No newline at end of file diff --git a/chenhai-ui/src/views/vet/comments/index.vue b/chenhai-ui/src/views/vet/comments/index.vue index 6ed5b0a..a246a72 100644 --- a/chenhai-ui/src/views/vet/comments/index.vue +++ b/chenhai-ui/src/views/vet/comments/index.vue @@ -9,7 +9,7 @@ --> - + @@ -33,8 +33,10 @@ - + + + - + diff --git a/chenhai-ui/src/views/vet/plan/index.vue b/chenhai-ui/src/views/vet/plan/index.vue index fe0112b..399f009 100644 --- a/chenhai-ui/src/views/vet/plan/index.vue +++ b/chenhai-ui/src/views/vet/plan/index.vue @@ -23,7 +23,7 @@ - + @@ -86,7 +86,7 @@ v-hasPermi="['vet:comments:list']" class="info-btn view-btn" >详情 - 删除 + >删除 -->