fix: report
This commit is contained in:
1 parent
07e83132c0
commit
4445ff68d4
46 files changed
+3845
-838
No files matched your search
@@ -22,21 +22,11 @@ def dashboard_summary():
|
|||||||
return jsonify(dashboard_service.compute_dashboard_summary())
|
return jsonify(dashboard_service.compute_dashboard_summary())
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/dashboard/badges', methods=['GET'])
|
|
||||||
@require_admin
|
|
||||||
def dashboard_badges():
|
|
||||||
"""
|
|
||||||
管理后台侧栏待办角标(供 AdminLayout 轻量轮询/缓存刷新)。
|
|
||||||
GET /api/admin/dashboard/badges
|
|
||||||
"""
|
|
||||||
return jsonify(dashboard_service.compute_dashboard_badges())
|
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/dashboard', methods=['GET'])
|
@admin_bp.route('/dashboard', methods=['GET'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def dashboard_stats():
|
def dashboard_stats():
|
||||||
"""
|
"""
|
||||||
仪表盘统计(遗留接口;新代码请用 /dashboard/summary 与 /dashboard/badges)。
|
仪表盘统计(遗留接口;新代码请用 /dashboard/summary)。
|
||||||
GET /api/admin/dashboard
|
GET /api/admin/dashboard
|
||||||
"""
|
"""
|
||||||
return jsonify(dashboard_service.compute_legacy_dashboard_stats())
|
return jsonify(dashboard_service.compute_legacy_dashboard_stats())
|
||||||
@@ -28,6 +28,13 @@ def create_department():
|
|||||||
return jsonify(payload), 201
|
return jsonify(payload), 201
|
||||||
|
|
||||||
|
|
||||||
|
@admin_bp.route('/departments/<int:id>/members', methods=['GET'])
|
||||||
|
@require_admin
|
||||||
|
def list_department_members(id: int):
|
||||||
|
"""返回部门员工数量与名单。"""
|
||||||
|
return jsonify(department_service.list_department_members(id))
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/departments/<int:id>', methods=['PUT'])
|
@admin_bp.route('/departments/<int:id>', methods=['PUT'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def update_department(id: int):
|
def update_department(id: int):
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
"""
|
"""
|
||||||
backend/app/api/admin/permissions.py
|
backend/app/api/admin/permissions.py
|
||||||
|
|
||||||
用途:管理后台权限批量更新与权限申请审批 API(薄路由层)。
|
用途:管理后台应用权限批量更新 API(薄路由层)。
|
||||||
依赖:admin.blueprint、services/admin/permission_service。
|
依赖:admin.blueprint、services/admin/permission_service。
|
||||||
逻辑:/permissions/*、/permission-requests/*、/users/<id>/permissions 路由。
|
逻辑:/permissions/*、/users/<id>/permissions 路由。
|
||||||
"""
|
"""
|
||||||
from flask import jsonify, request
|
from flask import jsonify, request
|
||||||
|
|
||||||
@@ -28,22 +28,3 @@ def update_user_permissions(id: int):
|
|||||||
return jsonify(permission_service.update_user_permissions(id, data))
|
return jsonify(permission_service.update_user_permissions(id, data))
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/permission-requests', methods=['GET'])
|
|
||||||
@require_admin
|
|
||||||
def list_permission_requests():
|
|
||||||
"""列出全部权限申请。"""
|
|
||||||
return jsonify(permission_service.list_permission_requests())
|
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/permission-requests/<int:id>/approve', methods=['POST'])
|
|
||||||
@require_admin
|
|
||||||
def approve_request(id: int):
|
|
||||||
"""批准权限申请。"""
|
|
||||||
return jsonify(permission_service.approve_permission_request(id))
|
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/permission-requests/<int:id>/reject', methods=['POST'])
|
|
||||||
@require_admin
|
|
||||||
def reject_request(id: int):
|
|
||||||
"""拒绝权限申请。"""
|
|
||||||
return jsonify(permission_service.reject_permission_request(id))
|
|
||||||
@@ -67,6 +67,18 @@ def applications_report():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@admin_bp.route('/reports/overview', methods=['GET'])
|
||||||
|
@require_admin
|
||||||
|
def ops_overview_report():
|
||||||
|
"""
|
||||||
|
运营总览报表:对话量 / 活跃用户 / 活跃应用 / 好评率 / 趋势环比 / Top 与低使用应用 / 低评分回答 / 未处理反馈。
|
||||||
|
Query: range(7d/30d/90d/180d/365d)。
|
||||||
|
"""
|
||||||
|
return jsonify(
|
||||||
|
report_service.build_ops_overview_report(range_key=request.args.get('range'))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/reports/feedback', methods=['GET'])
|
@admin_bp.route('/reports/feedback', methods=['GET'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def feedback_report():
|
def feedback_report():
|
||||||
@@ -86,3 +98,31 @@ def list_general_feedbacks_report():
|
|||||||
def count_general_feedbacks_report():
|
def count_general_feedbacks_report():
|
||||||
"""通用反馈计数。"""
|
"""通用反馈计数。"""
|
||||||
return jsonify(report_service.count_general_feedbacks_report(_query_params()))
|
return jsonify(report_service.count_general_feedbacks_report(_query_params()))
|
||||||
|
|
||||||
|
|
||||||
|
@admin_bp.route('/reports/chat-log-tops', methods=['GET'])
|
||||||
|
@require_admin
|
||||||
|
def chat_log_tops():
|
||||||
|
"""聊天日志 Top 提问/回答内容(直接按 ChatLog 明细统计,复用 FAQ 问句归一化)。"""
|
||||||
|
return jsonify(report_service.build_chat_log_top_content(_query_params()))
|
||||||
|
|
||||||
|
|
||||||
|
@admin_bp.route('/reports/feedback-summary', methods=['GET'])
|
||||||
|
@require_admin
|
||||||
|
def feedback_summary():
|
||||||
|
"""用户反馈概览:待处理 / 本月已关闭 / 最多反馈应用(三张概览卡)。"""
|
||||||
|
return jsonify(report_service.build_feedback_summary(_query_params()))
|
||||||
|
|
||||||
|
|
||||||
|
@admin_bp.route('/reports/issue-analysis', methods=['GET'])
|
||||||
|
@require_admin
|
||||||
|
def issue_analysis():
|
||||||
|
"""问题分析:高频问题簇 KPI + 优先处理问题(复用聊天日志风险规则)。"""
|
||||||
|
return jsonify(report_service.build_issue_analysis_report(_query_params()))
|
||||||
|
|
||||||
|
|
||||||
|
@admin_bp.route('/reports/general-feedbacks/<int:feedback_id>/close', methods=['POST'])
|
||||||
|
@require_admin
|
||||||
|
def close_general_feedback(feedback_id: int):
|
||||||
|
"""将一条意见反馈标记为已关闭(status='closed')。"""
|
||||||
|
return jsonify(report_service.mark_general_feedback_closed(feedback_id))
|
||||||
@@ -20,7 +20,7 @@ def _query_params() -> dict[str, str]:
|
|||||||
@admin_bp.route('/users', methods=['GET'])
|
@admin_bp.route('/users', methods=['GET'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def list_users():
|
def list_users():
|
||||||
"""鍒楀嚭绠$悊绔敤鎴凤紙鏀寔鍒嗛〉涓庣瓫閫夛級銆?""
|
"""Admin user operation."""
|
||||||
result = user_service.list_users(_query_params())
|
result = user_service.list_users(_query_params())
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ def list_users():
|
|||||||
@admin_bp.route('/users', methods=['POST'])
|
@admin_bp.route('/users', methods=['POST'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def create_user():
|
def create_user():
|
||||||
"""鍒涘缓鐢ㄦ埛骞跺悓姝?Casdoor銆?""
|
"""Admin user operation."""
|
||||||
data = request.get_json() or {}
|
data = request.get_json() or {}
|
||||||
payload = user_service.create_user(data)
|
payload = user_service.create_user(data)
|
||||||
return jsonify(payload), 201
|
return jsonify(payload), 201
|
||||||
@@ -37,7 +37,7 @@ def create_user():
|
|||||||
@admin_bp.route('/users/<int:id>', methods=['PUT'])
|
@admin_bp.route('/users/<int:id>', methods=['PUT'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def update_user(id: int):
|
def update_user(id: int):
|
||||||
"""鏇存柊鐢ㄦ埛璧勬枡锛涙湁 password 鏃跺悓姝?Casdoor 鏀瑰瘑銆?""
|
"""Admin user operation."""
|
||||||
data = request.get_json() or {}
|
data = request.get_json() or {}
|
||||||
return jsonify(user_service.update_user(id, data))
|
return jsonify(user_service.update_user(id, data))
|
||||||
|
|
||||||
@@ -45,14 +45,14 @@ def update_user(id: int):
|
|||||||
@admin_bp.route('/users/cleanup-rejected', methods=['POST'])
|
@admin_bp.route('/users/cleanup-rejected', methods=['POST'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def cleanup_rejected_users():
|
def cleanup_rejected_users():
|
||||||
"""鎵归噺鍒犻櫎 status=rejected 鐨勭敤鎴枫€?""
|
"""Admin user operation."""
|
||||||
return jsonify(user_service.cleanup_rejected_users())
|
return jsonify(user_service.cleanup_rejected_users())
|
||||||
|
|
||||||
|
|
||||||
@admin_bp.route('/users/batch-delete', methods=['POST'])
|
@admin_bp.route('/users/batch-delete', methods=['POST'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def batch_delete_users():
|
def batch_delete_users():
|
||||||
"""鎵归噺鍒犻櫎鐢ㄦ埛锛堟帓闄ゅ綋鍓嶇櫥褰曠鐞嗗憳锛夈€?""
|
"""Admin user operation."""
|
||||||
data = request.get_json() or {}
|
data = request.get_json() or {}
|
||||||
current_user = _get_auth_user()
|
current_user = _get_auth_user()
|
||||||
current_user_id = current_user.id if current_user else None
|
current_user_id = current_user.id if current_user else None
|
||||||
@@ -62,9 +62,7 @@ def batch_delete_users():
|
|||||||
@admin_bp.route('/users/<int:id>', methods=['DELETE'])
|
@admin_bp.route('/users/<int:id>', methods=['DELETE'])
|
||||||
@require_admin
|
@require_admin
|
||||||
def delete_user(id: int):
|
def delete_user(id: int):
|
||||||
"""鍒犻櫎鍗曚釜鐢ㄦ埛銆?""
|
"""Admin user operation."""
|
||||||
current_user = _get_auth_user()
|
current_user = _get_auth_user()
|
||||||
current_user_id = current_user.id if current_user else None
|
current_user_id = current_user.id if current_user else None
|
||||||
return jsonify(user_service.delete_user(id, current_user_id=current_user_id))
|
return jsonify(user_service.delete_user(id, current_user_id=current_user_id))
|
||||||
|
|
||||||
␍`n
|
|
||||||
@@ -130,4 +130,8 @@ class GeneralFeedback(Base):
|
|||||||
feedback_module: Mapped[str] = mapped_column(String(32), nullable=False)
|
feedback_module: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||||
content: Mapped[str] = mapped_column(Text, nullable=False)
|
content: Mapped[str] = mapped_column(Text, nullable=False)
|
||||||
source_page: Mapped[Optional[str]] = mapped_column(String(32))
|
source_page: Mapped[Optional[str]] = mapped_column(String(32))
|
||||||
|
# 处理状态:pending=待处理,closed=已关闭(数据分析卡片用;默认待处理)
|
||||||
|
status: Mapped[str] = mapped_column(String(20), default='pending', nullable=False, index=True)
|
||||||
|
# 关闭时间:记录何时被处理/关闭,用于「本月已关闭」统计
|
||||||
|
closed_at: Mapped[Optional[datetime]] = mapped_column(DateTime, nullable=True)
|
||||||
created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow, index=True)
|
created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow, index=True)
|
||||||
@@ -15,7 +15,13 @@ import requests
|
|||||||
from app import db
|
from app import db
|
||||||
from app.core.config.settings import Config
|
from app.core.config.settings import Config
|
||||||
from app.core.errors import NotFoundError, ValidationError
|
from app.core.errors import NotFoundError, ValidationError
|
||||||
from app.models import Agent, User
|
from app.models import (
|
||||||
|
Agent, AgentDirectoryMember, ChatLog, ChatSession, ChatToolRun,
|
||||||
|
ContractReview, FaqHotCandidate, Feedback, GeneralFeedback,
|
||||||
|
PermissionRequest, QuickQuestion, ScheduleTask, User,
|
||||||
|
UserDefaultAgent, UserFavoriteAgent, user_agent_permissions,
|
||||||
|
)
|
||||||
|
from sqlalchemy import delete, select, update
|
||||||
from app.services.agent_directory import normalize_directory_member_ids, replace_directory_members
|
from app.services.agent_directory import normalize_directory_member_ids, replace_directory_members
|
||||||
from app.services.admin.training_exam_pdf_service import parse_training_question_bank_from_guide
|
from app.services.admin.training_exam_pdf_service import parse_training_question_bank_from_guide
|
||||||
from app.services.agent_registry.admin_payload import apply_agent_payload, validate_agent_payload
|
from app.services.agent_registry.admin_payload import apply_agent_payload, validate_agent_payload
|
||||||
@@ -112,11 +118,40 @@ def update_agent(agent_id: int, data: dict[str, Any]) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def delete_agent(agent_id: int) -> None:
|
def delete_agent(agent_id: int) -> None:
|
||||||
"""删除 Agent(不存在时静默成功)。"""
|
"""
|
||||||
|
删除 Agent 及其数据库引用,避免 chat_logs 外键导致管理端删除失败。
|
||||||
|
|
||||||
|
[STEP 1] 清理权限、目录、收藏、默认入口及业务直接引用。
|
||||||
|
[STEP 2] 先清理 chat_log 子表,再删除会话日志。
|
||||||
|
[STEP 3] 最后删除 Agent,整段操作使用当前事务保证原子性。
|
||||||
|
"""
|
||||||
agent = db.session.get(Agent, agent_id)
|
agent = db.session.get(Agent, agent_id)
|
||||||
if agent:
|
if not agent:
|
||||||
db.session.delete(agent)
|
return
|
||||||
db.session.commit()
|
chat_log_ids = select(ChatLog.id).where(ChatLog.agent_id == agent_id)
|
||||||
|
db.session.execute(delete(user_agent_permissions).where(user_agent_permissions.c.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(AgentDirectoryMember).where(
|
||||||
|
(AgentDirectoryMember.directory_agent_id == agent_id)
|
||||||
|
| (AgentDirectoryMember.member_agent_id == agent_id)
|
||||||
|
))
|
||||||
|
db.session.execute(delete(UserFavoriteAgent).where(UserFavoriteAgent.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(UserDefaultAgent).where(UserDefaultAgent.agent_id == agent_id))
|
||||||
|
db.session.execute(update(User).where(User.default_agent_id == agent_id).values(default_agent_id=None))
|
||||||
|
db.session.execute(update(ScheduleTask).where(ScheduleTask.dify_agent_id == agent_id).values(dify_agent_id=None))
|
||||||
|
db.session.execute(delete(PermissionRequest).where(PermissionRequest.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(ContractReview).where(ContractReview.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(QuickQuestion).where(QuickQuestion.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(FaqHotCandidate).where(FaqHotCandidate.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(ChatSession).where(ChatSession.agent_id == agent_id))
|
||||||
|
db.session.execute(delete(ChatToolRun).where(
|
||||||
|
(ChatToolRun.agent_id == agent_id) | ChatToolRun.chat_log_id.in_(chat_log_ids)
|
||||||
|
))
|
||||||
|
db.session.execute(delete(Feedback).where(Feedback.chat_log_id.in_(chat_log_ids)))
|
||||||
|
db.session.execute(delete(GeneralFeedback).where(GeneralFeedback.chat_log_id.in_(chat_log_ids)))
|
||||||
|
db.session.execute(delete(ContractReview).where(ContractReview.chat_log_id.in_(chat_log_ids)))
|
||||||
|
db.session.execute(delete(ChatLog).where(ChatLog.agent_id == agent_id))
|
||||||
|
db.session.delete(agent)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
def test_agent_connectivity(agent_id: int) -> dict[str, Any]:
|
def test_agent_connectivity(agent_id: int) -> dict[str, Any]:
|
||||||
@@ -170,68 +205,65 @@ def _test_iframe_agent(agent: Agent, tested_at: str) -> dict[str, Any]:
|
|||||||
|
|
||||||
|
|
||||||
def _test_dify_agent(agent: Agent, tested_at: str) -> dict[str, Any]:
|
def _test_dify_agent(agent: Agent, tested_at: str) -> dict[str, Any]:
|
||||||
|
"""
|
||||||
|
Test Dify endpoint reachability without executing the configured application flow.
|
||||||
|
|
||||||
|
The test calls Dify's read-only ``/v1/parameters`` endpoint so a business
|
||||||
|
Chatflow/Workflow never receives synthetic text such as ``OK`` that could be
|
||||||
|
passed into a database or other external tool.
|
||||||
|
"""
|
||||||
if not agent.dify_api_key:
|
if not agent.dify_api_key:
|
||||||
return {
|
return {
|
||||||
'passed': False,
|
'passed': False,
|
||||||
'request_url': '',
|
'request_url': '',
|
||||||
'output_info': 'Missing dify_api_key.',
|
'output_info': 'Missing dify_api_key.',
|
||||||
'analysis': '测试失败:未配置 API Key。',
|
'analysis': '\u6d4b\u8bd5\u5931\u8d25\uff1a\u672a\u914d\u7f6e API Key\u3002',
|
||||||
'http_status': 0,
|
'http_status': 0,
|
||||||
'tested_at': tested_at,
|
'tested_at': tested_at,
|
||||||
}
|
}
|
||||||
|
|
||||||
base_url = (agent.api_base_url or Config.DIFY_API_BASE or '').rstrip('/')
|
base_url = (agent.api_base_url or Config.DIFY_API_BASE or '').rstrip('/')
|
||||||
if not base_url:
|
if not base_url:
|
||||||
return {
|
return {
|
||||||
'passed': False,
|
'passed': False,
|
||||||
'request_url': '',
|
'request_url': '',
|
||||||
'output_info': 'Missing api_base_url.',
|
'output_info': 'Missing api_base_url.',
|
||||||
'analysis': '测试失败:未配置 API Base URL。',
|
'analysis': '\u6d4b\u8bd5\u5931\u8d25\uff1a\u672a\u914d\u7f6e API Base URL\u3002',
|
||||||
'http_status': 0,
|
'http_status': 0,
|
||||||
'tested_at': tested_at,
|
'tested_at': tested_at,
|
||||||
}
|
}
|
||||||
|
|
||||||
dify_app_type = str(agent.dify_app_type or 'chatflow').strip().lower()
|
dify_app_type = str(agent.dify_app_type or 'chatflow').strip().lower()
|
||||||
if dify_app_type not in ('chatflow', 'workflow'):
|
if dify_app_type not in ('chatflow', 'workflow'):
|
||||||
dify_app_type = 'chatflow'
|
dify_app_type = 'chatflow'
|
||||||
if dify_app_type == 'workflow':
|
|
||||||
request_url = DifyService._build_workflow_url(base_url)
|
# [STEP 1] Read-only endpoint: never run a business Chatflow/Workflow in an admin connectivity test.
|
||||||
payload = {
|
request_url = DifyService._build_parameters_url(base_url)
|
||||||
'inputs': {'query': '系统连通性测试,请简短回复OK。'},
|
headers = {'Authorization': f'Bearer {agent.dify_api_key}'}
|
||||||
'response_mode': 'blocking',
|
|
||||||
'user': 'admin_test',
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
request_url = DifyService._build_chat_messages_url(base_url)
|
|
||||||
payload = {
|
|
||||||
'inputs': {},
|
|
||||||
'query': '系统连通性测试,请简短回复OK。',
|
|
||||||
'response_mode': 'blocking',
|
|
||||||
'user': 'admin_test',
|
|
||||||
}
|
|
||||||
headers = {'Authorization': f'Bearer {agent.dify_api_key}', 'Content-Type': 'application/json'}
|
|
||||||
try:
|
try:
|
||||||
resp = requests.post(request_url, headers=headers, json=payload, timeout=(5, 25))
|
response = requests.get(request_url, headers=headers, timeout=(5, 15))
|
||||||
raw_text = (resp.text or '')[:4000]
|
raw_text = (response.text or '')[:4000]
|
||||||
output_info = raw_text
|
output_info = raw_text
|
||||||
passed = False
|
if response.ok:
|
||||||
analysis = f'测试失败:HTTP {resp.status_code}。'
|
|
||||||
if dify_app_type == 'workflow' and 200 <= resp.status_code < 300:
|
|
||||||
passed = True
|
passed = True
|
||||||
analysis = '测试通过:Workflow 接口可访问且认证通过。'
|
analysis = '\u6d4b\u8bd5\u901a\u8fc7\uff1aDify \u53c2\u6570\u63a5\u53e3\u53ef\u8bbf\u95ee\u4e14 API Key \u8ba4\u8bc1\u901a\u8fc7\u3002'
|
||||||
try:
|
try:
|
||||||
data = resp.json()
|
body = response.json()
|
||||||
if dify_app_type == 'workflow':
|
if isinstance(body, dict):
|
||||||
passed, output_info, analysis = _parse_workflow_test_response(resp, data, output_info, analysis)
|
output_info = str(body)[:4000]
|
||||||
else:
|
except ValueError:
|
||||||
passed, output_info, analysis = _parse_chatflow_test_response(resp, data, output_info, analysis, passed)
|
pass
|
||||||
except ValueError:
|
else:
|
||||||
if resp.ok and raw_text.strip():
|
passed = False
|
||||||
passed = True
|
analysis = f'\u6d4b\u8bd5\u5931\u8d25\uff1aHTTP {response.status_code}\u3002'
|
||||||
analysis = (
|
try:
|
||||||
'测试通过:Workflow 接口可访问并返回了文本内容。'
|
body = response.json()
|
||||||
if dify_app_type == 'workflow'
|
if isinstance(body, dict) and body.get('message'):
|
||||||
else '测试通过:Chatflow 接口可访问并返回了文本内容。'
|
output_info = str(body['message'])[:4000]
|
||||||
)
|
except ValueError:
|
||||||
if passed and (not agent.is_active):
|
pass
|
||||||
|
|
||||||
|
if passed and not agent.is_active:
|
||||||
agent.is_active = True
|
agent.is_active = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return {
|
return {
|
||||||
@@ -240,7 +272,7 @@ def _test_dify_agent(agent: Agent, tested_at: str) -> dict[str, Any]:
|
|||||||
'request_url': request_url,
|
'request_url': request_url,
|
||||||
'output_info': output_info,
|
'output_info': output_info,
|
||||||
'analysis': analysis,
|
'analysis': analysis,
|
||||||
'http_status': resp.status_code,
|
'http_status': response.status_code,
|
||||||
'tested_at': tested_at,
|
'tested_at': tested_at,
|
||||||
}
|
}
|
||||||
except requests.RequestException as exc:
|
except requests.RequestException as exc:
|
||||||
@@ -249,12 +281,11 @@ def _test_dify_agent(agent: Agent, tested_at: str) -> dict[str, Any]:
|
|||||||
'dify_app_type': dify_app_type,
|
'dify_app_type': dify_app_type,
|
||||||
'request_url': request_url,
|
'request_url': request_url,
|
||||||
'output_info': str(exc),
|
'output_info': str(exc),
|
||||||
'analysis': '测试失败:请求异常(网络、超时或认证问题)。',
|
'analysis': '\u6d4b\u8bd5\u5931\u8d25\uff1a\u8bf7\u6c42\u5f02\u5e38\uff08\u7f51\u7edc\u3001\u8d85\u65f6\u6216\u8ba4\u8bc1\u95ee\u9898\uff09\u3002',
|
||||||
'http_status': 0,
|
'http_status': 0,
|
||||||
'tested_at': tested_at,
|
'tested_at': tested_at,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _parse_workflow_test_response(resp, data, output_info: str, analysis: str) -> tuple[bool, str, str]:
|
def _parse_workflow_test_response(resp, data, output_info: str, analysis: str) -> tuple[bool, str, str]:
|
||||||
passed = 200 <= resp.status_code < 300
|
passed = 200 <= resp.status_code < 300
|
||||||
workflow_data = data.get('data') if isinstance(data, dict) else None
|
workflow_data = data.get('data') if isinstance(data, dict) else None
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from __future__ import annotations
|
|||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.models import Agent, ChatLog, Feedback, PermissionRequest, User
|
from app.models import Agent, ChatLog, Feedback, User
|
||||||
|
|
||||||
|
|
||||||
def compute_dashboard_summary() -> dict:
|
def compute_dashboard_summary() -> dict:
|
||||||
@@ -32,26 +32,12 @@ def compute_dashboard_summary() -> dict:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def compute_dashboard_badges() -> dict:
|
|
||||||
"""
|
|
||||||
聚合侧栏角标所需的待办数量。
|
|
||||||
Returns:
|
|
||||||
pending_approvals、pending_requests。
|
|
||||||
"""
|
|
||||||
pending_requests = db.session.query(func.count(PermissionRequest.id)).filter_by(status='pending').scalar() or 0
|
|
||||||
return {
|
|
||||||
'pending_requests': pending_requests,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def compute_legacy_dashboard_stats() -> dict:
|
def compute_legacy_dashboard_stats() -> dict:
|
||||||
"""遗留 /dashboard 接口响应(summary + badges 字段名兼容早期前端)。"""
|
"""遗留 /dashboard 接口响应(summary + badges 字段名兼容早期前端)。"""
|
||||||
summary = compute_dashboard_summary()
|
summary = compute_dashboard_summary()
|
||||||
badges = compute_dashboard_badges()
|
|
||||||
return {
|
return {
|
||||||
'total_users': summary['user_count'],
|
'total_users': summary['user_count'],
|
||||||
'active_agents': summary['agent_count'],
|
'active_agents': summary['agent_count'],
|
||||||
'total_conversations': summary['total_conversations'],
|
'total_conversations': summary['total_conversations'],
|
||||||
'avg_score': summary['avg_score'],
|
'avg_score': summary['avg_score'],
|
||||||
'pending_requests': badges['pending_requests'],
|
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,6 @@ from app.models import (
|
|||||||
ChatLog,
|
ChatLog,
|
||||||
Department,
|
Department,
|
||||||
Feedback,
|
Feedback,
|
||||||
PermissionRequest,
|
|
||||||
QuickQuestion,
|
QuickQuestion,
|
||||||
User,
|
User,
|
||||||
UserDefaultAgent,
|
UserDefaultAgent,
|
||||||
@@ -33,7 +32,6 @@ ADMIN_TABLE_MODEL_MAP = {
|
|||||||
'agents': Agent,
|
'agents': Agent,
|
||||||
'chat_logs': ChatLog,
|
'chat_logs': ChatLog,
|
||||||
'feedbacks': Feedback,
|
'feedbacks': Feedback,
|
||||||
'permission_requests': PermissionRequest,
|
|
||||||
'departments': Department,
|
'departments': Department,
|
||||||
'quick_questions': QuickQuestion,
|
'quick_questions': QuickQuestion,
|
||||||
'user_homepage_configs': UserHomepageConfig,
|
'user_homepage_configs': UserHomepageConfig,
|
||||||
@@ -52,6 +50,35 @@ def _serialize_model_row(item) -> dict:
|
|||||||
return row
|
return row
|
||||||
|
|
||||||
|
|
||||||
|
def _apply_generic_table_filters(query, model, query_params: dict[str, str]):
|
||||||
|
"""通用表筛选:created_at 时间范围(created_from/created_to)+ 各列 ILIKE/等值过滤。"""
|
||||||
|
reserved = {'created_from', 'created_to'}
|
||||||
|
# 时间范围(支持有 created_at 列的通用表,如 feedbacks 回答评价)
|
||||||
|
created_from = (query_params.get('created_from') or '').strip()
|
||||||
|
created_to = (query_params.get('created_to') or '').strip()
|
||||||
|
if created_from and hasattr(model, 'created_at'):
|
||||||
|
dt = report_service._parse_datetime(created_from, end_of_day=False)
|
||||||
|
if dt:
|
||||||
|
query = query.filter(model.created_at >= dt)
|
||||||
|
if created_to and hasattr(model, 'created_at'):
|
||||||
|
dt = report_service._parse_datetime(created_to, end_of_day=True)
|
||||||
|
if dt:
|
||||||
|
query = query.filter(model.created_at <= dt)
|
||||||
|
|
||||||
|
for key, value in query_params.items():
|
||||||
|
if key in reserved or not value:
|
||||||
|
continue
|
||||||
|
if hasattr(model, key):
|
||||||
|
col = getattr(model, key)
|
||||||
|
col_type = getattr(col, 'type', None)
|
||||||
|
# 整型外键(如 agent_id)用等值过滤,避免 ILIKE '%16%' 误匹配 160
|
||||||
|
if value.isdigit() and col_type is not None and getattr(col_type, 'python_type', None) is int:
|
||||||
|
query = query.filter(col == int(value))
|
||||||
|
else:
|
||||||
|
query = query.filter(col.cast(db.String).ilike(f'%{value}%'))
|
||||||
|
return query
|
||||||
|
|
||||||
|
|
||||||
def get_table_data(table: str, query_params: dict[str, str]) -> list[dict]:
|
def get_table_data(table: str, query_params: dict[str, str]) -> list[dict]:
|
||||||
"""
|
"""
|
||||||
返回管理报表表数据(最多 100 行)。
|
返回管理报表表数据(最多 100 行)。
|
||||||
@@ -62,28 +89,20 @@ def get_table_data(table: str, query_params: dict[str, str]) -> list[dict]:
|
|||||||
model = ADMIN_TABLE_MODEL_MAP.get(table)
|
model = ADMIN_TABLE_MODEL_MAP.get(table)
|
||||||
if not model:
|
if not model:
|
||||||
raise ValidationError('Invalid table')
|
raise ValidationError('Invalid table')
|
||||||
query = db.session.query(model)
|
query = _apply_generic_table_filters(db.session.query(model), model, query_params)
|
||||||
for key, value in query_params.items():
|
|
||||||
if hasattr(model, key) and value:
|
|
||||||
col = getattr(model, key)
|
|
||||||
col_type = getattr(col, 'type', None)
|
|
||||||
# 整型外键(如 agent_id)用等值过滤,避免 ILIKE '%16%' 误匹配 160
|
|
||||||
if value.isdigit() and col_type is not None and getattr(col_type, 'python_type', None) is int:
|
|
||||||
query = query.filter(col == int(value))
|
|
||||||
else:
|
|
||||||
query = query.filter(col.cast(db.String).ilike(f'%{value}%'))
|
|
||||||
items = query.limit(100).all()
|
items = query.limit(100).all()
|
||||||
return [_serialize_model_row(item) for item in items]
|
return [_serialize_model_row(item) for item in items]
|
||||||
|
|
||||||
|
|
||||||
def get_table_count(table: str, query_params: dict[str, str]) -> dict:
|
def get_table_count(table: str, query_params: dict[str, str]) -> dict:
|
||||||
"""返回表行数;chat_logs 使用报表筛选。"""
|
"""返回表行数(应用当前筛选);chat_logs 使用报表筛选。"""
|
||||||
if table == 'chat_logs':
|
if table == 'chat_logs':
|
||||||
return report_service.count_chat_logs_report(query_params)
|
return report_service.count_chat_logs_report(query_params)
|
||||||
model = ADMIN_TABLE_MODEL_MAP.get(table)
|
model = ADMIN_TABLE_MODEL_MAP.get(table)
|
||||||
if not model:
|
if not model:
|
||||||
raise ValidationError('Invalid table')
|
raise ValidationError('Invalid table')
|
||||||
total = db.session.query(func.count(model.id)).scalar()
|
query = _apply_generic_table_filters(db.session.query(model), model, query_params)
|
||||||
|
total = query.count()
|
||||||
return {'table': table, 'total': int(total or 0)}
|
return {'table': table, 'total': int(total or 0)}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from sqlalchemy import func
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.core.errors import NotFoundError, ValidationError
|
from app.core.errors import NotFoundError, ValidationError
|
||||||
from app.models import Department
|
from app.models import Department, User
|
||||||
|
|
||||||
|
|
||||||
def serialize_department(dept: Department) -> dict:
|
def serialize_department(dept: Department) -> dict:
|
||||||
@@ -27,8 +29,43 @@ def serialize_department(dept: Department) -> dict:
|
|||||||
|
|
||||||
def list_departments() -> list[dict]:
|
def list_departments() -> list[dict]:
|
||||||
"""返回全部部门(按 name 升序)。"""
|
"""返回全部部门(按 name 升序)。"""
|
||||||
depts = db.session.query(Department).order_by(Department.name.asc()).all()
|
rows = (
|
||||||
return [serialize_department(d) for d in depts]
|
db.session.query(Department, func.count(User.id).label('member_count'))
|
||||||
|
.outerjoin(User, User.department == Department.name)
|
||||||
|
.group_by(Department.id)
|
||||||
|
.order_by(Department.name.asc())
|
||||||
|
.all()
|
||||||
|
)
|
||||||
|
return [{**serialize_department(dept), 'member_count': int(member_count or 0)} for dept, member_count in rows]
|
||||||
|
|
||||||
|
|
||||||
|
def list_department_members(dept_id: int) -> dict:
|
||||||
|
"""
|
||||||
|
查询指定部门的员工名单。
|
||||||
|
|
||||||
|
[STEP 1] 通过部门主键读取部门名称。
|
||||||
|
[STEP 2] 复用现有 users.department 文本关联查询成员。
|
||||||
|
[STEP 3] 返回人数与脱敏后的管理端成员资料。
|
||||||
|
"""
|
||||||
|
dept = db.session.get(Department, dept_id)
|
||||||
|
if not dept:
|
||||||
|
raise NotFoundError('Not found')
|
||||||
|
users = db.session.query(User).filter(User.department == dept.name).order_by(User.real_name.asc(), User.username.asc()).all()
|
||||||
|
return {
|
||||||
|
'department': serialize_department(dept),
|
||||||
|
'count': len(users),
|
||||||
|
'members': [
|
||||||
|
{
|
||||||
|
'id': user.id,
|
||||||
|
'username': user.username,
|
||||||
|
'real_name': user.real_name,
|
||||||
|
'employee_id': user.employee_id,
|
||||||
|
'email': user.email,
|
||||||
|
'status': user.status,
|
||||||
|
}
|
||||||
|
for user in users
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def create_department(data: dict[str, Any]) -> dict:
|
def create_department(data: dict[str, Any]) -> dict:
|
||||||
|
|||||||
@@ -7,29 +7,16 @@ backend/app/services/admin/permission_service.py
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from app import db
|
from app import db
|
||||||
from app.core.errors import NotFoundError, ValidationError
|
from app.core.errors import NotFoundError, ValidationError
|
||||||
from app.models import Agent, PermissionRequest, User
|
from app.models import Agent, User
|
||||||
from app.services.wecom_notify import send_wecom_event_message
|
from app.services.wecom_notify import send_wecom_event_message
|
||||||
|
|
||||||
_BATCH_ACTION_LABELS = {'add': '新增', 'remove': '移除', 'set': '重置为'}
|
_BATCH_ACTION_LABELS = {'add': '新增', 'remove': '移除', 'set': '重置为'}
|
||||||
|
|
||||||
|
|
||||||
def serialize_permission_request(req: PermissionRequest) -> dict:
|
|
||||||
"""PermissionRequest ORM → 管理端列表 JSON。"""
|
|
||||||
return {
|
|
||||||
'id': req.id,
|
|
||||||
'user_id': req.user_id,
|
|
||||||
'agent_id': req.agent_id,
|
|
||||||
'reason': req.reason,
|
|
||||||
'status': req.status,
|
|
||||||
'created_at': req.created_at.isoformat(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _load_users_and_agents(user_ids: list[Any], agent_ids: list[Any]) -> tuple[list[User], list[Agent]]:
|
def _load_users_and_agents(user_ids: list[Any], agent_ids: list[Any]) -> tuple[list[User], list[Agent]]:
|
||||||
users = db.session.query(User).filter(User.id.in_(user_ids)).all()
|
users = db.session.query(User).filter(User.id.in_(user_ids)).all()
|
||||||
agents = db.session.query(Agent).filter(Agent.id.in_(agent_ids)).all()
|
agents = db.session.query(Agent).filter(Agent.id.in_(agent_ids)).all()
|
||||||
@@ -110,65 +97,3 @@ def update_user_permissions(user_id: int, data: dict[str, Any]) -> dict:
|
|||||||
return {'status': 'ok'}
|
return {'status': 'ok'}
|
||||||
|
|
||||||
|
|
||||||
def list_permission_requests() -> list[dict]:
|
|
||||||
"""返回全部权限申请(按 created_at 降序)。"""
|
|
||||||
reqs = (
|
|
||||||
db.session.query(PermissionRequest)
|
|
||||||
.order_by(PermissionRequest.created_at.desc())
|
|
||||||
.all()
|
|
||||||
)
|
|
||||||
return [serialize_permission_request(r) for r in reqs]
|
|
||||||
|
|
||||||
|
|
||||||
def approve_permission_request(request_id: int) -> dict:
|
|
||||||
"""
|
|
||||||
批准权限申请:更新状态并将 Agent 加入用户权限。
|
|
||||||
Raises:
|
|
||||||
NotFoundError: 申请不存在。
|
|
||||||
"""
|
|
||||||
req = db.session.get(PermissionRequest, request_id)
|
|
||||||
if not req:
|
|
||||||
raise NotFoundError('Not found')
|
|
||||||
|
|
||||||
req.status = 'approved'
|
|
||||||
req.reviewed_at = datetime.utcnow()
|
|
||||||
user = db.session.get(User, req.user_id)
|
|
||||||
agent = db.session.get(Agent, req.agent_id)
|
|
||||||
if user and agent and (agent not in user.agents):
|
|
||||||
user.agents.append(agent)
|
|
||||||
if user and user.wecom_userid:
|
|
||||||
send_wecom_event_message(
|
|
||||||
event_type='permission_request_approved',
|
|
||||||
user=user,
|
|
||||||
title='权限申请已通过',
|
|
||||||
content=f'你申请的应用权限已通过:{(agent.name if agent else req.agent_id)}',
|
|
||||||
jump_path='/workspace',
|
|
||||||
)
|
|
||||||
db.session.commit()
|
|
||||||
return {'status': 'ok'}
|
|
||||||
|
|
||||||
|
|
||||||
def reject_permission_request(request_id: int) -> dict:
|
|
||||||
"""
|
|
||||||
拒绝权限申请并通知用户(若已绑定企微)。
|
|
||||||
Raises:
|
|
||||||
NotFoundError: 申请不存在。
|
|
||||||
"""
|
|
||||||
req = db.session.get(PermissionRequest, request_id)
|
|
||||||
if not req:
|
|
||||||
raise NotFoundError('Not found')
|
|
||||||
|
|
||||||
req.status = 'rejected'
|
|
||||||
req.reviewed_at = datetime.utcnow()
|
|
||||||
user = db.session.get(User, req.user_id)
|
|
||||||
agent = db.session.get(Agent, req.agent_id)
|
|
||||||
if user and user.wecom_userid:
|
|
||||||
send_wecom_event_message(
|
|
||||||
event_type='permission_request_rejected',
|
|
||||||
user=user,
|
|
||||||
title='权限申请未通过',
|
|
||||||
content=f'你申请的应用权限未通过:{(agent.name if agent else req.agent_id)}',
|
|
||||||
jump_path='/workspace',
|
|
||||||
)
|
|
||||||
db.session.commit()
|
|
||||||
return {'status': 'ok'}
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,40 @@
|
|||||||
|
"""
|
||||||
|
backend/migrations/versions/0f1e2d3c4b5a_add_general_feedback_status.py
|
||||||
|
|
||||||
|
用途:给 general_feedbacks 增加处理状态字段,支撑「用户反馈与回答评价」的三张概览卡
|
||||||
|
(待处理 / 本月已关闭 / 最多反馈应用)。
|
||||||
|
依赖:Alembic revision a0b1c2d3e4f5(当前唯一 head)。
|
||||||
|
逻辑:新增 status(默认 pending)与 closed_at(可空)两列;仅 DDL,不回填历史数据。
|
||||||
|
|
||||||
|
Revision ID: 0f1e2d3c4b5a
|
||||||
|
Revises: a0b1c2d3e4f5
|
||||||
|
Create Date: 2026-08-28 09:00:00.000000
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
revision = "0f1e2d3c4b5a"
|
||||||
|
down_revision = "a0b1c2d3e4f5"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column(
|
||||||
|
'general_feedbacks',
|
||||||
|
sa.Column('status', sa.String(20), nullable=False, server_default='pending'),
|
||||||
|
)
|
||||||
|
op.create_index('ix_general_feedbacks_status', 'general_feedbacks', ['status'])
|
||||||
|
op.add_column(
|
||||||
|
'general_feedbacks',
|
||||||
|
sa.Column('closed_at', sa.DateTime(), nullable=True),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_column('general_feedbacks', 'closed_at')
|
||||||
|
op.drop_index('ix_general_feedbacks_status', table_name='general_feedbacks')
|
||||||
|
op.drop_column('general_feedbacks', 'status')
|
||||||
+6
-2
@@ -502,8 +502,12 @@
|
|||||||
|
|
||||||
| 功能项 | 说明 | 状态 | 优先级 |
|
| 功能项 | 说明 | 状态 | 优先级 |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| 管理端使用分析 | 管理控制台「数据报表」首项由原始用户表替换为「使用分析」,展示对话总量、活跃用户/应用、按日趋势、应用/用户排行、低使用应用与异常高峰提醒,并保留聊天明细追溯与导出 | 已实现 | P1 |
|
| 管理端使用分析 | 管理控制台「数据报表」首项为「使用分析」,展示对话总量、活跃用户/应用、人员/部门排行、应用排行、按日趋势、时段热力图、低使用应用与异常高峰提醒;严格不展示聊天原文 | 已实现 | P1 |
|
||||||
| 管理端应用运营报表 | 「数据报表 > 应用」由 agents 配置表替换为应用运营看板:按应用聚合对话/用户/最近活跃/授权/均分,支持时间范围与状态筛选、Excel 导出,并可下钻聊天日志 | 已实现 | P1 |
|
| 管理端应用运营报表 | 「数据报表 > 应用」为应用运营看板:按应用聚合调用次数/用户数/最近活跃/授权人数/评分,支持时间范围与状态筛选、Excel 导出;识别「已授权未使用」应用,可由应用行下钻对应聊天日志筛选结果 | 已实现 | P1 |
|
||||||
|
| 管理端用户反馈与回答评价 | 「数据报表」将原「意见反馈、回答评价」两个入口合并为「用户反馈与回答评价」,页内以「意见反馈 / 回答评价」两个 Tab 切换数据源,意见反馈 Tab 展示实时计数角标 | 已实现 | P1 |
|
||||||
|
| 管理端运营总览 | 「数据报表」新增「运营总览」入口:展示对话量/活跃用户/活跃应用/好评率、对话趋势与环比、Top 应用与低使用应用、低评分回答与未处理反馈,复用 chat_logs/feedbacks/general_feedbacks/agents/应用授权数据 | 已实现(数据处理) | P1 |
|
||||||
|
| 管理端问题分析 | 「数据报表」新增「问题分析」入口,第一版为页面骨架与空状态,不伪造数据 | 已实现(骨架) | P2 |
|
||||||
|
| 管理端时间范围统一 | 「数据报表」各数据页时间范围筛选器统一为「近 7 天 / 30 天 / 90 天」,并同步四语言文案 | 已实现 | P1 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ const AnnouncementsPage = () =>
|
|||||||
const QuestionsPage = () =>
|
const QuestionsPage = () =>
|
||||||
import("@/features/admin/modules/questions/QuestionsPage.vue");
|
import("@/features/admin/modules/questions/QuestionsPage.vue");
|
||||||
|
|
||||||
const RequestsPage = () =>
|
|
||||||
import("@/features/admin/modules/requests/RequestsPage.vue");
|
|
||||||
|
|
||||||
const PermissionsPage = () =>
|
const PermissionsPage = () =>
|
||||||
import("@/features/admin/modules/permissions/PermissionsPage.vue");
|
import("@/features/admin/modules/permissions/PermissionsPage.vue");
|
||||||
const PlatformAppsPage = () =>
|
const PlatformAppsPage = () =>
|
||||||
@@ -171,16 +168,6 @@ export const adminRoutes: RouteRecordRaw[] = [
|
|||||||
title: "admin.nav.linkedServices",
|
title: "admin.nav.linkedServices",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "requests",
|
|
||||||
name: "AdminRequests",
|
|
||||||
component: RequestsPage,
|
|
||||||
meta: {
|
|
||||||
requiresAdmin: true,
|
|
||||||
adminModule: "requests",
|
|
||||||
title: "admin.nav.requests",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "permissions",
|
path: "permissions",
|
||||||
name: "AdminPermissions",
|
name: "AdminPermissions",
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export const config = {
|
|||||||
linked_services: true, // 鍏宠仈鏈嶅姟锛堜晶鏍忚烦杞叆鍙o級
|
linked_services: true, // 鍏宠仈鏈嶅姟锛堜晶鏍忚烦杞叆鍙o級
|
||||||
permissions: true, // 搴旂敤鏉冮檺
|
permissions: true, // 搴旂敤鏉冮檺
|
||||||
platform_apps: true, // 骞冲彴搴旂敤璇存槑
|
platform_apps: true, // 骞冲彴搴旂敤璇存槑
|
||||||
requests: true, // 瀹℃壒鏉冮檺
|
requests: false, // 权限审批功能已移除
|
||||||
reports: true, // 鏁版嵁鎶ヨ〃
|
reports: true, // 鏁版嵁鎶ヨ〃
|
||||||
schedules: true, // 瀹氭椂浠诲姟
|
schedules: true, // 瀹氭椂浠诲姟
|
||||||
procurement_contract: true, // 閲囪喘鍚堝悓瀹℃煡锛堟ā鏉垮簱 + 鍘嗗彶锛?
|
procurement_contract: true, // 閲囪喘鍚堝悓瀹℃煡锛堟ā鏉垮簱 + 鍘嗗彶锛?
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||||
import { requestJson } from '@/shared/api/client';
|
import { requestJson } from '@/shared/api/client';
|
||||||
import type { AdminUserRow } from '../types/admin.types';
|
import type { AdminUserRow } from '../types/admin.types';
|
||||||
import type { AdminDashboardBadges, AdminDashboardSummary } from '../types/dashboard.types';
|
import type { AdminDashboardSummary } from '../types/dashboard.types';
|
||||||
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
||||||
import type { AdminLinkedServiceRow } from '../types/linked-service.types';
|
import type { AdminLinkedServiceRow } from '../types/linked-service.types';
|
||||||
import type {
|
import type {
|
||||||
@@ -13,6 +13,7 @@ import type {
|
|||||||
ApplicationSortKey,
|
ApplicationSortKey,
|
||||||
ApplicationStatusFilter,
|
ApplicationStatusFilter,
|
||||||
ApplicationUsageFilter,
|
ApplicationUsageFilter,
|
||||||
|
OpsOverviewReport,
|
||||||
UsageReport,
|
UsageReport,
|
||||||
UsageRangeKey,
|
UsageRangeKey,
|
||||||
} from '../types/report.types';
|
} from '../types/report.types';
|
||||||
@@ -100,6 +101,8 @@ export const updateAdminUserPermissions = (userId: number, agentIds: number[]) =
|
|||||||
|
|
||||||
// Departments
|
// Departments
|
||||||
export const listAdminDepartments = () => requestJson<any[]>('/api/admin/departments', auth());
|
export const listAdminDepartments = () => requestJson<any[]>('/api/admin/departments', auth());
|
||||||
|
export const listAdminDepartmentMembers = (id: number) =>
|
||||||
|
requestJson(`/api/admin/departments/${id}/members`, auth());
|
||||||
export const createAdminDepartment = (payload: Record<string, unknown>) =>
|
export const createAdminDepartment = (payload: Record<string, unknown>) =>
|
||||||
requestJson('/api/admin/departments', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
requestJson('/api/admin/departments', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||||
export const updateAdminDepartment = (id: number, payload: Record<string, unknown>) =>
|
export const updateAdminDepartment = (id: number, payload: Record<string, unknown>) =>
|
||||||
@@ -243,13 +246,6 @@ export const saveAdminAgentPermissions = (agentId: number, userIds: number[]) =>
|
|||||||
body: JSON.stringify({ user_ids: userIds }),
|
body: JSON.stringify({ user_ids: userIds }),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Permission requests
|
|
||||||
export const listAdminPermissionRequests = () =>
|
|
||||||
requestJson<any[]>('/api/admin/permission-requests', auth());
|
|
||||||
export const approveAdminPermissionRequest = (id: number) =>
|
|
||||||
requestJson(`/api/admin/permission-requests/${id}/approve`, { method: 'POST', ...auth() });
|
|
||||||
export const rejectAdminPermissionRequest = (id: number) =>
|
|
||||||
requestJson(`/api/admin/permission-requests/${id}/reject`, { method: 'POST', ...auth() });
|
|
||||||
export const batchUpdateAdminPermissions = (payload: Record<string, unknown>) =>
|
export const batchUpdateAdminPermissions = (payload: Record<string, unknown>) =>
|
||||||
requestJson('/api/admin/permissions/batch', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
requestJson('/api/admin/permissions/batch', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||||
export const importAdminPermissions = (formData: FormData) =>
|
export const importAdminPermissions = (formData: FormData) =>
|
||||||
@@ -260,10 +256,6 @@ export const importAdminPermissions = (formData: FormData) =>
|
|||||||
export const getAdminDashboardSummary = () =>
|
export const getAdminDashboardSummary = () =>
|
||||||
requestJson<AdminDashboardSummary>('/api/admin/dashboard/summary', auth());
|
requestJson<AdminDashboardSummary>('/api/admin/dashboard/summary', auth());
|
||||||
|
|
||||||
/** 侧栏角标:待审批用户数、待处理权限申请数 */
|
|
||||||
export const getAdminDashboardBadges = () =>
|
|
||||||
requestJson<AdminDashboardBadges>('/api/admin/dashboard/badges', auth());
|
|
||||||
|
|
||||||
// Reports
|
// Reports
|
||||||
export interface AdminUsageReportParams {
|
export interface AdminUsageReportParams {
|
||||||
user_page?: number;
|
user_page?: number;
|
||||||
@@ -317,8 +309,62 @@ export const getAdminApplicationReport = (params: AdminApplicationReportParams =
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAdminFeedbackReport = () => requestJson<any>('/api/admin/reports/feedback', auth());
|
export const getAdminFeedbackReport = () => requestJson<any>('/api/admin/reports/feedback', auth());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取运营总览报表:对话量 / 活跃用户 / 活跃应用 / 好评率 / 趋势环比 / Top 与低使用应用 / 低评分回答 / 未处理反馈。
|
||||||
|
* @param params - 时间范围(近 7/30/90 天)
|
||||||
|
*/
|
||||||
|
export const getAdminOpsOverview = (params: { range?: UsageRangeKey } = {}) => {
|
||||||
|
const qs = new URLSearchParams();
|
||||||
|
if (params.range) qs.set('range', params.range);
|
||||||
|
const query = qs.toString();
|
||||||
|
return requestJson<OpsOverviewReport>(
|
||||||
|
`/api/admin/reports/overview${query ? `?${query}` : ''}`,
|
||||||
|
auth(),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const getAdminReportTable = (url: string) => requestJson<any[]>(url, auth());
|
export const getAdminReportTable = (url: string) => requestJson<any[]>(url, auth());
|
||||||
export const getAdminReportTableCount = (url: string) => requestJson<{ total: number }>(url, auth());
|
export const getAdminReportTableCount = (url: string) => requestJson<{ total: number }>(url, auth());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取聊天日志「Top 提问内容 / Top 回答内容」(直接按 ChatLog 明细统计)。
|
||||||
|
* @param query - 可选的查询串(时间范围/应用/用户等识别条件)
|
||||||
|
*/
|
||||||
|
export const getAdminChatLogTops = (query = '') =>
|
||||||
|
requestJson<{ questions: Array<{ label: string; count: number }>; answers: Array<{ label: string; count: number }> }>(
|
||||||
|
`/api/admin/reports/chat-log-tops${query}`,
|
||||||
|
auth(),
|
||||||
|
);
|
||||||
|
|
||||||
|
/** 反馈概览:待处理 / 本月已关闭 / 最多反馈应用 */
|
||||||
|
export const getAdminFeedbackSummary = (query = '') =>
|
||||||
|
requestJson<{ pending_count: number; closed_this_month: number; top_app: { name: string; count: number } }>(
|
||||||
|
`/api/admin/reports/feedback-summary${query}`,
|
||||||
|
auth(),
|
||||||
|
);
|
||||||
|
|
||||||
|
/** 问题分析:高频问题簇 KPI + 优先处理问题(复用聊天日志风险规则) */
|
||||||
|
export const getAdminIssueAnalysis = (query = '') =>
|
||||||
|
requestJson<{
|
||||||
|
kpi: {
|
||||||
|
high_freq_clusters: number;
|
||||||
|
attention_signals: number;
|
||||||
|
review_signals: number;
|
||||||
|
empty_answers: number;
|
||||||
|
top10_ratio: number;
|
||||||
|
top_risk_app: { name: string; signal_count: number; attention_ratio: number };
|
||||||
|
};
|
||||||
|
total_questions: number;
|
||||||
|
questions: Array<{ topic: string; count: number; apps: string; attention_count: number; reasons: string[]; checks: string[] }>;
|
||||||
|
}>(`/api/admin/reports/issue-analysis${query}`, auth());
|
||||||
|
|
||||||
|
/** 将一条意见反馈标记为已关闭 */
|
||||||
|
export const closeAdminGeneralFeedback = (feedbackId: number) =>
|
||||||
|
requestJson<{ id: number; status: string; closed_at: string }>(
|
||||||
|
`/api/admin/reports/general-feedbacks/${feedbackId}/close`,
|
||||||
|
{ method: 'POST', ...auth() },
|
||||||
|
);
|
||||||
export const batchDeleteAdminChatLogs = (ids: number[]) =>
|
export const batchDeleteAdminChatLogs = (ids: number[]) =>
|
||||||
requestJson<{ deleted_count: number }>('/api/admin/database/chat_logs/batch-delete', {
|
requestJson<{ deleted_count: number }>('/api/admin/database/chat_logs/batch-delete', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { computed, watch } from 'vue';
|
|||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { LayoutDashboard, UserCog, Building, Bot, FileText,
|
import { LayoutDashboard, UserCog, Building, Bot, FileText,
|
||||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow,
|
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, BarChart2, AppWindow,
|
||||||
ScrollText, ExternalLink,
|
ScrollText, ExternalLink,
|
||||||
} from 'lucide-vue-next';
|
} from 'lucide-vue-next';
|
||||||
import type { Component } from 'vue';
|
import type { Component } from 'vue';
|
||||||
@@ -37,7 +37,6 @@ const iconMap: Record<AdminModuleId, Component> = {
|
|||||||
permissions: Users,
|
permissions: Users,
|
||||||
platform_apps: AppWindow,
|
platform_apps: AppWindow,
|
||||||
procurement_contract: ScrollText,
|
procurement_contract: ScrollText,
|
||||||
requests: ShieldCheck,
|
|
||||||
reports: BarChart2,
|
reports: BarChart2,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -121,12 +120,6 @@ watch(
|
|||||||
:class="isModuleActive(item.id) ? 'text-brand-600' : 'text-muted group-hover:text-secondary'"
|
:class="isModuleActive(item.id) ? 'text-brand-600' : 'text-muted group-hover:text-secondary'"
|
||||||
/>
|
/>
|
||||||
<span :class="navStore.sidebarCollapsed ? 'md:hidden' : ''">{{ t(item.labelKey) }}</span>
|
<span :class="navStore.sidebarCollapsed ? 'md:hidden' : ''">{{ t(item.labelKey) }}</span>
|
||||||
<span
|
|
||||||
v-if="navStore.badgeForModule(item.id) && !navStore.sidebarCollapsed"
|
|
||||||
class="ml-auto bg-red-500 text-white text-[10px] font-bold px-2 py-0.5 rounded-full shadow-sm"
|
|
||||||
>
|
|
||||||
{{ navStore.badgeForModule(item.id) }}
|
|
||||||
</span>
|
|
||||||
<div
|
<div
|
||||||
v-if="isModuleActive(item.id)"
|
v-if="isModuleActive(item.id)"
|
||||||
class="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 bg-brand-600 rounded-r-full"
|
class="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 bg-brand-600 rounded-r-full"
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
* features/admin/composables/useAdminNavBadges.ts
|
* features/admin/composables/useAdminNavBadges.ts
|
||||||
* 暴露角标刷新入口;拉取与缓存放 admin-nav.store(不在此 composable 内 onMounted,避免子页面重复请求)。
|
* 暴露角标刷新入口;拉取与缓存放 admin-nav.store(不在此 composable 内 onMounted,避免子页面重复请求)。
|
||||||
*/
|
*/
|
||||||
import { useAdminNavStore } from '../stores/admin-nav.store';
|
|
||||||
|
|
||||||
export function useAdminNavBadges() {
|
export function useAdminNavBadges() {
|
||||||
const navStore = useAdminNavStore();
|
return { refreshBadges: async (): Promise<void> => undefined };
|
||||||
return {
|
|
||||||
refreshBadges: () => navStore.refreshBadges(),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* features/admin/constants/modules.ts
|
* features/admin/constants/modules.ts
|
||||||
* 绠$悊鍚庡彴妯″潡鍏冩暟鎹紝AdminNav 涓庡瓙璺敱鍏辩敤銆?
|
* 绠$悊鍚庡彴妯″潡鍏冩暟鎹紝AdminNav 涓庡瓙璺敱鍏辩敤銆?
|
||||||
*/
|
*/
|
||||||
@@ -15,7 +15,7 @@ export interface AdminModuleMeta {
|
|||||||
|
|
||||||
/** 宸茬嫭绔嬫媶鍒嗙殑妯″潡锛堝叏閮?admin 妯″潡鍧囧凡鎷嗗垎锛?*/
|
/** 宸茬嫭绔嬫媶鍒嗙殑妯″潡锛堝叏閮?admin 妯″潡鍧囧凡鎷嗗垎锛?*/
|
||||||
export const STANDALONE_ADMIN_MODULES = new Set<AdminModuleId>([
|
export const STANDALONE_ADMIN_MODULES = new Set<AdminModuleId>([
|
||||||
'dashboard', 'agents', 'users', 'departments', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'procurement_contract', 'reports',
|
'dashboard', 'agents', 'users', 'departments', 'announcements', 'questions', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'procurement_contract', 'reports',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||||
@@ -32,16 +32,22 @@ export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
|||||||
{ id: 'permissions', routeName: 'AdminPermissions', path: 'permissions', labelKey: 'admin.nav.permissions', configKey: 'permissions' },
|
{ id: 'permissions', routeName: 'AdminPermissions', path: 'permissions', labelKey: 'admin.nav.permissions', configKey: 'permissions' },
|
||||||
{ id: 'platform_apps', routeName: 'AdminPlatformApps', path: 'platform-apps', labelKey: 'admin.nav.platformApps', configKey: 'platform_apps' },
|
{ id: 'platform_apps', routeName: 'AdminPlatformApps', path: 'platform-apps', labelKey: 'admin.nav.platformApps', configKey: 'platform_apps' },
|
||||||
{ id: 'procurement_contract', routeName: 'AdminProcurementContract', path: 'procurement-contract', labelKey: 'admin.nav.procurementContract', configKey: 'procurement_contract' },
|
{ id: 'procurement_contract', routeName: 'AdminProcurementContract', path: 'procurement-contract', labelKey: 'admin.nav.procurementContract', configKey: 'procurement_contract' },
|
||||||
{ id: 'requests', routeName: 'AdminRequests', path: 'requests', labelKey: 'admin.nav.requests', configKey: 'requests' },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据报表导航子项:
|
||||||
|
* - 保留:使用分析、聊天日志、应用运营
|
||||||
|
* - 合并:意见反馈(general_feedbacks) + 回答评价(feedbacks) → 用户反馈与回答评价(feedbacks)
|
||||||
|
* - 新增:运营总览(ops_overview)、问题分析(issue_analysis) 第一版为骨架/空状态
|
||||||
|
* - 说明:general_feedbacks 仅作为「用户反馈与回答评价」页内 Tab 的数据源,不再作为独立导航项。
|
||||||
|
*/
|
||||||
export const ADMIN_REPORT_TABLES: AdminReportTableId[] = [
|
export const ADMIN_REPORT_TABLES: AdminReportTableId[] = [
|
||||||
|
'ops_overview',
|
||||||
'usage_analysis',
|
'usage_analysis',
|
||||||
'chat_logs',
|
'chat_logs',
|
||||||
'agents',
|
'agents',
|
||||||
'permission_requests',
|
|
||||||
'general_feedbacks',
|
|
||||||
'feedbacks',
|
'feedbacks',
|
||||||
|
'issue_analysis',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const LEGACY_MODULE_QUERY_TO_PATH: Record<string, string> = {};
|
export const LEGACY_MODULE_QUERY_TO_PATH: Record<string, string> = {};
|
||||||
|
|||||||
@@ -8,10 +8,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Bot, Plus, SquarePen, Trash2, Users } from 'lucide-vue-next';
|
import { Bot, Plus, SquarePen, Trash2 } from 'lucide-vue-next';
|
||||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||||
import AgentFormModal from './components/AgentFormModal.vue';
|
import AgentFormModal from './components/AgentFormModal.vue';
|
||||||
import AgentPermissionModal from './components/AgentPermissionModal.vue';
|
|
||||||
import AgentTestModal from './components/AgentTestModal.vue';
|
import AgentTestModal from './components/AgentTestModal.vue';
|
||||||
import { useAgentsAdmin } from './composables/useAgentsAdmin';
|
import { useAgentsAdmin } from './composables/useAgentsAdmin';
|
||||||
import { useAgentsTableColumnResize } from './composables/useAgentsTableColumnResize';
|
import { useAgentsTableColumnResize } from './composables/useAgentsTableColumnResize';
|
||||||
@@ -29,7 +28,6 @@ const {
|
|||||||
contentProfileOptions,
|
contentProfileOptions,
|
||||||
scheduleTasks,
|
scheduleTasks,
|
||||||
trainingExamPdfGuides,
|
trainingExamPdfGuides,
|
||||||
activeUsers,
|
|
||||||
isLoading,
|
isLoading,
|
||||||
isSaving,
|
isSaving,
|
||||||
isImportingTrainingPdf,
|
isImportingTrainingPdf,
|
||||||
@@ -40,9 +38,6 @@ const {
|
|||||||
isTesting,
|
isTesting,
|
||||||
testingAgent,
|
testingAgent,
|
||||||
testResult,
|
testResult,
|
||||||
showPermissionModal,
|
|
||||||
permissionAgent,
|
|
||||||
permissionUserIds,
|
|
||||||
showDeleteConfirmDialog,
|
showDeleteConfirmDialog,
|
||||||
deleteConfirmMessage,
|
deleteConfirmMessage,
|
||||||
loadAll,
|
loadAll,
|
||||||
@@ -59,9 +54,6 @@ const {
|
|||||||
deleteAgent,
|
deleteAgent,
|
||||||
openTestModal,
|
openTestModal,
|
||||||
runAgentTest,
|
runAgentTest,
|
||||||
openPermissionModal,
|
|
||||||
togglePermissionUser,
|
|
||||||
savePermissions,
|
|
||||||
closeDeleteConfirm,
|
closeDeleteConfirm,
|
||||||
confirmDelete,
|
confirmDelete,
|
||||||
} = useAgentsAdmin();
|
} = useAgentsAdmin();
|
||||||
@@ -75,13 +67,11 @@ const {
|
|||||||
|
|
||||||
const tableHeaderColumns = computed(() => [
|
const tableHeaderColumns = computed(() => [
|
||||||
{ key: 'name', label: t('admin.agent.headers.name'), align: 'left' as const },
|
{ key: 'name', label: t('admin.agent.headers.name'), align: 'left' as const },
|
||||||
{ key: 'type', label: t('admin.agent.headers.type'), align: 'left' as const },
|
|
||||||
{ key: 'aggregation', label: t('admin.agent.headers.aggregation'), align: 'left' as const },
|
|
||||||
{ key: 'config', label: t('admin.agent.headers.config'), align: 'left' as const },
|
|
||||||
{ key: 'status', label: t('admin.agent.headers.status'), align: 'left' as const },
|
{ key: 'status', label: t('admin.agent.headers.status'), align: 'left' as const },
|
||||||
{ key: 'actions', label: t('admin.agent.headers.actions'), align: 'right' as const },
|
{ key: 'actions', label: t('admin.agent.headers.actions'), align: 'right' as const },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/* 列表仅展示名称、状态和操作;类型/聚合/配置仍由编辑弹窗维护。 */
|
||||||
const formatAgentCode = (agent: AgentRow) => agent.agent_code || 'generic';
|
const formatAgentCode = (agent: AgentRow) => agent.agent_code || 'generic';
|
||||||
|
|
||||||
const formatAgentAggregationPrimary = (agent: AgentRow) => (
|
const formatAgentAggregationPrimary = (agent: AgentRow) => (
|
||||||
@@ -131,6 +121,8 @@ const formatRuntimeProviderLabel = (agent: AgentRow) => {
|
|||||||
const translated = t(key);
|
const translated = t(key);
|
||||||
return translated === key ? provider : translated;
|
return translated === key ? provider : translated;
|
||||||
};
|
};
|
||||||
|
void [formatAgentAggregationPrimary, formatAgentAggregationSecondary, formatAgentConfigPrimary,
|
||||||
|
formatAgentConfigSecondary, formatAgentTypeLabel, formatRuntimeProviderLabel];
|
||||||
|
|
||||||
const showFormDialog = ref(false);
|
const showFormDialog = ref(false);
|
||||||
|
|
||||||
@@ -241,43 +233,6 @@ onMounted(() => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-4 align-middle">
|
|
||||||
<div class="agent-list-cell">
|
|
||||||
<p class="truncate text-sm text-primary" :title="formatAgentTypeLabel(agent)">
|
|
||||||
{{ formatAgentTypeLabel(agent) }}
|
|
||||||
</p>
|
|
||||||
<p class="truncate text-xs text-muted" :title="formatRuntimeProviderLabel(agent)">
|
|
||||||
{{ formatRuntimeProviderLabel(agent) }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-4 align-middle">
|
|
||||||
<div class="agent-list-cell">
|
|
||||||
<p
|
|
||||||
class="truncate text-sm font-medium"
|
|
||||||
:class="agent.is_aggregate ? 'text-brand-700' : 'text-secondary'"
|
|
||||||
:title="formatAgentAggregationPrimary(agent)"
|
|
||||||
>
|
|
||||||
{{ formatAgentAggregationPrimary(agent) }}
|
|
||||||
</p>
|
|
||||||
<p class="truncate text-xs text-muted" :title="formatAgentAggregationSecondary(agent)">
|
|
||||||
{{ formatAgentAggregationSecondary(agent) }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-4 align-middle">
|
|
||||||
<div class="agent-list-cell">
|
|
||||||
<p
|
|
||||||
class="truncate font-mono text-sm text-primary"
|
|
||||||
:title="formatAgentConfigPrimary(agent)"
|
|
||||||
>
|
|
||||||
{{ formatAgentConfigPrimary(agent) }}
|
|
||||||
</p>
|
|
||||||
<p class="truncate text-xs text-muted">
|
|
||||||
{{ formatAgentConfigSecondary(agent) }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-4 align-middle">
|
<td class="px-4 py-4 align-middle">
|
||||||
<div class="agent-list-cell">
|
<div class="agent-list-cell">
|
||||||
<span
|
<span
|
||||||
@@ -300,14 +255,6 @@ onMounted(() => {
|
|||||||
<SquarePen class="w-4 h-4 shrink-0" />
|
<SquarePen class="w-4 h-4 shrink-0" />
|
||||||
{{ t('admin.edit') }}
|
{{ t('admin.edit') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="inline-flex shrink-0 items-center justify-center p-2 text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-lg transition-all"
|
|
||||||
:title="t('admin.agent.manageAccess')"
|
|
||||||
@click.stop="openPermissionModal(agent)"
|
|
||||||
>
|
|
||||||
<Users class="w-5 h-5 shrink-0" />
|
|
||||||
</button>
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="inline-flex shrink-0 items-center whitespace-nowrap p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all"
|
class="inline-flex shrink-0 items-center whitespace-nowrap p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all"
|
||||||
@@ -367,17 +314,6 @@ onMounted(() => {
|
|||||||
@import-training-pdf="importTrainingQuestionBankFromPdf"
|
@import-training-pdf="importTrainingQuestionBankFromPdf"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AgentPermissionModal
|
|
||||||
:visible="showPermissionModal"
|
|
||||||
:agent="permissionAgent"
|
|
||||||
:users="activeUsers()"
|
|
||||||
:selected-user-ids="permissionUserIds"
|
|
||||||
:is-saving="isSaving"
|
|
||||||
@close="showPermissionModal = false"
|
|
||||||
@save="savePermissions"
|
|
||||||
@toggle-user="togglePermissionUser"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DeleteConfirmDialog
|
<DeleteConfirmDialog
|
||||||
v-model="showDeleteConfirmDialog"
|
v-model="showDeleteConfirmDialog"
|
||||||
:message="deleteConfirmMessage"
|
:message="deleteConfirmMessage"
|
||||||
|
|||||||
+5
-3
@@ -8,12 +8,14 @@
|
|||||||
|
|
||||||
import { computed, onBeforeUnmount, ref } from 'vue';
|
import { computed, onBeforeUnmount, ref } from 'vue';
|
||||||
|
|
||||||
const STORAGE_KEY = 'hxops.admin.agents.tableColumnWidths';
|
// 列结构已移除权限操作,升级缓存键以废弃旧的拖拽宽度,避免旧值继续撑出横向滚动。
|
||||||
|
const STORAGE_KEY = 'hxops.admin.agents.tableColumnWidths.v4';
|
||||||
|
|
||||||
/** 名称 / 类型 / 分类 / 配置 / 状态 / 操作 */
|
/** 名称 / 类型 / 分类 / 配置 / 状态 / 操作 */
|
||||||
const DEFAULT_WIDTHS = [220, 168, 128, 140, 96, 220] as const;
|
// 列宽只根据字段和操作控件确定;描述始终在名称单元格内截断,不参与宽度计算。
|
||||||
|
const DEFAULT_WIDTHS = [400, 140, 240] as const;
|
||||||
|
|
||||||
const MIN_WIDTHS = [140, 120, 100, 120, 80, 200] as const;
|
const MIN_WIDTHS = [220, 110, 220] as const;
|
||||||
|
|
||||||
const COLUMN_COUNT = DEFAULT_WIDTHS.length;
|
const COLUMN_COUNT = DEFAULT_WIDTHS.length;
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,22 @@
|
|||||||
* 逻辑:路由 /admin/departments;表头排序复用 shared SortableTableHeader + useTableSort。
|
* 逻辑:路由 /admin/departments;表头排序复用 shared SortableTableHeader + useTableSort。
|
||||||
*/
|
*/
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Edit, Plus, Search, Trash2 } from 'lucide-vue-next';
|
import { Edit, Plus, Search, Trash2, Users } from 'lucide-vue-next';
|
||||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||||
import SortableTableHeader from '@/shared/components/SortableTableHeader.vue';
|
import SortableTableHeader from '@/shared/components/SortableTableHeader.vue';
|
||||||
import DepartmentFormModal from './components/DepartmentFormModal.vue';
|
import DepartmentFormModal from './components/DepartmentFormModal.vue';
|
||||||
|
import DepartmentMembersModal from './components/DepartmentMembersModal.vue';
|
||||||
import { useDepartmentsAdmin } from './composables/useDepartmentsAdmin';
|
import { useDepartmentsAdmin } from './composables/useDepartmentsAdmin';
|
||||||
|
import { listAdminDepartmentMembers } from '@/features/admin/api/admin.api';
|
||||||
|
import type { AdminDepartmentMembersResponse } from '@/features/admin/types/admin.types';
|
||||||
|
import { useMessage } from '@/shared/composables/useMessage';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const msg = useMessage();
|
||||||
|
const showMembersModal = ref(false);
|
||||||
|
const departmentMembers = ref<AdminDepartmentMembersResponse | null>(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
filteredDepartments,
|
filteredDepartments,
|
||||||
@@ -40,6 +47,16 @@ const {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
void loadAll();
|
void loadAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 加载并展示指定部门的员工名单。 */
|
||||||
|
const openDepartmentMembers = async (departmentId: number): Promise<void> => {
|
||||||
|
try {
|
||||||
|
departmentMembers.value = await listAdminDepartmentMembers(departmentId) as AdminDepartmentMembersResponse;
|
||||||
|
showMembersModal.value = true;
|
||||||
|
} catch (error) {
|
||||||
|
msg.error((error as Error).message || t('admin.msg.requestFailed'));
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -77,13 +94,14 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="admin-table-wrap">
|
<div class="admin-table-wrap">
|
||||||
<!-- 列宽:名称 / 编码 / 公司 / 操作 -->
|
<!-- 列宽:名称 / 编码 / 公司 / 员工 / 操作 -->
|
||||||
<table class="admin-table table-fixed">
|
<table class="admin-table table-fixed">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col class="w-[25%]" />
|
<col class="w-[25%]" />
|
||||||
<col class="w-[20%]" />
|
<col class="w-[20%]" />
|
||||||
<col class="w-[35%]" />
|
<col class="w-[30%]" />
|
||||||
<col class="w-[15%]" />
|
<col class="w-[12%]" />
|
||||||
|
<col class="w-[13%]" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -114,12 +132,13 @@ onMounted(() => {
|
|||||||
@sort="toggleSort"
|
@sort="toggleSort"
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="px-6 py-4 text-center text-xs">{{ t('admin.dept.headers.members') }}</th>
|
||||||
<th class="px-6 py-4 text-right text-xs">{{ t('admin.dept.headers.actions') }}</th>
|
<th class="px-6 py-4 text-right text-xs">{{ t('admin.dept.headers.actions') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-if="filteredDepartments.length === 0">
|
<tr v-if="filteredDepartments.length === 0">
|
||||||
<td colspan="4" class="px-6 admin-table-empty">
|
<td colspan="5" class="px-6 admin-table-empty">
|
||||||
{{ searchQuery.trim() ? t('admin.dept.noSearchResults') : t('admin.dept.noDepts') }}
|
{{ searchQuery.trim() ? t('admin.dept.noSearchResults') : t('admin.dept.noDepts') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -140,6 +159,14 @@ onMounted(() => {
|
|||||||
<td class="px-6 py-4 text-sm text-muted truncate" :title="d.company || '-'">
|
<td class="px-6 py-4 text-sm text-muted truncate" :title="d.company || '-'">
|
||||||
{{ d.company || '-' }}
|
{{ d.company || '-' }}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="px-6 py-4 text-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="inline-flex items-center justify-center rounded-lg bg-blue-50 p-2 text-blue-600 hover:bg-blue-100"
|
||||||
|
:title="t('admin.dept.actions.viewMembers')"
|
||||||
|
@click="openDepartmentMembers(d.id)"
|
||||||
|
><Users class="w-5 h-5" /><span class="ml-1 text-xs">{{ d.member_count || 0 }}</span></button>
|
||||||
|
</td>
|
||||||
<td class="px-6 py-4">
|
<td class="px-6 py-4">
|
||||||
<div class="flex justify-end gap-1">
|
<div class="flex justify-end gap-1">
|
||||||
<button
|
<button
|
||||||
@@ -173,6 +200,11 @@ onMounted(() => {
|
|||||||
@close="closeFormModal"
|
@close="closeFormModal"
|
||||||
@save="saveDepartment"
|
@save="saveDepartment"
|
||||||
/>
|
/>
|
||||||
|
<DepartmentMembersModal
|
||||||
|
:visible="showMembersModal"
|
||||||
|
:data="departmentMembers"
|
||||||
|
@close="showMembersModal = false"
|
||||||
|
/>
|
||||||
|
|
||||||
<DeleteConfirmDialog
|
<DeleteConfirmDialog
|
||||||
v-model="showDeleteConfirmDialog"
|
v-model="showDeleteConfirmDialog"
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* features/admin/modules/departments/components/DepartmentMembersModal.vue
|
||||||
|
* 用途:展示部门对应的员工数量和名单。
|
||||||
|
* 依赖:部门成员只读 API 响应与 Vue 事件。
|
||||||
|
* 逻辑:DepartmentsPage 点击员工图标后传入数据,本组件只负责呈现与关闭。
|
||||||
|
*/
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { Users, X } from 'lucide-vue-next';
|
||||||
|
import type { AdminDepartmentMembersResponse } from '@/features/admin/types/admin.types';
|
||||||
|
|
||||||
|
defineProps<{ visible: boolean; data: AdminDepartmentMembersResponse | null }>();
|
||||||
|
const emit = defineEmits<{ close: [] }>();
|
||||||
|
const { t } = useI18n();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="visible && data" class="admin-modal-overlay items-center" @click.self="emit('close')">
|
||||||
|
<section class="admin-modal-panel max-w-2xl max-h-[90vh] animate-fade-in-up">
|
||||||
|
<header class="px-8 py-6 border-b border-subtle flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<h3 class="text-lg font-bold text-primary">{{ t('admin.dept.members.title', { name: data.department.name }) }}</h3>
|
||||||
|
<p class="text-sm text-muted mt-1">{{ t('admin.dept.members.count', { count: data.count }) }}</p>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn-icon-ds rounded-full" :title="t('admin.close')" @click="emit('close')"><X class="w-5 h-5" /></button>
|
||||||
|
</header>
|
||||||
|
<div class="max-h-[60vh] overflow-y-auto p-6">
|
||||||
|
<div v-if="data.members.length === 0" class="py-12 text-center text-muted">
|
||||||
|
<Users class="w-9 h-9 mx-auto mb-3 opacity-60" />
|
||||||
|
{{ t('admin.dept.members.empty') }}
|
||||||
|
</div>
|
||||||
|
<ul v-else class="divide-y divide-subtle">
|
||||||
|
<li v-for="member in data.members" :key="member.id" class="py-3 flex items-center justify-between gap-4">
|
||||||
|
<div class="min-w-0">
|
||||||
|
<p class="font-medium text-primary">{{ member.real_name || member.username }}</p>
|
||||||
|
<p class="text-xs text-muted truncate">{{ member.employee_id || member.username }} · {{ member.email || '-' }}</p>
|
||||||
|
</div>
|
||||||
|
<span class="text-xs text-muted whitespace-nowrap">{{ member.status }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -5,17 +5,20 @@
|
|||||||
* 逻辑:路由 /admin/permissions;左侧用户相关列 sticky,右侧为各应用权限列。
|
* 逻辑:路由 /admin/permissions;左侧用户相关列 sticky,右侧为各应用权限列。
|
||||||
*/
|
*/
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Download, FileText, Users } from 'lucide-vue-next';
|
import { Download, FileText, Users } from 'lucide-vue-next';
|
||||||
import BatchPermissionModal from '@/features/admin/modules/users/components/BatchPermissionModal.vue';
|
import BatchPermissionModal from '@/features/admin/modules/users/components/BatchPermissionModal.vue';
|
||||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||||
|
import { getUserAvatarLabel } from '@/shared/utils/user-avatar';
|
||||||
import { usePermissionsAdmin } from './composables/usePermissionsAdmin';
|
import { usePermissionsAdmin } from './composables/usePermissionsAdmin';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
agents,
|
agents,
|
||||||
|
users,
|
||||||
|
appRows,
|
||||||
permissionFilters,
|
permissionFilters,
|
||||||
selectedUserIds,
|
selectedUserIds,
|
||||||
paginatedUsers,
|
paginatedUsers,
|
||||||
@@ -40,6 +43,45 @@ const { t } = useI18n();
|
|||||||
importPermissions,
|
importPermissions,
|
||||||
} = usePermissionsAdmin();
|
} = usePermissionsAdmin();
|
||||||
|
|
||||||
|
const permissionView = ref<'apps' | 'members'>('apps');
|
||||||
|
const selectedApp = ref<(typeof agents.value)[number] | null>(null);
|
||||||
|
const appMemberSearch = ref('');
|
||||||
|
const appMemberPage = ref(1);
|
||||||
|
const appMemberPageSize = ref(10);
|
||||||
|
const appMemberPageSizeOptions = [10, 20, 50, 100];
|
||||||
|
|
||||||
|
/** 应用成员弹窗:已授权人员优先展示,同时可搜索全部有效人员以便增删权限。 */
|
||||||
|
const appMembers = computed(() => {
|
||||||
|
const appId = selectedApp.value?.id;
|
||||||
|
const keyword = appMemberSearch.value.trim().toLowerCase();
|
||||||
|
if (!appId) return [];
|
||||||
|
return users.value
|
||||||
|
.filter((user) => user.status !== 'pending')
|
||||||
|
.filter((user) => !keyword || [user.username, user.real_name, user.department, user.employee_id]
|
||||||
|
.filter(Boolean)
|
||||||
|
.some((value) => String(value).toLowerCase().includes(keyword)))
|
||||||
|
.sort((a, b) => Number(b.agent_ids.includes(appId)) - Number(a.agent_ids.includes(appId)));
|
||||||
|
});
|
||||||
|
|
||||||
|
const appMemberTotalPages = computed(() => Math.max(1, Math.ceil(appMembers.value.length / appMemberPageSize.value)));
|
||||||
|
const paginatedAppMembers = computed(() => {
|
||||||
|
const page = Math.min(Math.max(1, appMemberPage.value), appMemberTotalPages.value);
|
||||||
|
const start = (page - 1) * appMemberPageSize.value;
|
||||||
|
return appMembers.value.slice(start, start + appMemberPageSize.value);
|
||||||
|
});
|
||||||
|
watch(appMemberSearch, () => { appMemberPage.value = 1; });
|
||||||
|
|
||||||
|
const openAppMembers = (app: (typeof agents.value)[number]): void => {
|
||||||
|
selectedApp.value = app;
|
||||||
|
appMemberSearch.value = '';
|
||||||
|
appMemberPage.value = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeAppMembers = (): void => {
|
||||||
|
selectedApp.value = null;
|
||||||
|
appMemberSearch.value = '';
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
void loadAll();
|
void loadAll();
|
||||||
});
|
});
|
||||||
@@ -85,7 +127,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="admin-table-filters--inline">
|
<div v-if="permissionView === 'members'" class="admin-table-filters--inline">
|
||||||
<input
|
<input
|
||||||
v-model="permissionFilters.username"
|
v-model="permissionFilters.username"
|
||||||
:placeholder="t('admin.perm.filterName')"
|
:placeholder="t('admin.perm.filterName')"
|
||||||
@@ -104,11 +146,37 @@ onMounted(() => {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="admin-table-section admin-table-wrap">
|
<div class="flex gap-6 border-b border-default">
|
||||||
<table class="admin-table">
|
<button type="button" class="border-b-2 px-1 py-3 text-sm font-medium transition-colors" :class="permissionView === 'apps' ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-primary'" @click="permissionView = 'apps'">
|
||||||
|
{{ t('admin.perm.views.apps') }}
|
||||||
|
</button>
|
||||||
|
<button type="button" class="border-b-2 px-1 py-3 text-sm font-medium transition-colors" :class="permissionView === 'members' ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-primary'" @click="permissionView = 'members'">
|
||||||
|
{{ t('admin.perm.views.members') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="permissionView === 'apps'" class="admin-table-section admin-table-wrap">
|
||||||
|
<table class="admin-table min-w-[680px]">
|
||||||
|
<thead><tr>
|
||||||
|
<th class="px-6 py-4 text-left text-sm">{{ t('admin.perm.appHeaders.app') }}</th>
|
||||||
|
<th class="px-4 py-4 text-center text-sm">{{ t('admin.perm.appHeaders.type') }}</th>
|
||||||
|
<th class="px-4 py-4 text-center text-sm">{{ t('admin.perm.appHeaders.authorized') }}</th>
|
||||||
|
<th class="px-6 py-4 text-right text-sm">{{ t('admin.perm.appHeaders.actions') }}</th>
|
||||||
|
</tr></thead>
|
||||||
|
<tbody><tr v-for="app in appRows" :key="app.id">
|
||||||
|
<td class="px-6 py-4"><div class="font-medium text-primary">{{ app.name }}</div><div class="mt-1 text-xs text-muted">{{ t('admin.perm.appHeaders.accessHint') }}</div></td>
|
||||||
|
<td class="px-4 py-4 text-center text-sm text-muted">{{ app.type || 'API' }}</td>
|
||||||
|
<td class="px-4 py-4 text-center text-sm font-medium text-primary">{{ app.authorizedCount }}</td>
|
||||||
|
<td class="px-6 py-4 text-right"><button type="button" class="text-sm font-medium text-brand-600 hover:text-brand-700" @click="openAppMembers(app)">{{ t('admin.perm.appHeaders.viewMembers') }}</button></td>
|
||||||
|
</tr></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="admin-table-section admin-table-wrap">
|
||||||
|
<table class="admin-table min-w-max">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="px-4 py-4 w-12 text-center sticky left-0 admin-table-sticky-head z-20">
|
<th class="w-[3rem] px-2 py-4 text-center sticky left-0 admin-table-sticky-head z-20">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="w-4 h-4 rounded text-brand-600 focus:ring-brand-500"
|
class="w-4 h-4 rounded text-brand-600 focus:ring-brand-500"
|
||||||
@@ -117,27 +185,17 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
class="px-6 py-4 text-left text-sm sticky left-12 admin-table-sticky-head z-20 w-56"
|
class="w-[18rem] min-w-[18rem] px-4 py-4 text-left text-sm sticky left-[3rem] admin-table-sticky-head z-20 border-r border-subtle shadow-[2px_0_5px_-2px_rgba(0,0,0,0.1)]"
|
||||||
>
|
>
|
||||||
{{ t('admin.perm.headers.user') }}
|
{{ t('admin.perm.headers.user') }}
|
||||||
</th>
|
</th>
|
||||||
<th
|
|
||||||
class="px-6 py-4 text-left text-sm sticky left-[17rem] admin-table-sticky-head z-20 w-36"
|
|
||||||
>
|
|
||||||
{{ t('admin.perm.headers.realName') }}
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
class="px-6 py-4 text-left text-sm sticky left-[26rem] admin-table-sticky-head z-20 w-40 border-r border-subtle shadow-[2px_0_5px_-2px_rgba(0,0,0,0.1)]"
|
|
||||||
>
|
|
||||||
{{ t('admin.perm.headers.dept') }}
|
|
||||||
</th>
|
|
||||||
<th
|
<th
|
||||||
v-for="agent in agents"
|
v-for="agent in agents"
|
||||||
:key="agent.id"
|
:key="agent.id"
|
||||||
class="px-4 py-4 text-center text-sm min-w-[100px]"
|
class="w-[7.5rem] min-w-[7.5rem] px-3 py-4 text-center text-sm"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col items-center gap-1">
|
<div class="flex min-h-14 flex-col items-center justify-center gap-1">
|
||||||
<span>{{ agent.name }}</span>
|
<span class="line-clamp-2 max-w-[6.5rem] break-words leading-tight" :title="agent.name">{{ agent.name }}</span>
|
||||||
<span class="text-[10px] text-muted font-normal border border-default px-1 rounded">
|
<span class="text-[10px] text-muted font-normal border border-default px-1 rounded">
|
||||||
{{ agent.type }}
|
{{ agent.type }}
|
||||||
</span>
|
</span>
|
||||||
@@ -147,7 +205,7 @@ onMounted(() => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="user in paginatedUsers" :key="user.id">
|
<tr v-for="user in paginatedUsers" :key="user.id">
|
||||||
<td class="px-4 py-4 text-center sticky left-0 admin-table-sticky-cell z-20">
|
<td class="w-[3rem] px-2 py-4 text-center sticky left-0 admin-table-sticky-cell z-20">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="w-4 h-4 rounded text-brand-600 focus:ring-brand-500"
|
class="w-4 h-4 rounded text-brand-600 focus:ring-brand-500"
|
||||||
@@ -155,34 +213,29 @@ onMounted(() => {
|
|||||||
@change="toggleUserSelection(user.id)"
|
@change="toggleUserSelection(user.id)"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 sticky left-12 admin-table-sticky-cell z-20">
|
<td class="w-[18rem] min-w-[18rem] px-4 py-3 sticky left-[3rem] admin-table-sticky-cell z-20 border-r border-subtle shadow-[2px_0_5px_-2px_rgba(0,0,0,0.05)]">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<div
|
<div
|
||||||
class="w-8 h-8 rounded-full bg-gradient-to-br from-brand-100 to-indigo-100 text-brand-600 flex items-center justify-center font-bold text-sm"
|
class="w-8 h-8 rounded-full bg-gradient-to-br from-brand-100 to-indigo-100 text-brand-600 flex items-center justify-center font-bold text-sm"
|
||||||
>
|
>
|
||||||
{{ user.username.charAt(0).toUpperCase() }}
|
{{ getUserAvatarLabel(user) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="font-medium text-primary text-sm truncate max-w-[120px]" :title="user.username">
|
<div class="min-w-0">
|
||||||
{{ user.username }}
|
<div class="truncate text-sm font-medium text-primary" :title="user.real_name || user.username">
|
||||||
|
{{ user.real_name || user.username }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 flex min-w-0 items-center gap-2 text-xs text-muted">
|
||||||
|
<span class="max-w-[7rem] truncate" :title="user.username">{{ user.username }}</span>
|
||||||
|
<span class="h-3 w-px shrink-0 bg-border" />
|
||||||
|
<span class="max-w-[8rem] truncate" :title="user.department || '-'">{{ user.department || '-' }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 sticky left-[17rem] admin-table-sticky-cell z-20">
|
|
||||||
<div class="text-sm text-primary truncate" :title="user.real_name || '-'">
|
|
||||||
{{ user.real_name || '-' }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
class="px-6 py-4 sticky left-[26rem] admin-table-sticky-cell z-20 border-r border-subtle shadow-[2px_0_5px_-2px_rgba(0,0,0,0.05)]"
|
|
||||||
>
|
|
||||||
<div class="text-sm text-muted truncate" :title="user.department">
|
|
||||||
{{ user.department || '-' }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td
|
<td
|
||||||
v-for="agent in agents"
|
v-for="agent in agents"
|
||||||
:key="agent.id"
|
:key="agent.id"
|
||||||
class="px-4 py-4 text-center border-l border-dashed border-subtle"
|
class="w-[7.5rem] min-w-[7.5rem] px-3 py-3 text-center border-l border-dashed border-subtle"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -215,5 +268,33 @@ onMounted(() => {
|
|||||||
@close="closeBatchPermissionModal"
|
@close="closeBatchPermissionModal"
|
||||||
@save="submitBatchPermission"
|
@save="submitBatchPermission"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div v-if="selectedApp" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/30 p-4" @click.self="closeAppMembers">
|
||||||
|
<section class="flex max-h-[min(720px,calc(100vh-2rem))] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-default bg-surface shadow-2xl">
|
||||||
|
<header class="flex items-start justify-between border-b border-default px-6 py-5"><div><h3 class="text-lg font-semibold text-primary">{{ selectedApp.name }}</h3><p class="mt-1 text-sm text-muted">{{ t('admin.perm.appHeaders.memberHint') }}</p></div><button type="button" class="text-sm text-muted hover:text-primary" @click="closeAppMembers">{{ t('admin.close') }}</button></header>
|
||||||
|
<div class="border-b border-subtle bg-surface-soft px-6 py-4"><input v-model="appMemberSearch" :placeholder="t('admin.perm.appHeaders.memberSearch')" class="admin-table-filter-input w-full" /></div>
|
||||||
|
<div class="min-h-0 flex-1 overflow-y-auto">
|
||||||
|
<div v-for="member in paginatedAppMembers" :key="member.id" class="flex items-center justify-between gap-4 border-b border-subtle px-6 py-3 last:border-b-0"><div class="flex min-w-0 items-center gap-3"><div class="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-brand-100 text-sm font-bold text-brand-600">{{ getUserAvatarLabel(member) }}</div><div class="min-w-0"><div class="truncate text-sm font-medium text-primary">{{ member.real_name || member.username }}</div><div class="truncate text-xs text-muted">{{ member.username }} · {{ member.department || '-' }}</div></div></div><button type="button" class="shrink-0 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors" :class="member.agent_ids.includes(selectedApp.id) ? 'text-red-600 hover:bg-red-50' : 'text-brand-600 hover:bg-brand-50'" @click="toggleUserAgentPermission(member, selectedApp.id)">{{ member.agent_ids.includes(selectedApp.id) ? t('admin.perm.appHeaders.removeMember') : t('admin.perm.appHeaders.addMember') }}</button></div>
|
||||||
|
<p v-if="appMembers.length === 0" class="px-6 py-12 text-center text-sm text-muted">{{ t('admin.perm.appHeaders.noMembers') }}</p>
|
||||||
|
</div>
|
||||||
|
<PaginationBar v-if="appMembers.length > 0" v-model:page="appMemberPage" v-model:page-size="appMemberPageSize" :total="appMembers.length" :pages="appMemberTotalPages" :page-size-options="appMemberPageSizeOptions" class="app-member-pagination rounded-none border-x-0 border-b-0" />
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 查看成员弹窗宽度固定,分页摘要与翻页操作保持在同一行。 */
|
||||||
|
:deep(.app-member-pagination) {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.app-member-pagination > div) {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.app-member-pagination > div:last-child) {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -39,6 +39,12 @@ export function usePermissionsAdmin() {
|
|||||||
|
|
||||||
const activeUsers = computed(() => users.value.filter((u) => u.status !== 'pending'));
|
const activeUsers = computed(() => users.value.filter((u) => u.status !== 'pending'));
|
||||||
|
|
||||||
|
/** 按应用视图行:复用已加载用户权限,统计每个应用的有效授权人数。 */
|
||||||
|
const appRows = computed(() => agents.value.map((agent) => ({
|
||||||
|
...agent,
|
||||||
|
authorizedCount: activeUsers.value.filter((user) => user.agent_ids.includes(agent.id)).length,
|
||||||
|
})));
|
||||||
|
|
||||||
const filteredUsers = computed(() =>
|
const filteredUsers = computed(() =>
|
||||||
activeUsers.value.filter((u) => {
|
activeUsers.value.filter((u) => {
|
||||||
const matchName =
|
const matchName =
|
||||||
@@ -216,6 +222,7 @@ export function usePermissionsAdmin() {
|
|||||||
return {
|
return {
|
||||||
users,
|
users,
|
||||||
agents,
|
agents,
|
||||||
|
appRows,
|
||||||
permissionFilters,
|
permissionFilters,
|
||||||
selectedUserIds,
|
selectedUserIds,
|
||||||
filteredUsers,
|
filteredUsers,
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,9 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* features/admin/modules/reports/composables/useReportsAdmin.ts
|
* features/admin/modules/reports/composables/useReportsAdmin.ts
|
||||||
* 用途:管理后台报表(多表浏览、筛选、排序、chat_logs 批量删除、使用分析与应用运营看板)。
|
* 用途:管理后台报表(多表浏览、筛选、排序、chat_logs 批量删除、使用分析与应用运营看板)。
|
||||||
* 依赖:admin.api、useReportLayoutStorage、useOffsetPagination、useMessage、dateTime、vue-router。
|
* 依赖:admin.api、useReportLayoutStorage、useOffsetPagination、useMessage、dateTime、vue-router。
|
||||||
* 逻辑:ReportsPage 调用本 composable;使用分析按用户服务端分页、按应用前端分页,均复用 PaginationBar;
|
* 逻辑:ReportsPage 调用本 composable;使用分析按用户服务端分页、按应用前端分页,均复用 PaginationBar;
|
||||||
* 低使用应用优先消费后端 low_agents(含零使用启用应用),与应用运营口径对齐。
|
* 低使用应用优先消费后端 low_agents(含零使用启用应用),与应用运营口径对齐;
|
||||||
|
* 趋势 by_day 前端按日期升序兜底;问题分析优先问题表前端分页;非表页切换时清空通用表状态防幽灵分页。
|
||||||
*/
|
*/
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@@ -11,10 +12,16 @@ import { useRoute, useRouter } from 'vue-router';
|
|||||||
import * as XLSX from 'xlsx';
|
import * as XLSX from 'xlsx';
|
||||||
import {
|
import {
|
||||||
batchDeleteAdminChatLogs,
|
batchDeleteAdminChatLogs,
|
||||||
|
closeAdminGeneralFeedback,
|
||||||
getAdminApplicationReport,
|
getAdminApplicationReport,
|
||||||
|
getAdminChatLogTops,
|
||||||
|
getAdminFeedbackSummary,
|
||||||
|
getAdminIssueAnalysis,
|
||||||
|
getAdminOpsOverview,
|
||||||
getAdminReportTable,
|
getAdminReportTable,
|
||||||
getAdminReportTableCount,
|
getAdminReportTableCount,
|
||||||
getAdminUsageReport,
|
getAdminUsageReport,
|
||||||
|
listAdminAgents,
|
||||||
} from '@/features/admin/api/admin.api';
|
} from '@/features/admin/api/admin.api';
|
||||||
import { loadReportLayoutPref, saveReportLayoutPref } from '@/shared/composables/useReportLayoutStorage';
|
import { loadReportLayoutPref, saveReportLayoutPref } from '@/shared/composables/useReportLayoutStorage';
|
||||||
import { buildOffsetPageButtons } from '@/shared/composables/useOffsetPagination';
|
import { buildOffsetPageButtons } from '@/shared/composables/useOffsetPagination';
|
||||||
@@ -28,7 +35,9 @@ import type {
|
|||||||
ApplicationStatusFilter,
|
ApplicationStatusFilter,
|
||||||
ApplicationUsageFilter,
|
ApplicationUsageFilter,
|
||||||
ChatLogsLayoutPref,
|
ChatLogsLayoutPref,
|
||||||
|
OpsOverviewReport,
|
||||||
ReportColumnConfig,
|
ReportColumnConfig,
|
||||||
|
ReportFeedbackTab,
|
||||||
SortRule,
|
SortRule,
|
||||||
UsageRangeKey,
|
UsageRangeKey,
|
||||||
UsageReport,
|
UsageReport,
|
||||||
@@ -41,6 +50,8 @@ const CHAT_LOGS_REPORT_KEYS = [
|
|||||||
'username',
|
'username',
|
||||||
'real_name',
|
'real_name',
|
||||||
'created_at',
|
'created_at',
|
||||||
|
'risk_status',
|
||||||
|
'risk_score',
|
||||||
'query',
|
'query',
|
||||||
'answer',
|
'answer',
|
||||||
'tokens_used',
|
'tokens_used',
|
||||||
@@ -48,8 +59,12 @@ const CHAT_LOGS_REPORT_KEYS = [
|
|||||||
|
|
||||||
const CHAT_LOGS_TABLE_KEYS = ['id', ...CHAT_LOGS_REPORT_KEYS] as const;
|
const CHAT_LOGS_TABLE_KEYS = ['id', ...CHAT_LOGS_REPORT_KEYS] as const;
|
||||||
|
|
||||||
|
/** 聊天日志风险状态可选项(值 = 后端 risk_status 枚举) */
|
||||||
|
const CHAT_LOG_RISK_STATUS_OPTIONS = ['attention', 'review', 'responded'] as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 聊天日志列默认宽度:前三列与 Token 收窄,提问/回答留宽。
|
* 报表列默认宽度:聊天日志前三列与 Token 收窄,提问/回答留宽,风险列居中紧凑;
|
||||||
|
* 意见反馈操作列保留按钮所需空间,防止中文文案按单字断行拉高整行。
|
||||||
* @param key - 列字段名
|
* @param key - 列字段名
|
||||||
* @returns 像素宽度
|
* @returns 像素宽度
|
||||||
*/
|
*/
|
||||||
@@ -67,9 +82,21 @@ const defaultChatLogsColumnWidth = (key: string): number => {
|
|||||||
return 156;
|
return 156;
|
||||||
case 'tokens_used':
|
case 'tokens_used':
|
||||||
return 96;
|
return 96;
|
||||||
|
case 'risk_status':
|
||||||
|
return 104;
|
||||||
|
case 'risk_score':
|
||||||
|
return 84;
|
||||||
|
case 'latency':
|
||||||
|
return 90;
|
||||||
|
case 'is_empty_answer':
|
||||||
|
return 96;
|
||||||
|
case 'is_system_failure':
|
||||||
|
return 108;
|
||||||
case 'query':
|
case 'query':
|
||||||
case 'answer':
|
case 'answer':
|
||||||
return 240;
|
return 240;
|
||||||
|
case 'actions':
|
||||||
|
return 112;
|
||||||
default:
|
default:
|
||||||
return 160;
|
return 160;
|
||||||
}
|
}
|
||||||
@@ -85,9 +112,29 @@ export function useReportsAdmin() {
|
|||||||
const usageUserPage = ref(1);
|
const usageUserPage = ref(1);
|
||||||
const usageUserPageSize = ref(10);
|
const usageUserPageSize = ref(10);
|
||||||
const usageUserPageSizeOptions = [5, 10, 20, 50];
|
const usageUserPageSizeOptions = [5, 10, 20, 50];
|
||||||
/** 使用分析时间范围,默认近一月 */
|
/** 使用分析时间范围,默认近 30 天 */
|
||||||
const usageRange = ref<UsageRangeKey>('30d');
|
const usageRange = ref<UsageRangeKey>('30d');
|
||||||
const usageRangeOptions: UsageRangeKey[] = ['7d', '30d', '90d', '180d', '365d'];
|
/** 统一时间范围筛选器:仅近 7 天 / 30 天 / 90 天 */
|
||||||
|
const usageRangeOptions: UsageRangeKey[] = ['7d', '30d', '90d'];
|
||||||
|
|
||||||
|
/** 用户反馈与回答评价页内 Tab:general=意见反馈,rating=回答评价 */
|
||||||
|
const feedbackTab = ref<ReportFeedbackTab>('general');
|
||||||
|
/** 「意见反馈」Tab 角标:general_feedbacks 记录总数 */
|
||||||
|
const generalFeedbackTotal = ref(0);
|
||||||
|
/** 反馈概览卡片:待处理 / 本月已关闭 / 最多反馈应用 */
|
||||||
|
const feedbackSummary = ref<{ pending_count: number; closed_this_month: number; top_app: { name: string; count: number } } | null>(null);
|
||||||
|
/** 「意见反馈」内容列当前展开查看的行 id(null=全部收起) */
|
||||||
|
const expandedFeedbackId = ref<number | null>(null);
|
||||||
|
/** 反馈页枚举筛选选项:值取自后端枚举,展示时按当前语言翻译 */
|
||||||
|
const feedbackTypeOptions = ['feature_suggestion', 'issue_feedback', 'experience_optimization'];
|
||||||
|
const feedbackModuleOptions = ['knowledge_base', 'general', 'workflow', 'account_permission'];
|
||||||
|
const feedbackSourceOptions = ['workspace', 'chat', 'unknown'];
|
||||||
|
/** 运营总览报表(复用 chat_logs / feedbacks / general_feedbacks / agents / 应用授权数据) */
|
||||||
|
const opsOverview = ref<OpsOverviewReport | null>(null);
|
||||||
|
/** 问题分析:高频问题簇 KPI + 优先处理问题 */
|
||||||
|
const issueAnalysis = ref<any | null>(null);
|
||||||
|
/** 运营总览时间范围,默认近 30 天 */
|
||||||
|
const opsOverviewRange = ref<UsageRangeKey>('30d');
|
||||||
|
|
||||||
/** 按应用统计:前端分页(后端已返回范围内全部应用) */
|
/** 按应用统计:前端分页(后端已返回范围内全部应用) */
|
||||||
const usageAgentPage = ref(1);
|
const usageAgentPage = ref(1);
|
||||||
@@ -123,6 +170,31 @@ export function useReportsAdmin() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载运营总览报表。
|
||||||
|
* 核心逻辑:调用 /reports/overview 拉取 KPI / 趋势环比 / Top 与低使用应用 / 低评分回答 / 未处理反馈。
|
||||||
|
*/
|
||||||
|
const loadOpsOverview = async (): Promise<void> => {
|
||||||
|
try {
|
||||||
|
opsOverview.value = await getAdminOpsOverview({ range: opsOverviewRange.value });
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error loading ops overview:', e);
|
||||||
|
opsOverview.value = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载问题分析(高频问题簇 KPI + 优先处理问题)。
|
||||||
|
* 核心逻辑:调用 /reports/issue-analysis,复用聊天日志风险规则。
|
||||||
|
*/
|
||||||
|
const loadIssueAnalysis = async (): Promise<void> => {
|
||||||
|
try {
|
||||||
|
issueAnalysis.value = await getAdminIssueAnalysis();
|
||||||
|
} catch {
|
||||||
|
issueAnalysis.value = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载应用运营报表。
|
* 加载应用运营报表。
|
||||||
* 核心逻辑:调用 /reports/applications,按当前筛选与排序拉取分页数据。
|
* 核心逻辑:调用 /reports/applications,按当前筛选与排序拉取分页数据。
|
||||||
@@ -207,6 +279,200 @@ export function useReportsAdmin() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 「用户反馈与回答评价」关联跳转:跳到对应聊天日志明细。
|
||||||
|
* 核心逻辑:按 chat_log_id 精确过滤 /admin/reports/chat_logs,落点即该条对话。
|
||||||
|
* @param chatLogId - 关联的聊天日志 ID(无关联 ID 时直接忽略)
|
||||||
|
*/
|
||||||
|
const openFeedbackChatLog = (chatLogId: number | string | null | undefined): void => {
|
||||||
|
const id = Number(chatLogId);
|
||||||
|
if (!Number.isFinite(id) || id <= 0) return;
|
||||||
|
void router.push({
|
||||||
|
name: 'AdminReports',
|
||||||
|
params: { table: 'chat_logs' },
|
||||||
|
query: { id: String(id) },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算反馈/评价「关联聊天」单元格的展示形态。
|
||||||
|
* 规则:无关联 chat_log_id -> empty(显示“未关联”,不强行补齐);
|
||||||
|
* 意见反馈仅当来源为“对话”时才是可点击链接,其余展示原始 ID;回答评价有 ID 即链接。
|
||||||
|
* @param row - 反馈/评价行
|
||||||
|
* @returns { type, value?, chatLogId? }
|
||||||
|
*/
|
||||||
|
const getFeedbackChatLogCell = (
|
||||||
|
row: any,
|
||||||
|
): { type: 'empty' | 'plain' | 'link'; value?: string; chatLogId?: number } => {
|
||||||
|
const chatLogId = Number(row?.chat_log_id);
|
||||||
|
const hasId = Number.isFinite(chatLogId) && chatLogId > 0;
|
||||||
|
if (!hasId) return { type: 'empty' };
|
||||||
|
if (feedbackTab.value === 'general') {
|
||||||
|
const source = String(row?.source_page ?? '').trim().toLowerCase();
|
||||||
|
const fromChat = source === 'chat' || source === '\u5bf9\u8bdd' || source === 'chat_page';
|
||||||
|
if (!fromChat) return { type: 'plain', value: String(chatLogId) };
|
||||||
|
}
|
||||||
|
return { type: 'link', chatLogId };
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展开/收起「意见反馈」内容列。
|
||||||
|
* @param row - 反馈行
|
||||||
|
*/
|
||||||
|
const toggleFeedbackContent = (row: any): void => {
|
||||||
|
const id = Number(row?.id);
|
||||||
|
expandedFeedbackId.value = id === expandedFeedbackId.value ? null : id;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 当前反馈行内容是否已展开查看 */
|
||||||
|
const isFeedbackContentExpanded = (row: any): boolean =>
|
||||||
|
expandedFeedbackId.value === Number(row?.id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开反馈内容浮窗(悬停/聚焦时)。
|
||||||
|
* @param row - 反馈行
|
||||||
|
*/
|
||||||
|
const openFeedbackContent = (row: any): void => {
|
||||||
|
const id = Number(row?.id);
|
||||||
|
expandedFeedbackId.value = Number.isFinite(id) ? id : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 关闭反馈内容浮窗。 */
|
||||||
|
const closeFeedbackContent = (): void => {
|
||||||
|
expandedFeedbackId.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开聊天日志详情弹窗(用户提问/智能体回答/风险状态/风险分/判定原因/建议检查项)。
|
||||||
|
* @param row - 聊天日志行
|
||||||
|
*/
|
||||||
|
const openChatLogDetail = (row: any): void => {
|
||||||
|
chatLogDetailRow.value = row;
|
||||||
|
chatLogDetailVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 关闭聊天日志详情弹窗 */
|
||||||
|
const closeChatLogDetail = (): void => {
|
||||||
|
chatLogDetailVisible.value = false;
|
||||||
|
chatLogDetailRow.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 风险状态 → 本地化标签 */
|
||||||
|
const getChatLogRiskStatusLabel = (status: string): string => {
|
||||||
|
const key = `admin.report.chatLog.risk.${status}`;
|
||||||
|
const v = t(key);
|
||||||
|
return v && v !== key ? v : status;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 判定原因 code → 本地化标签 */
|
||||||
|
const getChatLogRiskReasonLabel = (code: string): string => {
|
||||||
|
const key = `admin.report.chatLog.reason.${code}`;
|
||||||
|
const v = t(key);
|
||||||
|
return v && v !== key ? v : code;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 建议检查项 code → 本地化标签 */
|
||||||
|
const getChatLogRiskCheckLabel = (code: string): string => {
|
||||||
|
const key = `admin.report.chatLog.check.${code}`;
|
||||||
|
const v = t(key);
|
||||||
|
return v && v !== key ? v : code;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 风险状态 → 徽标颜色 class(便于前端三色区分) */
|
||||||
|
const getChatLogRiskStatusClass = (status: string): string => {
|
||||||
|
switch (status) {
|
||||||
|
case 'attention':
|
||||||
|
return 'bg-rose-100 text-rose-700';
|
||||||
|
case 'review':
|
||||||
|
return 'bg-amber-100 text-amber-700';
|
||||||
|
default:
|
||||||
|
return 'bg-emerald-100 text-emerald-700';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 重置聊天日志风险/定位筛选并重新加载(清除关联跳转残留的 id/agent_id 等) */
|
||||||
|
const resetChatLogFilters = (): void => {
|
||||||
|
const keys = [
|
||||||
|
'created_from', 'created_to', 'agent_name', 'agent_id', 'username', 'user_id',
|
||||||
|
'is_empty_answer', 'is_system_failure', 'risk_status', 'risk_score',
|
||||||
|
'min_score', 'max_score', 'feedback_score', 'id',
|
||||||
|
];
|
||||||
|
for (const k of keys) {
|
||||||
|
columnFilters.value[k] = '';
|
||||||
|
}
|
||||||
|
handleFilterChange();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 聊天日志 Top 提问/回答内容条形图数据(随当前识别条件刷新) */
|
||||||
|
const loadChatLogTops = async (): Promise<void> => {
|
||||||
|
if (!isChatLogsTable.value) return;
|
||||||
|
try {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
for (const [key, value] of Object.entries(columnFilters.value)) {
|
||||||
|
if (value) params.append(key, value);
|
||||||
|
}
|
||||||
|
const qs = params.toString();
|
||||||
|
chatLogTops.value = await getAdminChatLogTops(qs ? `?${qs}` : '');
|
||||||
|
} catch {
|
||||||
|
chatLogTops.value = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Top 提问条形图宽度归一化基准 */
|
||||||
|
const chatLogTopsQuestionsMax = computed(() =>
|
||||||
|
Math.max(1, ...(chatLogTops.value?.questions || []).map((x) => x.count)),
|
||||||
|
);
|
||||||
|
/** Top 回答条形图宽度归一化基准 */
|
||||||
|
const chatLogTopsAnswersMax = computed(() =>
|
||||||
|
Math.max(1, ...(chatLogTops.value?.answers || []).map((x) => x.count)),
|
||||||
|
);
|
||||||
|
|
||||||
|
/** 加载反馈概览卡片(待处理/本月已关闭/最多反馈应用) */
|
||||||
|
const loadFeedbackSummary = async (): Promise<void> => {
|
||||||
|
if (!isMergedFeedbackTable.value || feedbackTab.value !== 'general') return;
|
||||||
|
try {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
for (const [key, value] of Object.entries(columnFilters.value)) {
|
||||||
|
if (value) params.append(key, value);
|
||||||
|
}
|
||||||
|
const qs = params.toString();
|
||||||
|
feedbackSummary.value = await getAdminFeedbackSummary(qs ? `?${qs}` : '');
|
||||||
|
} catch {
|
||||||
|
feedbackSummary.value = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 将一条意见反馈标记为已关闭,并刷新列表与概览 */
|
||||||
|
const closeFeedback = async (row: any): Promise<void> => {
|
||||||
|
const id = Number(row?.id);
|
||||||
|
if (!Number.isFinite(id) || id <= 0) return;
|
||||||
|
try {
|
||||||
|
await closeAdminGeneralFeedback(id);
|
||||||
|
msg.success(t('admin.report.feedback.closedOk'));
|
||||||
|
await loadTableData();
|
||||||
|
void loadFeedbackSummary();
|
||||||
|
} catch (e) {
|
||||||
|
msg.error((e as Error).message || t('admin.msg.failed'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 拉取聊天日志「应用」筛选项(应用列表) */
|
||||||
|
const loadChatLogAgents = async (): Promise<void> => {
|
||||||
|
if (!isChatLogsTable.value) return;
|
||||||
|
try {
|
||||||
|
chatLogAgents.value = await listAdminAgents();
|
||||||
|
} catch {
|
||||||
|
chatLogAgents.value = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 进入聊天日志页时给统一时间范围一个默认值,保证筛选生效 */
|
||||||
|
const ensureChatLogsRange = (): void => {
|
||||||
|
if (isChatLogsTable.value && !columnFilters.value.range) {
|
||||||
|
columnFilters.value.range = '30d';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出应用运营报表 Excel(仅运营字段)。
|
* 导出应用运营报表 Excel(仅运营字段)。
|
||||||
*/
|
*/
|
||||||
@@ -240,6 +506,44 @@ export function useReportsAdmin() {
|
|||||||
const usageUserTopLimit = computed(() => usageReport.value?.user_top_limit ?? 50);
|
const usageUserTopLimit = computed(() => usageReport.value?.user_top_limit ?? 50);
|
||||||
const usageActiveAgentCount = computed(() => usageReport.value?.by_agent.length ?? 0);
|
const usageActiveAgentCount = computed(() => usageReport.value?.by_agent.length ?? 0);
|
||||||
const usageTrendMax = computed(() => Math.max(1, ...(usageReport.value?.by_day || []).map((item) => item.count)));
|
const usageTrendMax = computed(() => Math.max(1, ...(usageReport.value?.by_day || []).map((item) => item.count)));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将报表日维度日期解析为可比较时间戳;非法值回退 0。
|
||||||
|
* @param date - 后端日期字符串(期望 yyyy-mm-dd,兼容未补零)
|
||||||
|
*/
|
||||||
|
const reportDayTimestamp = (date: string): number => {
|
||||||
|
const raw = String(date || '').trim();
|
||||||
|
if (!raw) return 0;
|
||||||
|
const head = raw.split(/[ T]/)[0]?.replace(/\//g, '-') || '';
|
||||||
|
const parts = head.split('-');
|
||||||
|
if (parts.length >= 3) {
|
||||||
|
const y = Number(parts[0]);
|
||||||
|
const m = Number(parts[1]);
|
||||||
|
const d = Number(String(parts[2]).slice(0, 2));
|
||||||
|
if (Number.isFinite(y) && Number.isFinite(m) && Number.isFinite(d)) {
|
||||||
|
return Date.UTC(y, m - 1, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const parsed = Date.parse(raw);
|
||||||
|
return Number.isFinite(parsed) ? parsed : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按自然日升序排序趋势点,避免未补零日期字符串把月初甩到横轴末尾。
|
||||||
|
* @param days - by_day 原始列表
|
||||||
|
*/
|
||||||
|
const sortReportDaysAsc = <T extends { date: string }>(days: T[]): T[] =>
|
||||||
|
[...days].sort((a, b) => {
|
||||||
|
const diff = reportDayTimestamp(a.date) - reportDayTimestamp(b.date);
|
||||||
|
if (diff !== 0) return diff;
|
||||||
|
return String(a.date).localeCompare(String(b.date));
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 使用分析「近段趋势」按日期升序后的柱状数据 */
|
||||||
|
const usageTrendByDay = computed(() => sortReportDaysAsc(usageReport.value?.by_day || []));
|
||||||
|
|
||||||
|
/** 运营总览「对话趋势」按日期升序后的柱状数据 */
|
||||||
|
const opsTrendByDay = computed(() => sortReportDaysAsc(opsOverview.value?.trend.by_day || []));
|
||||||
/** 低使用应用:范围内对话次数 ≤ 该阈值(兜底;优先用后端返回值) */
|
/** 低使用应用:范围内对话次数 ≤ 该阈值(兜底;优先用后端返回值) */
|
||||||
const USAGE_LOW_AGENT_MAX_CHATS = 2;
|
const USAGE_LOW_AGENT_MAX_CHATS = 2;
|
||||||
/** 低使用应用提醒最多展示条数(兜底;优先用后端返回值) */
|
/** 低使用应用提醒最多展示条数(兜底;优先用后端返回值) */
|
||||||
@@ -350,6 +654,10 @@ export function useReportsAdmin() {
|
|||||||
if (typeof table === 'string' && (ADMIN_REPORT_TABLES as readonly string[]).includes(table)) {
|
if (typeof table === 'string' && (ADMIN_REPORT_TABLES as readonly string[]).includes(table)) {
|
||||||
return table as AdminReportTableId;
|
return table as AdminReportTableId;
|
||||||
}
|
}
|
||||||
|
// 兼容旧链接:意见反馈曾是独立导航项,现并入「用户反馈与回答评价」页
|
||||||
|
if (table === 'general_feedbacks') {
|
||||||
|
return 'feedbacks';
|
||||||
|
}
|
||||||
return 'usage_analysis';
|
return 'usage_analysis';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -377,6 +685,18 @@ const reportCurrentPage = ref(1);
|
|||||||
const reportPageSize = ref(20);
|
const reportPageSize = ref(20);
|
||||||
const reportPageSizeOptions = [10, 20, 50, 100];
|
const reportPageSizeOptions = [10, 20, 50, 100];
|
||||||
|
|
||||||
|
/** 聊天日志详情弹窗:当前查看行(null=关闭) */
|
||||||
|
const chatLogDetailVisible = ref(false);
|
||||||
|
const chatLogDetailRow = ref<any | null>(null);
|
||||||
|
|
||||||
|
/** 聊天日志 Top 提问/回答内容(直接按 ChatLog 明细统计) */
|
||||||
|
const chatLogTops = ref<{ questions: Array<{ label: string; count: number }>; answers: Array<{ label: string; count: number }> } | null>(null);
|
||||||
|
|
||||||
|
/** 聊天日志统一时间范围(近 7/30/90 天) */
|
||||||
|
const chatLogRangeOptions: UsageRangeKey[] = ['7d', '30d', '90d'];
|
||||||
|
/** 聊天日志「应用」筛选项(应用运营跳转/按应用查看) */
|
||||||
|
const chatLogAgents = ref<any[]>([]);
|
||||||
|
|
||||||
const chatLogsColumns = ref<ReportColumnConfig[]>([]);
|
const chatLogsColumns = ref<ReportColumnConfig[]>([]);
|
||||||
const chatLogsSortRules = ref<SortRule[]>([]);
|
const chatLogsSortRules = ref<SortRule[]>([]);
|
||||||
const reportHeaderSort = ref<SortRule | null>(null);
|
const reportHeaderSort = ref<SortRule | null>(null);
|
||||||
@@ -385,10 +705,16 @@ const resizingColumnKey = ref<string | null>(null);
|
|||||||
let resizeStartX = 0;
|
let resizeStartX = 0;
|
||||||
let resizeStartWidth = 0;
|
let resizeStartWidth = 0;
|
||||||
|
|
||||||
/** 使用分析 / 应用运营是菜单层虚拟页,明细表仍复用对应数据源。 */
|
/**
|
||||||
const dataSourceTable = computed<Exclude<AdminReportTableId, 'usage_analysis'>>(() => {
|
* 数据源表解析:使用分析/应用运营是菜单层虚拟页,明细表仍复用对应数据源。
|
||||||
|
* 「用户反馈与回答评价」页内按 Tab 切换数据源(general_feedbacks / feedbacks)。
|
||||||
|
*/
|
||||||
|
const dataSourceTable = computed<AdminReportTableId>(() => {
|
||||||
if (currentTable.value === 'usage_analysis') return 'chat_logs';
|
if (currentTable.value === 'usage_analysis') return 'chat_logs';
|
||||||
return currentTable.value as Exclude<AdminReportTableId, 'usage_analysis'>;
|
if (currentTable.value === 'feedbacks') {
|
||||||
|
return feedbackTab.value === 'general' ? 'general_feedbacks' : 'feedbacks';
|
||||||
|
}
|
||||||
|
return currentTable.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -405,6 +731,18 @@ const applyRouteQueryFilters = (): void => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadTableData = async () => {
|
const loadTableData = async () => {
|
||||||
|
// 使用分析 / 运营总览 / 问题分析:非通用数据表(使用分析严格不展示聊天原文,直接清空)
|
||||||
|
if (
|
||||||
|
isUsageAnalysisTable.value
|
||||||
|
|| isPlaceholderTable.value
|
||||||
|
|| isOpsOverviewTable.value
|
||||||
|
|| isIssueAnalysisTable.value
|
||||||
|
) {
|
||||||
|
tableData.value = [];
|
||||||
|
selectedReportRowIds.value = [];
|
||||||
|
chatLogsColumns.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 应用运营页不走通用配置表
|
// 应用运营页不走通用配置表
|
||||||
if (currentTable.value === 'agents') {
|
if (currentTable.value === 'agents') {
|
||||||
tableData.value = [];
|
tableData.value = [];
|
||||||
@@ -428,9 +766,11 @@ const loadTableData = async () => {
|
|||||||
tableData.value = await getAdminReportTable(url);
|
tableData.value = await getAdminReportTable(url);
|
||||||
if (tableData.value.length > 0) {
|
if (tableData.value.length > 0) {
|
||||||
const rowKeys = Object.keys(tableData.value[0] || {});
|
const rowKeys = Object.keys(tableData.value[0] || {});
|
||||||
|
// 反馈表隐藏内部字段(status/closed_at/id 等,避免出现在列设置)
|
||||||
|
const internalRelKeys = new Set(['id', 'user_id', 'status', 'closed_at']);
|
||||||
const columnKeys = dataSourceTable.value === 'chat_logs'
|
const columnKeys = dataSourceTable.value === 'chat_logs'
|
||||||
? CHAT_LOGS_TABLE_KEYS.filter((k) => rowKeys.includes(k))
|
? CHAT_LOGS_TABLE_KEYS.filter((k) => rowKeys.includes(k))
|
||||||
: rowKeys;
|
: rowKeys.filter((k) => !internalRelKeys.has(k));
|
||||||
initChatLogsColumns(columnKeys);
|
initChatLogsColumns(columnKeys);
|
||||||
}
|
}
|
||||||
if (dataSourceTable.value === 'chat_logs') {
|
if (dataSourceTable.value === 'chat_logs') {
|
||||||
@@ -447,6 +787,15 @@ const loadTableData = async () => {
|
|||||||
tableData.value = [];
|
tableData.value = [];
|
||||||
selectedReportRowIds.value = [];
|
selectedReportRowIds.value = [];
|
||||||
}
|
}
|
||||||
|
// 聊天日志:刷新 Top 提问/回答内容(复用当前识别条件)
|
||||||
|
if (isChatLogsTable.value) {
|
||||||
|
void loadChatLogTops();
|
||||||
|
void loadChatLogAgents();
|
||||||
|
}
|
||||||
|
// 用户反馈:刷新概览卡片(仅意见反馈 Tab)
|
||||||
|
if (isMergedFeedbackTable.value && feedbackTab.value === 'general') {
|
||||||
|
void loadFeedbackSummary();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveChatLogsColumns = () => {
|
const saveChatLogsColumns = () => {
|
||||||
@@ -573,19 +922,41 @@ const startResizeColumn = (key: string, e: MouseEvent) => {
|
|||||||
document.addEventListener('mouseup', onResizeMouseUp);
|
document.addEventListener('mouseup', onResizeMouseUp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 构造带当前列筛选的 count URL,使「总数」随筛选变化(与「显示」一致)。 */
|
||||||
|
const buildCountUrl = (table: string): string => {
|
||||||
|
const countUrl = table === 'general_feedbacks'
|
||||||
|
? '/api/admin/reports/general-feedbacks/count'
|
||||||
|
: `/api/admin/database/${table}/count`;
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
for (const [key, value] of Object.entries(columnFilters.value)) {
|
||||||
|
if (value) params.append(key, value);
|
||||||
|
}
|
||||||
|
const qs = params.toString();
|
||||||
|
return qs ? `${countUrl}?${qs}` : countUrl;
|
||||||
|
};
|
||||||
|
|
||||||
const loadTableCount = async (table: string) => {
|
const loadTableCount = async (table: string) => {
|
||||||
try {
|
try {
|
||||||
const countUrl = table === 'general_feedbacks'
|
const data = await getAdminReportTableCount(buildCountUrl(table));
|
||||||
? '/api/admin/reports/general-feedbacks/count'
|
|
||||||
: `/api/admin/database/${table}/count`;
|
|
||||||
|
|
||||||
const data = await getAdminReportTableCount(countUrl);
|
|
||||||
return Number(data.total || 0);
|
return Number(data.total || 0);
|
||||||
} catch {
|
} catch {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载「意见反馈」Tab 角标计数(general_feedbacks 记录总数)。
|
||||||
|
* 核心逻辑:进入用户反馈与回答评价页时刷新,供 Tab 角标展示,非核心数据失败时静默降级为 0。
|
||||||
|
*/
|
||||||
|
const loadGeneralFeedbackTotal = async (): Promise<void> => {
|
||||||
|
if (!isMergedFeedbackTable.value) return;
|
||||||
|
try {
|
||||||
|
generalFeedbackTotal.value = await loadTableCount('general_feedbacks');
|
||||||
|
} catch {
|
||||||
|
generalFeedbackTotal.value = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const exportToExcel = () => {
|
const exportToExcel = () => {
|
||||||
if (currentTable.value === 'agents') {
|
if (currentTable.value === 'agents') {
|
||||||
exportApplicationReport();
|
exportApplicationReport();
|
||||||
@@ -593,17 +964,33 @@ const exportToExcel = () => {
|
|||||||
}
|
}
|
||||||
if (tableData.value.length === 0) return;
|
if (tableData.value.length === 0) return;
|
||||||
const keys = visibleReportKeys.value;
|
const keys = visibleReportKeys.value;
|
||||||
const rows = tableData.value.map((row) => {
|
// 「用户反馈与回答评价」导出当前 Tab + 当前筛选结果(时间范围已由服务端过滤进 tableData)
|
||||||
|
const sourceRows = isMergedFeedbackTable.value ? sortedTableData.value : tableData.value;
|
||||||
|
const rows = sourceRows.map((row) => {
|
||||||
const out: Record<string, unknown> = {};
|
const out: Record<string, unknown> = {};
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
out[getReportColumnLabel(key)] = getReportCellValue(row, key);
|
out[getReportColumnLabel(key)] = getReportCellValue(row, key);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
});
|
});
|
||||||
const ws = XLSX.utils.json_to_sheet(rows.length > 0 ? rows : tableData.value);
|
const ws = XLSX.utils.json_to_sheet(rows.length > 0 ? rows : sourceRows);
|
||||||
const wb = XLSX.utils.book_new();
|
const wb = XLSX.utils.book_new();
|
||||||
XLSX.utils.book_append_sheet(wb, ws, currentTable.value);
|
// 反馈页文件名包含模块(Tab)与时间范围,避免误解为总体结论
|
||||||
XLSX.writeFile(wb, `${currentTable.value}_report_${new Date().toISOString().split('T')[0]}.xlsx`);
|
let sheetName: string = currentTable.value;
|
||||||
|
let fileName: string = `${currentTable.value}_report_${new Date().toISOString().split('T')[0]}`;
|
||||||
|
if (isMergedFeedbackTable.value) {
|
||||||
|
const tabLabel = feedbackTab.value === 'rating'
|
||||||
|
? t('admin.report.feedback.tabs.rating')
|
||||||
|
: t('admin.report.feedback.tabs.general');
|
||||||
|
const moduleLabel = getReportTableLabel(currentTable.value);
|
||||||
|
const fromDate = columnFilters.value.created_from || '';
|
||||||
|
const toDate = columnFilters.value.created_to || '';
|
||||||
|
const rangeLabel = fromDate && toDate ? `${fromDate}_${toDate}` : 'all';
|
||||||
|
fileName = `${moduleLabel}_${tabLabel}_${rangeLabel}`;
|
||||||
|
sheetName = feedbackTab.value === 'rating' ? 'answer_rating' : 'general_feedback';
|
||||||
|
}
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
||||||
|
XLSX.writeFile(wb, `${fileName}.xlsx`);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Debounce filter input
|
// Debounce filter input
|
||||||
@@ -618,10 +1005,20 @@ const handleFilterChange = () => {
|
|||||||
const isUsageAnalysisTable = computed(() => currentTable.value === 'usage_analysis');
|
const isUsageAnalysisTable = computed(() => currentTable.value === 'usage_analysis');
|
||||||
const isApplicationOpsTable = computed(() => currentTable.value === 'agents');
|
const isApplicationOpsTable = computed(() => currentTable.value === 'agents');
|
||||||
const isChatLogsTable = computed(() => dataSourceTable.value === 'chat_logs');
|
const isChatLogsTable = computed(() => dataSourceTable.value === 'chat_logs');
|
||||||
/** 列已初始化后(含筛选无结果)仍展示表头与筛选框;应用运营页用专用看板,不展示通用表 */
|
const isMergedFeedbackTable = computed(() => currentTable.value === 'feedbacks');
|
||||||
|
const isOpsOverviewTable = computed(() => currentTable.value === 'ops_overview');
|
||||||
|
const isIssueAnalysisTable = computed(() => currentTable.value === 'issue_analysis');
|
||||||
|
/** 已无占位页(问题分析已实现) */
|
||||||
|
const isPlaceholderTable = computed(() => false);
|
||||||
|
/** 使用分析 / 运营总览 / 问题分析:非通用数据表页,隐藏列设置/导出等表格工具栏 */
|
||||||
|
const isNonTablePage = computed(
|
||||||
|
() => isUsageAnalysisTable.value || isOpsOverviewTable.value || isIssueAnalysisTable.value,
|
||||||
|
);
|
||||||
|
/** 列已初始化后(含筛选无结果)仍展示表头与筛选框;应用运营/非表看板不展示通用表 */
|
||||||
const showReportTable = computed(
|
const showReportTable = computed(
|
||||||
() =>
|
() =>
|
||||||
!isApplicationOpsTable.value
|
!isApplicationOpsTable.value
|
||||||
|
&& !isNonTablePage.value
|
||||||
&& (tableData.value.length > 0 || chatLogsColumns.value.length > 0),
|
&& (tableData.value.length > 0 || chatLogsColumns.value.length > 0),
|
||||||
);
|
);
|
||||||
const visibleReportKeys = computed(() => {
|
const visibleReportKeys = computed(() => {
|
||||||
@@ -632,7 +1029,14 @@ const visibleReportKeys = computed(() => {
|
|||||||
keys = chatLogsColumns.value.filter((c) => c.visible).map((c) => c.key);
|
keys = chatLogsColumns.value.filter((c) => c.visible).map((c) => c.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTable.value === 'general_feedbacks') {
|
if (dataSourceTable.value === 'feedbacks') {
|
||||||
|
// 回答评价:字段更易读的顺序(关联聊天/评价时间/评分/评价内容/内部 ID)
|
||||||
|
const ratingFixedOrder = ['chat_log_id', 'created_at', 'score', 'comment', 'id'];
|
||||||
|
const available = new Set(keys);
|
||||||
|
return ratingFixedOrder.filter((k) => available.has(k));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataSourceTable.value === 'general_feedbacks') {
|
||||||
const feedbackFixedOrder = [
|
const feedbackFixedOrder = [
|
||||||
'created_at',
|
'created_at',
|
||||||
'source_page',
|
'source_page',
|
||||||
@@ -643,9 +1047,11 @@ const visibleReportKeys = computed(() => {
|
|||||||
'real_name',
|
'real_name',
|
||||||
'department',
|
'department',
|
||||||
'chat_log_id',
|
'chat_log_id',
|
||||||
|
'actions',
|
||||||
];
|
];
|
||||||
const available = new Set(keys);
|
const available = new Set(keys);
|
||||||
return feedbackFixedOrder.filter((k) => available.has(k));
|
// actions 为虚拟操作列,始终展示;其余按可用列过滤
|
||||||
|
return feedbackFixedOrder.filter((k) => k === 'actions' || available.has(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataSourceTable.value === 'chat_logs') {
|
if (dataSourceTable.value === 'chat_logs') {
|
||||||
@@ -664,12 +1070,26 @@ const resolveReportLang = () => {
|
|||||||
return 'en';
|
return 'en';
|
||||||
};
|
};
|
||||||
|
|
||||||
const feedbackReportI18nMap: Record<string, {
|
/** 反馈报表 i18n 语言包:列/类型/模块/页面/按 Tab 收敛的列名 */
|
||||||
|
interface FeedbackReportI18nPack {
|
||||||
columns: Record<string, string>;
|
columns: Record<string, string>;
|
||||||
types: Record<string, string>;
|
types: Record<string, string>;
|
||||||
modules: Record<string, string>;
|
modules: Record<string, string>;
|
||||||
pages: Record<string, string>;
|
pages: Record<string, string>;
|
||||||
}> = {
|
generalColumns: Record<string, string>;
|
||||||
|
ratingColumns: Record<string, string>;
|
||||||
|
}
|
||||||
|
/** 兜底空语言包,避免 enPack 回退时缺失字段导致类型报错 */
|
||||||
|
const EMPTY_FEEDBACK_PACK: FeedbackReportI18nPack = {
|
||||||
|
columns: {},
|
||||||
|
types: {},
|
||||||
|
modules: {},
|
||||||
|
pages: {},
|
||||||
|
generalColumns: {},
|
||||||
|
ratingColumns: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const feedbackReportI18nMap: Record<string, FeedbackReportI18nPack> = {
|
||||||
en: {
|
en: {
|
||||||
columns: {
|
columns: {
|
||||||
feedback_module: 'Feedback Module',
|
feedback_module: 'Feedback Module',
|
||||||
@@ -694,6 +1114,18 @@ const feedbackReportI18nMap: Record<string, {
|
|||||||
chat: 'Chat',
|
chat: 'Chat',
|
||||||
unknown: 'Unknown',
|
unknown: 'Unknown',
|
||||||
},
|
},
|
||||||
|
/** 意见反馈 Tab 专用列名(覆盖通用列名,主要在关联跳转列) */
|
||||||
|
generalColumns: {
|
||||||
|
chat_log_id: 'Linked Chat',
|
||||||
|
},
|
||||||
|
/** 回答评价 Tab 列名:更易读、贴合评价语境 */
|
||||||
|
ratingColumns: {
|
||||||
|
chat_log_id: 'Linked Chat',
|
||||||
|
created_at: 'Rated At',
|
||||||
|
score: 'Score',
|
||||||
|
comment: 'Comment',
|
||||||
|
id: 'Internal ID',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'zh-CN': {
|
'zh-CN': {
|
||||||
columns: {
|
columns: {
|
||||||
@@ -719,6 +1151,16 @@ const feedbackReportI18nMap: Record<string, {
|
|||||||
chat: '\u5bf9\u8bdd',
|
chat: '\u5bf9\u8bdd',
|
||||||
unknown: '\u672a\u77e5',
|
unknown: '\u672a\u77e5',
|
||||||
},
|
},
|
||||||
|
generalColumns: {
|
||||||
|
chat_log_id: '\u5173\u8054\u804a\u5929',
|
||||||
|
},
|
||||||
|
ratingColumns: {
|
||||||
|
chat_log_id: '\u5173\u8054\u804a\u5929',
|
||||||
|
created_at: '\u8bc4\u4ef7\u65f6\u95f4',
|
||||||
|
score: '\u8bc4\u5206',
|
||||||
|
comment: '\u8bc4\u4ef7\u5185\u5bb9',
|
||||||
|
id: '\u5185\u90e8 ID',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
'zh-TW': {
|
'zh-TW': {
|
||||||
columns: {
|
columns: {
|
||||||
@@ -744,6 +1186,16 @@ const feedbackReportI18nMap: Record<string, {
|
|||||||
chat: '\u5c0d\u8a71',
|
chat: '\u5c0d\u8a71',
|
||||||
unknown: '\u672a\u77e5',
|
unknown: '\u672a\u77e5',
|
||||||
},
|
},
|
||||||
|
generalColumns: {
|
||||||
|
chat_log_id: '\u95dc\u806f\u804a\u5929',
|
||||||
|
},
|
||||||
|
ratingColumns: {
|
||||||
|
chat_log_id: '\u95dc\u806f\u804a\u5929',
|
||||||
|
created_at: '\u8a55\u50f9\u6642\u9593',
|
||||||
|
score: '\u8a55\u5206',
|
||||||
|
comment: '\u8a55\u50f9\u5167\u5bb9',
|
||||||
|
id: '\u5167\u90e8 ID',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
th: {
|
th: {
|
||||||
columns: {
|
columns: {
|
||||||
@@ -769,12 +1221,30 @@ const feedbackReportI18nMap: Record<string, {
|
|||||||
chat: '\u0e41\u0e0a\u0e17',
|
chat: '\u0e41\u0e0a\u0e17',
|
||||||
unknown: '\u0e44\u0e21\u0e48\u0e17\u0e23\u0e32\u0e1a',
|
unknown: '\u0e44\u0e21\u0e48\u0e17\u0e23\u0e32\u0e1a',
|
||||||
},
|
},
|
||||||
|
generalColumns: {
|
||||||
|
chat_log_id: '\u0e41\u0e0a\u0e17\u0e17\u0e35\u0e48\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e42\u0e22\u0e07',
|
||||||
|
},
|
||||||
|
ratingColumns: {
|
||||||
|
chat_log_id: '\u0e41\u0e0a\u0e17\u0e17\u0e35\u0e48\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e42\u0e22\u0e07',
|
||||||
|
created_at: '\u0e40\u0e27\u0e25\u0e32\u0e17\u0e35\u0e48\u0e43\u0e2b\u0e49\u0e04\u0e30\u0e41\u0e19\u0e19',
|
||||||
|
score: '\u0e04\u0e30\u0e41\u0e19\u0e19',
|
||||||
|
comment: '\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32\u0e04\u0e27\u0e32\u0e21\u0e04\u0e34\u0e14\u0e40\u0e2b\u0e47\u0e19',
|
||||||
|
id: 'ID \u0e20\u0e32\u0e22\u0e43\u0e19',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getReportColumnLabel = (key: string) => {
|
const getReportColumnLabel = (key: string): string => {
|
||||||
const lang = resolveReportLang();
|
const lang = resolveReportLang();
|
||||||
const enPack = feedbackReportI18nMap['en'] || { columns: {}, types: {}, modules: {}, pages: {} };
|
const enPack = feedbackReportI18nMap['en'] || EMPTY_FEEDBACK_PACK;
|
||||||
|
// 「用户反馈与回答评价」页按 Tab 收敛更易读的列名(关联聊天/评价时间/评分/评价内容等)
|
||||||
|
if (isMergedFeedbackTable.value) {
|
||||||
|
const tabPack = feedbackTab.value === 'rating'
|
||||||
|
? (feedbackReportI18nMap[lang]?.ratingColumns || enPack.ratingColumns)
|
||||||
|
: (feedbackReportI18nMap[lang]?.generalColumns || enPack.generalColumns);
|
||||||
|
const tabDirect = tabPack[key];
|
||||||
|
if (tabDirect) return tabDirect;
|
||||||
|
}
|
||||||
const direct = feedbackReportI18nMap[lang]?.columns?.[key] || enPack.columns[key];
|
const direct = feedbackReportI18nMap[lang]?.columns?.[key] || enPack.columns[key];
|
||||||
if (direct) return direct;
|
if (direct) return direct;
|
||||||
const i18nKey = `admin.report.columns.${key}`;
|
const i18nKey = `admin.report.columns.${key}`;
|
||||||
@@ -834,9 +1304,9 @@ const getTranslatedFeedbackValue = (group: 'types' | 'modules' | 'pages', value:
|
|||||||
const normalized = normalizeFeedbackKey(value);
|
const normalized = normalizeFeedbackKey(value);
|
||||||
if (!normalized) return value;
|
if (!normalized) return value;
|
||||||
const lang = resolveReportLang();
|
const lang = resolveReportLang();
|
||||||
const enPack = feedbackReportI18nMap['en'] || { columns: {}, types: {}, modules: {}, pages: {} };
|
const enPack = feedbackReportI18nMap['en'] || EMPTY_FEEDBACK_PACK;
|
||||||
const dict = feedbackReportI18nMap[lang]?.[group] || enPack[group];
|
const dict = feedbackReportI18nMap[lang]?.[group] || enPack[group];
|
||||||
return dict?.[normalized] || value;
|
return dict[normalized] || value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatReportDateTime = (value: any) => {
|
const formatReportDateTime = (value: any) => {
|
||||||
@@ -919,7 +1389,20 @@ const sortedTableData = computed(() => {
|
|||||||
const list = [...tableData.value];
|
const list = [...tableData.value];
|
||||||
const advanced = chatLogsSortRules.value.length > 0 ? chatLogsSortRules.value : [];
|
const advanced = chatLogsSortRules.value.length > 0 ? chatLogsSortRules.value : [];
|
||||||
const rules = advanced.length > 0 ? advanced : (reportHeaderSort.value ? [reportHeaderSort.value] : []);
|
const rules = advanced.length > 0 ? advanced : (reportHeaderSort.value ? [reportHeaderSort.value] : []);
|
||||||
if (rules.length === 0) return list;
|
if (rules.length === 0) {
|
||||||
|
// 「用户反馈与回答评价」默认按创建时间倒序(回答评价无服务端排序,前端兜底)
|
||||||
|
if (isMergedFeedbackTable.value && dataSourceTable.value === 'feedbacks') {
|
||||||
|
return list.sort((a, b) => {
|
||||||
|
const av = Date.parse(String(a?.created_at ?? ''));
|
||||||
|
const bv = Date.parse(String(b?.created_at ?? ''));
|
||||||
|
if (Number.isNaN(av) && Number.isNaN(bv)) return 0;
|
||||||
|
if (Number.isNaN(av)) return 1;
|
||||||
|
if (Number.isNaN(bv)) return -1;
|
||||||
|
return bv - av;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
return list.sort((a, b) => {
|
return list.sort((a, b) => {
|
||||||
for (const r of rules) {
|
for (const r of rules) {
|
||||||
const c = compareByRule(a, b, r);
|
const c = compareByRule(a, b, r);
|
||||||
@@ -963,6 +1446,31 @@ const reportPageButtons = computed(() => {
|
|||||||
return buildOffsetPageButtons(current, total);
|
return buildOffsetPageButtons(current, total);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 问题分析:优先处理问题总数(前端分页) */
|
||||||
|
const issueQuestionTotal = computed(() => issueAnalysis.value?.questions?.length ?? 0);
|
||||||
|
const issueQuestionTotalPages = computed(() => {
|
||||||
|
const size = Math.max(1, Number(reportPageSize.value) || 20);
|
||||||
|
return Math.max(1, Math.ceil(issueQuestionTotal.value / size));
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 问题分析当前页问题列表。
|
||||||
|
* 核心逻辑:复用 reportCurrentPage / reportPageSize,对 questions 做偏移切片。
|
||||||
|
*/
|
||||||
|
const paginatedIssueQuestions = computed(() => {
|
||||||
|
const list = issueAnalysis.value?.questions ?? [];
|
||||||
|
const size = Math.max(1, Number(reportPageSize.value) || 20);
|
||||||
|
const safePage = Math.min(Math.max(1, reportCurrentPage.value), issueQuestionTotalPages.value);
|
||||||
|
const start = (safePage - 1) * size;
|
||||||
|
return list.slice(start, start + size);
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 跳转问题分析分页;页码超出时钳制到有效范围。
|
||||||
|
* @param page - 目标页(1-based)
|
||||||
|
*/
|
||||||
|
const goToIssueAnalysisPage = (page: number): void => {
|
||||||
|
reportCurrentPage.value = Math.min(Math.max(1, page), issueQuestionTotalPages.value);
|
||||||
|
};
|
||||||
|
|
||||||
const onReportHeaderClick = (key: string) => {
|
const onReportHeaderClick = (key: string) => {
|
||||||
// Column-header sorting is the quick mode; clear advanced rules to avoid precedence conflict.
|
// Column-header sorting is the quick mode; clear advanced rules to avoid precedence conflict.
|
||||||
if (chatLogsSortRules.value.length > 0) {
|
if (chatLogsSortRules.value.length > 0) {
|
||||||
@@ -1062,18 +1570,61 @@ const batchDeleteChatLogs = async () => {
|
|||||||
|
|
||||||
watch(currentTable, async () => {
|
watch(currentTable, async () => {
|
||||||
applyRouteQueryFilters();
|
applyRouteQueryFilters();
|
||||||
|
ensureChatLogsRange();
|
||||||
chatLogsColumns.value = [];
|
chatLogsColumns.value = [];
|
||||||
selectedReportRowIds.value = [];
|
selectedReportRowIds.value = [];
|
||||||
showChatLogsColumnPanel.value = false;
|
showChatLogsColumnPanel.value = false;
|
||||||
showChatLogsSelection.value = false;
|
showChatLogsSelection.value = false;
|
||||||
reportCurrentPage.value = 1;
|
reportCurrentPage.value = 1;
|
||||||
await loadTableData();
|
|
||||||
reportHeaderSort.value = null;
|
reportHeaderSort.value = null;
|
||||||
if (dataSourceTable.value === 'chat_logs' && !isApplicationOpsTable.value) {
|
expandedFeedbackId.value = null;
|
||||||
|
if (isOpsOverviewTable.value) {
|
||||||
|
tableData.value = [];
|
||||||
|
await loadOpsOverview();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isIssueAnalysisTable.value) {
|
||||||
|
tableData.value = [];
|
||||||
|
await loadIssueAnalysis();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isUsageAnalysisTable.value) {
|
||||||
|
tableData.value = [];
|
||||||
|
await loadUsageReport();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await loadTableData();
|
||||||
|
if (dataSourceTable.value === 'chat_logs' && !isApplicationOpsTable.value && !isUsageAnalysisTable.value) {
|
||||||
chatLogsTotal.value = await loadTableCount('chat_logs');
|
chatLogsTotal.value = await loadTableCount('chat_logs');
|
||||||
}
|
}
|
||||||
|
if (isMergedFeedbackTable.value) {
|
||||||
|
await loadGeneralFeedbackTotal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 「用户反馈与回答评价」页内切换 Tab 时,重建列配置并按新数据源重新加载。
|
||||||
|
*/
|
||||||
|
watch(feedbackTab, async () => {
|
||||||
|
if (!isMergedFeedbackTable.value) return;
|
||||||
|
chatLogsColumns.value = [];
|
||||||
|
selectedReportRowIds.value = [];
|
||||||
|
showChatLogsColumnPanel.value = false;
|
||||||
|
showChatLogsSelection.value = false;
|
||||||
|
reportCurrentPage.value = 1;
|
||||||
|
reportHeaderSort.value = null;
|
||||||
|
expandedFeedbackId.value = null;
|
||||||
|
await loadTableData();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换「用户反馈与回答评价」页内 Tab。
|
||||||
|
* @param tab - general=意见反馈,rating=回答评价
|
||||||
|
*/
|
||||||
|
const switchFeedbackTab = (tab: ReportFeedbackTab): void => {
|
||||||
|
feedbackTab.value = tab;
|
||||||
|
};
|
||||||
|
|
||||||
watch(chatLogsColumns, () => {
|
watch(chatLogsColumns, () => {
|
||||||
saveChatLogsColumns();
|
saveChatLogsColumns();
|
||||||
}, { deep: true });
|
}, { deep: true });
|
||||||
@@ -1108,6 +1659,12 @@ watch(usageRange, () => {
|
|||||||
void loadUsageReport();
|
void loadUsageReport();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(opsOverviewRange, () => {
|
||||||
|
if (isOpsOverviewTable.value) {
|
||||||
|
void loadOpsOverview();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
watch(usageAgentPageSize, () => {
|
watch(usageAgentPageSize, () => {
|
||||||
usageAgentPage.value = 1;
|
usageAgentPage.value = 1;
|
||||||
});
|
});
|
||||||
@@ -1134,21 +1691,62 @@ watch([reportPageSize, sortedTableData], () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch([reportPageSize, issueQuestionTotal], () => {
|
||||||
|
if (!isIssueAnalysisTable.value) return;
|
||||||
|
if (reportCurrentPage.value > issueQuestionTotalPages.value) {
|
||||||
|
reportCurrentPage.value = issueQuestionTotalPages.value;
|
||||||
|
}
|
||||||
|
if (reportCurrentPage.value < 1) {
|
||||||
|
reportCurrentPage.value = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const loadAll = async (): Promise<void> => {
|
const loadAll = async (): Promise<void> => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
// 运营总览:走独立 /reports/overview 接口
|
||||||
|
if (isOpsOverviewTable.value) {
|
||||||
|
tableData.value = [];
|
||||||
|
chatLogsColumns.value = [];
|
||||||
|
selectedReportRowIds.value = [];
|
||||||
|
showChatLogsColumnPanel.value = false;
|
||||||
|
showChatLogsSelection.value = false;
|
||||||
|
reportCurrentPage.value = 1;
|
||||||
|
reportHeaderSort.value = null;
|
||||||
|
await loadOpsOverview();
|
||||||
|
isLoading.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 问题分析:高频问题簇 KPI + 优先处理问题(复用聊天日志风险规则)
|
||||||
|
if (isIssueAnalysisTable.value) {
|
||||||
|
tableData.value = [];
|
||||||
|
chatLogsColumns.value = [];
|
||||||
|
selectedReportRowIds.value = [];
|
||||||
|
showChatLogsColumnPanel.value = false;
|
||||||
|
showChatLogsSelection.value = false;
|
||||||
|
reportCurrentPage.value = 1;
|
||||||
|
reportHeaderSort.value = null;
|
||||||
|
await loadIssueAnalysis();
|
||||||
|
isLoading.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
await loadReports();
|
await loadReports();
|
||||||
applyRouteQueryFilters();
|
applyRouteQueryFilters();
|
||||||
|
ensureChatLogsRange();
|
||||||
selectedReportRowIds.value = [];
|
selectedReportRowIds.value = [];
|
||||||
showChatLogsColumnPanel.value = false;
|
showChatLogsColumnPanel.value = false;
|
||||||
showChatLogsSelection.value = false;
|
showChatLogsSelection.value = false;
|
||||||
reportCurrentPage.value = 1;
|
reportCurrentPage.value = 1;
|
||||||
reportHeaderSort.value = null;
|
reportHeaderSort.value = null;
|
||||||
|
expandedFeedbackId.value = null;
|
||||||
await loadTableData();
|
await loadTableData();
|
||||||
if (dataSourceTable.value === 'chat_logs' && !isApplicationOpsTable.value) {
|
if (dataSourceTable.value === 'chat_logs' && !isApplicationOpsTable.value && !isUsageAnalysisTable.value) {
|
||||||
chatLogsTotal.value = await loadTableCount('chat_logs');
|
chatLogsTotal.value = await loadTableCount('chat_logs');
|
||||||
} else {
|
} else {
|
||||||
showChatLogsSelection.value = false;
|
showChatLogsSelection.value = false;
|
||||||
}
|
}
|
||||||
|
if (isMergedFeedbackTable.value) {
|
||||||
|
await loadGeneralFeedbackTotal();
|
||||||
|
}
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1164,6 +1762,8 @@ watch([reportPageSize, sortedTableData], () => {
|
|||||||
usageUserTopLimit,
|
usageUserTopLimit,
|
||||||
usageActiveAgentCount,
|
usageActiveAgentCount,
|
||||||
usageTrendMax,
|
usageTrendMax,
|
||||||
|
usageTrendByDay,
|
||||||
|
opsTrendByDay,
|
||||||
usageLowAgentMaxChats,
|
usageLowAgentMaxChats,
|
||||||
usageLowAgentListLimit,
|
usageLowAgentListLimit,
|
||||||
usageSpikeDayMinChats: USAGE_SPIKE_DAY_MIN_CHATS,
|
usageSpikeDayMinChats: USAGE_SPIKE_DAY_MIN_CHATS,
|
||||||
@@ -1183,6 +1783,9 @@ watch([reportPageSize, sortedTableData], () => {
|
|||||||
goToUsageUserPage,
|
goToUsageUserPage,
|
||||||
prevUsageUserPage,
|
prevUsageUserPage,
|
||||||
nextUsageUserPage,
|
nextUsageUserPage,
|
||||||
|
opsOverview,
|
||||||
|
opsOverviewRange,
|
||||||
|
issueAnalysis,
|
||||||
applicationReport,
|
applicationReport,
|
||||||
applicationRange,
|
applicationRange,
|
||||||
applicationStatus,
|
applicationStatus,
|
||||||
@@ -1227,11 +1830,51 @@ watch([reportPageSize, sortedTableData], () => {
|
|||||||
isUsageAnalysisTable,
|
isUsageAnalysisTable,
|
||||||
isApplicationOpsTable,
|
isApplicationOpsTable,
|
||||||
isChatLogsTable,
|
isChatLogsTable,
|
||||||
|
isMergedFeedbackTable,
|
||||||
|
isOpsOverviewTable,
|
||||||
|
isIssueAnalysisTable,
|
||||||
|
isPlaceholderTable,
|
||||||
|
isNonTablePage,
|
||||||
|
feedbackTab,
|
||||||
|
switchFeedbackTab,
|
||||||
|
generalFeedbackTotal,
|
||||||
|
feedbackSummary,
|
||||||
|
expandedFeedbackId,
|
||||||
|
closeFeedback,
|
||||||
|
feedbackTypeOptions,
|
||||||
|
feedbackModuleOptions,
|
||||||
|
feedbackSourceOptions,
|
||||||
|
getTranslatedFeedbackValue,
|
||||||
|
openFeedbackChatLog,
|
||||||
|
getFeedbackChatLogCell,
|
||||||
|
toggleFeedbackContent,
|
||||||
|
isFeedbackContentExpanded,
|
||||||
|
openFeedbackContent,
|
||||||
|
closeFeedbackContent,
|
||||||
|
chatLogDetailVisible,
|
||||||
|
chatLogDetailRow,
|
||||||
|
openChatLogDetail,
|
||||||
|
closeChatLogDetail,
|
||||||
|
chatLogTops,
|
||||||
|
chatLogTopsQuestionsMax,
|
||||||
|
chatLogTopsAnswersMax,
|
||||||
|
chatLogRangeOptions,
|
||||||
|
chatLogAgents,
|
||||||
|
getChatLogRiskStatusLabel,
|
||||||
|
getChatLogRiskReasonLabel,
|
||||||
|
getChatLogRiskCheckLabel,
|
||||||
|
getChatLogRiskStatusClass,
|
||||||
|
resetChatLogFilters,
|
||||||
|
chatLogRiskStatusOptions: CHAT_LOG_RISK_STATUS_OPTIONS,
|
||||||
showReportTable,
|
showReportTable,
|
||||||
visibleReportKeys,
|
visibleReportKeys,
|
||||||
allReportRowsSelected,
|
allReportRowsSelected,
|
||||||
sortedTableData,
|
sortedTableData,
|
||||||
paginatedSortedTableData,
|
paginatedSortedTableData,
|
||||||
|
issueQuestionTotal,
|
||||||
|
issueQuestionTotalPages,
|
||||||
|
paginatedIssueQuestions,
|
||||||
|
goToIssueAnalysisPage,
|
||||||
reportTotalRows,
|
reportTotalRows,
|
||||||
reportTotalPages,
|
reportTotalPages,
|
||||||
reportRangeStart,
|
reportRangeStart,
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
/**
|
|
||||||
* features/admin/modules/requests/RequestsPage.vue
|
|
||||||
* 权限申请管理独立页面。路由:/admin/requests
|
|
||||||
*/
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { ShieldCheck } from 'lucide-vue-next';
|
|
||||||
import { useRequestsAdmin } from './composables/useRequestsAdmin';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const {
|
|
||||||
requests,
|
|
||||||
isLoading,
|
|
||||||
loadAll,
|
|
||||||
approveRequest,
|
|
||||||
rejectRequest,
|
|
||||||
} = useRequestsAdmin();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void loadAll();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<section class="admin-table-section">
|
|
||||||
<div v-if="isLoading" class="flex items-center justify-center py-20">
|
|
||||||
<div class="animate-spin rounded-full h-10 w-10 border-b-2 border-brand-600" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<template v-else>
|
|
||||||
<div class="admin-table-header">
|
|
||||||
<div>
|
|
||||||
<h2 class="section-title">{{ t('admin.request.title') }}</h2>
|
|
||||||
<p class="section-desc mt-1">{{ t('admin.request.subtitle') }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="requests.length === 0"
|
|
||||||
class="flex flex-col items-center justify-center py-16 text-muted"
|
|
||||||
>
|
|
||||||
<div class="w-16 h-16 bg-surface-soft rounded-full flex items-center justify-center mb-4">
|
|
||||||
<ShieldCheck class="w-8 h-8 text-muted" />
|
|
||||||
</div>
|
|
||||||
<p>{{ t('admin.request.noPending') }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table v-else class="admin-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="px-8 py-4 text-xs">{{ t('admin.request.headers.userId') }}</th>
|
|
||||||
<th class="px-8 py-4 text-xs">{{ t('admin.request.headers.targetAgent') }}</th>
|
|
||||||
<th class="px-8 py-4 text-xs">{{ t('admin.request.headers.reason') }}</th>
|
|
||||||
<th class="px-8 py-4 text-xs">{{ t('admin.request.headers.status') }}</th>
|
|
||||||
<th class="px-8 py-4 text-xs text-right">{{ t('admin.request.headers.actions') }}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="req in requests" :key="req.id">
|
|
||||||
<td class="px-8 py-4 text-sm font-medium text-primary">{{ req.user_id }}</td>
|
|
||||||
<td class="px-8 py-4 text-sm text-secondary">{{ req.agent_id }}</td>
|
|
||||||
<td
|
|
||||||
class="px-8 py-4 text-sm text-muted max-w-xs truncate"
|
|
||||||
:title="req.reason"
|
|
||||||
>
|
|
||||||
{{ req.reason || '-' }}
|
|
||||||
</td>
|
|
||||||
<td class="px-8 py-4">
|
|
||||||
<span
|
|
||||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-50 text-yellow-700 border border-yellow-100"
|
|
||||||
>
|
|
||||||
{{ t('admin.status.' + req.status) }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td class="px-8 py-4 text-right">
|
|
||||||
<div class="flex justify-end gap-3">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="text-green-600 hover:text-green-800 text-sm font-medium hover:underline"
|
|
||||||
@click="approveRequest(req.id)"
|
|
||||||
>
|
|
||||||
{{ t('admin.request.approve') }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="text-red-500 hover:text-red-700 text-sm font-medium hover:underline"
|
|
||||||
@click="rejectRequest(req.id)"
|
|
||||||
>
|
|
||||||
{{ t('admin.request.reject') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</template>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/**
|
|
||||||
* features/admin/modules/requests/composables/useRequestsAdmin.ts
|
|
||||||
* 权限申请管理:列表、通过、拒绝。
|
|
||||||
*/
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import {
|
|
||||||
approveAdminPermissionRequest,
|
|
||||||
listAdminPermissionRequests,
|
|
||||||
rejectAdminPermissionRequest,
|
|
||||||
} from '@/features/admin/api/admin.api';
|
|
||||||
import { useMessage } from '@/shared/composables/useMessage';
|
|
||||||
import { useAdminNavBadges } from '@/features/admin/composables/useAdminNavBadges';
|
|
||||||
import type { AdminPermissionRequestRow } from '@/features/admin/types/request.types';
|
|
||||||
|
|
||||||
export function useRequestsAdmin() {
|
|
||||||
const { t } = useI18n();
|
|
||||||
const msg = useMessage();
|
|
||||||
const { refreshBadges } = useAdminNavBadges();
|
|
||||||
|
|
||||||
const requests = ref<AdminPermissionRequestRow[]>([]);
|
|
||||||
const isLoading = ref(true);
|
|
||||||
|
|
||||||
const loadRequests = async (): Promise<void> => {
|
|
||||||
try {
|
|
||||||
requests.value = await listAdminPermissionRequests();
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Error loading permission requests:', e);
|
|
||||||
requests.value = [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadAll = async (): Promise<void> => {
|
|
||||||
isLoading.value = true;
|
|
||||||
await loadRequests();
|
|
||||||
isLoading.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const approveRequest = async (id: number): Promise<void> => {
|
|
||||||
try {
|
|
||||||
await approveAdminPermissionRequest(id);
|
|
||||||
await loadRequests();
|
|
||||||
await refreshBadges();
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
msg.error((e as Error).message || t('admin.msg.failed'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const rejectRequest = async (id: number): Promise<void> => {
|
|
||||||
try {
|
|
||||||
await rejectAdminPermissionRequest(id);
|
|
||||||
await loadRequests();
|
|
||||||
await refreshBadges();
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
msg.error((e as Error).message || t('admin.msg.failed'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
requests,
|
|
||||||
isLoading,
|
|
||||||
loadAll,
|
|
||||||
approveRequest,
|
|
||||||
rejectRequest,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -11,6 +11,7 @@ import { Edit, Plus, Trash2, Users } from 'lucide-vue-next';
|
|||||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||||
import SortableTableHeader from '@/shared/components/SortableTableHeader.vue';
|
import SortableTableHeader from '@/shared/components/SortableTableHeader.vue';
|
||||||
|
import { getUserAvatarLabel } from '@/shared/utils/user-avatar';
|
||||||
import BatchEditUserModal from './components/BatchEditUserModal.vue';
|
import BatchEditUserModal from './components/BatchEditUserModal.vue';
|
||||||
import BatchPermissionModal from './components/BatchPermissionModal.vue';
|
import BatchPermissionModal from './components/BatchPermissionModal.vue';
|
||||||
import UserFormModal from './components/UserFormModal.vue';
|
import UserFormModal from './components/UserFormModal.vue';
|
||||||
@@ -199,7 +200,7 @@ onMounted(() => {
|
|||||||
<td class="px-6 py-4">
|
<td class="px-6 py-4">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<div class="h-9 w-9 rounded-full bg-gradient-to-br from-brand-500 to-indigo-600 text-white flex items-center justify-center text-xs font-bold shadow-sm">
|
<div class="h-9 w-9 rounded-full bg-gradient-to-br from-brand-500 to-indigo-600 text-white flex items-center justify-center text-xs font-bold shadow-sm">
|
||||||
{{ user.username.charAt(0).toUpperCase() }}
|
{{ getUserAvatarLabel(user) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-3 text-sm font-medium text-primary">{{ user.username }}</div>
|
<div class="ml-3 text-sm font-medium text-primary">{{ user.username }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,17 +2,10 @@
|
|||||||
* features/admin/stores/admin-nav.store.ts
|
* features/admin/stores/admin-nav.store.ts
|
||||||
* 管理后台导航 UI 状态(侧栏折叠、报表/企微子菜单展开、角标)。
|
* 管理后台导航 UI 状态(侧栏折叠、报表/企微子菜单展开、角标)。
|
||||||
*
|
*
|
||||||
* 角标数据来自 GET /api/admin/dashboard/badges,在 store 内做 TTL 缓存与 in-flight 去重,
|
|
||||||
* 避免切换 admin 子路由时重复请求(AdminLayout 挂载一次即可)。
|
|
||||||
* 报表与企业微信子菜单默认折叠,进入对应模块时由 AdminNav 展开。
|
* 报表与企业微信子菜单默认折叠,进入对应模块时由 AdminNav 展开。
|
||||||
*/
|
*/
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { getAdminDashboardBadges } from '@/features/admin/api/admin.api';
|
|
||||||
import type { AdminModuleId } from '../types/admin.types';
|
|
||||||
|
|
||||||
/** 角标缓存有效期(毫秒):此时间内 ensureBadges 直接复用内存中的计数 */
|
|
||||||
const BADGE_CACHE_TTL_MS = 60_000;
|
|
||||||
|
|
||||||
export const useAdminNavStore = defineStore('adminNav', () => {
|
export const useAdminNavStore = defineStore('adminNav', () => {
|
||||||
const sidebarCollapsed = ref(false);
|
const sidebarCollapsed = ref(false);
|
||||||
@@ -20,77 +13,16 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
|||||||
const reportsExpanded = ref(false);
|
const reportsExpanded = ref(false);
|
||||||
/** 企业微信子菜单:默认折叠 */
|
/** 企业微信子菜单:默认折叠 */
|
||||||
const wecomExpanded = ref(false);
|
const wecomExpanded = ref(false);
|
||||||
/** 「用户审批」导航角标:pending 注册用户数 */
|
|
||||||
/** 「权限申请」导航角标:pending 权限申请数 */
|
|
||||||
const pendingRequestsCount = ref(0);
|
|
||||||
|
|
||||||
/** 上次成功拉取 badges 的时间戳;0 表示尚未拉取 */
|
|
||||||
let badgesFetchedAt = 0;
|
|
||||||
/** 进行中的 badges 请求 Promise,用于并发调用合并为单次 HTTP */
|
|
||||||
let badgesInFlight: Promise<void> | null = null;
|
|
||||||
|
|
||||||
const toggleSidebar = (): void => {
|
const toggleSidebar = (): void => {
|
||||||
sidebarCollapsed.value = !sidebarCollapsed.value;
|
sidebarCollapsed.value = !sidebarCollapsed.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setBadgeCounts = (_approvals: number, requests: number): void => {
|
|
||||||
pendingRequestsCount.value = requests;
|
|
||||||
};
|
|
||||||
|
|
||||||
const badgeForModule = (moduleId: AdminModuleId): number | undefined => {
|
|
||||||
if (moduleId === 'requests' && pendingRequestsCount.value > 0) return pendingRequestsCount.value;
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拉取侧栏角标。force=false 时命中 TTL 缓存则跳过网络请求;
|
|
||||||
* 多个组件同时调用时会共享同一 inFlight,避免重复打 /dashboard/badges。
|
|
||||||
*/
|
|
||||||
const fetchBadges = async (options?: { force?: boolean }): Promise<void> => {
|
|
||||||
const force = options?.force ?? false;
|
|
||||||
const now = Date.now();
|
|
||||||
|
|
||||||
// 非强制刷新且缓存未过期:直接返回 store 中已有计数
|
|
||||||
if (!force && badgesFetchedAt > 0 && now - badgesFetchedAt < BADGE_CACHE_TTL_MS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 已有请求在飞:等待同一 Promise,不再发起第二次请求
|
|
||||||
if (badgesInFlight) {
|
|
||||||
return badgesInFlight;
|
|
||||||
}
|
|
||||||
|
|
||||||
badgesInFlight = (async () => {
|
|
||||||
try {
|
|
||||||
const data = await getAdminDashboardBadges();
|
|
||||||
setBadgeCounts(0, data.pending_requests);
|
|
||||||
badgesFetchedAt = Date.now();
|
|
||||||
} catch {
|
|
||||||
setBadgeCounts(0, 0);
|
|
||||||
} finally {
|
|
||||||
badgesInFlight = null;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
return badgesInFlight;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** AdminLayout onMounted:有有效缓存则跳过请求 */
|
|
||||||
const ensureBadges = (): Promise<void> => fetchBadges({ force: false });
|
|
||||||
|
|
||||||
/** 审批/驳回操作后:忽略缓存,立即重新拉取角标 */
|
|
||||||
const refreshBadges = (): Promise<void> => fetchBadges({ force: true });
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sidebarCollapsed,
|
sidebarCollapsed,
|
||||||
reportsExpanded,
|
reportsExpanded,
|
||||||
wecomExpanded,
|
wecomExpanded,
|
||||||
pendingRequestsCount,
|
|
||||||
toggleSidebar,
|
toggleSidebar,
|
||||||
setBadgeCounts,
|
|
||||||
badgeForModule,
|
|
||||||
ensureBadges,
|
|
||||||
refreshBadges,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* features/admin/types/admin.types.ts
|
* features/admin/types/admin.types.ts
|
||||||
* 绠$悊鍚庡彴鍩熷叕鍏辩被鍨嬨€?
|
* 绠$悊鍚庡彴鍩熷叕鍏辩被鍨嬨€?
|
||||||
*/
|
*/
|
||||||
@@ -15,7 +15,6 @@ export type AdminModuleId =
|
|||||||
| 'wecom'
|
| 'wecom'
|
||||||
| 'linked_services'
|
| 'linked_services'
|
||||||
| 'permissions'
|
| 'permissions'
|
||||||
| 'requests'
|
|
||||||
| 'platform_apps'
|
| 'platform_apps'
|
||||||
| 'procurement_contract'
|
| 'procurement_contract'
|
||||||
| 'reports';
|
| 'reports';
|
||||||
@@ -25,9 +24,10 @@ export type AdminReportTableId =
|
|||||||
| 'users'
|
| 'users'
|
||||||
| 'agents'
|
| 'agents'
|
||||||
| 'chat_logs'
|
| 'chat_logs'
|
||||||
| 'permission_requests'
|
|
||||||
| 'general_feedbacks'
|
| 'general_feedbacks'
|
||||||
| 'feedbacks';
|
| 'feedbacks'
|
||||||
|
| 'ops_overview'
|
||||||
|
| 'issue_analysis';
|
||||||
|
|
||||||
export interface AdminUserRow {
|
export interface AdminUserRow {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -51,6 +51,22 @@ export interface AdminDepartmentRow {
|
|||||||
code?: string;
|
code?: string;
|
||||||
company?: string;
|
company?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
member_count?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminDepartmentMember {
|
||||||
|
id: number;
|
||||||
|
username: string;
|
||||||
|
real_name?: string;
|
||||||
|
employee_id?: string;
|
||||||
|
email?: string;
|
||||||
|
status?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminDepartmentMembersResponse {
|
||||||
|
department: AdminDepartmentRow;
|
||||||
|
count: number;
|
||||||
|
members: AdminDepartmentMember[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminAgentOption {
|
export interface AdminAgentOption {
|
||||||
|
|||||||
@@ -11,11 +11,6 @@ export interface AdminDashboardSummary {
|
|||||||
avg_score: number;
|
avg_score: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GET /api/admin/dashboard/badges — 侧栏「用户审批」「权限申请」角标 */
|
|
||||||
export interface AdminDashboardBadges {
|
|
||||||
pending_requests: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AdminUsageReport {
|
export interface AdminUsageReport {
|
||||||
total: number;
|
total: number;
|
||||||
by_user: { username: string; count: number }[];
|
by_user: { username: string; count: number }[];
|
||||||
|
|||||||
@@ -8,6 +8,19 @@
|
|||||||
/** 使用分析时间范围(与后端 USAGE_RANGE_DAYS 一致) */
|
/** 使用分析时间范围(与后端 USAGE_RANGE_DAYS 一致) */
|
||||||
export type UsageRangeKey = '7d' | '30d' | '90d' | '180d' | '365d';
|
export type UsageRangeKey = '7d' | '30d' | '90d' | '180d' | '365d';
|
||||||
|
|
||||||
|
/** 「用户反馈与回答评价」页内 Tab:general=意见反馈(general_feedbacks),rating=回答评价(feedbacks) */
|
||||||
|
export type ReportFeedbackTab = 'general' | 'rating';
|
||||||
|
|
||||||
|
/** 工作日 x 时段热力图数据 */
|
||||||
|
export interface UsageHourHeatmap {
|
||||||
|
/** 纵轴一周日序号(ISO:1=周一 .. 7=周日) */
|
||||||
|
weekdays: number[];
|
||||||
|
/** 横轴小时(0-23) */
|
||||||
|
hours: number[];
|
||||||
|
/** 单元格矩阵:cells[weekdayIndex][hourIndex] = 该日该时段对话量 */
|
||||||
|
cells: number[][];
|
||||||
|
}
|
||||||
|
|
||||||
export interface UsageReport {
|
export interface UsageReport {
|
||||||
total: number;
|
total: number;
|
||||||
/** 当前统计时间范围 */
|
/** 当前统计时间范围 */
|
||||||
@@ -16,6 +29,10 @@ export interface UsageReport {
|
|||||||
by_agent: { agent: string; count: number }[];
|
by_agent: { agent: string; count: number }[];
|
||||||
/** 当前范围内按自然日聚合的对话趋势,用于使用分析柱状图。 */
|
/** 当前范围内按自然日聚合的对话趋势,用于使用分析柱状图。 */
|
||||||
by_day?: { date: string; count: number }[];
|
by_day?: { date: string; count: number }[];
|
||||||
|
/** 人员/部门排行:按部门聚合对话量与去重用户数 */
|
||||||
|
by_department?: { department: string; chat_count: number; user_count: number }[];
|
||||||
|
/** 工作日 x 时段热力图:横轴=小时,纵轴=工作日(周一..周五),格子颜色深浅=该日该时段对话量 */
|
||||||
|
hour_heatmap?: UsageHourHeatmap;
|
||||||
/**
|
/**
|
||||||
* 运营提醒:启用应用中范围内对话次数 ≤ low_agent_max_chats 的列表(含零使用)。
|
* 运营提醒:启用应用中范围内对话次数 ≤ low_agent_max_chats 的列表(含零使用)。
|
||||||
* 由后端以 Agent 主表左连接统计,与应用运营「零使用」口径对齐。
|
* 由后端以 Agent 主表左连接统计,与应用运营「零使用」口径对齐。
|
||||||
@@ -35,8 +52,8 @@ export interface UsageReport {
|
|||||||
/** 应用运营报表:启用状态筛选 */
|
/** 应用运营报表:启用状态筛选 */
|
||||||
export type ApplicationStatusFilter = 'all' | 'active' | 'inactive';
|
export type ApplicationStatusFilter = 'all' | 'active' | 'inactive';
|
||||||
|
|
||||||
/** 应用运营报表:是否有使用筛选 */
|
/** 应用运营报表:是否有使用筛选(unused_authorized=已授权未使用) */
|
||||||
export type ApplicationUsageFilter = 'all' | 'used' | 'unused';
|
export type ApplicationUsageFilter = 'all' | 'used' | 'unused' | 'unused_authorized';
|
||||||
|
|
||||||
/** 应用运营报表可排序字段 */
|
/** 应用运营报表可排序字段 */
|
||||||
export type ApplicationSortKey =
|
export type ApplicationSortKey =
|
||||||
@@ -58,11 +75,12 @@ export interface ApplicationReportItem {
|
|||||||
last_active_at: string | null;
|
last_active_at: string | null;
|
||||||
authorized_users: number;
|
authorized_users: number;
|
||||||
/** 后端仍返回;应用运营页已不再展示待审列 */
|
/** 后端仍返回;应用运营页已不再展示待审列 */
|
||||||
pending_requests?: number;
|
|
||||||
avg_score: number | null;
|
avg_score: number | null;
|
||||||
feedback_count: number;
|
feedback_count: number;
|
||||||
tokens_used: number;
|
tokens_used: number;
|
||||||
avg_latency_ms: number | null;
|
avg_latency_ms: number | null;
|
||||||
|
/** 「已授权未使用」:已授权给用户但范围内无对话 */
|
||||||
|
authorized_unused?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApplicationReportSummary {
|
export interface ApplicationReportSummary {
|
||||||
@@ -72,6 +90,8 @@ export interface ApplicationReportSummary {
|
|||||||
unused_agents: number;
|
unused_agents: number;
|
||||||
/** 后端仍返回;应用运营页已不再展示待审摘要卡 */
|
/** 后端仍返回;应用运营页已不再展示待审摘要卡 */
|
||||||
pending_permission_total?: number;
|
pending_permission_total?: number;
|
||||||
|
/** 「已授权未使用」应用数量 */
|
||||||
|
authorized_unused_count?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApplicationReport {
|
export interface ApplicationReport {
|
||||||
@@ -108,3 +128,40 @@ export interface SortRule {
|
|||||||
key: string;
|
key: string;
|
||||||
direction: SortDirection;
|
direction: SortDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 运营总览 KPI 卡片指标 */
|
||||||
|
export interface OpsOverviewKpi {
|
||||||
|
total_chats: number;
|
||||||
|
active_users: number;
|
||||||
|
active_agents: number;
|
||||||
|
/** 待跟进反馈数量(status=pending 的通用意见反馈,与反馈页「待处理」一致) */
|
||||||
|
pending_feedback: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 运营总览:对话趋势与环比 */
|
||||||
|
export interface OpsOverviewTrend {
|
||||||
|
by_day: { date: string; count: number }[];
|
||||||
|
total: number;
|
||||||
|
prev_total: number;
|
||||||
|
/** 环比变化百分数;无上一周期数据时为 null */
|
||||||
|
change_pct: number | null;
|
||||||
|
range_days: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 运营总览:Top / 低使用应用项 */
|
||||||
|
export interface OpsOverviewApp {
|
||||||
|
agent_id: number;
|
||||||
|
name: string;
|
||||||
|
chat_count: number;
|
||||||
|
unique_users: number;
|
||||||
|
avg_score: number | null;
|
||||||
|
authorized_users?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OpsOverviewReport {
|
||||||
|
range: UsageRangeKey;
|
||||||
|
kpi: OpsOverviewKpi;
|
||||||
|
trend: OpsOverviewTrend;
|
||||||
|
top_apps: OpsOverviewApp[];
|
||||||
|
low_use_apps: OpsOverviewApp[];
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* features/admin/types/request.types.ts
|
|
||||||
* 权限申请管理类型。
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface AdminPermissionRequestRow {
|
|
||||||
id: number;
|
|
||||||
user_id: number;
|
|
||||||
agent_id: number;
|
|
||||||
reason: string;
|
|
||||||
status: string;
|
|
||||||
created_at: string;
|
|
||||||
reviewed_at?: string | null;
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* features/admin/views/AdminLayout.vue
|
* features/admin/views/AdminLayout.vue
|
||||||
* 管理后台壳层:顶栏 + AdminNav + 子路由出口。
|
* 管理后台壳层:顶栏 + AdminNav + 子路由出口。
|
||||||
* 角标仅在 Layout 首次挂载时 ensureBadges(store 内 60s TTL 缓存)。
|
* 逻辑:桌面端将导航与业务内容拆成独立纵向滚动区,任一侧滚动不会带动另一侧。
|
||||||
*/
|
*/
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { ArrowLeft } from 'lucide-vue-next';
|
import { ArrowLeft } from 'lucide-vue-next';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
@@ -16,15 +15,11 @@ const { t } = useI18n();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const navStore = useAdminNavStore();
|
const navStore = useAdminNavStore();
|
||||||
|
|
||||||
// 进入 /admin 时拉一次角标;切换子路由不重复挂载 Layout,故不会重复请求
|
|
||||||
onMounted(() => {
|
|
||||||
void navStore.ensureBadges();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="page-shell min-h-screen font-sans flex flex-col">
|
<div class="page-shell flex h-dvh min-h-screen flex-col overflow-hidden font-sans">
|
||||||
<header class="app-header px-6">
|
<header class="app-header shrink-0 px-6">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<button type="button" class="btn-icon-ds md:block hidden" @click="navStore.toggleSidebar()">
|
<button type="button" class="btn-icon-ds md:block hidden" @click="navStore.toggleSidebar()">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/></svg>
|
||||||
@@ -42,9 +37,11 @@ onMounted(() => {
|
|||||||
<AppHeaderTools />
|
<AppHeaderTools />
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="flex-1 w-full mx-auto px-4 md:px-8 py-6 md:py-8 flex flex-col md:flex-row gap-8 items-start">
|
<main class="flex min-h-0 flex-1 w-full mx-auto flex-col gap-8 overflow-hidden px-4 py-6 md:flex-row md:items-stretch md:px-8 md:py-8">
|
||||||
<AdminNav />
|
<aside class="min-h-0 shrink-0 overflow-y-auto md:pr-1">
|
||||||
<section class="flex-1 min-w-0 space-y-8 w-full">
|
<AdminNav />
|
||||||
|
</aside>
|
||||||
|
<section class="min-h-0 w-full flex-1 space-y-8 overflow-y-auto md:pr-1">
|
||||||
<router-view />
|
<router-view />
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
/**
|
/**
|
||||||
* features/kb/components/KbAdminPanel.vue
|
* features/kb/components/KbAdminPanel.vue
|
||||||
* 知识库配置面板(治理面:分组、Dify、任务队列)。
|
* 知识库配置面板(治理面:分组、Dify)。
|
||||||
* 依赖:kb.api、DifySettingsDialog、DifyHealthDialog、DeleteConfirmDialog、Vue I18n。
|
* 依赖:kb.api、DifySettingsDialog、DifyHealthDialog、DeleteConfirmDialog、Vue I18n。
|
||||||
* 逻辑:管理控制台加载知识库分组与任务队列;分组列表在主表格过滤排序,新增/编辑通过右侧抽屉提交。
|
* 逻辑:管理控制台加载知识库分组;分组列表在主表格过滤排序,新增/编辑通过右侧抽屉提交。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
Wrench,
|
Wrench,
|
||||||
} from 'lucide-vue-next';
|
} from 'lucide-vue-next';
|
||||||
import KbGroupDrawer, { type KbGroupFormValue } from './KbGroupDrawer.vue';
|
import KbGroupDrawer, { type KbGroupFormValue } from './KbGroupDrawer.vue';
|
||||||
import KbJobQueuePanel from './KbJobQueuePanel.vue';
|
|
||||||
import DifyHealthDialog from './DifyHealthDialog.vue';
|
import DifyHealthDialog from './DifyHealthDialog.vue';
|
||||||
import DifySettingsDialog from './DifySettingsDialog.vue';
|
import DifySettingsDialog from './DifySettingsDialog.vue';
|
||||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||||
@@ -30,11 +29,8 @@ import {
|
|||||||
createKbGroup,
|
createKbGroup,
|
||||||
deleteKbGroup,
|
deleteKbGroup,
|
||||||
getKbGroupsSafe,
|
getKbGroupsSafe,
|
||||||
getKbJobsSafe,
|
|
||||||
runKbJob,
|
|
||||||
updateKbGroup,
|
updateKbGroup,
|
||||||
type KbGroup,
|
type KbGroup,
|
||||||
type KbJob,
|
|
||||||
} from '../api/kb.api';
|
} from '../api/kb.api';
|
||||||
import { formatDateTime } from '../utils/kb-display.utils';
|
import { formatDateTime } from '../utils/kb-display.utils';
|
||||||
|
|
||||||
@@ -45,7 +41,6 @@ const router = useRouter();
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const groups = ref<KbGroup[]>([]);
|
const groups = ref<KbGroup[]>([]);
|
||||||
const jobs = ref<KbJob[]>([]);
|
|
||||||
const isSubmitting = ref(false);
|
const isSubmitting = ref(false);
|
||||||
const isDeleting = ref(false);
|
const isDeleting = ref(false);
|
||||||
const isRefreshing = ref(false);
|
const isRefreshing = ref(false);
|
||||||
@@ -53,7 +48,6 @@ const editingGroupId = ref<number | null>(null);
|
|||||||
const form = ref<KbGroupFormValue>({ name: '', description: '' });
|
const form = ref<KbGroupFormValue>({ name: '', description: '' });
|
||||||
const feedback = ref('');
|
const feedback = ref('');
|
||||||
const feedbackType = ref<'success' | 'error' | ''>('');
|
const feedbackType = ref<'success' | 'error' | ''>('');
|
||||||
const runningJobId = ref<number | string | null>(null);
|
|
||||||
const settingsDialogOpen = ref(false);
|
const settingsDialogOpen = ref(false);
|
||||||
const healthDialogOpen = ref(false);
|
const healthDialogOpen = ref(false);
|
||||||
const deleteDialogOpen = ref(false);
|
const deleteDialogOpen = ref(false);
|
||||||
@@ -103,20 +97,15 @@ const pagedGroups = computed(() => {
|
|||||||
/** 格式化分组更新时间,避免管理台表格直接暴露后端 ISO 时间字符串。 */
|
/** 格式化分组更新时间,避免管理台表格直接暴露后端 ISO 时间字符串。 */
|
||||||
const formatGroupUpdatedAt = (value?: string | null) => formatDateTime(value);
|
const formatGroupUpdatedAt = (value?: string | null) => formatDateTime(value);
|
||||||
|
|
||||||
/** 加载知识库治理页的分组与任务队列,供页面初始渲染和操作后刷新复用。 */
|
/** 加载知识库治理页的分组数据,供页面初始渲染和操作后刷新复用。 */
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
isRefreshing.value = true;
|
isRefreshing.value = true;
|
||||||
const [groupsResult, jobsResult] = await Promise.all([getKbGroupsSafe(), getKbJobsSafe()]);
|
const groupsResult = await getKbGroupsSafe();
|
||||||
if (groupsResult.ok) groups.value = groupsResult.data;
|
if (groupsResult.ok) groups.value = groupsResult.data;
|
||||||
else {
|
else {
|
||||||
feedback.value = groupsResult.error || t('kbAdmin.msg.loadGroupsFailed');
|
feedback.value = groupsResult.error || t('kbAdmin.msg.loadGroupsFailed');
|
||||||
feedbackType.value = 'error';
|
feedbackType.value = 'error';
|
||||||
}
|
}
|
||||||
if (jobsResult.ok) jobs.value = jobsResult.data;
|
|
||||||
else {
|
|
||||||
feedback.value = jobsResult.error || t('kbAdmin.msg.loadJobsFailed');
|
|
||||||
feedbackType.value = 'error';
|
|
||||||
}
|
|
||||||
isRefreshing.value = false;
|
isRefreshing.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -199,23 +188,6 @@ const handleDeleteGroupConfirm = async () => {
|
|||||||
await loadData();
|
await loadData();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 手动执行可重试的知识库任务,并将后端执行结果反馈到页面提示区。 */
|
|
||||||
const handleRunJob = async (job: KbJob) => {
|
|
||||||
runningJobId.value = job.id;
|
|
||||||
const result = await runKbJob(job.id);
|
|
||||||
runningJobId.value = null;
|
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
feedback.value = result.error || t('kbAdmin.msg.runFailed');
|
|
||||||
feedbackType.value = 'error';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
feedback.value = result.run_result || t('kbAdmin.msg.runDone');
|
|
||||||
feedbackType.value = 'success';
|
|
||||||
await loadData();
|
|
||||||
};
|
|
||||||
|
|
||||||
watch([searchKeyword, filterMode, sortMode, pageSize], () => {
|
watch([searchKeyword, filterMode, sortMode, pageSize], () => {
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
});
|
});
|
||||||
@@ -362,11 +334,6 @@ defineExpose({ loadData });
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<KbJobQueuePanel
|
|
||||||
:jobs="jobs"
|
|
||||||
:running-job-id="runningJobId"
|
|
||||||
@run-job="handleRunJob"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { inject } from 'vue';
|
|||||||
import {
|
import {
|
||||||
User, Mail, Building, CreditCard, Globe, Save, Palette,
|
User, Mail, Building, CreditCard, Globe, Save, Palette,
|
||||||
} from 'lucide-vue-next';
|
} from 'lucide-vue-next';
|
||||||
|
import { getUserAvatarLabel } from '@/shared/utils/user-avatar';
|
||||||
import { USER_PROFILE_KEY } from '../composables/user-profile.context';
|
import { USER_PROFILE_KEY } from '../composables/user-profile.context';
|
||||||
|
|
||||||
const userProfile = inject(USER_PROFILE_KEY)!;
|
const userProfile = inject(USER_PROFILE_KEY)!;
|
||||||
@@ -21,7 +22,7 @@ const userProfile = inject(USER_PROFILE_KEY)!;
|
|||||||
<div class="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between">
|
<div class="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between">
|
||||||
<div class="flex flex-1 flex-col gap-6 sm:flex-row sm:items-center sm:justify-start">
|
<div class="flex flex-1 flex-col gap-6 sm:flex-row sm:items-center sm:justify-start">
|
||||||
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-brand-100 text-4xl font-bold text-brand-600" :class="userProfile.isMobile ? 'h-14 w-14 text-2xl' : ''">
|
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-full bg-brand-100 text-4xl font-bold text-brand-600" :class="userProfile.isMobile ? 'h-14 w-14 text-2xl' : ''">
|
||||||
{{ (userProfile.profileUser.real_name || userProfile.profileUser.username || 'U').charAt(0).toUpperCase() }}
|
{{ getUserAvatarLabel(userProfile.profileUser) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid flex-1 text-left" :class="userProfile.isMobile ? 'grid-cols-2 gap-x-4 gap-y-1' : 'grid-cols-1 gap-x-12 gap-y-3 sm:grid-cols-2'">
|
<div class="grid flex-1 text-left" :class="userProfile.isMobile ? 'grid-cols-2 gap-x-4 gap-y-1' : 'grid-cols-1 gap-x-12 gap-y-3 sm:grid-cols-2'">
|
||||||
<div :class="userProfile.isMobile ? '' : ''">
|
<div :class="userProfile.isMobile ? '' : ''">
|
||||||
|
|||||||
@@ -197,12 +197,15 @@
|
|||||||
"name": "Name",
|
"name": "Name",
|
||||||
"code": "Code",
|
"code": "Code",
|
||||||
"company": "Company",
|
"company": "Company",
|
||||||
|
"members": "Members",
|
||||||
"actions": "Actions"
|
"actions": "Actions"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"delete": "Delete"
|
"delete": "Delete",
|
||||||
|
"viewMembers": "View department members"
|
||||||
},
|
},
|
||||||
|
"members": { "title": "{name} Members", "count": "{count} members", "empty": "No members" },
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"namePlaceholder": "e.g. IT Department",
|
"namePlaceholder": "e.g. IT Department",
|
||||||
@@ -813,6 +816,8 @@
|
|||||||
"filterName": "Filter by Name/Username",
|
"filterName": "Filter by Name/Username",
|
||||||
"filterDept": "Filter by Department",
|
"filterDept": "Filter by Department",
|
||||||
"allRoles": "All Roles",
|
"allRoles": "All Roles",
|
||||||
|
"views": { "apps": "By Application", "members": "By Member" },
|
||||||
|
"appHeaders": { "app": "Application", "type": "Type", "authorized": "Authorized", "actions": "Actions", "viewMembers": "View members", "accessHint": "Open member permissions", "memberHint": "Add or remove access to this application", "memberSearch": "Search name, username, employee ID, or department", "addMember": "Grant access", "removeMember": "Remove access", "noMembers": "No matching members" },
|
||||||
"headers": {
|
"headers": {
|
||||||
"user": "User",
|
"user": "User",
|
||||||
"realName": "Real Name",
|
"realName": "Real Name",
|
||||||
@@ -855,6 +860,7 @@
|
|||||||
"report": {
|
"report": {
|
||||||
"title": "Data Reports: {table}",
|
"title": "Data Reports: {table}",
|
||||||
"subtitle": "Operational analytics and detail tracing",
|
"subtitle": "Operational analytics and detail tracing",
|
||||||
|
"currentFilterResults": "Current filter results: {total}",
|
||||||
"export": "Export Excel",
|
"export": "Export Excel",
|
||||||
"columnSettings": "Column Settings",
|
"columnSettings": "Column Settings",
|
||||||
"showSelection": "Show Selection",
|
"showSelection": "Show Selection",
|
||||||
@@ -890,12 +896,28 @@
|
|||||||
"usageRanges": {
|
"usageRanges": {
|
||||||
"7d": "Last 7 days",
|
"7d": "Last 7 days",
|
||||||
"30d": "Last 30 days",
|
"30d": "Last 30 days",
|
||||||
"90d": "Last 3 months",
|
"90d": "Last 90 days",
|
||||||
"180d": "Last 6 months",
|
"180d": "Last 6 months",
|
||||||
"365d": "Last 12 months"
|
"365d": "Last 12 months"
|
||||||
},
|
},
|
||||||
"byUser": "Requests by User",
|
"byUser": "Requests by User",
|
||||||
"byAgent": "Requests by Agent",
|
"byAgent": "Requests by Agent",
|
||||||
|
"byDepartment": "Requests by Department",
|
||||||
|
"usageByDepartmentHint": "Chat volume and participating users aggregated by department",
|
||||||
|
"unknownDepartment": "Unassigned",
|
||||||
|
"usageByDepartmentEmpty": "No department chat activity yet",
|
||||||
|
"usageHourHeatmap": "Weekday × time-slot heatmap",
|
||||||
|
"usageHourHeatmapHint": "X-axis = time slot, Y-axis = weekday; cell shade = chat volume for that day and slot",
|
||||||
|
"usageHourHeatmapEmpty": "No time-slot heatmap data yet",
|
||||||
|
"weekdays": {
|
||||||
|
"Mon": "Mon",
|
||||||
|
"Tue": "Tue",
|
||||||
|
"Wed": "Wed",
|
||||||
|
"Thu": "Thu",
|
||||||
|
"Fri": "Fri",
|
||||||
|
"Sat": "Sat",
|
||||||
|
"Sun": "Sun"
|
||||||
|
},
|
||||||
"usageByUserTopHint": "Top {limit} users by chat volume",
|
"usageByUserTopHint": "Top {limit} users by chat volume",
|
||||||
"usageByUserEmpty": "No user chat activity yet",
|
"usageByUserEmpty": "No user chat activity yet",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -963,16 +985,26 @@
|
|||||||
"reset_token_expiry": "Reset Token Expiry",
|
"reset_token_expiry": "Reset Token Expiry",
|
||||||
"feedback_module": "Feedback Module",
|
"feedback_module": "Feedback Module",
|
||||||
"feedback_type": "Feedback Type",
|
"feedback_type": "Feedback Type",
|
||||||
"source_page": "Source Page"
|
"source_page": "Source Page",
|
||||||
|
"risk_status": "Risk Status",
|
||||||
|
"risk_score": "Risk Score",
|
||||||
|
"latency": "Latency (ms)",
|
||||||
|
"is_empty_answer": "Empty Answer",
|
||||||
|
"is_system_failure": "System Failure",
|
||||||
|
"feedback_score": "Rating",
|
||||||
|
"feedback_comment": "Rating Comment",
|
||||||
|
"negative_feedback_count": "Negative Feedback",
|
||||||
|
"actions": "Actions"
|
||||||
},
|
},
|
||||||
"tables": {
|
"tables": {
|
||||||
"users": "Users",
|
"users": "Users",
|
||||||
"chat_logs": "Chat Logs",
|
"chat_logs": "Chat Logs",
|
||||||
"general_feedbacks": "Feedback",
|
"general_feedbacks": "Feedback",
|
||||||
"feedbacks": "Answer Rating",
|
"feedbacks": "User Feedback & Answer Rating",
|
||||||
"departments": "Departments",
|
"departments": "Departments",
|
||||||
"agents": "App Ops",
|
"agents": "App Ops",
|
||||||
"permission_requests": "Permission Requests",
|
"ops_overview": "Ops Overview",
|
||||||
|
"issue_analysis": "Issue Analysis",
|
||||||
"usage_analysis": "Usage Analytics"
|
"usage_analysis": "Usage Analytics"
|
||||||
},
|
},
|
||||||
"feedbackValues": {
|
"feedbackValues": {
|
||||||
@@ -1022,11 +1054,15 @@
|
|||||||
"usageAll": "All",
|
"usageAll": "All",
|
||||||
"usageUsed": "Used",
|
"usageUsed": "Used",
|
||||||
"usageUnused": "Unused",
|
"usageUnused": "Unused",
|
||||||
|
"usageAuthorizedUnused": "Authorized, unused",
|
||||||
"searchPlaceholder": "Search app name…",
|
"searchPlaceholder": "Search app name…",
|
||||||
"summaryActive": "Active apps",
|
"summaryActive": "Active apps",
|
||||||
"summaryTotal": "{total} total",
|
"summaryTotal": "{total} total",
|
||||||
"summaryUsed": "Used",
|
"summaryUsed": "Used",
|
||||||
"summaryUnused": "Unused",
|
"summaryUnused": "Unused",
|
||||||
|
"summaryAuthorizedUnused": "Authorized, unused",
|
||||||
|
"summaryAuthorizedUnusedHint": "Authorized but no chat in range",
|
||||||
|
"authorizedUnused": "Authorized, unused",
|
||||||
"empty": "No application ops data. Try adjusting filters.",
|
"empty": "No application ops data. Try adjusting filters.",
|
||||||
"actionLogs": "Logs",
|
"actionLogs": "Logs",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -1042,6 +1078,138 @@
|
|||||||
"tokens_used": "Tokens",
|
"tokens_used": "Tokens",
|
||||||
"actions": "Actions"
|
"actions": "Actions"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"placeholder": "This module is under construction. Stay tuned.",
|
||||||
|
"feedback": {
|
||||||
|
"title": "User Feedback & Answer Rating",
|
||||||
|
"intro": "Review user-submitted feedback and answer-rating details, with filtering, export, and tracing.",
|
||||||
|
"tabs": {
|
||||||
|
"general": "General Feedback",
|
||||||
|
"rating": "Answer Rating"
|
||||||
|
},
|
||||||
|
"timeFrom": "From",
|
||||||
|
"timeTo": "To",
|
||||||
|
"typeLabel": "Feedback Type",
|
||||||
|
"sourceLabel": "Source Page",
|
||||||
|
"moduleLabel": "Feedback Module",
|
||||||
|
"allOption": "All",
|
||||||
|
"notLinked": "Not linked",
|
||||||
|
"viewChatLog": "View chat log",
|
||||||
|
"expand": "Expand",
|
||||||
|
"collapse": "Collapse",
|
||||||
|
"viewFullContent": "View full feedback content",
|
||||||
|
"markClosed": "Mark closed",
|
||||||
|
"closed": "Closed",
|
||||||
|
"closedOk": "Marked as closed",
|
||||||
|
"summary": {
|
||||||
|
"pending": "Pending",
|
||||||
|
"pendingHint": "Feedback to follow up",
|
||||||
|
"closed": "Closed this month",
|
||||||
|
"closedHint": "Closed in this month",
|
||||||
|
"topApp": "Most feedback app",
|
||||||
|
"topAppHint": "{count} related feedback"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chatLog": {
|
||||||
|
"title": "Chat Log Detail",
|
||||||
|
"detail": "Detail",
|
||||||
|
"meta": {
|
||||||
|
"app": "Application",
|
||||||
|
"user": "User",
|
||||||
|
"createdAt": "Created at",
|
||||||
|
"chatLogId": "Chat Log ID",
|
||||||
|
"rating": "Rating",
|
||||||
|
"negativeFeedback": "Negative feedback"
|
||||||
|
},
|
||||||
|
"tops": {
|
||||||
|
"questions": "Top Questions",
|
||||||
|
"answers": "Top Answers",
|
||||||
|
"empty": "No stats yet"
|
||||||
|
},
|
||||||
|
"question": "User Question",
|
||||||
|
"answer": "Agent Answer",
|
||||||
|
"riskStatus": "Risk Status",
|
||||||
|
"riskScore": "Risk Score",
|
||||||
|
"reasons": "Triggered Reasons",
|
||||||
|
"checks": "Suggested Checks",
|
||||||
|
"noReason": "No risk rule triggered",
|
||||||
|
"noCheck": "No suggested check",
|
||||||
|
"close": "Close",
|
||||||
|
"risk": {
|
||||||
|
"attention": "Needs attention",
|
||||||
|
"review": "Pending manual review",
|
||||||
|
"responded": "Responded"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"empty_answer": "Empty answer",
|
||||||
|
"system_failure": "System failure",
|
||||||
|
"low_score": "Low rating",
|
||||||
|
"negative_feedback": "Negative feedback",
|
||||||
|
"duplicate": "Repeated question"
|
||||||
|
},
|
||||||
|
"check": {
|
||||||
|
"check_chain": "Check model, API, and tool chain",
|
||||||
|
"check_answer": "Manually spot-check the answer",
|
||||||
|
"check_kb": "Check knowledge base and material validity",
|
||||||
|
"check_key_info": "Check whether the answer missed key info",
|
||||||
|
"priority_review": "Prioritize manual review of this question"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"title": "Risk Filters",
|
||||||
|
"timeFrom": "From",
|
||||||
|
"timeTo": "To",
|
||||||
|
"appLabel": "Application",
|
||||||
|
"userLabel": "User",
|
||||||
|
"emptyAnswerLabel": "Empty answer",
|
||||||
|
"systemFailureLabel": "System failure",
|
||||||
|
"riskStatusLabel": "Risk status",
|
||||||
|
"scoreRangeLabel": "Rating range",
|
||||||
|
"minScore": "Min",
|
||||||
|
"maxScore": "Max",
|
||||||
|
"reset": "Reset filters",
|
||||||
|
"yes": "Yes",
|
||||||
|
"no": "No"
|
||||||
|
},
|
||||||
|
"detailPlaceholder": "No data"
|
||||||
|
},
|
||||||
|
"opsOverview": {
|
||||||
|
"title": "Ops Overview",
|
||||||
|
"intro": "Aggregate key operational metrics and app health for a holistic platform view.",
|
||||||
|
"empty": "No ops overview data yet",
|
||||||
|
"kpi": {
|
||||||
|
"totalChats": "Total chats",
|
||||||
|
"activeUsers": "Active users",
|
||||||
|
"activeAgents": "Active apps",
|
||||||
|
"pendingFollowup": "Feedback to follow up"
|
||||||
|
},
|
||||||
|
"trendTitle": "Chat trend & period-over-period",
|
||||||
|
"trendEmpty": "No trend data yet",
|
||||||
|
"topApps": "Top apps",
|
||||||
|
"lowUseApps": "Low-usage apps"
|
||||||
|
},
|
||||||
|
"issueAnalysis": {
|
||||||
|
"title": "Issue Analysis",
|
||||||
|
"intro": "Cluster high-frequency questions and attention/review signals from chat-log risk rules to spot areas to optimize.",
|
||||||
|
"empty": "No issue analysis data yet",
|
||||||
|
"priorityTitle": "Priority Issues",
|
||||||
|
"colTopic": "Question Topic",
|
||||||
|
"colCount": "Count",
|
||||||
|
"colApps": "Application",
|
||||||
|
"colAttention": "Needs attention",
|
||||||
|
"colReasons": "Reasons",
|
||||||
|
"colChecks": "Suggested Checks",
|
||||||
|
"kpi": {
|
||||||
|
"highFreq": "High-frequency clusters",
|
||||||
|
"highFreqHint": "Top 10 = {ratio}% of all questions",
|
||||||
|
"attention": "Needs attention",
|
||||||
|
"attentionHint": "Empty/system failure +3; low rating +3; negative feedback +2; repeated question +1",
|
||||||
|
"review": "Pending review",
|
||||||
|
"reviewHint": "Low-risk signal, suggest manual check",
|
||||||
|
"emptyAnswer": "Empty answers",
|
||||||
|
"emptyAnswerHint": "Check model output and API chain",
|
||||||
|
"topApp": "App to optimize",
|
||||||
|
"topAppHint": "Attention signal share {ratio}%"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"batchEdit": {
|
"batchEdit": {
|
||||||
|
|||||||
@@ -818,6 +818,8 @@
|
|||||||
"filterName": "กรองตามชื่อ/ชื่อผู้ใช้",
|
"filterName": "กรองตามชื่อ/ชื่อผู้ใช้",
|
||||||
"filterDept": "กรองตามแผนก",
|
"filterDept": "กรองตามแผนก",
|
||||||
"allRoles": "ทุกบทบาท",
|
"allRoles": "ทุกบทบาท",
|
||||||
|
"views": { "apps": "ตามแอปพลิเคชัน", "members": "ตามสมาชิก" },
|
||||||
|
"appHeaders": { "app": "แอปพลิเคชัน", "type": "ประเภท", "authorized": "ผู้ได้รับอนุญาต", "actions": "การดำเนินการ", "viewMembers": "ดูสมาชิก", "accessHint": "เปิดสิทธิ์ของสมาชิก", "memberHint": "เพิ่มหรือลบสิทธิ์ของแอปนี้", "memberSearch": "ค้นหาชื่อ ชื่อผู้ใช้ รหัสพนักงาน หรือแผนก", "addMember": "มอบสิทธิ์", "removeMember": "ยกเลิกสิทธิ์", "noMembers": "ไม่พบสมาชิกที่ตรงกัน" },
|
||||||
"headers": {
|
"headers": {
|
||||||
"user": "ผู้ใช้",
|
"user": "ผู้ใช้",
|
||||||
"realName": "ชื่อจริง",
|
"realName": "ชื่อจริง",
|
||||||
@@ -860,6 +862,7 @@
|
|||||||
"report": {
|
"report": {
|
||||||
"title": "รายงานข้อมูล: {table}",
|
"title": "รายงานข้อมูล: {table}",
|
||||||
"subtitle": "การวิเคราะห์การใช้งานและรายละเอียดย้อนหลัง",
|
"subtitle": "การวิเคราะห์การใช้งานและรายละเอียดย้อนหลัง",
|
||||||
|
"currentFilterResults": "ผลการกรองปัจจุบัน: {total}",
|
||||||
"export": "ส่งออก Excel",
|
"export": "ส่งออก Excel",
|
||||||
"columnSettings": "ตั้งค่าคอลัมน์",
|
"columnSettings": "ตั้งค่าคอลัมน์",
|
||||||
"showSelection": "แสดงการเลือก",
|
"showSelection": "แสดงการเลือก",
|
||||||
@@ -895,12 +898,28 @@
|
|||||||
"usageRanges": {
|
"usageRanges": {
|
||||||
"7d": "7 วันล่าสุด",
|
"7d": "7 วันล่าสุด",
|
||||||
"30d": "30 วันล่าสุด",
|
"30d": "30 วันล่าสุด",
|
||||||
"90d": "3 เดือนล่าสุด",
|
"90d": "90 วันล่าสุด",
|
||||||
"180d": "6 เดือนล่าสุด",
|
"180d": "6 เดือนล่าสุด",
|
||||||
"365d": "12 เดือนล่าสุด"
|
"365d": "12 เดือนล่าสุด"
|
||||||
},
|
},
|
||||||
"byUser": "ตามผู้ใช้",
|
"byUser": "ตามผู้ใช้",
|
||||||
"byAgent": "ตามตัวแทน",
|
"byAgent": "ตามตัวแทน",
|
||||||
|
"byDepartment": "ตามแผนก",
|
||||||
|
"usageByDepartmentHint": "ปริมาณการสนทนาและจำนวนผู้ใช้ตามแผนก",
|
||||||
|
"unknownDepartment": "ไม่ระบุแผนก",
|
||||||
|
"usageByDepartmentEmpty": "ยังไม่มีบันทึกการสนทนาตามแผนก",
|
||||||
|
"usageHourHeatmap": "ฮีตแมปวันทำงาน ตามช่วงเวลา",
|
||||||
|
"usageHourHeatmapHint": "แกนนอน=ช่วงเวลา แกนตั้ง=วันทำงาน สีเข้มของช่อง=ปริมาณการสนทนาของวันและช่วงนั้น",
|
||||||
|
"usageHourHeatmapEmpty": "ยังไม่มีข้อมูลฮีตแมปตามช่วงเวลา",
|
||||||
|
"weekdays": {
|
||||||
|
"Mon": "จ.",
|
||||||
|
"Tue": "อ.",
|
||||||
|
"Wed": "พ.",
|
||||||
|
"Thu": "พฤ.",
|
||||||
|
"Fri": "ศ.",
|
||||||
|
"Sat": "ส.",
|
||||||
|
"Sun": "อา."
|
||||||
|
},
|
||||||
"usageByUserTopHint": "แสดงผู้ใช้ {limit} อันดับแรกตามปริมาณการสนทนา",
|
"usageByUserTopHint": "แสดงผู้ใช้ {limit} อันดับแรกตามปริมาณการสนทนา",
|
||||||
"usageByUserEmpty": "ยังไม่มีบันทึกการสนทนาของผู้ใช้",
|
"usageByUserEmpty": "ยังไม่มีบันทึกการสนทนาของผู้ใช้",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -965,16 +984,26 @@
|
|||||||
"theme_preference": "ค่ากำหนดธีม",
|
"theme_preference": "ค่ากำหนดธีม",
|
||||||
"password_hash": "แฮชรหัสผ่าน",
|
"password_hash": "แฮชรหัสผ่าน",
|
||||||
"reset_token": "โทเค็นรีเซ็ต",
|
"reset_token": "โทเค็นรีเซ็ต",
|
||||||
"reset_token_expiry": "เวลาหมดอายุโทเค็นรีเซ็ต"
|
"reset_token_expiry": "เวลาหมดอายุโทเค็นรีเซ็ต",
|
||||||
|
"risk_status": "สถานะความเสี่ยง",
|
||||||
|
"risk_score": "คะแนนความเสี่ยง",
|
||||||
|
"latency": "เวลาแฝง (ms)",
|
||||||
|
"is_empty_answer": "คำตอบว่าง",
|
||||||
|
"is_system_failure": "ระบบล้มเหลว",
|
||||||
|
"feedback_score": "คะแนน",
|
||||||
|
"feedback_comment": "หมายเหตุคะแนน",
|
||||||
|
"negative_feedback_count": "จำนวนข้อเสนอแนะเชิงลบ",
|
||||||
|
"actions": "การทำงาน"
|
||||||
},
|
},
|
||||||
"tables": {
|
"tables": {
|
||||||
"users": "ผู้ใช้",
|
"users": "ผู้ใช้",
|
||||||
"chat_logs": "บันทึกแชท",
|
"chat_logs": "บันทึกแชท",
|
||||||
"general_feedbacks": "ข้อเสนอแนะทั่วไป",
|
"general_feedbacks": "ข้อเสนอแนะทั่วไป",
|
||||||
"feedbacks": "การประเมินคำตอบ",
|
"feedbacks": "ข้อเสนอแนะผู้ใช้และการประเมินคำตอบ",
|
||||||
"departments": "แผนก",
|
"departments": "แผนก",
|
||||||
"agents": "แอปปฏิบัติการ",
|
"agents": "แอปปฏิบัติการ",
|
||||||
"permission_requests": "คำขอสิทธิ์",
|
"ops_overview": "ภาพรวมการดำเนินงาน",
|
||||||
|
"issue_analysis": "การวิเคราะห์ปัญหา",
|
||||||
"usage_analysis": "วิเคราะห์การใช้งาน"
|
"usage_analysis": "วิเคราะห์การใช้งาน"
|
||||||
},
|
},
|
||||||
"usageIntro": "ดูแนวโน้มการเรียกใช้แอป AI ผู้ใช้ที่ใช้งาน แอปที่ใช้น้อย และช่วงพีคผิดปกติ",
|
"usageIntro": "ดูแนวโน้มการเรียกใช้แอป AI ผู้ใช้ที่ใช้งาน แอปที่ใช้น้อย และช่วงพีคผิดปกติ",
|
||||||
@@ -1006,11 +1035,15 @@
|
|||||||
"usageAll": "ทั้งหมด",
|
"usageAll": "ทั้งหมด",
|
||||||
"usageUsed": "มีการใช้",
|
"usageUsed": "มีการใช้",
|
||||||
"usageUnused": "ไม่มีการใช้",
|
"usageUnused": "ไม่มีการใช้",
|
||||||
|
"usageAuthorizedUnused": "ได้รับสิทธิ์แต่ไม่ใช้งาน",
|
||||||
"searchPlaceholder": "ค้นหาชื่อแอป…",
|
"searchPlaceholder": "ค้นหาชื่อแอป…",
|
||||||
"summaryActive": "แอปที่เปิดใช้",
|
"summaryActive": "แอปที่เปิดใช้",
|
||||||
"summaryTotal": "ทั้งหมด {total}",
|
"summaryTotal": "ทั้งหมด {total}",
|
||||||
"summaryUsed": "มีการใช้",
|
"summaryUsed": "มีการใช้",
|
||||||
"summaryUnused": "ไม่มีการใช้",
|
"summaryUnused": "ไม่มีการใช้",
|
||||||
|
"summaryAuthorizedUnused": "ได้รับสิทธิ์แต่ไม่ใช้งาน",
|
||||||
|
"summaryAuthorizedUnusedHint": "ได้รับสิทธิ์แต่ไม่มีแชทในช่วงที่เลือก",
|
||||||
|
"authorizedUnused": "ได้รับสิทธิ์แต่ไม่ใช้งาน",
|
||||||
"empty": "ไม่มีข้อมูลแอปปฏิบัติการ ลองปรับตัวกรอง",
|
"empty": "ไม่มีข้อมูลแอปปฏิบัติการ ลองปรับตัวกรอง",
|
||||||
"actionLogs": "บันทึก",
|
"actionLogs": "บันทึก",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -1026,6 +1059,138 @@
|
|||||||
"tokens_used": "Token",
|
"tokens_used": "Token",
|
||||||
"actions": "การทำงาน"
|
"actions": "การทำงาน"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"placeholder": "โมดูลนี้อยู่ระหว่างการพัฒนา โปรดรอติดตาม",
|
||||||
|
"feedback": {
|
||||||
|
"title": "ข้อเสนอแนะผู้ใช้และการประเมินคำตอบ",
|
||||||
|
"intro": "ดูรายละเอียดข้อเสนอแนะและการประเมินคำตอบจากผู้ใช้ รองรับการกรอง การส่งออก และการติดตามย้อนหลัง",
|
||||||
|
"tabs": {
|
||||||
|
"general": "ข้อเสนอแนะทั่วไป",
|
||||||
|
"rating": "การประเมินคำตอบ"
|
||||||
|
},
|
||||||
|
"timeFrom": "ตั้งแต่วันที่",
|
||||||
|
"timeTo": "ถึงวันที่",
|
||||||
|
"typeLabel": "ประเภทข้อเสนอแนะ",
|
||||||
|
"sourceLabel": "หน้าที่มา",
|
||||||
|
"moduleLabel": "โมดูลข้อเสนอแนะ",
|
||||||
|
"allOption": "ทั้งหมด",
|
||||||
|
"notLinked": "ไม่เชื่อมโยง",
|
||||||
|
"viewChatLog": "ดูบันทึกแชท",
|
||||||
|
"expand": "ขยาย",
|
||||||
|
"collapse": "ย่อ",
|
||||||
|
"viewFullContent": "ดูเนื้อหาข้อเสนอแนะทั้งหมด",
|
||||||
|
"markClosed": "ทำเครื่องหมายว่าปิดแล้ว",
|
||||||
|
"closed": "ปิดแล้ว",
|
||||||
|
"closedOk": "ทำเครื่องหมายว่าปิดแล้ว",
|
||||||
|
"summary": {
|
||||||
|
"pending": "รอดำเนินการ",
|
||||||
|
"pendingHint": "ข้อเสนอแนะรอติดตาม",
|
||||||
|
"closed": "ปิดแล้วเดือนนี้",
|
||||||
|
"closedHint": "จำนวนที่ปิดเดือนนี้",
|
||||||
|
"topApp": "แอปที่ได้รับข้อเสนอแนะมากสุด",
|
||||||
|
"topAppHint": "ข้อเสนอแนะที่เกี่ยวข้อง {count} รายการ"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chatLog": {
|
||||||
|
"title": "รายละเอียดบันทึกแชท",
|
||||||
|
"detail": "รายละเอียด",
|
||||||
|
"meta": {
|
||||||
|
"app": "แอปพลิเคชัน",
|
||||||
|
"user": "ผู้ใช้",
|
||||||
|
"createdAt": "สร้างเมื่อ",
|
||||||
|
"chatLogId": "ID บันทึกแชท",
|
||||||
|
"rating": "คะแนน",
|
||||||
|
"negativeFeedback": "ข้อเสนอแนะเชิงลบ"
|
||||||
|
},
|
||||||
|
"tops": {
|
||||||
|
"questions": "คำถามยอดนิยม",
|
||||||
|
"answers": "คำตอบยอดนิยม",
|
||||||
|
"empty": "ยังไม่มีสถิติ"
|
||||||
|
},
|
||||||
|
"question": "คำถามผู้ใช้",
|
||||||
|
"answer": "คำตอบแอเจนต์",
|
||||||
|
"riskStatus": "สถานะความเสี่ยง",
|
||||||
|
"riskScore": "คะแนนความเสี่ยง",
|
||||||
|
"reasons": "เหตุผลที่ตัดสิน",
|
||||||
|
"checks": "รายการตรวจสอบที่แนะนำ",
|
||||||
|
"noReason": "ไม่พบกฎความเสี่ยง",
|
||||||
|
"noCheck": "ไม่มีรายการตรวจสอบที่แนะนำ",
|
||||||
|
"close": "ปิด",
|
||||||
|
"risk": {
|
||||||
|
"attention": "ต้องให้ความสนใจ",
|
||||||
|
"review": "รอตรวจสอบด้วยตนเอง",
|
||||||
|
"responded": "ตอบแล้ว"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"empty_answer": "คำตอบว่าง",
|
||||||
|
"system_failure": "ระบบล้มเหลว",
|
||||||
|
"low_score": "คะแนนต่ำ",
|
||||||
|
"negative_feedback": "ข้อเสนอแนะเชิงลบ",
|
||||||
|
"duplicate": "ถามซ้ำทั้งหมด"
|
||||||
|
},
|
||||||
|
"check": {
|
||||||
|
"check_chain": "ตรวจสอบโมเดล API และเครื่องมือ",
|
||||||
|
"check_answer": "สุ่มตรวจเนื้อหาคำตอบ",
|
||||||
|
"check_kb": "ตรวจสอบฐานความรู้และอายุเอกสาร",
|
||||||
|
"check_key_info": "ตรวจสอบว่าคำตอบขาดข้อมูลสำคัญ",
|
||||||
|
"priority_review": "ให้ตรวจสอบคำถามนี้ก่อน"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"title": "ตัวกรองความเสี่ยง",
|
||||||
|
"timeFrom": "ตั้งแต่วันที่",
|
||||||
|
"timeTo": "ถึงวันที่",
|
||||||
|
"appLabel": "แอปพลิเคชัน",
|
||||||
|
"userLabel": "ผู้ใช้",
|
||||||
|
"emptyAnswerLabel": "คำตอบว่าง",
|
||||||
|
"systemFailureLabel": "ระบบล้มเหลว",
|
||||||
|
"riskStatusLabel": "สถานะความเสี่ยง",
|
||||||
|
"scoreRangeLabel": "ช่วงคะแนน",
|
||||||
|
"minScore": "ขั้นต่ำ",
|
||||||
|
"maxScore": "สูงสุด",
|
||||||
|
"reset": "ล้างตัวกรอง",
|
||||||
|
"yes": "ใช่",
|
||||||
|
"no": "ไม่"
|
||||||
|
},
|
||||||
|
"detailPlaceholder": "ไม่มีข้อมูล"
|
||||||
|
},
|
||||||
|
"opsOverview": {
|
||||||
|
"title": "ภาพรวมการดำเนินงาน",
|
||||||
|
"intro": "รวบรวมเมตริกการดำเนินงานที่สำคัญและสุขภาพแอปพลิเคชันเพื่อภาพรวมของแพลตฟอร์ม",
|
||||||
|
"empty": "ยังไม่มีข้อมูลภาพรวมการดำเนินงาน",
|
||||||
|
"kpi": {
|
||||||
|
"totalChats": "จำนวนแชท",
|
||||||
|
"activeUsers": "ผู้ใช้ที่ใช้งาน",
|
||||||
|
"activeAgents": "แอปที่ใช้งาน",
|
||||||
|
"pendingFollowup": "ข้อเสนอแนะที่รอติดตาม"
|
||||||
|
},
|
||||||
|
"trendTitle": "แนวโน้มแชทและเทียบช่วงเวลา",
|
||||||
|
"trendEmpty": "ยังไม่มีข้อมูลแนวโน้ม",
|
||||||
|
"topApps": "แอปยอดนิยม",
|
||||||
|
"lowUseApps": "แอปที่ใช้น้อย"
|
||||||
|
},
|
||||||
|
"issueAnalysis": {
|
||||||
|
"title": "การวิเคราะห์ปัญหา",
|
||||||
|
"intro": "จัดกลุ่มคำถามยอดนิยมและสัญญาณที่ต้องให้ความสนใจ/รอตรวจสอบจากกฎความเสี่ยงของบันทึกแชท เพื่อหาพื้นที่ที่ควรปรับปรุง",
|
||||||
|
"empty": "ยังไม่มีข้อมูลการวิเคราะห์ปัญหา",
|
||||||
|
"priorityTitle": "ปัญหาที่ควรจัดการก่อน",
|
||||||
|
"colTopic": "หัวข้อคำถาม",
|
||||||
|
"colCount": "จำนวนครั้ง",
|
||||||
|
"colApps": "แอปพลิเคชันที่เกี่ยวข้อง",
|
||||||
|
"colAttention": "ต้องให้ความสนใจ",
|
||||||
|
"colReasons": "เหตุผล",
|
||||||
|
"colChecks": "รายการตรวจสอบที่แนะนำ",
|
||||||
|
"kpi": {
|
||||||
|
"highFreq": "กลุ่มคำถามยอดนิยม",
|
||||||
|
"highFreqHint": "Top 10 = {ratio}% ของคำถามทั้งหมด",
|
||||||
|
"attention": "ต้องให้ความสนใจ",
|
||||||
|
"attentionHint": "คำตอบว่าง/ระบบล้มเหลว +3; คะแนนต่ำ +3; ข้อเสนอแนะเชิงลบ +2; ถามซ้ำ +1",
|
||||||
|
"review": "รอตรวจสอบด้วยตนเอง",
|
||||||
|
"reviewHint": "สัญญาณความเสี่ยงต่ำ แนะนำตรวจด้วยตนเอง",
|
||||||
|
"emptyAnswer": "คำตอบว่าง",
|
||||||
|
"emptyAnswerHint": "ตรวจสอบผลลัพธ์โมเดลและ API",
|
||||||
|
"topApp": "แอปที่ควรปรับปรุง",
|
||||||
|
"topAppHint": "สัดส่วนสัญญาณที่ต้องให้ความสนใจ {ratio}%"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"batchEdit": {
|
"batchEdit": {
|
||||||
|
|||||||
@@ -197,12 +197,15 @@
|
|||||||
"name": "名称",
|
"name": "名称",
|
||||||
"code": "编码",
|
"code": "编码",
|
||||||
"company": "公司",
|
"company": "公司",
|
||||||
|
"members": "员工",
|
||||||
"actions": "操作"
|
"actions": "操作"
|
||||||
},
|
},
|
||||||
"actions": {
|
"actions": {
|
||||||
"edit": "编辑",
|
"edit": "编辑",
|
||||||
"delete": "删除"
|
"delete": "删除",
|
||||||
|
"viewMembers": "查看部门员工"
|
||||||
},
|
},
|
||||||
|
"members": { "title": "{name}员工", "count": "共 {count} 人", "empty": "暂无员工" },
|
||||||
"fields": {
|
"fields": {
|
||||||
"name": "名称",
|
"name": "名称",
|
||||||
"namePlaceholder": "例如:信息技术部",
|
"namePlaceholder": "例如:信息技术部",
|
||||||
@@ -813,6 +816,8 @@
|
|||||||
"filterName": "筛选 姓名/用户名",
|
"filterName": "筛选 姓名/用户名",
|
||||||
"filterDept": "筛选 部门",
|
"filterDept": "筛选 部门",
|
||||||
"allRoles": "所有角色",
|
"allRoles": "所有角色",
|
||||||
|
"views": { "apps": "按应用查看", "members": "按成员查看" },
|
||||||
|
"appHeaders": { "app": "应用", "type": "类型", "authorized": "已授权人数", "actions": "操作", "viewMembers": "查看成员", "accessHint": "点击查看成员权限", "memberHint": "可添加或取消此应用的访问权限", "memberSearch": "搜索姓名、用户名、工号或部门", "addMember": "添加权限", "removeMember": "取消权限", "noMembers": "没有匹配的人员" },
|
||||||
"headers": {
|
"headers": {
|
||||||
"user": "用户",
|
"user": "用户",
|
||||||
"realName": "真实姓名",
|
"realName": "真实姓名",
|
||||||
@@ -853,8 +858,9 @@
|
|||||||
"reject": "拒绝"
|
"reject": "拒绝"
|
||||||
},
|
},
|
||||||
"report": {
|
"report": {
|
||||||
"title": "数据报表: {table}",
|
"title": "数据报表:{table}",
|
||||||
"subtitle": "运营分析与明细追溯",
|
"subtitle": "运营分析与明细追溯",
|
||||||
|
"currentFilterResults": "当前筛选结果:{total} 条",
|
||||||
"export": "导出 Excel",
|
"export": "导出 Excel",
|
||||||
"columnSettings": "列设置",
|
"columnSettings": "列设置",
|
||||||
"showSelection": "显示选择",
|
"showSelection": "显示选择",
|
||||||
@@ -888,14 +894,30 @@
|
|||||||
"usage": "使用分析",
|
"usage": "使用分析",
|
||||||
"usageRangeLabel": "统计范围",
|
"usageRangeLabel": "统计范围",
|
||||||
"usageRanges": {
|
"usageRanges": {
|
||||||
"7d": "近一周",
|
"7d": "近 7 天",
|
||||||
"30d": "近一月",
|
"30d": "近 30 天",
|
||||||
"90d": "近三月",
|
"90d": "近 90 天",
|
||||||
"180d": "近半年",
|
"180d": "近半年",
|
||||||
"365d": "近一年"
|
"365d": "近一年"
|
||||||
},
|
},
|
||||||
"byUser": "按用户统计",
|
"byUser": "按用户统计",
|
||||||
"byAgent": "按应用统计",
|
"byAgent": "按应用统计",
|
||||||
|
"byDepartment": "按部门统计",
|
||||||
|
"usageByDepartmentHint": "按部门聚合对话量与参与用户数",
|
||||||
|
"unknownDepartment": "未分组",
|
||||||
|
"usageByDepartmentEmpty": "暂无部门对话记录",
|
||||||
|
"usageHourHeatmap": "工作日与时段热力图",
|
||||||
|
"usageHourHeatmapHint": "横轴=时段,纵轴=工作日,格子颜色深浅=该日该时段对话量",
|
||||||
|
"usageHourHeatmapEmpty": "暂无时段热力图数据",
|
||||||
|
"weekdays": {
|
||||||
|
"Mon": "周一",
|
||||||
|
"Tue": "周二",
|
||||||
|
"Wed": "周三",
|
||||||
|
"Thu": "周四",
|
||||||
|
"Fri": "周五",
|
||||||
|
"Sat": "周六",
|
||||||
|
"Sun": "周日"
|
||||||
|
},
|
||||||
"usageByUserTopHint": "仅显示对话量前 {limit} 名用户",
|
"usageByUserTopHint": "仅显示对话量前 {limit} 名用户",
|
||||||
"usageByUserEmpty": "暂无用户对话记录",
|
"usageByUserEmpty": "暂无用户对话记录",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -960,16 +982,26 @@
|
|||||||
"theme_preference": "主题偏好",
|
"theme_preference": "主题偏好",
|
||||||
"password_hash": "密码哈希",
|
"password_hash": "密码哈希",
|
||||||
"reset_token": "重置令牌",
|
"reset_token": "重置令牌",
|
||||||
"reset_token_expiry": "重置令牌过期时间"
|
"reset_token_expiry": "重置令牌过期时间",
|
||||||
|
"risk_status": "风险状态",
|
||||||
|
"risk_score": "风险分",
|
||||||
|
"latency": "耗时(毫秒)",
|
||||||
|
"is_empty_answer": "空回答",
|
||||||
|
"is_system_failure": "系统失败",
|
||||||
|
"feedback_score": "评分",
|
||||||
|
"feedback_comment": "评分备注",
|
||||||
|
"negative_feedback_count": "负面反馈数",
|
||||||
|
"actions": "操作"
|
||||||
},
|
},
|
||||||
"tables": {
|
"tables": {
|
||||||
"users": "用户",
|
"users": "用户",
|
||||||
"chat_logs": "聊天日志",
|
"chat_logs": "聊天日志",
|
||||||
"general_feedbacks": "意见反馈",
|
"general_feedbacks": "意见反馈",
|
||||||
"feedbacks": "回答评价",
|
"feedbacks": "用户反馈与回答评价",
|
||||||
"departments": "部门",
|
"departments": "部门",
|
||||||
"agents": "应用运营",
|
"agents": "应用运营",
|
||||||
"permission_requests": "权限申请",
|
"ops_overview": "运营总览",
|
||||||
|
"issue_analysis": "问题分析",
|
||||||
"usage_analysis": "使用分析"
|
"usage_analysis": "使用分析"
|
||||||
},
|
},
|
||||||
"usageIntro": "查看 AI 应用调用趋势、活跃用户、低使用应用与异常高峰。",
|
"usageIntro": "查看 AI 应用调用趋势、活跃用户、低使用应用与异常高峰。",
|
||||||
@@ -1001,11 +1033,15 @@
|
|||||||
"usageAll": "全部",
|
"usageAll": "全部",
|
||||||
"usageUsed": "有使用",
|
"usageUsed": "有使用",
|
||||||
"usageUnused": "零使用",
|
"usageUnused": "零使用",
|
||||||
|
"usageAuthorizedUnused": "已授权未使用",
|
||||||
"searchPlaceholder": "搜索应用名称…",
|
"searchPlaceholder": "搜索应用名称…",
|
||||||
"summaryActive": "启用应用",
|
"summaryActive": "启用应用",
|
||||||
"summaryTotal": "共 {total} 个",
|
"summaryTotal": "共 {total} 个",
|
||||||
"summaryUsed": "有使用",
|
"summaryUsed": "有使用",
|
||||||
"summaryUnused": "零使用",
|
"summaryUnused": "零使用",
|
||||||
|
"summaryAuthorizedUnused": "已授权未使用",
|
||||||
|
"summaryAuthorizedUnusedHint": "已授权但范围内无对话",
|
||||||
|
"authorizedUnused": "已授权未使用",
|
||||||
"empty": "暂无应用运营数据,请调整筛选条件",
|
"empty": "暂无应用运营数据,请调整筛选条件",
|
||||||
"actionLogs": "日志",
|
"actionLogs": "日志",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -1021,6 +1057,138 @@
|
|||||||
"tokens_used": "Token",
|
"tokens_used": "Token",
|
||||||
"actions": "操作"
|
"actions": "操作"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"placeholder": "该模块正在建设中,敬请期待",
|
||||||
|
"feedback": {
|
||||||
|
"title": "用户反馈与回答评价",
|
||||||
|
"intro": "查看用户提交的意见反馈与回答评分明细,支持筛选、导出和追溯。",
|
||||||
|
"tabs": {
|
||||||
|
"general": "意见反馈",
|
||||||
|
"rating": "回答评价"
|
||||||
|
},
|
||||||
|
"timeFrom": "开始日期",
|
||||||
|
"timeTo": "结束日期",
|
||||||
|
"typeLabel": "反馈类型",
|
||||||
|
"sourceLabel": "来源页面",
|
||||||
|
"moduleLabel": "反馈模块",
|
||||||
|
"allOption": "全部",
|
||||||
|
"notLinked": "未关联",
|
||||||
|
"viewChatLog": "查看聊天记录",
|
||||||
|
"expand": "展开",
|
||||||
|
"collapse": "收起",
|
||||||
|
"viewFullContent": "查看完整反馈内容",
|
||||||
|
"markClosed": "标记已关闭",
|
||||||
|
"closed": "已关闭",
|
||||||
|
"closedOk": "已标记关闭",
|
||||||
|
"summary": {
|
||||||
|
"pending": "待处理",
|
||||||
|
"pendingHint": "待跟进反馈",
|
||||||
|
"closed": "本月已关闭",
|
||||||
|
"closedHint": "本月关闭量",
|
||||||
|
"topApp": "最多反馈应用",
|
||||||
|
"topAppHint": "共 {count} 条相关反馈"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chatLog": {
|
||||||
|
"title": "聊天日志详情",
|
||||||
|
"detail": "详情",
|
||||||
|
"meta": {
|
||||||
|
"app": "应用",
|
||||||
|
"user": "用户",
|
||||||
|
"createdAt": "创建时间",
|
||||||
|
"chatLogId": "聊天日志 ID",
|
||||||
|
"rating": "评分",
|
||||||
|
"negativeFeedback": "负面反馈"
|
||||||
|
},
|
||||||
|
"tops": {
|
||||||
|
"questions": "Top 提问内容",
|
||||||
|
"answers": "Top 回答内容",
|
||||||
|
"empty": "暂无统计"
|
||||||
|
},
|
||||||
|
"question": "用户提问",
|
||||||
|
"answer": "智能体回答",
|
||||||
|
"riskStatus": "风险状态",
|
||||||
|
"riskScore": "风险分数",
|
||||||
|
"reasons": "判定原因",
|
||||||
|
"checks": "建议检查项",
|
||||||
|
"noReason": "无命中风险规则",
|
||||||
|
"noCheck": "无建议检查项",
|
||||||
|
"close": "关闭",
|
||||||
|
"risk": {
|
||||||
|
"attention": "需要关注",
|
||||||
|
"review": "待人工抽查",
|
||||||
|
"responded": "已响应"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"empty_answer": "空回答",
|
||||||
|
"system_failure": "系统失败",
|
||||||
|
"low_score": "低评分",
|
||||||
|
"negative_feedback": "负面反馈",
|
||||||
|
"duplicate": "完全重复提问"
|
||||||
|
},
|
||||||
|
"check": {
|
||||||
|
"check_chain": "检查模型、接口、工具链路",
|
||||||
|
"check_answer": "人工抽查回答内容",
|
||||||
|
"check_kb": "检查知识库和资料有效期",
|
||||||
|
"check_key_info": "检查回答是否遗漏关键信息",
|
||||||
|
"priority_review": "优先人工复核该问题"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"title": "风险筛选",
|
||||||
|
"timeFrom": "开始日期",
|
||||||
|
"timeTo": "结束日期",
|
||||||
|
"appLabel": "应用",
|
||||||
|
"userLabel": "用户",
|
||||||
|
"emptyAnswerLabel": "是否空回答",
|
||||||
|
"systemFailureLabel": "是否系统失败",
|
||||||
|
"riskStatusLabel": "风险状态",
|
||||||
|
"scoreRangeLabel": "评分区间",
|
||||||
|
"minScore": "最低分",
|
||||||
|
"maxScore": "最高分",
|
||||||
|
"reset": "重置筛选",
|
||||||
|
"yes": "是",
|
||||||
|
"no": "否"
|
||||||
|
},
|
||||||
|
"detailPlaceholder": "暂无数据"
|
||||||
|
},
|
||||||
|
"opsOverview": {
|
||||||
|
"title": "运营总览",
|
||||||
|
"intro": "汇总关键运营指标与应用健康度,整体把握平台运行情况。",
|
||||||
|
"empty": "暂无运营总览数据",
|
||||||
|
"kpi": {
|
||||||
|
"totalChats": "对话量",
|
||||||
|
"activeUsers": "活跃用户",
|
||||||
|
"activeAgents": "活跃应用",
|
||||||
|
"pendingFollowup": "待跟进反馈"
|
||||||
|
},
|
||||||
|
"trendTitle": "对话趋势与环比",
|
||||||
|
"trendEmpty": "暂无趋势数据",
|
||||||
|
"topApps": "Top 应用",
|
||||||
|
"lowUseApps": "低使用应用"
|
||||||
|
},
|
||||||
|
"issueAnalysis": {
|
||||||
|
"title": "问题分析",
|
||||||
|
"intro": "基于聊天日志风险规则聚合高频问题与需要关注/待抽查信号,定位待优化问题。",
|
||||||
|
"empty": "暂无问题分析数据",
|
||||||
|
"priorityTitle": "优先处理问题",
|
||||||
|
"colTopic": "问题主题",
|
||||||
|
"colCount": "出现次数",
|
||||||
|
"colApps": "涉及应用",
|
||||||
|
"colAttention": "需要关注",
|
||||||
|
"colReasons": "判定原因",
|
||||||
|
"colChecks": "建议检查项",
|
||||||
|
"kpi": {
|
||||||
|
"highFreq": "高频问题簇",
|
||||||
|
"highFreqHint": "Top 10 占全部提问 {ratio}%",
|
||||||
|
"attention": "需要关注",
|
||||||
|
"attentionHint": "空回答/系统失败 +3;低评分 +3;负面反馈 +2;完全重复提问 +1",
|
||||||
|
"review": "待人工抽查",
|
||||||
|
"reviewHint": "低风险信号,建议人工抽查",
|
||||||
|
"emptyAnswer": "空回答",
|
||||||
|
"emptyAnswerHint": "检查模型返回和接口链路",
|
||||||
|
"topApp": "优先优化应用",
|
||||||
|
"topAppHint": "需要关注信号占比 {ratio}%"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"batchEdit": {
|
"batchEdit": {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
"codes": {
|
"codes": {
|
||||||
"AUTH_UNAUTHORIZED": "请先登录。",
|
"AUTH_UNAUTHORIZED": "请先登录。",
|
||||||
"AUTH_INCORRECT_PASSWORD": "密码错误",
|
"AUTH_INCORRECT_PASSWORD": "密码错误",
|
||||||
"AUTH_INCORRECT_CURRENT_PASSWORD": "原:当前密码不正确,新:您输入的原密码有误,请重新输入",
|
|
||||||
"AUTH_USER_NOT_FOUND": "用户不存在",
|
"AUTH_USER_NOT_FOUND": "用户不存在",
|
||||||
"AUTH_ACCOUNT_DISABLED": "账号已禁用",
|
"AUTH_ACCOUNT_DISABLED": "账号已禁用",
|
||||||
"AUTH_CASDOOR_IDENTITY_INVALID": "Casdoor 未返回稳定用户身份,请联系管理员检查 OIDC 配置。",
|
"AUTH_CASDOOR_IDENTITY_INVALID": "Casdoor 未返回稳定用户身份,请联系管理员检查 OIDC 配置。",
|
||||||
|
|||||||
@@ -818,6 +818,8 @@
|
|||||||
"filterName": "篩選 姓名/用戶名",
|
"filterName": "篩選 姓名/用戶名",
|
||||||
"filterDept": "篩選 部門",
|
"filterDept": "篩選 部門",
|
||||||
"allRoles": "所有角色",
|
"allRoles": "所有角色",
|
||||||
|
"views": { "apps": "按應用查看", "members": "按成員查看" },
|
||||||
|
"appHeaders": { "app": "應用", "type": "類型", "authorized": "已授權人數", "actions": "操作", "viewMembers": "查看成員", "accessHint": "點擊查看成員權限", "memberHint": "可新增或取消此應用的存取權限", "memberSearch": "搜尋姓名、用戶名、工號或部門", "addMember": "新增權限", "removeMember": "取消權限", "noMembers": "沒有符合的成員" },
|
||||||
"headers": {
|
"headers": {
|
||||||
"user": "用戶",
|
"user": "用戶",
|
||||||
"realName": "真實姓名",
|
"realName": "真實姓名",
|
||||||
@@ -858,8 +860,9 @@
|
|||||||
"reject": "拒絕"
|
"reject": "拒絕"
|
||||||
},
|
},
|
||||||
"report": {
|
"report": {
|
||||||
"title": "資料報表: {table}",
|
"title": "資料報表:{table}",
|
||||||
"subtitle": "營運分析與明細追溯",
|
"subtitle": "營運分析與明細追溯",
|
||||||
|
"currentFilterResults": "當前篩選結果:{total} 條",
|
||||||
"export": "導出 Excel",
|
"export": "導出 Excel",
|
||||||
"columnSettings": "列設置",
|
"columnSettings": "列設置",
|
||||||
"showSelection": "顯示選擇",
|
"showSelection": "顯示選擇",
|
||||||
@@ -893,14 +896,30 @@
|
|||||||
"usage": "使用分析",
|
"usage": "使用分析",
|
||||||
"usageRangeLabel": "統計範圍",
|
"usageRangeLabel": "統計範圍",
|
||||||
"usageRanges": {
|
"usageRanges": {
|
||||||
"7d": "近一週",
|
"7d": "近 7 天",
|
||||||
"30d": "近一月",
|
"30d": "近 30 天",
|
||||||
"90d": "近三月",
|
"90d": "近 90 天",
|
||||||
"180d": "近半年",
|
"180d": "近半年",
|
||||||
"365d": "近一年"
|
"365d": "近一年"
|
||||||
},
|
},
|
||||||
"byUser": "按用戶統計",
|
"byUser": "按用戶統計",
|
||||||
"byAgent": "按應用統計",
|
"byAgent": "按應用統計",
|
||||||
|
"byDepartment": "按部門統計",
|
||||||
|
"usageByDepartmentHint": "按部門聚合對話量與參與用戶數",
|
||||||
|
"unknownDepartment": "未分組",
|
||||||
|
"usageByDepartmentEmpty": "暫無部門對話記錄",
|
||||||
|
"usageHourHeatmap": "工作日與時段熱力圖",
|
||||||
|
"usageHourHeatmapHint": "橫軸=時段,縱軸=工作日,格子顏色深淺=該日該時段對話量",
|
||||||
|
"usageHourHeatmapEmpty": "暫無時段熱力圖資料",
|
||||||
|
"weekdays": {
|
||||||
|
"Mon": "週一",
|
||||||
|
"Tue": "週二",
|
||||||
|
"Wed": "週三",
|
||||||
|
"Thu": "週四",
|
||||||
|
"Fri": "週五",
|
||||||
|
"Sat": "週六",
|
||||||
|
"Sun": "週日"
|
||||||
|
},
|
||||||
"usageByUserTopHint": "僅顯示對話量前 {limit} 名用戶",
|
"usageByUserTopHint": "僅顯示對話量前 {limit} 名用戶",
|
||||||
"usageByUserEmpty": "暫無用戶對話記錄",
|
"usageByUserEmpty": "暫無用戶對話記錄",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -965,16 +984,26 @@
|
|||||||
"theme_preference": "主題偏好",
|
"theme_preference": "主題偏好",
|
||||||
"password_hash": "密碼雜湊",
|
"password_hash": "密碼雜湊",
|
||||||
"reset_token": "重置令牌",
|
"reset_token": "重置令牌",
|
||||||
"reset_token_expiry": "重置令牌過期時間"
|
"reset_token_expiry": "重置令牌過期時間",
|
||||||
|
"risk_status": "風險狀態",
|
||||||
|
"risk_score": "風險分",
|
||||||
|
"latency": "耗時(毫秒)",
|
||||||
|
"is_empty_answer": "空回答",
|
||||||
|
"is_system_failure": "系統失敗",
|
||||||
|
"feedback_score": "評分",
|
||||||
|
"feedback_comment": "評分備註",
|
||||||
|
"negative_feedback_count": "負面反饋數",
|
||||||
|
"actions": "操作"
|
||||||
},
|
},
|
||||||
"tables": {
|
"tables": {
|
||||||
"users": "用戶",
|
"users": "用戶",
|
||||||
"chat_logs": "聊天日誌",
|
"chat_logs": "聊天日誌",
|
||||||
"general_feedbacks": "意見反饋",
|
"general_feedbacks": "意見反饋",
|
||||||
"feedbacks": "回答評價",
|
"feedbacks": "用戶反饋與回答評價",
|
||||||
"departments": "部門",
|
"departments": "部門",
|
||||||
"agents": "應用運營",
|
"agents": "應用運營",
|
||||||
"permission_requests": "權限申請",
|
"ops_overview": "營運總覽",
|
||||||
|
"issue_analysis": "問題分析",
|
||||||
"usage_analysis": "使用分析"
|
"usage_analysis": "使用分析"
|
||||||
},
|
},
|
||||||
"usageIntro": "查看 AI 應用呼叫趨勢、活躍使用者、低使用應用與異常高峰。",
|
"usageIntro": "查看 AI 應用呼叫趨勢、活躍使用者、低使用應用與異常高峰。",
|
||||||
@@ -1006,11 +1035,15 @@
|
|||||||
"usageAll": "全部",
|
"usageAll": "全部",
|
||||||
"usageUsed": "有使用",
|
"usageUsed": "有使用",
|
||||||
"usageUnused": "零使用",
|
"usageUnused": "零使用",
|
||||||
|
"usageAuthorizedUnused": "已授權未使用",
|
||||||
"searchPlaceholder": "搜尋應用名稱…",
|
"searchPlaceholder": "搜尋應用名稱…",
|
||||||
"summaryActive": "啟用應用",
|
"summaryActive": "啟用應用",
|
||||||
"summaryTotal": "共 {total} 個",
|
"summaryTotal": "共 {total} 個",
|
||||||
"summaryUsed": "有使用",
|
"summaryUsed": "有使用",
|
||||||
"summaryUnused": "零使用",
|
"summaryUnused": "零使用",
|
||||||
|
"summaryAuthorizedUnused": "已授權未使用",
|
||||||
|
"summaryAuthorizedUnusedHint": "已授權但範圍內無對話",
|
||||||
|
"authorizedUnused": "已授權未使用",
|
||||||
"empty": "暫無應用運營資料,請調整篩選條件",
|
"empty": "暫無應用運營資料,請調整篩選條件",
|
||||||
"actionLogs": "日誌",
|
"actionLogs": "日誌",
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -1026,6 +1059,138 @@
|
|||||||
"tokens_used": "Token",
|
"tokens_used": "Token",
|
||||||
"actions": "操作"
|
"actions": "操作"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"placeholder": "該模塊正在建設中,敬請期待",
|
||||||
|
"feedback": {
|
||||||
|
"title": "用戶反饋與回答評價",
|
||||||
|
"intro": "查看用戶提交的意見反饋與回答評分明細,支持篩選、導出和追溯。",
|
||||||
|
"tabs": {
|
||||||
|
"general": "意見反饋",
|
||||||
|
"rating": "回答評價"
|
||||||
|
},
|
||||||
|
"timeFrom": "開始日期",
|
||||||
|
"timeTo": "結束日期",
|
||||||
|
"typeLabel": "反饋類型",
|
||||||
|
"sourceLabel": "來源頁面",
|
||||||
|
"moduleLabel": "反饋模塊",
|
||||||
|
"allOption": "全部",
|
||||||
|
"notLinked": "未關聯",
|
||||||
|
"viewChatLog": "查看聊天記錄",
|
||||||
|
"expand": "展開",
|
||||||
|
"collapse": "收起",
|
||||||
|
"viewFullContent": "查看完整反饋內容",
|
||||||
|
"markClosed": "標記已關閉",
|
||||||
|
"closed": "已關閉",
|
||||||
|
"closedOk": "已標記關閉",
|
||||||
|
"summary": {
|
||||||
|
"pending": "待處理",
|
||||||
|
"pendingHint": "待跟進反饋",
|
||||||
|
"closed": "本月已關閉",
|
||||||
|
"closedHint": "本月關閉量",
|
||||||
|
"topApp": "最多反饋應用",
|
||||||
|
"topAppHint": "共 {count} 條相關反饋"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chatLog": {
|
||||||
|
"title": "聊天日誌詳情",
|
||||||
|
"detail": "詳情",
|
||||||
|
"meta": {
|
||||||
|
"app": "應用",
|
||||||
|
"user": "用戶",
|
||||||
|
"createdAt": "創建時間",
|
||||||
|
"chatLogId": "聊天日誌 ID",
|
||||||
|
"rating": "評分",
|
||||||
|
"negativeFeedback": "負面反饋"
|
||||||
|
},
|
||||||
|
"tops": {
|
||||||
|
"questions": "Top 提問內容",
|
||||||
|
"answers": "Top 回答內容",
|
||||||
|
"empty": "暫無統計"
|
||||||
|
},
|
||||||
|
"question": "用戶提問",
|
||||||
|
"answer": "智能體回答",
|
||||||
|
"riskStatus": "風險狀態",
|
||||||
|
"riskScore": "風險分數",
|
||||||
|
"reasons": "判定原因",
|
||||||
|
"checks": "建議檢查項",
|
||||||
|
"noReason": "無命中風險規則",
|
||||||
|
"noCheck": "無建議檢查項",
|
||||||
|
"close": "關閉",
|
||||||
|
"risk": {
|
||||||
|
"attention": "需要關注",
|
||||||
|
"review": "待人工抽查",
|
||||||
|
"responded": "已響應"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"empty_answer": "空回答",
|
||||||
|
"system_failure": "系統失敗",
|
||||||
|
"low_score": "低評分",
|
||||||
|
"negative_feedback": "負面反饋",
|
||||||
|
"duplicate": "完全重複提問"
|
||||||
|
},
|
||||||
|
"check": {
|
||||||
|
"check_chain": "檢查模型、接口、工具鏈路",
|
||||||
|
"check_answer": "人工抽查回答內容",
|
||||||
|
"check_kb": "檢查知識庫和資料有效期",
|
||||||
|
"check_key_info": "檢查回答是否遺漏關鍵信息",
|
||||||
|
"priority_review": "優先人工複核該問題"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"title": "風險篩選",
|
||||||
|
"timeFrom": "開始日期",
|
||||||
|
"timeTo": "結束日期",
|
||||||
|
"appLabel": "應用",
|
||||||
|
"userLabel": "用戶",
|
||||||
|
"emptyAnswerLabel": "是否空回答",
|
||||||
|
"systemFailureLabel": "是否系統失敗",
|
||||||
|
"riskStatusLabel": "風險狀態",
|
||||||
|
"scoreRangeLabel": "評分區間",
|
||||||
|
"minScore": "最低分",
|
||||||
|
"maxScore": "最高分",
|
||||||
|
"reset": "重設篩選",
|
||||||
|
"yes": "是",
|
||||||
|
"no": "否"
|
||||||
|
},
|
||||||
|
"detailPlaceholder": "暫無數據"
|
||||||
|
},
|
||||||
|
"opsOverview": {
|
||||||
|
"title": "營運總覽",
|
||||||
|
"intro": "彙總關鍵營運指標與應用健康度,整體掌握平台運行情況。",
|
||||||
|
"empty": "暫無營運總覽資料",
|
||||||
|
"kpi": {
|
||||||
|
"totalChats": "對話量",
|
||||||
|
"activeUsers": "活躍使用者",
|
||||||
|
"activeAgents": "活躍應用",
|
||||||
|
"pendingFollowup": "待跟進反饋"
|
||||||
|
},
|
||||||
|
"trendTitle": "對話趨勢與環比",
|
||||||
|
"trendEmpty": "暫無趨勢資料",
|
||||||
|
"topApps": "Top 應用",
|
||||||
|
"lowUseApps": "低使用應用"
|
||||||
|
},
|
||||||
|
"issueAnalysis": {
|
||||||
|
"title": "問題分析",
|
||||||
|
"intro": "基於聊天日誌風險規則聚合高頻問題與需要關注/待抽查信號,定位待優化問題。",
|
||||||
|
"empty": "暫無問題分析資料",
|
||||||
|
"priorityTitle": "優先處理問題",
|
||||||
|
"colTopic": "問題主題",
|
||||||
|
"colCount": "出現次數",
|
||||||
|
"colApps": "涉及應用",
|
||||||
|
"colAttention": "需要關注",
|
||||||
|
"colReasons": "判定原因",
|
||||||
|
"colChecks": "建議檢查項",
|
||||||
|
"kpi": {
|
||||||
|
"highFreq": "高頻問題簇",
|
||||||
|
"highFreqHint": "Top 10 占全部提問 {ratio}%",
|
||||||
|
"attention": "需要關注",
|
||||||
|
"attentionHint": "空回答/系統失敗 +3;低評分 +3;負面反饋 +2;完全重複提問 +1",
|
||||||
|
"review": "待人工抽查",
|
||||||
|
"reviewHint": "低風險信號,建議人工抽查",
|
||||||
|
"emptyAnswer": "空回答",
|
||||||
|
"emptyAnswerHint": "檢查模型返回和接口鏈路",
|
||||||
|
"topApp": "優先優化應用",
|
||||||
|
"topAppHint": "需要關注信號占比 {ratio}%"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"batchEdit": {
|
"batchEdit": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* shared/styles/components-ds.css
|
* shared/styles/components-ds.css
|
||||||
* 设计系统组件样式(按钮、表格、表单等)。
|
* 设计系统组件样式(按钮、表格、表单等)。
|
||||||
*/
|
*/
|
||||||
@@ -394,6 +394,42 @@
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-report-table--compact tbody td {
|
||||||
|
@apply align-middle py-2;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 反馈表必须为操作列保留横向按钮空间;内容详情始终由浮层承载,避免撑高数据行。 */
|
||||||
|
.admin-report-table--feedback {
|
||||||
|
min-width: 58rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-report-table--feedback th:last-child,
|
||||||
|
.admin-report-table--feedback td:last-child {
|
||||||
|
min-width: 7rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-report-feedback-action {
|
||||||
|
@apply inline-flex items-center justify-center whitespace-nowrap px-2.5 py-1;
|
||||||
|
min-width: 6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-report-feedback-content-trigger {
|
||||||
|
@apply w-full max-w-full truncate rounded px-0.5 py-0.5 text-left text-sm text-secondary transition-colors;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-report-feedback-content-trigger:hover,
|
||||||
|
.admin-report-feedback-content-trigger:focus-visible {
|
||||||
|
@apply text-brand-700 outline-none;
|
||||||
|
background-color: color-mix(in srgb, #0ea5e9 8%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-report-feedback-content-popover {
|
||||||
|
@apply absolute left-0 top-full z-30 mt-1 max-h-48 w-72 overflow-auto whitespace-pre-wrap break-words rounded-xl border border-default p-3 text-sm text-secondary shadow-elevated;
|
||||||
|
background-color: var(--bg-surface);
|
||||||
|
}
|
||||||
|
|
||||||
.admin-report-filter-input {
|
.admin-report-filter-input {
|
||||||
@apply w-full max-w-full min-w-0 box-border px-1.5 py-1 text-xs border rounded outline-none font-normal normal-case;
|
@apply w-full max-w-full min-w-0 box-border px-1.5 py-1 text-xs border rounded outline-none font-normal normal-case;
|
||||||
border-color: var(--border-default);
|
border-color: var(--border-default);
|
||||||
@@ -442,6 +478,16 @@
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 应用运营汇总卡:激活(被点击)时更深蓝高亮 */
|
||||||
|
.app-ops-summary-card {
|
||||||
|
@apply cursor-pointer;
|
||||||
|
}
|
||||||
|
.app-ops-summary-card--active {
|
||||||
|
border-color: color-mix(in srgb, #2563eb 45%, var(--border-default));
|
||||||
|
background-color: color-mix(in srgb, #2563eb 14%, var(--bg-surface));
|
||||||
|
box-shadow: 0 0 0 1px color-mix(in srgb, #2563eb 35%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
.admin-report-panel {
|
.admin-report-panel {
|
||||||
@apply p-4 md:p-5 rounded-2xl border border-default shadow-sm;
|
@apply p-4 md:p-5 rounded-2xl border border-default shadow-sm;
|
||||||
background-color: var(--bg-surface);
|
background-color: var(--bg-surface);
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* shared/utils/user-avatar.ts
|
||||||
|
* 用途:统一生成用户头像中的姓名缩写。
|
||||||
|
* 依赖:用户对象的 real_name 与 username 字段。
|
||||||
|
* 逻辑:优先显示真实姓名最后两个 Unicode 字符;无真实姓名时回退到账号首字母。
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成用户头像文字,供用户管理和个人中心等用户头像展示位置复用。
|
||||||
|
* @param user 用户信息,必须包含 username,可选 real_name。
|
||||||
|
* @returns 真实姓名后两个字符;姓名不足两字时返回全部姓名;无姓名时返回账号首字母。
|
||||||
|
*/
|
||||||
|
export function getUserAvatarLabel(user: { real_name?: string | null; username?: string | null }): string {
|
||||||
|
const realName = String(user.real_name || '').trim();
|
||||||
|
if (realName) return Array.from(realName).slice(-2).join('');
|
||||||
|
return String(user.username || 'U').charAt(0).toUpperCase();
|
||||||
|
}
|
||||||
Reference in new issue
Block a user