Merge remote-tracking branch 'origin/main'

This commit is contained in:
MDSMO
2025-08-18 09:46:19 +08:00
36 changed files with 5744 additions and 3216 deletions

View File

@@ -74,6 +74,31 @@ export default {
value: 0,
url: "/task/todo"
},
{
label: "辅导员·困难资助审核",
name: "knzz",
value: 0,
url: "hard/tufa/fdy"
},
{
label: "辅导员·学生离校审核",
name: "leave",
value: 0,
url: "/survey/leave/fdy"
},
{
// 宁博
label: "辅导员·学生返校审核",
name: "return",
value: 0,
url: "/survey/return/fdy"
},
{
label: "辅导员·国家励志奖学金审核",
name: "knzzgl",
value: 0,
url: "/hard/gl/fdy"
}
],

View File

@@ -74,6 +74,19 @@ export default {
value: 0,
url: "/task/todo"
},
{
label: "学工·困难资助审核",
name: "knzz",
value: 0,
url: "hard/tufa/xg"
},
// 宁博
{
label: "学工·国家励志奖学金审核",
name: "knzzgl",
value: 0,
url: "/hard/gl/xg"
}
]
}

View File

@@ -1,170 +1,187 @@
<template>
<div>
<div class="six-action-container">
<div style="padding: 1rem;" class="six-action-item" v-for="(v, i) in taskList" :key="i">
<div class="bubble"
:style="{ backgroundImage: `url(${require('@/assets/index_bg/' + (i + 1) + '.png')})` }">
<div class="act-text">
<div class="title">
{{ v.label }}·待办
</div>
<div class="todo">
{{ v.value }}
</div>
</div>
<div class="bg-to" @click="toRoute(v.url)">更多</div>
</div>
<div>
<div class="six-action-container">
<div
style="padding: 1rem"
class="six-action-item"
v-for="(v, i) in taskList"
:key="i"
>
<div
class="bubble"
:style="{
backgroundImage: `url(${require('@/assets/index_bg/' +
(i + 1) +
'.png')})`,
}"
>
<div class="act-text">
<div class="title">{{ v.label }}·待办</div>
<div class="todo">
{{ v.value }}
</div>
</div>
<div class="bg-to" @click="toRoute(v.url)">更多</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { countXwUnDo as countUndo } from "@/api/stuCQS/good/apply";
import { isEmpty } from "@/api/helpFunc";
import { checkPermi } from "@/utils/permission";
export default {
name: "xw-undo",
data() {
return {
hasPrem:false,
name: "xw-undo",
data() {
return {
hasPrem: false,
taskList: [
{
label: "学务·评优评先审核",
name: "good",
value: 0,
url: "/stuGood/about-good/xw",
},
{
label: "学务·静湖之星审核",
name: "lake",
value: 0,
url: "/stuGood/about-lake/xw",
},
{
label: "学务·优秀毕业生审核",
name: "biye",
value: 0,
url: "/stuGood/good-graduate/xw",
},
{
label: "学务·困难认定审核",
name: "kn",
value: 0,
url: "/hard/pks/xw",
},
{
label: "学务·助学金审核",
name: "zx",
value: 0,
url: "/hard/zxj/xw",
},
{
label: "学务·宿舍管理审核",
name: "dms",
value: 0,
url: "/dormitory/stuDormitoryManage/work",
},
{
label: "学务·任务管理审核",
name: "rwgl",
value: 0,
url: "/task/todo",
},
],
}
},
created() {
if (checkPermi(['home:xw:undo1'])) {
this.countUndo();
this.hasPrem = true;
}
},
methods: {
async countUndo() {
let res = await countUndo();
if (res.code == 200) {
let data = [...res.data];
this.taskList.map(x => {
let temp = data.filter(y => y.startsWith(x.name));
if (!isEmpty(temp)) {
let result = temp[0].split("-")[1];
x.value = result;
}
});
}
taskList: [
{
label: "学务·评优评先审核",
name: "good",
value: 0,
url: "/stuGood/about-good/xw",
},
{
label: "学务·静湖之星审核",
name: "lake",
value: 0,
url: "/stuGood/about-lake/xw",
},
{
label: "学务·优秀毕业生审核",
name: "biye",
value: 0,
url: "/stuGood/good-graduate/xw",
},
{
label: "学务·困难认定审核",
name: "kn",
value: 0,
url: "/hard/pks/xw",
},
{
label: "学务·助学金审核",
name: "zx",
value: 0,
url: "/hard/zxj/xw",
},
{
label: "学务·宿舍管理审核",
name: "dms",
value: 0,
url: "/dormitory/stuDormitoryManage/work",
},
toRoute(url) {
if (!isEmpty(url)) {
this.$router.push(url);
}
{
label: "学务·任务管理审核",
name: "rwgl",
value: 0,
url: "/task/todo",
},
{
label: "学务·困难资助审核",
name: "knzz",
value: 0,
url: "hard/tufa/xw",
},
// 宁博
{
label: "学务·国家励志奖学金审核",
name: "knzzgl",
value: 0,
url: "/hard/gl/xw",
},
],
};
},
created() {
if (checkPermi(["home:xw:undo1"])) {
this.countUndo();
this.hasPrem = true;
}
},
methods: {
async countUndo() {
let res = await countUndo();
if (res.code == 200) {
let data = [...res.data];
this.taskList.map((x) => {
let temp = data.filter((y) => y.startsWith(x.name));
if (!isEmpty(temp)) {
let result = temp[0].split("-")[1];
x.value = result;
}
});
}
},
}
toRoute(url) {
if (!isEmpty(url)) {
this.$router.push(url);
}
},
},
};
</script>
<style scoped lang="scss">
.six-action-container {
display: flex;
flex-wrap: wrap;
display: flex;
flex-wrap: wrap;
}
.six-action-item {
flex-basis: 33.33%;
flex-basis: 33.33%;
}
.bubble {
overflow: hidden;
margin: 0 auto;
width: 100%;
height: 170px;
border-radius: 1rem;
// background-image: linear-gradient(120deg, rgb(134, 233, 98) 0%, rgb(45, 175, 92) 100%);
position: relative;
background-size: cover;
min-width: 250px;
overflow: hidden;
margin: 0 auto;
width: 100%;
height: 170px;
border-radius: 1rem;
// background-image: linear-gradient(120deg, rgb(134, 233, 98) 0%, rgb(45, 175, 92) 100%);
position: relative;
background-size: cover;
min-width: 250px;
}
.act-text {
width: 100%;
z-index: 2;
margin: 1rem;
width: 100%;
z-index: 2;
margin: 1rem;
.title {
text-align: left;
font-size: 1.25rem;
color: #fff;
}
.title {
text-align: left;
font-size: 1.25rem;
color: #fff;
}
.todo {
margin-top: 1rem;
font-size: 6rem;
color: #fff;
}
.todo {
margin-top: 1rem;
font-size: 6rem;
color: #fff;
}
}
.bg-to {
cursor: pointer;
z-index: 3;
position: absolute;
bottom: 5%;
right: 3%;
margin-top: 10px;
color: white;
cursor: pointer;
z-index: 3;
position: absolute;
bottom: 5%;
right: 3%;
margin-top: 10px;
color: white;
}
.six-action-item:hover,
.fast-act:hover {
cursor: pointer;
cursor: pointer;
transform: scale(1.1);
transform: scale(1.1);
}
</style>
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,671 +0,0 @@
<!-- src/views/tool/ai-chat/index.vue -->
<template>
<div class="ai-chat-container">
<h3>AI 聊天助手</h3>
<div class="conversation-controls">
<el-button @click="toggleConversationList">
{{ showConversationList ? '隐藏会话列表' : '显示会话列表' }}
</el-button>
<el-button @click="fetchHistoryMessages" :disabled="!conversationId || historyLoaded">获取历史消息</el-button>
<el-button @click="createNewConversation" type="primary">新建会话</el-button>
<el-button @click="fetchFeedbacks">获取反馈列表</el-button>
</div>
<!-- 会话列表 -->
<div v-if="showConversationList" class="conversation-list">
<h4>会话列表</h4>
<el-scrollbar max-height="200px">
<div v-for="conv in conversationList" :key="conv.id" class="conversation-item" :class="{ 'active': conv.id === conversationId }" @click="switchConversation(conv.id)">
<div class="conv-title">{{ conv.title || '未命名会话' }}</div>
<div class="conv-time">{{ formatDate(conv.updated_at) }}</div>
<div class="conv-preview">{{ conv.preview || '无消息' }}</div>
</div>
</el-scrollbar>
</div>
<el-button @click="fetchHistoryMessages" :disabled="!conversationId">获取历史消息</el-button>
<div class="chat-box" ref="chatBox">
<div v-for="(msg, index) in messages" :key="index" class="message-item">
<!-- 用户消息 -->
<div v-if="msg.type === 'user'" class="user-message">
<el-avatar :size="30" style="background-color: #1890ff;">U</el-avatar>
<div class="message-content user">{{ msg.content }}</div>
</div>
<!-- AI 消息带点赞/点踩 -->
<div v-else class="ai-message">
<el-avatar :size="30" style="background-color: #52c41a;">AI</el-avatar>
<div class="message-content ai" v-html="msg.content"></div>
<!-- 引用和归属分段列表 -->
<div v-if="msg.references && msg.references.length > 0" class="references-section">
<h4 class="references-title">引用来源</h4>
<ul class="references-list">
<li v-for="(ref, refIndex) in msg.references" :key="refIndex" class="reference-item">
<span class="reference-source">{{ ref.source }}</span>
<span class="reference-content">{{ ref.content }}</span>
</li>
</ul>
</div>
<!-- 👍 点赞 / 👎 点踩 按钮 -->
<div class="feedback-actions" v-if="msg.message_id">
<el-button
size="mini"
:type="msg.feedback === 'like' ? 'primary' : 'default'"
icon="el-icon-thumb"
@click="submitFeedback(msg, 'like')"
:loading="msg.feedbackLoading"
>点赞</el-button
>
<el-button
size="mini"
:type="msg.feedback === 'dislike' ? 'danger' : 'default'"
icon="el-icon-minus"
@click="submitFeedback(msg, 'dislike')"
:loading="msg.feedbackLoading"
>点踩</el-button
>
</div>
</div>
</div>
<!-- 流式输出中 -->
<div v-if="isStreaming" class="ai-message">
<el-avatar :size="30" style="background-color: #52c41a;">AI</el-avatar>
<div class="message-content ai" v-html="currentText"></div>
</div>
</div>
<div class="input-area">
<el-input
v-model="inputText"
placeholder="请输入你的问题... (回车发送)"
@keyup.enter.native="send"
@keydown.enter.native="handleEnterKey"
clearable
/>
<el-button type="primary" @click="send" :loading="isStreaming">发送</el-button>
</div>
</div>
</template>
<script>
import { getConversationList, submitFeedback, getFeedbacks, getHistoryMessages } from "@/api/aitutor/chat";
import { getTokenKeySessionStorage } from "@/utils/auth";
export default {
name: "AiChat",
data() {
return {
inputText: "",
messages: [],
currentText: "",
isStreaming: false,
abortController: null,
conversationId: null,
userId: 2023429112,
userName: "当前用户", // 添加用户名
userRole: "我是学生", // 添加用户角色
//userToken: getTokenKeySessionStorage(),
userToken: "123",
showConversationList: false,
conversationList: [],
loadingConversations: false,
historyLoaded: false, // 新增:标记历史消息是否已加载
};
},
mounted() {
// 组件挂载时获取会话列表
this.fetchConversationList();
},
methods: {
// 处理回车键事件
handleEnterKey(event) {
// 阻止默认行为,避免表单提交
event.preventDefault();
this.send();
},
// 切换会话列表显示状态并获取数据
toggleConversationList() {
this.showConversationList = !this.showConversationList;
this.fetchConversationList();
},
// 获取会话列表
async fetchConversationList() {
if (this.loadingConversations) return;
this.loadingConversations = true;
try {
const result = await getConversationList({ user: this.userId });
this.conversationList = result.data || [];
console.log('会话列表接口返回数据:', result.data);
// 自动选中第一个会话(如果有)
if (this.conversationList.length > 0 && !this.conversationId) {
this.switchConversation(this.conversationList[0].id);
}
} catch (err) {
this.$message.error("网络错误:" + err.message);
} finally {
this.loadingConversations = false;
}
},
// 切换会话
switchConversation(conversationId) {
this.conversationId = conversationId;
this.messages = []; // 清空当前消息
this.historyLoaded = false; // 重置历史消息加载标志
this.fetchHistoryMessages(); // 获取选中会话的历史消息
},
// 新建会话
createNewConversation() {
this.conversationId = null;
this.messages = [];
this.currentText = "";
this.historyLoaded = false;
this.showConversationList = false;
this.$message.info("已创建新会话,请先发送消息开始对话");
},
// 格式化日期
formatDate(dateString) {
if (!dateString) return '';
const date = new Date(dateString);
return date.toLocaleString();
},
async send() {
const query = this.inputText.trim();
if (!query || this.isStreaming) return;
this.messages.push({
type: "user",
content: query,
});
this.currentText = "";
this.isStreaming = true;
this.inputText = "";
// 确保有会话ID
if (!this.conversationId) {
console.log('发送消息时conversationId为null尝试创建新会话');
if (this.conversationList.length > 0) {
this.switchConversation(this.conversationList[0].id);
} else {
console.log('没有现有会话,将发送消息以创建新会话');
}
}
console.log('发送消息时的conversationId:', this.conversationId);
// 创建请求体
const requestBody = {
query: query,
conversation_id: this.conversationId || undefined,
user: this.userId,
user_id: this.userId,
user_name: this.userName,
user_role: this.userRole,
user_token: this.userToken
};
// 创建AbortController以支持取消请求
this.abortController = new AbortController();
try {
// 对于SSE请求使用原生fetch而不是axios封装
// Use the base API URL from environment configuration
const baseUrl = process.env.VUE_APP_BASE_API || '';
const response = await fetch(`${baseUrl}/aitutor/aichat/stream`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'text/event-stream',
'Authorization': `Bearer ${getTokenKeySessionStorage()}`
},
body: JSON.stringify(requestBody),
signal: this.abortController.signal
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
if (!response.body) throw new Error("No response body");
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop();
for (const line of lines) {
if (line.startsWith("data:")) {
const data = line.slice(5).trim();
if (data === "[DONE]") {
await this.finalizeResponse();
return;
} else {
try {
const json = JSON.parse(data);
const eventType = json.event;
switch (eventType) {
case "message":
this.currentText += json.answer || "";
break;
case "message_end":
// ✅ 保存 conversation_id 和 message_id
if (json.conversation_id) {
this.conversationId = json.conversation_id;
console.log("Conversation ID set to:", this.conversationId); // 添加调试信息
}
// 给最后一条 AI 消息添加 message_id 和引用数据
// 处理引用数据 - 根据Dify文档引用数据在retriever_resources字段中
let refs = [];
if (json.retriever_resources && Array.isArray(json.retriever_resources)) {
refs = json.retriever_resources;
console.log('引用数据来自retriever_resources字段:', refs);
} else if (json.references && Array.isArray(json.references)) {
refs = json.references;
console.log('引用数据来自references字段:', refs);
} else if (json.sources && Array.isArray(json.sources)) {
refs = json.sources;
console.log('引用数据来自sources字段:', refs);
} else {
console.log('未找到引用数据或格式不正确:', json);
}
this.messages.push({
type: "ai",
content: this.currentText,
message_id: json.id, // Dify 返回的消息 ID
references: refs, // 引用数据
feedback: null, // 初始无反馈
feedbackLoading: false,
});
this.currentText = "";
break;
case "error":
this.currentText += `<span style=\"color:red\">[AI错误] ${json.message || "未知错误"}</span>`;
break;
default:
break;
}
} catch (e) {
this.currentText += data;
}
}
}
}
}
await this.finalizeResponse();
} catch (err) {
if (err.name !== "AbortError") {
console.error("SSE Error:", err);
this.$message.error("连接失败: " + err.message + ", 请检查后端服务是否正常运行");
}
this.isStreaming = false;
}
},
async finalizeResponse() {
this.isStreaming = false;
this.abortController = null;
},
// ==================== 新增:提交点赞/点踩 ====================
async submitFeedback(msg, rating) {
// 防止重复提交
if (msg.feedbackLoading) return;
// 构造请求体
const payload = {
message_id: msg.message_id,
user_id: this.userId,
user: this.userId, // 添加user参数与user_id保持一致
rating: rating, // 'like' 或 'dislike'
content: null,
};
// 更新 UI 状态
msg.feedbackLoading = true;
try {
const result = await submitFeedback(payload);
console.log("提交反馈响应:", result);
if (result.code === 200) {
// 更新反馈状态(如果再次点击则撤销)
if (msg.feedback === rating) {
msg.feedback = null;
this.$message.success("已撤销");
} else {
msg.feedback = rating;
this.$message.success(rating === "like" ? "感谢点赞!" : "已提交点踩");
}
} else {
this.$message.error("提交失败:" + (result.msg || result.message));
}
} catch (err) {
this.$message.error("网络错误:" + err.message);
} finally {
msg.feedbackLoading = false;
}
},
// 获取反馈列表
async fetchFeedbacks() {
/* if (!this.conversationId) {
this.$message.error("当前会话ID不存在请先选择一个会话。");
return;
} */
try {
// 调用API函数
const data = await getFeedbacks({
conversation_id: this.conversationId,
user_id: this.userId
});
// 处理响应数据
if (data.code === 200) {
// 检查data是否是数组如果不是则尝试获取其content属性
const feedbacks = Array.isArray(data.data) ? data.data : (data.data?.content || []);
// 创建一个反馈映射,方便快速查找
const feedbackMap = {};
feedbacks.forEach(feedback => {
feedbackMap[feedback.message_id] = feedback.rating;
});
// 更新消息列表中的反馈状态
this.messages = this.messages.map(msg => {
if (feedbackMap[msg.message_id] !== undefined) {
return {
...msg,
feedback: feedbackMap[msg.message_id],
};
}
return msg;
});
this.$message.success("获取反馈列表成功");
} else {
console.error('获取反馈失败: 响应格式不正确', data);
this.$message.error("获取反馈列表失败:" + (data.msg || data.message));
}
} catch (error) {
console.error('获取反馈失败:', error);
this.$message.error("网络错误:" + error.message);
}
},
// ==================== 新增:获取历史消息 ====================
async fetchHistoryMessages() {
if (!this.conversationId) {
// 如果会话列表不为空但没有选中会话,自动选中第一个
if (this.conversationList.length > 0) {
this.switchConversation(this.conversationList[0].id);
return;
}
this.$message.error("当前会话ID不存在请先发起一次对话。");
return;
}
// 如果历史消息已加载,则不再重复加载
if (this.historyLoaded) {
this.$message.info("历史消息已加载");
return;
}
try {
// 调用API函数
// 确保user参数是字符串类型并正确传递
const data = await getHistoryMessages({
conversation_id: this.conversationId,
user_id: this.userId,
user: String(this.userId)
});
// 处理响应数据
if (data.code === 200) {
let historyData;
try {
// 尝试解析数据如果是字符串形式的JSON
historyData = typeof data.data === 'string' ? JSON.parse(data.data) : data.data;
} catch (e) {
historyData = data.data;
}
if (Array.isArray(historyData)) {
// 格式化历史消息
const historyMessages = [];
historyData.forEach(msg => {
// 如果有query字段添加用户消息
if (msg.query) {
historyMessages.push({
type: 'user',
content: msg.query,
message_id: msg.id + '-user', // 添加后缀以确保唯一性
feedback: null,
feedbackLoading: false,
});
}
// 如果有answer字段添加AI消息
if (msg.answer) {
historyMessages.push({
type: 'ai',
content: msg.answer,
message_id: msg.id,
references: msg.references || msg.sources || [], // 引用数据,适配不同字段名
feedback: msg.feedback || null,
feedbackLoading: false,
});
}
});
// 将历史消息添加到现有消息列表的开头
this.messages = [...historyMessages, ...this.messages];
this.historyLoaded = true; // 标记历史消息已加载
} else if (historyData && Array.isArray(historyData.messages)) {
// 格式化历史消息
const historyMessages = [];
historyData.messages.forEach(msg => {
if (msg.role === 'user') {
historyMessages.push({
type: 'user',
content: msg.content,
message_id: msg.id + '-user',
feedback: null,
feedbackLoading: false,
});
} else {
historyMessages.push({
type: 'ai',
content: msg.content,
message_id: msg.id,
references: msg.references || [],
feedback: null,
feedbackLoading: false,
});
}
});
this.messages = [...historyMessages, ...this.messages];
this.historyLoaded = true; // 标记历史消息已加载
} else {
console.error('获取历史消息失败: 响应格式不正确', historyData);
this.$message.error("获取历史消息失败:响应格式不正确");
}
} else {
console.error('获取历史消息失败:', data);
this.$message.error("获取历史消息失败:" + (data.msg || data.message));
}
} catch (error) {
console.error('获取历史消息失败:', error);
this.$message.error("网络错误:" + error.message);
}
},
},
beforeUnmount() {
if (this.abortController) {
this.abortController.abort();
}
},
};
</script>
<style scoped>
.ai-chat-container {
padding: 20px;
background-color: #f5f5f5;
height: calc(100vh - 100px);
display: flex;
flex-direction: column;
}
.chat-box {
flex: 1;
overflow-y: auto;
padding: 10px;
border: 1px solid #ebeef5;
border-radius: 8px;
background-color: white;
margin-bottom: 20px;
}
.message-item {
margin-bottom: 15px;
display: flex;
align-items: flex-start;
}
.message-content {
max-width: 80%;
padding: 8px 12px;
border-radius: 18px;
margin-left: 8px;
line-height: 1.6;
}
.user-message .message-content {
background-color: #1890ff;
color: white;
}
.ai-message .message-content {
background-color: #f0f2f5;
color: #333;
}
.references-section {
margin-left: 40px;
margin-top: 10px;
padding: 10px;
background-color: #f5f5f5;
border-radius: 8px;
font-size: 13px;
}
.references-title {
margin-bottom: 8px;
font-size: 14px;
font-weight: bold;
color: #666;
}
.references-list {
list-style-type: none;
padding-left: 0;
}
.reference-item {
margin-bottom: 8px;
padding-bottom: 8px;
border-bottom: 1px dashed #e0e0e0;
}
.reference-item:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.reference-source {
font-weight: bold;
color: #1890ff;
}
.reference-content {
color: #666;
}
/* 点赞/点踩按钮样式 */
.feedback-actions {
margin-left: 40px;
margin-top: 5px;
font-size: 12px;
}
.feedback-actions .el-button {
padding: 4px 8px;
margin-right: 5px;
}
.conversation-controls {
margin-bottom: 15px;
display: flex;
gap: 10px;
}
.conversation-list {
margin-bottom: 15px;
padding: 10px;
border: 1px solid #ebeef5;
border-radius: 8px;
background-color: white;
}
.conversation-item {
padding: 10px;
border-bottom: 1px solid #f0f0f0;
cursor: pointer;
}
.conversation-item:hover {
background-color: #f5f5f5;
}
.conversation-item.active {
background-color: #e6f7ff;
border-left: 3px solid #1890ff;
}
.conv-title {
font-weight: bold;
margin-bottom: 5px;
}
.conv-time {
font-size: 12px;
color: #999;
margin-bottom: 5px;
}
.conv-preview {
font-size: 12px;
color: #666;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

View File

@@ -0,0 +1,223 @@
<template>
<div class="app-container">
<el-table v-loading="loading" :data="psychologicalList" style="width: 100%">
<el-table-column label="学号" align="center" prop="studentId" min-width="120" />
<el-table-column label="最新评估等级" align="center" prop="rating" min-width="120">
<template slot-scope="scope">
<el-tag :type="getRatingTagType(scope.row.rating)" effect="dark">
{{ scope.row.rating }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="120">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="viewDetails(scope.row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<!-- 心理评估详情弹出对话框 -->
<el-dialog
title="心理评估详情"
:visible.sync="dialogVisible"
width="80%"
:before-close="closeRatingHistory"
class="rating-dialog"
>
<div v-if="selectedStudent">
<h3>学生信息</h3>
<p><strong>学号</strong>{{ selectedStudent.studentId }}</p>
<p><strong>姓名</strong>{{ selectedStudent.studentName }}</p>
<p><strong>班级</strong>{{ selectedStudent.className }}</p>
<p><strong>辅导员</strong>{{ selectedStudent.counselor }}</p>
<h3>历史评估记录</h3>
<el-table :data="studentHistoryList" style="width: 100%">
<el-table-column label="评估等级" align="center" prop="rating" min-width="120">
<template slot-scope="scope">
<el-tag :type="getRatingTagType(scope.row.rating)" effect="dark">
{{ scope.row.rating }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="评估时间" align="center" prop="createdTime" min-width="150">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
</template>
<script>
import { getPsychologicalRatings } from "@/api/aitutor/chat";
import { listStudent } from "@/api/stuCQS/basedata/student";
export default {
name: "ChatWarning",
data() {
return {
// 遮罩层
loading: true,
// 心理评估表格数据
psychologicalList: [],
// 对话框显示状态
dialogVisible: false,
// 选中的学生信息
selectedStudent: null,
// 学生历史评估记录
studentHistoryList: [],
// 原始数据(用于详情查看)
originalData: []
};
},
created() {
this.getList();
},
methods: {
/** 查询心理评估列表 */
getList() {
this.loading = true;
getPsychologicalRatings().then(response => {
// 处理数据按学生ID分组只保留最新的评估记录
this.originalData = response.data || [];
const studentMap = new Map();
this.originalData.forEach(item => {
const studentId = item.studentId;
if (!studentMap.has(studentId) ||
new Date(item.createdTime) > new Date(studentMap.get(studentId).createdTime)) {
studentMap.set(studentId, item);
}
});
this.psychologicalList = Array.from(studentMap.values());
this.loading = false;
}).catch(error => {
console.error('获取心理评估数据失败:', error);
this.loading = false;
this.$modal.msgError('获取数据失败');
});
},
/** 查看详情 */
viewDetails(row) {
// 查询学生基本信息
this.getStudentInfo(row.studentId);
// 获取该学生的所有历史记录
this.studentHistoryList = this.originalData
.filter(item => item.studentId === row.studentId)
.sort((a, b) => new Date(b.createdTime) - new Date(a.createdTime));
this.dialogVisible = true;
},
/** 查询学生基本信息 */
getStudentInfo(studentId) {
// 使用现有的学生查询API
const queryParams = {
pageNum: 1,
pageSize: 1,
stuNo: studentId
};
this.getList2(queryParams).then(response => {
if (response.rows && response.rows.length > 0) {
const student = response.rows[0];
this.selectedStudent = {
studentId: student.stuNo,
studentName: student.name,
className: student.srsMajors ? student.srsMajors.majorName : '未知班级',
counselor: student.cphName
};
} else {
this.selectedStudent = {
studentId: studentId,
studentName: '未找到',
className: '未找到',
counselor: '未找到'
};
}
}).catch(error => {
console.error('获取学生信息失败:', error);
this.selectedStudent = {
studentId: studentId,
studentName: '查询失败',
className: '查询失败',
counselor: '查询失败'
};
});
},
/** 查询学生列表 */
getList2(queryParams) {
this.loading = true;
return listStudent(queryParams).then(response => {
this.loading = false;
return response;
}).catch(error => {
this.loading = false;
throw error;
});
},
/** 获取评估等级标签类型 */
getRatingTagType(rating) {
if (!rating) return 'info';
const ratingStr = rating.toString().toLowerCase();
if (ratingStr.includes('高') || ratingStr.includes('严重') || ratingStr.includes('high')) {
return 'danger';
} else if (ratingStr.includes('中') || ratingStr.includes('medium')) {
return 'warning';
} else if (ratingStr.includes('低') || ratingStr.includes('轻') || ratingStr.includes('low')) {
return 'success';
}
return 'info';
}
}
};
</script>
<style scoped>
.app-container {
padding: 20px;
}
.mb8 {
margin-bottom: 8px;
}
.el-table .cell {
word-break: break-word;
}
/* 对话框样式 */
.rating-dialog .el-dialog__body {
padding: 0;
}
.dialog-header {
background: #f8f9fa;
padding: 16px 20px;
border-bottom: 1px solid #e9ecef;
margin-bottom: 0;
}
.student-info {
font-size: 16px;
font-weight: 500;
color: #303133;
}
.rating-content {
padding: 20px;
min-height: 200px;
}
.no-rating {
text-align: center;
padding: 40px 0;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,8 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope">
<el-button v-if="scope.row.auditStatus == '6'" size="mini" type="text" icon="el-icon-close"
@click="processRClick(scope.row)">撤销</el-button>
<el-button size="mini" type="text" icon="el-icon-folder" @click="processVClick(scope.row)">查看详情</el-button>
<!-- <el-button v-if="scope.row.auditStatus == '6'" size="mini" type="text" icon="el-icon-circle-close"
@click="cancelVClick(scope.row)">取消加/扣分</el-button> -->
@@ -131,9 +133,9 @@
</div>
</template>
<script>
import { myProcessed, getAuditDetails, delAuditDetails, addAuditDetails, updateAuditDetails, listOwnProcessed, cancelProcess } from "@/api/stuCQS/process-center/auditDetails";
import { myProcessed, getAuditDetails, delAuditDetails, addAuditDetails, updateAuditDetails, listOwnProcessed, cancelProcess, cancelAudit } from "@/api/stuCQS/process-center/auditDetails";
import { isEmpty } from "@/api/helpFunc";
import lodash from "lodash";
@@ -176,8 +178,8 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
stuName:"",
stuNo:""
stuName: "",
stuNo: ""
},
// 表单参数
form: {},
@@ -231,6 +233,22 @@ export default {
this.processForm = val;
this.processV = true;
},
//撤销
async processRClick(row) {
this.$confirm('您确定要撤销吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const id = row.id;
cancelAudit(id).then(res => {
if (res.code == 200) {
this.getList();
}
});
});
},
/** 查询审核明细列表 */
getList() {
this.loading = true;
@@ -331,5 +349,4 @@ export default {
}
}
};
</script>
</script>