Merge remote-tracking branch 'origin/dev' into super

合并sophie开发的内容0414
This commit is contained in:
super committed 2026-04-14 16:23:28 +08:00
commit 3b35a66307
26 files changed
+7244 -448

No files matched your search

+3
View File
@@ -36,6 +36,9 @@ frontend/node_modules/
frontend/.DS_Store frontend/.DS_Store
frontend/.env.local frontend/.env.local
frontend/.env.*.local frontend/.env.*.local
frontend/.npm-cache
frontend/public/WW_verify_46MjWA55y3PBRLid.txt
frontend/package-lock.json
# IDEs # IDEs
.vscode/ .vscode/
+275 -1
View File
@@ -5,9 +5,16 @@ backend/app/api/chat.py
引用文件:flask, services.dify, decorators, models 引用文件:flask, services.dify, decorators, models
逻辑关系:作为前端与 Dify 之间的 BFF 层,负责转发请求并流式返回结果 逻辑关系:作为前端与 Dify 之间的 BFF 层,负责转发请求并流式返回结果
""" """
import io
import ipaddress
from urllib.parse import urlparse
import requests
from flask import Blueprint, request, Response, stream_with_context, jsonify, g, current_app from flask import Blueprint, request, Response, stream_with_context, jsonify, g, current_app
from sqlalchemy import func, desc from sqlalchemy import func, desc
from openpyxl import load_workbook
from app.services.dify import DifyService from app.services.dify import DifyService
from app.services.integration_api import IntegrationApiService
from app.decorators import require_agent_permission from app.decorators import require_agent_permission
from app.models import Agent, ChatLog, Feedback from app.models import Agent, ChatLog, Feedback
from app import db from app import db
@@ -16,6 +23,66 @@ from app import db
chat_bp = Blueprint('chat', __name__) chat_bp = Blueprint('chat', __name__)
def _is_allowed_preview_url(target_url: str) -> bool:
"""
预览代理 URL 白名单校验。
仅允许:
1) 配置中的集成服务主机;
2) 本机地址;
3) 私网 IP 或常见内网域名(.local/.lan)。
"""
try:
parsed = urlparse(target_url)
if parsed.scheme not in ("http", "https"):
return False
host = (parsed.hostname or "").strip().lower()
if not host:
return False
# 显式放行配置中的集成服务主机。
integration_base = (current_app.config.get("INTEGRATION_API_BASE") or "").strip()
if integration_base:
integration_host = (urlparse(integration_base).hostname or "").strip().lower()
if integration_host and host == integration_host:
return True
if host in ("localhost", "127.0.0.1", "::1"):
return True
try:
ip = ipaddress.ip_address(host)
return ip.is_private or ip.is_loopback
except ValueError:
# 非 IP 主机:仅放行内网风格本地域名。
return host.endswith(".local") or host.endswith(".lan")
except Exception:
return False
def _fetch_preview_source_bytes(file_url: str):
"""
从上游文件 URL 拉取二进制内容(供预览接口复用)。
返回: (content_bytes, content_type, error_tuple)
其中 error_tuple = (message, status_code);成功时为 None。
"""
try:
upstream = requests.get(file_url, timeout=(5, 20))
except requests.RequestException as e:
current_app.logger.warning("[file-preview] upstream request failed: %s", e)
return None, None, ('failed to fetch source file', 502)
if upstream.status_code != 200:
return None, None, (f'upstream returned status {upstream.status_code}', 502)
content = upstream.content or b''
max_size = 15 * 1024 * 1024
if len(content) > max_size:
return None, None, ('file too large for online preview', 413)
content_type = (upstream.headers.get('content-type') or '').split(';')[0].strip().lower()
return content, content_type, None
@chat_bp.route('/sessions', methods=['GET']) @chat_bp.route('/sessions', methods=['GET'])
@require_agent_permission @require_agent_permission
def get_chat_sessions(): def get_chat_sessions():
@@ -85,7 +152,12 @@ def get_chat_messages():
messages = [] messages = []
for log in logs: for log in logs:
messages.append({'role': 'user', 'content': log.query}) messages.append({'role': 'user', 'content': log.query})
messages.append({'role': 'assistant', 'content': log.answer}) messages.append({
'role': 'assistant',
'content': log.answer,
'retriever_resources': log.retriever_resources or [],
'attribution_parts': log.attribution_parts or []
})
return jsonify(messages) return jsonify(messages)
@@ -116,8 +188,17 @@ def chat_completions():
user = getattr(g, 'current_user', None) user = getattr(g, 'current_user', None)
agent = getattr(g, 'current_agent', None) agent = getattr(g, 'current_agent', None)
current_app.logger.info(
"[chat-api] /completions request user_id=%s agent_id=%s query_len=%s conversation_id=%s",
getattr(user, 'id', None),
getattr(agent, 'id', None),
len(query or ''),
conversation_id,
)
# 安全兜底:如果装饰器未正确注入,返回错误 # 安全兜底:如果装饰器未正确注入,返回错误
if user is None or agent is None: if user is None or agent is None:
current_app.logger.error("[chat-api] missing user/agent context user=%s agent=%s", bool(user), bool(agent))
return jsonify({'error': 'Missing user or agent context'}), 500 return jsonify({'error': 'Missing user or agent context'}), 500
# 返回 SSE 响应,mimetype 设为 text/event-stream # 返回 SSE 响应,mimetype 设为 text/event-stream
@@ -128,6 +209,8 @@ def chat_completions():
mimetype='text/event-stream', mimetype='text/event-stream',
headers={ headers={
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
'Content-Type': 'text/event-stream; charset=utf-8',
'Connection': 'keep-alive',
# 对于 Nginx 反向代理,需要关闭缓冲以支持实时流式传输 # 对于 Nginx 反向代理,需要关闭缓冲以支持实时流式传输
'X-Accel-Buffering': 'no' 'X-Accel-Buffering': 'no'
} }
@@ -193,3 +276,194 @@ def submit_feedback():
db.session.commit() db.session.commit()
return jsonify({'status': 'ok'}) return jsonify({'status': 'ok'})
@chat_bp.route('/source-file', methods=['GET'])
@require_agent_permission
def resolve_source_file():
"""
Resolve original source download URL by Dify dataset/document IDs.
"""
dataset_id = (request.args.get('dataset_id') or '').strip()
remote_document_id = (request.args.get('remote_document_id') or '').strip()
if not dataset_id or not remote_document_id:
current_app.logger.warning(
"[source-file] missing required params: dataset_id=%r remote_document_id_present=%s remote_document_id_preview=%r query_args=%s",
dataset_id,
bool(remote_document_id),
(remote_document_id[:8] + "...") if remote_document_id else "",
dict(request.args),
)
return jsonify({'error': 'dataset_id and remote_document_id are required'}), 400
payload = IntegrationApiService.lookup_file_by_dify(dataset_id, remote_document_id)
if not payload:
return jsonify({'error': 'source file mapping not found'}), 404
return jsonify({
'dataset_id': dataset_id,
'remote_document_id': remote_document_id,
'source_filename': payload.get('source_filename'),
'source_ext': payload.get('source_ext'),
'source_download_url': payload.get('source_download_url'),
'download_url_expires_at': payload.get('download_url_expires_at'),
})
@chat_bp.route('/preview-excel', methods=['GET'])
@require_agent_permission
def preview_excel():
"""
内网 Excel 预览接口(简版可上线)。
说明:
- 当前仅支持 xlsx;
- xls 返回 415,由前端走下载兜底。
"""
file_url = (request.args.get('url') or '').strip()
if not file_url:
return jsonify({'error': 'url is required'}), 400
if not _is_allowed_preview_url(file_url):
return jsonify({'error': 'url is not allowed for preview'}), 403
parsed = urlparse(file_url)
ext = ((parsed.path or '').split('.')[-1] if '.' in (parsed.path or '') else '').lower()
if ext == 'xls':
return jsonify({'error': 'xls is not supported in online preview'}), 415
if ext and ext not in ('xlsx',):
return jsonify({'error': f'unsupported file extension: {ext}'}), 415
try:
limit = int(request.args.get('limit', 100))
except ValueError:
limit = 100
limit = max(1, min(limit, 300))
content, _, err = _fetch_preview_source_bytes(file_url)
if err:
msg, code = err
return jsonify({'error': msg}), code
try:
wb = load_workbook(filename=io.BytesIO(content), data_only=True, read_only=True)
except Exception as e:
current_app.logger.warning("[excel-preview] parse workbook failed: %s", e)
return jsonify({'error': 'failed to parse excel file'}), 422
if not wb.sheetnames:
return jsonify({'error': 'workbook has no sheets'}), 422
requested_sheet = (request.args.get('sheet') or '').strip()
sheet_name = requested_sheet if requested_sheet in wb.sheetnames else wb.sheetnames[0]
ws = wb[sheet_name]
rows = []
for row in ws.iter_rows(values_only=True):
normalized = []
for cell in row:
if cell is None:
normalized.append('')
elif isinstance(cell, (int, float, bool)):
normalized.append(cell)
else:
normalized.append(str(cell))
rows.append(normalized)
if len(rows) >= limit:
break
# 统一列宽,保证前端表格渲染稳定。
max_cols = max((len(r) for r in rows), default=0)
for r in rows:
if len(r) < max_cols:
r.extend([''] * (max_cols - len(r)))
columns = [f'COL_{i + 1}' for i in range(max_cols)]
return jsonify({
'sheet_name': sheet_name,
'sheets': wb.sheetnames,
'columns': columns,
'rows': rows,
'limit': limit,
'truncated': len(rows) >= limit,
})
@chat_bp.route('/preview-text', methods=['GET'])
@require_agent_permission
def preview_text():
"""
文本类文件预览接口(内网代理)。
支持:md/markdown/txt/csv/vtt/properties/html/htm
"""
file_url = (request.args.get('url') or '').strip()
if not file_url:
return jsonify({'error': 'url is required'}), 400
if not _is_allowed_preview_url(file_url):
return jsonify({'error': 'url is not allowed for preview'}), 403
parsed = urlparse(file_url)
ext = ((parsed.path or '').split('.')[-1] if '.' in (parsed.path or '') else '').lower()
allowed = {'md', 'markdown', 'txt', 'csv', 'vtt', 'properties', 'html', 'htm'}
if ext and ext not in allowed:
return jsonify({'error': f'unsupported text extension: {ext}'}), 415
content, content_type, err = _fetch_preview_source_bytes(file_url)
if err:
msg, code = err
return jsonify({'error': msg}), code
# 尝试多编码解码,提升兼容性。
text = None
for enc in ('utf-8', 'utf-8-sig', 'gb18030', 'latin-1'):
try:
text = content.decode(enc)
break
except Exception:
continue
if text is None:
return jsonify({'error': 'failed to decode text file'}), 422
return jsonify({
'content': text,
'content_type': content_type or 'text/plain',
'ext': ext,
})
@chat_bp.route('/preview-file-raw', methods=['GET'])
@require_agent_permission
def preview_file_raw():
"""
二进制文件内网代理预览接口。
用途:
- 为 pdf/doc/docx 生成可被前端 iframe 访问的同源地址;
- 尽量使用 inline 响应头,避免强制下载。
"""
file_url = (request.args.get('url') or '').strip()
if not file_url:
return jsonify({'error': 'url is required'}), 400
if not _is_allowed_preview_url(file_url):
return jsonify({'error': 'url is not allowed for preview'}), 403
parsed = urlparse(file_url)
ext = ((parsed.path or '').split('.')[-1] if '.' in (parsed.path or '') else '').lower()
content, content_type, err = _fetch_preview_source_bytes(file_url)
if err:
msg, code = err
return jsonify({'error': msg}), code
fallback_types = {
'pdf': 'application/pdf',
'doc': 'application/msword',
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
}
if ext == 'pdf' and not content.startswith(b'%PDF-'):
return jsonify({'error': 'upstream did not return a valid pdf binary'}), 422
mime = fallback_types.get(ext) or content_type or 'application/octet-stream'
filename = (request.args.get('name') or '').strip() or f'preview.{ext or "bin"}'
resp = Response(content, status=200, mimetype=mime)
resp.headers['Content-Disposition'] = f'inline; filename="{filename}"'
resp.headers['Cache-Control'] = 'no-store'
return resp
+27 -10
View File
@@ -1,9 +1,17 @@
"""
"""
backend/app/config.py backend/app/config.py
配置类,区分开发/生产环境 配置类,区分开发/生产环境
""" """
import os import os
from pathlib import Path
from dotenv import load_dotenv
# Auto-load backend/.env so new shell windows also pick up local settings.
_BACKEND_DIR = Path(__file__).resolve().parents[1]
load_dotenv(_BACKEND_DIR / '.env')
class Config: class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
@@ -13,7 +21,7 @@ class Config:
'pool_size': 20, 'pool_size': 20,
'max_overflow': 10, 'max_overflow': 10,
'pool_recycle': 3600, 'pool_recycle': 3600,
'pool_pre_ping': True 'pool_pre_ping': True,
} }
# Dify 网关配置 # Dify 网关配置
DIFY_API_BASE = os.getenv('DIFY_API_BASE', 'https://api.dify.ai/v1') DIFY_API_BASE = os.getenv('DIFY_API_BASE', 'https://api.dify.ai/v1')
@@ -23,10 +31,15 @@ class Config:
FEEDBACK_ENABLED = os.getenv('FEEDBACK_ENABLED', 'true').lower() == 'true' FEEDBACK_ENABLED = os.getenv('FEEDBACK_ENABLED', 'true').lower() == 'true'
HR_WORKFLOW_IFRAME_URL = os.getenv( HR_WORKFLOW_IFRAME_URL = os.getenv(
'HR_WORKFLOW_IFRAME_URL', 'HR_WORKFLOW_IFRAME_URL',
'http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg' 'http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg',
) )
HR_WORKFLOW_API_BASE = os.getenv('HR_WORKFLOW_API_BASE', 'http://127.0.0.1:5001/v1') HR_WORKFLOW_API_BASE = os.getenv('HR_WORKFLOW_API_BASE', 'http://127.0.0.1:5001/v1')
HR_WORKFLOW_API_KEY = os.getenv('HR_WORKFLOW_API_KEY') HR_WORKFLOW_API_KEY = os.getenv('HR_WORKFLOW_API_KEY')
# External integration API (resolve original source file links by Dify IDs)
INTEGRATION_API_BASE = os.getenv('INTEGRATION_API_BASE', 'http://192.168.100.230:8891')
INTEGRATION_API_KEY = os.getenv('INTEGRATION_API_KEY')
# WeCom (企业微信) 登录配置 # WeCom (企业微信) 登录配置
WECOM_ENABLED = os.getenv('WECOM_ENABLED', 'false').lower() == 'true' WECOM_ENABLED = os.getenv('WECOM_ENABLED', 'false').lower() == 'true'
WECOM_CORP_ID = os.getenv('WECOM_CORP_ID') WECOM_CORP_ID = os.getenv('WECOM_CORP_ID')
@@ -35,19 +48,22 @@ class Config:
WECOM_REDIRECT_URI = os.getenv('WECOM_REDIRECT_URI') WECOM_REDIRECT_URI = os.getenv('WECOM_REDIRECT_URI')
WECOM_AUTO_CREATE_USER = os.getenv('WECOM_AUTO_CREATE_USER', 'true').lower() == 'true' WECOM_AUTO_CREATE_USER = os.getenv('WECOM_AUTO_CREATE_USER', 'true').lower() == 'true'
class DevelopmentConfig(Config): class DevelopmentConfig(Config):
DEBUG = True DEBUG = True
# 本地 MacBook PostgreSQL 配置(数据库: hxops_db,用户: postgres, 密码: difyai123456)
SQLALCHEMY_DATABASE_URI = os.getenv( SQLALCHEMY_DATABASE_URI = os.getenv(
'DATABASE_URL', 'DATABASE_URL',
'postgresql://postgres:difyai123456@localhost:5432/hxops_db' 'postgresql://postgres:difyai123456@localhost:5432/hxops_db',
) )
class ProductionConfig(Config): class ProductionConfig(Config):
DEBUG = False DEBUG = False
# 服务器 Ubuntu PostgreSQL 配置 SQLALCHEMY_DATABASE_URI = os.getenv(
# 注意:在服务器上通过环境变量覆盖,但此处保留默认模板 'DATABASE_URL',
SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', 'postgresql://postgres:difyai123456@localhost:5432/hxops_prod') 'postgresql://postgres:difyai123456@localhost:5432/hxops_prod',
)
class TestingConfig(Config): class TestingConfig(Config):
TESTING = True TESTING = True
@@ -55,9 +71,10 @@ class TestingConfig(Config):
WTF_CSRF_ENABLED = False WTF_CSRF_ENABLED = False
SQLALCHEMY_ENGINE_OPTIONS = {} SQLALCHEMY_ENGINE_OPTIONS = {}
config = { config = {
'development': DevelopmentConfig, 'development': DevelopmentConfig,
'testing': TestingConfig, 'testing': TestingConfig,
'production': ProductionConfig, 'production': ProductionConfig,
'default': DevelopmentConfig 'default': DevelopmentConfig,
} }
+3
View File
@@ -194,6 +194,9 @@ class ChatLog(Base):
latency: Mapped[int] = mapped_column(default=0) latency: Mapped[int] = mapped_column(default=0)
conversation_id: Mapped[Optional[str]] = mapped_column(String(100)) conversation_id: Mapped[Optional[str]] = mapped_column(String(100))
tokens_used: Mapped[int] = mapped_column(default=0) tokens_used: Mapped[int] = mapped_column(default=0)
# Persist citation/source metadata so history messages can still show sources.
retriever_resources: Mapped[Optional[list]] = mapped_column(JSON)
attribution_parts: Mapped[Optional[list]] = mapped_column(JSON)
created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow) created_at: Mapped[datetime] = mapped_column(default=datetime.utcnow)
# 关联 Feedback # 关联 Feedback
+459 -90
View File
@@ -1,125 +1,213 @@
""" """
backend/app/services/dify.py backend/app/services/dify.py
文件用途:Dify API 集成服务
引用文件:requests, json, models, config File-Level Overview
逻辑关系:负责与 Dify 平台进行 HTTP 通信,处理 SSE 流式响应,并记录审计日志 -------------------
This module provides the backend service wrapper for Dify streaming chat APIs.
It is responsible for:
1) Forwarding chat requests from this system to Dify in streaming mode.
2) Relaying Dify SSE events to the frontend.
3) Aggregating answer text and metadata (retriever resources / attribution).
4) Enriching retriever resources with original source-file download URLs via
the integration API mapping (dataset_id + remote_document_id).
5) Persisting chat logs to the local database.
Main Data Flow
--------------
chat.py (/api/chat/completions)
-> DifyService.stream_chat(...)
-> requests.post(... stream=True) to Dify
-> parse SSE events from Dify
-> optional enrichment of source links on message_end
-> write chat log
-> yield SSE events to frontend
""" """
import requests
import json import json
import time import time
from typing import Any, List
import requests
from flask import current_app from flask import current_app
from app.models import ChatLog, db
from app.config import Config from app.config import Config
from app.models import ChatLog, db
from app.services.integration_api import IntegrationApiService
class DifyService: class DifyService:
""" """Dify service wrapper."""
Dify 服务类
用途:封装与 Dify API 的交互逻辑
"""
@staticmethod @staticmethod
def stream_chat(query: str, user_id: int, agent, conversation_id: str = None): def stream_chat(query: str, user_id: int, agent, conversation_id: str = None):
""" """
生成器函数:向 Dify 发起请求并流式返回 主流程,调用 Dify、解析 SSE、记录日志、写库、向上游继续产出 SSE
用途:处理 /v1/chat-messages 接口的流式响应 Stream chat completion from Dify and relay SSE events to caller.
核心逻辑:
1. 构造请求头与 Payload Args:
2. 使用 requests.post(stream=True) 发起请求 query: User prompt text.
3. 逐行读取 SSE 数据 user_id: Local user ID (sent to Dify as user string).
4. 解析 'data: ' 开头的行,透传给前端 agent: Agent model instance, must contain dify_api_key and optional api_base_url.
5. 在 'message_end' 事件中记录完整日志到数据库 conversation_id: Existing conversation ID for multi-turn context (optional).
参数:
query: 用户提问内容 Yields:
user_id: 当前用户 ID SSE event lines in format: `data: {...}\\n\\n`.
agent: Agent 模型对象,包含 API Key
conversation_id: 会话 ID (可选) Side Effects:
输出: - Collects/merges metadata from Dify events.
Yields SSE 格式字符串 "data: {...}\n\n" - Enriches retriever resources with source URLs on message_end.
- Persists chat log to DB when message_end arrives.
- Writes diagnostic logs.
""" """
# 使用 Agent 自定义的 API Base URL,若未配置则使用全局配置 # Prefer agent-specific base URL; fallback to global config.
base_url = agent.api_base_url if agent.api_base_url else Config.DIFY_API_BASE base_url = agent.api_base_url if agent.api_base_url else Config.DIFY_API_BASE
# 移除末尾斜杠以避免双斜杠问题
base_url = base_url.rstrip('/') base_url = base_url.rstrip('/')
url = f"{base_url}/chat-messages" url = f"{base_url}/chat-messages"
headers = { headers = {
'Authorization': f'Bearer {agent.dify_api_key}', 'Authorization': f'Bearer {agent.dify_api_key}',
'Content-Type': 'application/json' 'Content-Type': 'application/json',
} }
payload = { payload = {
"inputs": {}, 'inputs': {},
"query": query, 'query': query,
"response_mode": "streaming", 'response_mode': 'streaming',
"conversation_id": conversation_id, 'conversation_id': conversation_id,
"user": str(user_id) 'user': str(user_id),
} }
# 记录开始时间,用于计算耗时 if current_app:
current_app.logger.info(
"[chat-stream] start user_id=%s agent_id=%s base_url=%s query_len=%s conversation_id=%s",
user_id,
getattr(agent, 'id', None),
base_url,
len(query or ''),
conversation_id,
)
start_time = time.time() start_time = time.time()
# 用于收集流式片段拼接完整回答 full_answer: List[str] = []
full_answer = [] retriever_resources: List[Any] = []
attribution_parts: List[str] = []
try: try:
# stream=True 关键参数,建立长连接
# 设置连接超时为 5 秒,读取超时为 60 秒
with requests.post(url, headers=headers, json=payload, stream=True, timeout=(5, 60)) as response: with requests.post(url, headers=headers, json=payload, stream=True, timeout=(5, 60)) as response:
if current_app:
current_app.logger.info(
"[chat-stream] dify response status=%s reason=%s",
response.status_code,
response.reason,
)
response.raise_for_status() response.raise_for_status()
# 逐行迭代响应内容
for line in response.iter_lines(): for line in response.iter_lines():
if line: if not line:
decoded_line = line.decode('utf-8') continue
# 识别 SSE 数据行
if decoded_line.startswith('data: '): decoded_line = line.decode('utf-8')
json_str = decoded_line[6:] if not decoded_line.startswith('data: '):
try: continue
data = json.loads(json_str)
event = data.get('event') raw_json = decoded_line[6:]
try:
# 核心:将 Dify 的原始数据透传给前端 data = json.loads(raw_json)
yield f"data: {json_str}\n\n" except json.JSONDecodeError:
continue
# 收集完整回答用于日志
if event == 'message': event = data.get('event')
full_answer.append(data.get('answer', '')) if current_app:
elif event == 'message_end': current_app.logger.info(
# 对话结束,记录日志 "[chat-stream] event=%s answer_len=%s has_metadata=%s conversation_id=%s",
latency = int((time.time() - start_time) * 1000) event,
metadata = data.get('metadata', {}) len(data.get('answer', '') or ''),
usage = metadata.get('usage', {}) bool(data.get('metadata')),
data.get('conversation_id') or conversation_id,
# 显式使用应用上下文 )
with current_app.app_context():
DifyService._log_chat( if event == 'message':
user_id=user_id, full_answer.append(data.get('answer', ''))
agent_id=agent.id, DifyService._collect_metadata(retriever_resources, attribution_parts, data)
conversation_id=data.get('conversation_id') or conversation_id,
query=query, elif event in ('message_end', 'agent_message', 'workflow_finished'):
answer="".join(full_answer), if data.get('answer'):
tokens=usage.get('total_tokens', 0), full_answer.append(data.get('answer', ''))
latency=latency DifyService._collect_metadata(retriever_resources, attribution_parts, data)
)
if event == 'message_end':
except json.JSONDecodeError: if current_app:
continue current_app.logger.info(
else: "[source-link] message_end: collected retriever resources=%s",
# 处理 keep-alive 等其他行 len(retriever_resources),
pass )
# Resolve original source file URLs from external integration API.
DifyService._enrich_retriever_resources_with_source_urls(retriever_resources)
metadata = data.get('metadata') or {}
metadata['retriever_resources'] = retriever_resources
data['metadata'] = metadata
data['retriever_resources'] = retriever_resources
latency = int((time.time() - start_time) * 1000)
usage = metadata.get('usage', {}) or {}
with current_app.app_context():
DifyService._log_chat(
user_id=user_id,
agent_id=agent.id,
conversation_id=data.get('conversation_id') or conversation_id,
query=query,
answer=''.join(full_answer),
tokens=usage.get('total_tokens', 0),
latency=latency,
retriever_resources=retriever_resources,
attribution_parts=attribution_parts,
)
if current_app:
current_app.logger.info(
"[chat-stream] message_end logged conversation_id=%s answer_len=%s resources=%s attribution=%s latency_ms=%s",
data.get('conversation_id') or conversation_id,
len(''.join(full_answer)),
len(retriever_resources),
len(attribution_parts),
latency,
)
# Pass-through SSE event (after optional enrichment).
# SSE frame delimiter must be real newlines, not literal "\n".
yield f"data: {json.dumps(data, ensure_ascii=False)}\n\n"
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
# 异常处理:返回标准错误格式给前端 if current_app:
error_msg = json.dumps({"event": "error", "message": str(e)}) current_app.logger.exception("[chat-stream] request exception: %s", e)
error_msg = json.dumps({'event': 'error', 'message': str(e)})
yield f"data: {error_msg}\n\n" yield f"data: {error_msg}\n\n"
@staticmethod @staticmethod
def _log_chat(user_id, agent_id, conversation_id, query, answer, tokens, latency): def _log_chat(
user_id,
agent_id,
conversation_id,
query,
answer,
tokens,
latency,
retriever_resources=None,
attribution_parts=None,
):
""" """
内部方法:写入数据库日志 把最终问答和元数据写入 ChatLog
用途:将对话详情持久化到 ChatLog 表 Persist one chat record into ChatLog table.
Args:
user_id, agent_id, conversation_id: Chat identity fields.
query: User input.
answer: Aggregated assistant answer.
tokens: Total token usage (best effort).
latency: End-to-end latency in milliseconds.
retriever_resources: Source retrieval metadata list.
attribution_parts: Attribution/annotation list.
""" """
try: try:
# 确保在应用上下文中
chat_log = ChatLog( chat_log = ChatLog(
user_id=user_id, user_id=user_id,
agent_id=agent_id, agent_id=agent_id,
@@ -127,12 +215,293 @@ class DifyService:
query=query, query=query,
answer=answer, answer=answer,
tokens_used=tokens or 0, tokens_used=tokens or 0,
latency=latency or 0 latency=latency or 0,
retriever_resources=retriever_resources or [],
attribution_parts=attribution_parts or [],
) )
db.session.add(chat_log) db.session.add(chat_log)
db.session.commit() db.session.commit()
except Exception as e: except Exception as e:
# Re-acquire logger from current_app as it might be detached
if current_app: if current_app:
current_app.logger.error(f"Failed to log chat: {e}") current_app.logger.error(f'Failed to log chat: {e}')
db.session.rollback() db.session.rollback()
@staticmethod
def _normalize_resources(resources):
"""
把资源结构统一为 list
Normalize retriever resource payload into a list.
Dify events may return resources as:
- list
- dict with `data: []`
- empty / None
"""
if not resources:
return []
if isinstance(resources, list):
return resources
if isinstance(resources, dict) and isinstance(resources.get('data'), list):
return resources.get('data')
return []
@staticmethod
def _merge_retriever_resources(target: List[Any], resources):
"""
合并去重检索来源
Merge retriever resources into target list with de-duplication.
De-dup strategy: serialize each item as sorted JSON string.
"""
for item in DifyService._normalize_resources(resources):
item_key = json.dumps(item, ensure_ascii=False, sort_keys=True, default=str)
exists = any(
json.dumps(existing, ensure_ascii=False, sort_keys=True, default=str) == item_key
for existing in target
)
if not exists:
target.append(item)
@staticmethod
def _merge_attribution_parts(target: List[str], value):
"""
合并去重归属片段
Merge attribution values into target list with de-duplication.
Supports string / list / dict / arbitrary values and converts them to
stable text snippets.
"""
if value is None:
return
def push_unique(v):
text = (v or '').strip()
if text and text not in target:
target.append(text)
if isinstance(value, str):
push_unique(value)
return
if isinstance(value, list):
for item in value:
if isinstance(item, str):
push_unique(item)
elif isinstance(item, dict):
push_unique(item.get('content') or item.get('text') or item.get('title') or json.dumps(item, ensure_ascii=False))
else:
push_unique(str(item))
return
if isinstance(value, dict):
push_unique(value.get('content') or value.get('text') or value.get('title') or json.dumps(value, ensure_ascii=False))
return
push_unique(str(value))
@staticmethod
def _collect_metadata(retriever_resources: List[Any], attribution_parts: List[str], event_data: dict):
"""
从 event 和 metadata 中收集来源与归属
Collect metadata from one Dify SSE event and merge into accumulators.
Reads both top-level and nested metadata keys to improve compatibility
with different Dify event payload shapes.
"""
metadata = event_data.get('metadata', {}) or {}
DifyService._merge_retriever_resources(retriever_resources, event_data.get('retriever_resources'))
DifyService._merge_retriever_resources(retriever_resources, metadata.get('retriever_resources'))
DifyService._merge_retriever_resources(retriever_resources, metadata.get('retrieverResources'))
DifyService._merge_attribution_parts(attribution_parts, event_data.get('annotations'))
DifyService._merge_attribution_parts(attribution_parts, event_data.get('annotation_reply'))
DifyService._merge_attribution_parts(attribution_parts, metadata.get('annotations'))
DifyService._merge_attribution_parts(attribution_parts, metadata.get('annotation_reply'))
DifyService._merge_attribution_parts(attribution_parts, event_data.get('citation'))
DifyService._merge_attribution_parts(attribution_parts, metadata.get('citation'))
@staticmethod
def _extract_dify_ids(resource: dict):
"""
从 resource(含嵌套 metadata)提取 dataset_id 和 remote_document_id
Extract dataset_id and remote_document_id from a retriever resource.
Tries multiple key aliases from both top-level and metadata, then
falls back to recursive deep search for robustness.
"""
metadata = resource.get('metadata') if isinstance(resource, dict) else None
metadata = metadata if isinstance(metadata, dict) else {}
dataset_id = (
resource.get('dataset_id')
or resource.get('dify_dataset_id')
or resource.get('knowledge_base_id')
or metadata.get('dataset_id')
or metadata.get('dify_dataset_id')
or metadata.get('knowledge_base_id')
or DifyService._find_first_by_keys(
resource,
['dataset_id', 'dify_dataset_id', 'knowledge_base_id', 'kb_id'],
)
)
remote_document_id = (
resource.get('remote_document_id')
or resource.get('dify_document_id')
or resource.get('document_id')
or resource.get('doc_id')
or metadata.get('remote_document_id')
or metadata.get('dify_document_id')
or metadata.get('document_id')
or metadata.get('doc_id')
or DifyService._find_first_by_keys(
resource,
[
'remote_document_id',
'dify_document_id',
'document_id',
'doc_id',
'source_document_id',
],
)
)
return dataset_id, remote_document_id
@staticmethod
def _find_first_by_keys(payload: Any, key_candidates: List[str]):
"""
递归在任意嵌套结构里按候选 key 找第一个非空值
Recursively find the first non-empty value for any key in key_candidates.
"""
if isinstance(payload, dict):
for k, v in payload.items():
if k in key_candidates and v not in (None, ''):
return v
for v in payload.values():
found = DifyService._find_first_by_keys(v, key_candidates)
if found not in (None, ''):
return found
elif isinstance(payload, list):
for item in payload:
found = DifyService._find_first_by_keys(item, key_candidates)
if found not in (None, ''):
return found
return None
@staticmethod
def _enrich_retriever_resources_with_source_urls(resources: List[Any]):
"""
批量调用集成 API,把 source_download_url 回填到每个 resource
Batch enrich retriever resources with source_download_url and file meta.
Process:
1) Extract (dataset_id, remote_document_id) pairs from resources.
2) Batch query integration mapping service.
3) Write resolved source URL / filename / ext / expiry back to each item.
Notes:
- Resources without required IDs are skipped with warning logs.
- Existing source_download_url is preserved.
"""
candidates = []
index_to_key = {}
for idx, item in enumerate(resources):
if not isinstance(item, dict):
if current_app:
current_app.logger.debug(
"[source-link] resource[%s] skipped: not a dict (type=%s)",
idx,
type(item).__name__,
)
continue
if item.get('source_download_url'):
if current_app:
current_app.logger.info(
"[source-link] resource[%s] already has source_download_url",
idx,
)
continue
dataset_id, remote_document_id = DifyService._extract_dify_ids(item)
if current_app:
current_app.logger.info(
"[source-link] resource[%s] extracted ids: dataset_id=%r remote_document_id=%r",
idx,
dataset_id,
remote_document_id,
)
if not dataset_id or not remote_document_id:
if current_app:
metadata = item.get('metadata') if isinstance(item.get('metadata'), dict) else {}
current_app.logger.warning(
"[source-link] resource[%s] missing ids. top-level keys=%s metadata keys=%s",
idx,
sorted(list(item.keys())),
sorted(list(metadata.keys())),
)
continue
key = (str(dataset_id), str(remote_document_id))
index_to_key[idx] = key
candidates.append({
"dataset_id": key[0],
"remote_document_id": key[1],
})
if not candidates:
return
if current_app:
current_app.logger.info(
"[source-link] batch resolving source urls: candidates=%s",
len(candidates),
)
resolved_map = IntegrationApiService.lookup_files_by_dify(candidates)
for idx, item in enumerate(resources):
if idx not in index_to_key:
continue
dataset_id, remote_document_id = index_to_key[idx]
payload = resolved_map.get((dataset_id, remote_document_id))
if not payload:
if current_app:
current_app.logger.warning(
"[source-link] resource[%s] integration lookup empty for dataset_id=%s remote_document_id=%s",
idx,
dataset_id,
remote_document_id,
)
continue
source_url = payload.get('source_download_url')
if not source_url:
if current_app:
current_app.logger.warning(
"[source-link] resource[%s] integration payload has no source_download_url "
"(dataset_id=%s remote_document_id=%s, payload keys=%s)",
idx,
dataset_id,
remote_document_id,
sorted(list(payload.keys())) if isinstance(payload, dict) else [],
)
continue
item['source_download_url'] = source_url
if payload.get('source_filename'):
item['source_filename'] = payload.get('source_filename')
if payload.get('source_ext'):
item['source_ext'] = payload.get('source_ext')
if payload.get('download_url_expires_at'):
item['source_download_url_expires_at'] = payload.get('download_url_expires_at')
if current_app:
current_app.logger.info(
"[source-link] resource[%s] resolved source_download_url ok "
"(dataset_id=%s remote_document_id=%s)",
idx,
dataset_id,
remote_document_id,
)
+179
View File
@@ -0,0 +1,179 @@
"""
Integration API client for resolving original source-file download links.
"""
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
import requests
from flask import current_app
from app.config import Config
class IntegrationApiService:
_cache: Dict[Tuple[str, str], Dict[str, Any]] = {}
@staticmethod
def _cache_key(dataset_id: str, remote_document_id: str) -> Tuple[str, str]:
return (str(dataset_id), str(remote_document_id))
@staticmethod
def _is_cache_valid(payload: Dict[str, Any]) -> bool:
exp = payload.get("download_url_expires_at")
if not exp:
return True
try:
return datetime.fromisoformat(exp) > datetime.now().astimezone()
except Exception:
return True
@staticmethod
def lookup_file_by_dify(dataset_id: str, remote_document_id: str) -> Optional[Dict[str, Any]]:
if not dataset_id or not remote_document_id:
return None
cache_key = IntegrationApiService._cache_key(dataset_id, remote_document_id)
cached = IntegrationApiService._cache.get(cache_key)
if cached and IntegrationApiService._is_cache_valid(cached):
return cached
base_url = (Config.INTEGRATION_API_BASE or "").rstrip("/")
api_key = Config.INTEGRATION_API_KEY
if not base_url or not api_key:
return None
url = f"{base_url}/api/integration/dify-file"
headers = {"X-Integration-Key": api_key}
params = {
"dataset_id": str(dataset_id),
"remote_document_id": str(remote_document_id),
}
try:
resp = requests.get(url, headers=headers, params=params, timeout=(4, 8))
if resp.status_code != 200:
return None
payload = resp.json()
if not isinstance(payload, dict):
return None
IntegrationApiService._cache[cache_key] = payload
return payload
except Exception as e:
if current_app:
current_app.logger.warning(f"Integration API lookup failed: {e}")
return None
@staticmethod
def lookup_files_by_dify(items: List[Dict[str, str]]) -> Dict[Tuple[str, str], Dict[str, Any]]:
"""
Batch resolve source files by (dataset_id, remote_document_id).
Returns a mapping keyed by (dataset_id, remote_document_id).
"""
results: Dict[Tuple[str, str], Dict[str, Any]] = {}
if not items:
return results
unresolved: List[Dict[str, str]] = []
seen = set()
for item in items:
dataset_id = str(item.get("dataset_id") or "").strip()
remote_document_id = str(item.get("remote_document_id") or "").strip()
if not dataset_id or not remote_document_id:
continue
key = IntegrationApiService._cache_key(dataset_id, remote_document_id)
if key in seen:
continue
seen.add(key)
cached = IntegrationApiService._cache.get(key)
if cached and IntegrationApiService._is_cache_valid(cached):
results[key] = cached
else:
unresolved.append({
"dataset_id": dataset_id,
"remote_document_id": remote_document_id,
})
if not unresolved:
return results
base_url = (Config.INTEGRATION_API_BASE or "").rstrip("/")
api_key = Config.INTEGRATION_API_KEY
if not base_url or not api_key:
return results
url = f"{base_url}/api/integration/dify-files/resolve"
headers = {
"X-Integration-Key": api_key,
"Content-Type": "application/json",
}
body = {"items": unresolved}
try:
resp = requests.post(url, headers=headers, json=body, timeout=(5, 12))
if resp.status_code != 200:
if current_app:
current_app.logger.warning(
"Integration API batch lookup failed: status=%s", resp.status_code
)
# Fallback to single lookup for reliability.
for item in unresolved:
payload = IntegrationApiService.lookup_file_by_dify(
item["dataset_id"], item["remote_document_id"]
)
if payload:
key = IntegrationApiService._cache_key(
item["dataset_id"], item["remote_document_id"]
)
results[key] = payload
return results
payload = resp.json()
data = payload.get("data") if isinstance(payload, dict) else None
if not isinstance(data, list):
return results
for row in data:
if not isinstance(row, dict):
continue
req = row.get("request") if isinstance(row.get("request"), dict) else {}
dataset_id = str(req.get("dataset_id") or "").strip()
remote_document_id = str(req.get("remote_document_id") or "").strip()
if not dataset_id or not remote_document_id:
continue
if not row.get("found"):
continue
doc = row.get("document") if isinstance(row.get("document"), dict) else {}
source_url = doc.get("source_download_url")
if not source_url:
continue
normalized = {
"source_download_url": source_url,
"source_filename": doc.get("source_filename"),
"source_ext": doc.get("source_ext"),
"download_url_expires_at": doc.get("download_url_expires_at"),
"version_id": doc.get("version_id"),
"document_id": doc.get("document_id"),
}
key = IntegrationApiService._cache_key(dataset_id, remote_document_id)
IntegrationApiService._cache[key] = normalized
results[key] = normalized
return results
except Exception as e:
if current_app:
current_app.logger.warning(f"Integration API batch lookup exception: {e}")
# Fallback to single lookup when batch call errors.
for item in unresolved:
payload = IntegrationApiService.lookup_file_by_dify(
item["dataset_id"], item["remote_document_id"]
)
if payload:
key = IntegrationApiService._cache_key(
item["dataset_id"], item["remote_document_id"]
)
results[key] = payload
return results
@@ -0,0 +1,27 @@
"""add source metadata fields to chat_logs
Revision ID: d1e8a7f4c2b9
Revises: c4e2d9f1a6bc
Create Date: 2026-03-31 12:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd1e8a7f4c2b9'
down_revision = 'c4e2d9f1a6bc'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('chat_logs', sa.Column('retriever_resources', sa.JSON(), nullable=True))
op.add_column('chat_logs', sa.Column('attribution_parts', sa.JSON(), nullable=True))
def downgrade():
op.drop_column('chat_logs', 'attribution_parts')
op.drop_column('chat_logs', 'retriever_resources')
+1
View File
@@ -10,3 +10,4 @@ gunicorn
gevent gevent
pydantic pydantic
python-dotenv python-dotenv
openpyxl
@@ -0,0 +1,193 @@
#!/usr/bin/env python3
"""
Generate batch INSERT SQL for departments table from Excel (.xlsx).
Mapping (first sheet):
- 部门编号 -> departments.code
- 部门名称 -> departments.name
- 公司名称 -> departments.company
"""
from __future__ import annotations
import argparse
import re
import sys
import xml.etree.ElementTree as ET
import zipfile
from pathlib import Path
from typing import Dict, List, Tuple
NS_MAIN = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
NS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
NS_PKG = "http://schemas.openxmlformats.org/package/2006/relationships"
NS = {"a": NS_MAIN}
def _cell_col_index(cell_ref: str) -> int:
match = re.match(r"([A-Z]+)", cell_ref)
if not match:
return 0
idx = 0
for ch in match.group(1):
idx = idx * 26 + (ord(ch) - ord("A") + 1)
return idx - 1
def _get_cell_value(cell: ET.Element, shared_strings: List[str]) -> str:
cell_type = cell.attrib.get("t")
inline_node = cell.find("a:is", NS)
if inline_node is not None:
return "".join(t.text or "" for t in inline_node.findall(".//a:t", NS)).strip()
value_node = cell.find("a:v", NS)
if value_node is None or value_node.text is None:
return ""
raw = value_node.text.strip()
if cell_type == "s" and raw.isdigit():
idx = int(raw)
if 0 <= idx < len(shared_strings):
return shared_strings[idx].strip()
return raw
def _read_shared_strings(zf: zipfile.ZipFile) -> List[str]:
if "xl/sharedStrings.xml" not in zf.namelist():
return []
root = ET.fromstring(zf.read("xl/sharedStrings.xml"))
return [
"".join(t.text or "" for t in si.findall(".//a:t", NS)).strip()
for si in root.findall("a:si", NS)
]
def _first_sheet_path(zf: zipfile.ZipFile) -> str:
workbook = ET.fromstring(zf.read("xl/workbook.xml"))
sheets = workbook.find("a:sheets", NS)
if sheets is None:
raise ValueError("No sheets found in workbook.")
first_sheet = sheets.find("a:sheet", NS)
if first_sheet is None:
raise ValueError("No sheet found in workbook.")
rid = first_sheet.attrib.get(f"{{{NS_REL}}}id")
if not rid:
raise ValueError("Cannot resolve first sheet relationship id.")
rels = ET.fromstring(zf.read("xl/_rels/workbook.xml.rels"))
rel_map = {
rel.attrib["Id"]: rel.attrib["Target"]
for rel in rels.findall(f"{{{NS_PKG}}}Relationship")
}
target = rel_map.get(rid)
if not target:
raise ValueError("Cannot resolve first sheet target.")
if target.startswith("/"):
target = target[1:]
if not target.startswith("xl/"):
target = f"xl/{target}"
return target
def read_xlsx_rows(xlsx_path: Path) -> List[List[str]]:
with zipfile.ZipFile(xlsx_path, "r") as zf:
shared = _read_shared_strings(zf)
sheet_path = _first_sheet_path(zf)
root = ET.fromstring(zf.read(sheet_path))
rows: List[List[str]] = []
for row in root.findall(".//a:sheetData/a:row", NS):
cells = row.findall("a:c", NS)
if not cells:
rows.append([])
continue
row_map: Dict[int, str] = {}
max_idx = 0
for cell in cells:
ref = cell.attrib.get("r", "A1")
idx = _cell_col_index(ref)
max_idx = max(max_idx, idx)
row_map[idx] = _get_cell_value(cell, shared)
rows.append([row_map.get(i, "").strip() for i in range(max_idx + 1)])
return rows
def sql_quote(value: str) -> str:
return "'" + value.replace("'", "''") + "'"
def build_sql(rows: List[List[str]]) -> Tuple[str, int]:
if not rows:
raise ValueError("Excel is empty.")
header = rows[0]
idx_map = {name: idx for idx, name in enumerate(header)}
required = ["部门编号", "部门名称", "公司名称"]
missing = [c for c in required if c not in idx_map]
if missing:
raise ValueError(f"Missing required columns: {', '.join(missing)}")
by_code: Dict[str, Tuple[str, str]] = {}
for row in rows[1:]:
code = row[idx_map["部门编号"]].strip() if idx_map["部门编号"] < len(row) else ""
name = row[idx_map["部门名称"]].strip() if idx_map["部门名称"] < len(row) else ""
company = row[idx_map["公司名称"]].strip() if idx_map["公司名称"] < len(row) else ""
if not code or not name:
continue
if code not in by_code:
by_code[code] = (name, company)
if not by_code:
raise ValueError("No valid department data found.")
values = []
for code, (name, company) in sorted(by_code.items(), key=lambda x: x[0]):
values.append(
f"({sql_quote(code)}, {sql_quote(name)}, {sql_quote(company)})"
)
sql = (
"BEGIN;\n\n"
"INSERT INTO departments (code, name, company)\nVALUES\n "
+ ",\n ".join(values)
+ "\nON CONFLICT (code) DO UPDATE\n"
"SET name = EXCLUDED.name,\n"
" company = EXCLUDED.company;\n\n"
"COMMIT;\n"
)
return sql, len(by_code)
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Generate departments import SQL from xlsx.")
parser.add_argument("--xlsx", required=True, help="Path to source .xlsx file.")
parser.add_argument(
"--output",
default="backend/scripts/generated_department_inserts.sql",
help="Output SQL file path.",
)
return parser.parse_args()
def main() -> int:
args = parse_args()
xlsx_path = Path(args.xlsx)
output_path = Path(args.output)
if not xlsx_path.exists():
print(f"ERROR: File not found: {xlsx_path}")
return 1
rows = read_xlsx_rows(xlsx_path)
sql, dept_count = build_sql(rows)
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_text(sql, encoding="utf-8")
print(f"Generated SQL file: {output_path}")
print(f"Departments generated: {dept_count}")
return 0
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
"""
Generate batch INSERT SQL for user_agent_permissions.
Default behavior matches current request:
- user_id: 6..312
- agent_id: 1,3,4,5,6,7,8,9,10,12
"""
from __future__ import annotations
import argparse
from pathlib import Path
def parse_agent_ids(raw: str) -> list[int]:
ids: list[int] = []
for part in raw.split(","):
part = part.strip()
if not part:
continue
ids.append(int(part))
if not ids:
raise ValueError("agent_ids cannot be empty")
return ids
def build_sql(user_start: int, user_end: int, agent_ids: list[int]) -> str:
values: list[str] = []
for user_id in range(user_start, user_end + 1):
for agent_id in agent_ids:
values.append(f"({user_id}, {agent_id})")
if not values:
raise ValueError("No rows generated")
sql = (
"BEGIN;\n\n"
"INSERT INTO user_agent_permissions (user_id, agent_id)\nVALUES\n "
+ ",\n ".join(values)
+ "\nON CONFLICT DO NOTHING;\n\n"
"COMMIT;\n"
)
return sql
def main() -> int:
parser = argparse.ArgumentParser(
description="Generate SQL for user_agent_permissions batch insert."
)
parser.add_argument("--user-start", type=int, default=6, help="Start user_id (inclusive).")
parser.add_argument("--user-end", type=int, default=312, help="End user_id (inclusive).")
parser.add_argument(
"--agent-ids",
default="1,3,4,5,6,7,8,9,10,12",
help="Comma-separated agent ids.",
)
parser.add_argument(
"--output",
default="backend/scripts/generated_user_agent_permissions.sql",
help="Output SQL file path.",
)
args = parser.parse_args()
if args.user_start > args.user_end:
raise ValueError("--user-start cannot be greater than --user-end")
agent_ids = parse_agent_ids(args.agent_ids)
sql = build_sql(args.user_start, args.user_end, agent_ids)
output_path = Path(args.output)
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_text(sql, encoding="utf-8")
total_users = args.user_end - args.user_start + 1
total_rows = total_users * len(agent_ids)
print(f"Generated SQL: {output_path}")
print(f"Users: {total_users}, agents/user: {len(agent_ids)}, rows: {total_rows}")
return 0
if __name__ == "__main__":
raise SystemExit(main())
@@ -0,0 +1,255 @@
#!/usr/bin/env python3
"""
Generate batch user INSERT SQL from an Excel (.xlsx) file.
Mapping (from first sheet):
- 工号 -> username, employee_id
- 姓名 -> real_name
- 部门名称 -> department
Password hashing follows backend logic:
- werkzeug.security.generate_password_hash
"""
from __future__ import annotations
import argparse
import re
import sys
import xml.etree.ElementTree as ET
import zipfile
from pathlib import Path
from typing import Dict, Iterable, List
from werkzeug.security import generate_password_hash
NS_MAIN = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
NS_REL = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
NS_PKG = "http://schemas.openxmlformats.org/package/2006/relationships"
NS = {"a": NS_MAIN}
def _cell_col_index(cell_ref: str) -> int:
match = re.match(r"([A-Z]+)", cell_ref)
if not match:
return 0
letters = match.group(1)
idx = 0
for ch in letters:
idx = idx * 26 + (ord(ch) - ord("A") + 1)
return idx - 1
def _get_cell_value(cell: ET.Element, shared_strings: List[str]) -> str:
cell_type = cell.attrib.get("t")
inline = cell.find("a:is", NS)
if inline is not None:
return "".join(node.text or "" for node in inline.findall(".//a:t", NS)).strip()
value_node = cell.find("a:v", NS)
if value_node is None or value_node.text is None:
return ""
raw = value_node.text.strip()
if cell_type == "s" and raw.isdigit():
idx = int(raw)
if 0 <= idx < len(shared_strings):
return shared_strings[idx].strip()
return raw
def _read_shared_strings(zf: zipfile.ZipFile) -> List[str]:
if "xl/sharedStrings.xml" not in zf.namelist():
return []
root = ET.fromstring(zf.read("xl/sharedStrings.xml"))
values: List[str] = []
for si in root.findall("a:si", NS):
text = "".join(node.text or "" for node in si.findall(".//a:t", NS)).strip()
values.append(text)
return values
def _first_sheet_path(zf: zipfile.ZipFile) -> str:
workbook = ET.fromstring(zf.read("xl/workbook.xml"))
sheets = workbook.find("a:sheets", NS)
if sheets is None:
raise ValueError("No sheets found in workbook.")
first_sheet = sheets.find("a:sheet", NS)
if first_sheet is None:
raise ValueError("Workbook does not contain any sheet.")
rid = first_sheet.attrib.get(f"{{{NS_REL}}}id")
if not rid:
raise ValueError("Cannot resolve first sheet relationship id.")
rels = ET.fromstring(zf.read("xl/_rels/workbook.xml.rels"))
rel_map = {
rel.attrib["Id"]: rel.attrib["Target"]
for rel in rels.findall(f"{{{NS_PKG}}}Relationship")
}
target = rel_map.get(rid)
if not target:
raise ValueError("Cannot resolve first sheet path.")
if target.startswith("/"):
target = target[1:]
if not target.startswith("xl/"):
target = f"xl/{target}"
return target
def read_xlsx_first_sheet_rows(xlsx_path: Path) -> List[List[str]]:
with zipfile.ZipFile(xlsx_path, "r") as zf:
shared_strings = _read_shared_strings(zf)
sheet_path = _first_sheet_path(zf)
root = ET.fromstring(zf.read(sheet_path))
rows: List[List[str]] = []
for row in root.findall(".//a:sheetData/a:row", NS):
cells = row.findall("a:c", NS)
if not cells:
rows.append([])
continue
row_map: Dict[int, str] = {}
max_col = 0
for cell in cells:
ref = cell.attrib.get("r", "A1")
col_idx = _cell_col_index(ref)
max_col = max(max_col, col_idx)
row_map[col_idx] = _get_cell_value(cell, shared_strings)
normalized = [row_map.get(i, "").strip() for i in range(max_col + 1)]
rows.append(normalized)
return rows
def sql_quote(value: str) -> str:
return "'" + value.replace("'", "''") + "'"
def build_insert_sql(
rows: Iterable[List[str]],
default_password: str,
email_domain: str,
role: str,
status: str,
language: str,
) -> str:
rows = list(rows)
if not rows:
raise ValueError("Excel has no rows.")
header = rows[0]
header_idx = {name: idx for idx, name in enumerate(header)}
required_columns = ["工号", "姓名", "部门名称"]
missing = [col for col in required_columns if col not in header_idx]
if missing:
raise ValueError(f"Missing required columns: {', '.join(missing)}")
statements: List[str] = []
seen_usernames = set()
for row in rows[1:]:
employee_id = row[header_idx["工号"]].strip() if header_idx["工号"] < len(row) else ""
real_name = row[header_idx["姓名"]].strip() if header_idx["姓名"] < len(row) else ""
department = row[header_idx["部门名称"]].strip() if header_idx["部门名称"] < len(row) else ""
if not employee_id or not real_name:
continue
username = employee_id
if username in seen_usernames:
continue
seen_usernames.add(username)
email = f"{employee_id}@{email_domain}"
password_hash = generate_password_hash(default_password)
stmt = (
"INSERT INTO users "
"(username, email, real_name, employee_id, department, password_hash, role, status, language)\n"
f"VALUES ({sql_quote(username)}, {sql_quote(email)}, {sql_quote(real_name)}, "
f"{sql_quote(employee_id)}, {sql_quote(department)}, {sql_quote(password_hash)}, "
f"{sql_quote(role)}, {sql_quote(status)}, {sql_quote(language)});"
)
statements.append(stmt)
if not statements:
raise ValueError("No valid user rows parsed from Excel.")
return "BEGIN;\n\n" + "\n\n".join(statements) + "\n\nCOMMIT;\n"
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Generate batch INSERT SQL for users table from Excel."
)
parser.add_argument(
"--xlsx",
required=True,
help="Path to source Excel file (.xlsx).",
)
parser.add_argument(
"--output",
default="backend/scripts/generated_user_inserts.sql",
help="Output SQL file path.",
)
parser.add_argument(
"--default-password",
default="123456",
help="Default plain password before hashing.",
)
parser.add_argument(
"--email-domain",
default="example.com",
help="Email domain used to generate unique email from employee id.",
)
parser.add_argument(
"--role",
default="user",
help="Default user role.",
)
parser.add_argument(
"--status",
default="active",
help="Default account status.",
)
parser.add_argument(
"--language",
default="zh-CN",
help="Default language.",
)
return parser.parse_args()
def main() -> int:
args = parse_args()
xlsx_path = Path(args.xlsx)
output_path = Path(args.output)
if not xlsx_path.exists():
print(f"ERROR: Excel file not found: {xlsx_path}")
return 1
rows = read_xlsx_first_sheet_rows(xlsx_path)
sql = build_insert_sql(
rows=rows,
default_password=args.default_password,
email_domain=args.email_domain,
role=args.role,
status=args.status,
language=args.language,
)
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_text(sql, encoding="utf-8")
print(f"Generated SQL: {output_path}")
print(f"Rows parsed (including header): {len(rows)}")
return 0
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,65 @@
BEGIN;
INSERT INTO departments (code, name, company)
VALUES
('301000', '总经理室', '苏州和信精密科技有限公司'),
('305100', '业务部', '苏州和信精密科技有限公司'),
('305110', '业一课', '苏州和信精密科技有限公司'),
('305120', '业二课', '苏州和信精密科技有限公司'),
('308000', '研发中心', '苏州和信精密科技有限公司'),
('308500', '研发一部', '苏州和信精密科技有限公司'),
('308510', 'PE课', '苏州和信精密科技有限公司'),
('308520', '模具课', '苏州和信精密科技有限公司'),
('308521', '模具设计', '苏州和信精密科技有限公司'),
('308522', '加工组', '苏州和信精密科技有限公司'),
('308523', '制模组', '苏州和信精密科技有限公司'),
('308524', '维修A组', '苏州和信精密科技有限公司'),
('308525', '维修B组', '苏州和信精密科技有限公司'),
('308610', 'NCT工程课', '苏州和信精密科技有限公司'),
('308800', '研发三部', '苏州和信精密科技有限公司'),
('308810', 'IE工程课', '苏州和信精密科技有限公司'),
('308850', '自动化组', '苏州和信精密科技有限公司'),
('308901', '研发中心测试中心', '苏州和信精密科技有限公司'),
('308902', '研发中心技术课', '苏州和信精密科技有限公司'),
('310100', '生一冲压B车间', '苏州和信精密科技有限公司'),
('311000', '生产一部', '苏州和信精密科技有限公司'),
('311110', '生一冲压A车间', '苏州和信精密科技有限公司'),
('311120', '生一加工', '苏州和信精密科技有限公司'),
('311130', '生一组装B车间', '苏州和信精密科技有限公司'),
('311150', '生一组装A车间', '苏州和信精密科技有限公司'),
('311180', '生一组装C车间', '苏州和信精密科技有限公司'),
('312000', '生产二部', '苏州和信精密科技有限公司'),
('312110', '生二下料', '苏州和信精密科技有限公司'),
('312120', '生二折弯', '苏州和信精密科技有限公司'),
('312130', '生二加工', '苏州和信精密科技有限公司'),
('312140', '生二焊接', '苏州和信精密科技有限公司'),
('312150', '生二包装', '苏州和信精密科技有限公司'),
('312180', '生二包装B车间', '苏州和信精密科技有限公司'),
('312200', '生二包装C车间', '苏州和信精密科技有限公司'),
('312230', '液冷组装', '苏州和信精密科技有限公司'),
('313000', '生产三部', '苏州和信精密科技有限公司'),
('313110', '生三补土/打磨', '苏州和信精密科技有限公司'),
('313120', '生三粉体涂装', '苏州和信精密科技有限公司'),
('313130', '生三液体涂装', '苏州和信精密科技有限公司'),
('313160', '生三成型', '苏州和信精密科技有限公司'),
('318000', '品保部', '苏州和信精密科技有限公司'),
('318100', '品保课', '苏州和信精密科技有限公司'),
('318200', '品管课', '苏州和信精密科技有限公司'),
('318300', '文管课', '苏州和信精密科技有限公司'),
('322300', '生管课', '苏州和信精密科技有限公司'),
('322500', '供应链部', '苏州和信精密科技有限公司'),
('322600', '仓储课', '苏州和信精密科技有限公司'),
('326100', '公用课', '苏州和信精密科技有限公司'),
('326200', '总务课', '苏州和信精密科技有限公司'),
('326300', '人事课', '苏州和信精密科技有限公司'),
('326400', '关务组', '苏州和信精密科技有限公司'),
('330000', '财务部', '苏州和信精密科技有限公司'),
('330100', '成本课', '苏州和信精密科技有限公司'),
('330200', '总账课', '苏州和信精密科技有限公司'),
('330300', '出纳课', '苏州和信精密科技有限公司'),
('335000', '资讯组', '苏州和信精密科技有限公司')
ON CONFLICT (code) DO UPDATE
SET name = EXCLUDED.name,
company = EXCLUDED.company;
COMMIT;
File diff suppressed because it is too large. Load diff
+924
View File
@@ -0,0 +1,924 @@
BEGIN;
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100001', '100001@example.com', '钟国松', '100001', '总经理室', 'scrypt:32768:8:1$UM3bQbCuI1oZYuRY$f669056233e35539d4fbeb51677674aa1a98a246d376a0e9fdf1411fb160fcc4ebb658f5a1933c6b8222f90e83ffb015ca60aa469e72009f042579b302b567bf', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100004', '100004@example.com', '钟淑惠', '100004', '总务课', 'scrypt:32768:8:1$45ouekaeyqHFI80i$2e3915ab013d7c23e1bc0804e5ce255f26e0dc3d262c56fdd4208d8baf59c2409a8f43804c66160f1c677556084a5b96cf8c662f4f22b4fa7293bea1e0a75191', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100006', '100006@example.com', '陈春兰', '100006', '总经理室', 'scrypt:32768:8:1$86YpRMP4paUsJHU9$1c045048abae902f86ad2c0d1744d05026bc72945ab78878143a37eb657fc1ab958c2ad9b38dde414e454127a1f35b790d25c941a29c3e0c8568bdd3807dca02', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100008', '100008@example.com', 'HOONG MING KOON', '100008', '总经理室', 'scrypt:32768:8:1$IwR2SjXknuIggZs5$b614b9d620074b2652bfc812e032a921b70e6fd57dbd44640617ecb141734f11251811f0aad80b54e6412c39e3782d8ec4f16c71693542088123b4baa024d3bd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100011', '100011@example.com', '廖启涵', '100011', '总经理室', 'scrypt:32768:8:1$FrcHOmR5JdwXl5K0$ed88ec175c62236c8c931642aec0c7f76527f15b15660623477588cd7370970d019a9702a76249a62e865eeb8d22930b1fab681f9a23d942c44a119e1a82060f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100048', '100048@example.com', '钟环阳', '100048', 'NCT工程课', 'scrypt:32768:8:1$HS2BUooRN895xMK5$9fdf96f617bb267ac80b7ae4b3dc5fd577c0d5ced5e096f5b5bc7259eaccf5114d35d095ad689cb30e01e53d213cbb99a034617fa7576b18853912124461b8ef', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100057', '100057@example.com', '谈勇', '100057', '研发三部', 'scrypt:32768:8:1$oRqYJtjZRc0K1Cuu$b9c87f93f7103df998c05ff60ee6b45df4c6a943d0610ad7dc8abc180bcf12846b9180b95c321004456f9ffae9f86536aeea95fb329fdbfb8c4c1c1d4812ab97', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100060', '100060@example.com', '廖韵淳', '100060', '总经理室', 'scrypt:32768:8:1$QiYfrNlXjis3P3su$d015bdb2bf3120c9f91513f396de230e894a406007fe0fa8b58f6386511e2b16b40fae7645397bbb6f3ae564305f95064d34d86d87ecf02e907203b1d4a2aa9d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100061', '100061@example.com', '钟政格', '100061', '总经理室', 'scrypt:32768:8:1$Lije0ywEcXdRj3gJ$384ace0ddcd736f7efe732faf97127667929f06446242bbe7572280347957a3d44b257a5698958f70f1a279cc5dbde20a75301e0bf00dee412ca893faa79b77c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('100062', '100062@example.com', '郭惠龄', '100062', '总经理室', 'scrypt:32768:8:1$wlv2iboIwQ1hFedW$e06a145637504eae426ef0d0ebb6f05708189bcd58bbb35a5cb190ea6247b862da97c8957713e05f4b5a0998c4f9f9003348febd8070aa1df1696395c00037e7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('107004', '107004@example.com', '徐雪红', '107004', '出纳课', 'scrypt:32768:8:1$xLJVgxgSyKgsFEaz$270e2b5d473882a40e79fd103f21d7904b85851a2fea530a67dc64fa6a97cc9d6e6bb0adc32c6cd808458914c7ee8becfb5b853eb55039ae48f834a48fef58fd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('107009', '107009@example.com', '王砚', '107009', '研发一部', 'scrypt:32768:8:1$ecYtFIFhSGzTzrnD$8cc8dce61353b345d8232210cf3e2995860b37aa32fc2cb5d47fb608b3f9e6adf8fe79386220e446080e1d9ac9847c1630815d6deddcb55f3d5aa0940f843d80', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('107010', '107010@example.com', '徐永', '107010', '公用课', 'scrypt:32768:8:1$ksVeKKeqaUHMTCfN$46d006cd599708b348cf15c10556a8ec77ddcc2bba69097bab49cdf301c3c5bdf9623b0ff91f569c358a09c16a1a940ae03deb283281a029506d7d869ee5e956', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('107023', '107023@example.com', '刘义万', '107023', '维修A组', 'scrypt:32768:8:1$HRvt4lHhOuzTU84i$a874e59bbce0e71fe19556526de9f0e68df946d3ca0bd4ff35bd9626f0fe590486701467624de1d3358a0dadc811563f8cd86ab1046f300da26a037cee996e94', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('108002', '108002@example.com', '朱纯美', '108002', '品管课', 'scrypt:32768:8:1$C0nAkZWdogUUIq0t$a389bc0fa83f30b60111e0604ba94d939aa9265528c389c63afd3116be90706b879465a2be76ea11ef0c5f9ca60ba704429b0c6328f6325f2828b4a007f2fa11', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('108004', '108004@example.com', '吴新升', '108004', '品保部', 'scrypt:32768:8:1$agXZlrwVN5WFyYVO$e4ecaae6b42090109dfe12e1bb75f83189c55460fe57060a822d1a24feacaa625fb00ea050db1dc16e3afaf096503e8bdfcc8bffbb6d48194c2368476baaeee0', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('203009', '203009@example.com', '施敬', '203009', '生一组装A车间', 'scrypt:32768:8:1$EBC5Y39SmrvxXX64$5fb869f82a12a371a7a7c7867fd31c643abb2072d229ccf7bf084210b55c6639ecb1f8af70b7fe8a3f4e5c924f415c1d16d29d93ee7c2564d4398317d719d19f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('203015', '203015@example.com', '赵辉', '203015', '制模组', 'scrypt:32768:8:1$sCcWvc8GAtfXjUGk$f059ae6dd0389c2a4dae917818c626f51a45b6a7115164c372e96af9b1a3fd3f638e5b739b75e4815889e7ef6b53593c9125aa740685a453d1812990569cffab', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('203036', '203036@example.com', '成秋兰', '203036', '供应链部', 'scrypt:32768:8:1$wP0YzdSRoex54KpE$9d47112cd18f242eca2225f404496aed0b46671dceb16cbcd441bfb1b8b2d1c65265592e2797f4c8b8630db95d61bb4c1aa5c1c909a5f864bc308f3672bbeba9', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('204008', '204008@example.com', '张莉莉', '204008', '品管课', 'scrypt:32768:8:1$4Klu7qW7eghQpNCU$643d52984a5ccf5acf0f32bac580aea46a072af3a25427f7f288f16069269f1344a199681af96b70d5cf9c3e0f99f16db6f78915d6838eec37dac139f055da1a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('204009', '204009@example.com', '任亚', '204009', '模具课', 'scrypt:32768:8:1$GYjHePSpEGpCCoV3$a319209a446c9aa543caad952055cb8abf690e771c37a6647f7e01194607706cfa8f27e3f55798ebd5ad821b86e9bf9d280ad662f65bffc7345f3d91636cecfe', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('204037', '204037@example.com', '吕珍荣', '204037', '生产一部', 'scrypt:32768:8:1$O6SfH3gEi5BDzTRh$9ea25ff94bb431ea7084befcc4bb52348ecc02fa05b066d7933e09c8263e08b6630a1fed5d84b1179200ba9aed2b5a4cdf17b584ce8325a407624af487a837a6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('204062', '204062@example.com', '蒋忠林', '204062', '研发中心技术课', 'scrypt:32768:8:1$K0AKLg573Di69mXn$1d49a415dd5f33e18c6ed93826f24a41154664fd13ee1a9909643f28bf32e5bcd3dcf22df11fd5b26b13bbc2c0fb6b0c74daba72904082d799a742c122677b51', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('204077', '204077@example.com', '唐开勇', '204077', '生二下料', 'scrypt:32768:8:1$2lKDQAEQso7bhLIH$6619c072e18d1fb866a50716e6ac9b584e0aeb1418d9c1f66559200b4033590645de802cb69534347ee515f823f9c49d91fa12291580d6bdc62c0a6dc75bbf1f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('205003', '205003@example.com', '陈先霞', '205003', '生管课', 'scrypt:32768:8:1$4hURNzxsuWn621bn$e8ad5dcfe0a2fdcef4a8c3fd20f538422a88b609d7faa0448ddd7c4e09ff218a27896249beb56b087594a28d42510729531ef3a6a34ad79f2a5d11988188a66b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('207002', '207002@example.com', '彭德国', '207002', '生二包装', 'scrypt:32768:8:1$cm9wpCWTnTpvcrSO$42fc91dc11615693cdb5140a9cd01955d8115dc20cfba5de6fe80aab9036040d99b1e8ce3edbdcfd4b3090b1b2bb56408a08722987e4cedff644b5cbb6ba8ce5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('209002', '209002@example.com', '李文', '209002', '加工组', 'scrypt:32768:8:1$TijLuXic6jTpYu14$22ebdd62c935f599558e86e376eec48cafc1781a1fce248a5b61fa3de6902d91ab31918b78a5e677df1899f648dffdbbbc937ecf2228e3db03809d677215f44c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('209008', '209008@example.com', '毕华忠', '209008', '自动化组', 'scrypt:32768:8:1$LeejzuuQSn0xYMI0$b3c9954a676a80703a3742a5376345a8cb64ddc89e1069fc59a0067915aa2fada074366d5cad7211eaf0ca5e7fd2cf51959a6047e8da34b2472a42b729031a5a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('210021', '210021@example.com', '吴军伟', '210021', '生一组装B车间', 'scrypt:32768:8:1$otmDt9tlZk674xYX$912b3cf86d1a6018413bfedaad31827b621d92ec032080a8b38114b17b935a6d33d6e8414bc1509dfda6fd2fcb38a72accae8bd95ca440c907e47ee43d172b56', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('212001', '212001@example.com', '郭建', '212001', 'PE课', 'scrypt:32768:8:1$QVRatwkoP1Q3Rgod$9d9c2b03d1c180fe71376669570033ba1d83b1558831af511115d8abb4a2093404a459d482738d60d6fd4a6707453f7d3d375a1225902af5df814d766c05b352', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('302027', '302027@example.com', '胡建林', '302027', '生一冲压B车间', 'scrypt:32768:8:1$tH7hR7JBtuDtPUJZ$3a392ca3611efbda900c0178c900f5426ad49599319217c9eef7d067611fd3203901dcb9ff5c36a32297d3e38e60d2bb7e82d3f91377116f3bb242db62f7898f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('302045', '302045@example.com', '夏广雷', '302045', '公用课', 'scrypt:32768:8:1$PmAbyOvxrA7Qwubc$840f5ae5018b0a991261571ffa8fa9ec53986a5e0246ef333172381b66c61b3a94428deb8b69980f26cf2f5e67b8ed7da0ee00d8ca966f3646f595c4c55d0762', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('303013', '303013@example.com', '赵登华', '303013', '研发中心', 'scrypt:32768:8:1$SDbnsDtIBrrZds5E$d7169734efea9f5c73d6a3b30d34beb2dc40484ed035dff699988d35d2cef707878f88202bf750f971ba6bfca4261655dfa4a7bea6ae81b146ef4ede262bf87e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('303037', '303037@example.com', '陈广香', '303037', '人事课', 'scrypt:32768:8:1$N8nQ5NsfIX1tzq9y$c130c5eb7305ddd753df7597e78af2513c89ca6ad3574df16b9cdf305f37455690d989fe1bde412c290f0b1f53122a099c21c9c004c5c62ba11dfea04336c9fc', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('303046', '303046@example.com', '张东湖', '303046', '总务课', 'scrypt:32768:8:1$osodyEfgnCqB8ZF6$22fbc30ba1ee503ab5f659b128d8e710feb420e5ca716983cd22fd613e1eb9c4157468e2cf43dd61a14b93500765ec1ab9304d411c4246843b3bccbd49f4ab77', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('304011', '304011@example.com', '任培中', '304011', '生一冲压B车间', 'scrypt:32768:8:1$nZI6VLtOzohNhv7G$e28d108c1e8d3f707bb80c1bd87e0eddc9fbae8e739c495bba78ec1a42bb5ee0e217bb09e1ab3d7690d66387826005db64a97387f4c4db76528d8bd21b38d1ba', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('304020', '304020@example.com', '任永标', '304020', '加工组', 'scrypt:32768:8:1$SIvKbSIAEGWb4nk5$b98f0b6d9ebe5f31c669dea559413c7a793df2c757588a45e851bf7922222705ba236bacedc53531e813463f7b49004c5a10377ecd4e92bcc641d659d0be3e05', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('304023', '304023@example.com', '张树芹', '304023', '品管课', 'scrypt:32768:8:1$OdDiGeRujzD1EkO7$bc870a80fed7a1d855d37678cb3f23d41b0f6b7acddbfb7e5aea8f697f9b3d9c684d0b9ce1c0c651e4a6d4beacd5682cafecda61d4cd18ddddac2a2575fbbe56', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('304028', '304028@example.com', '徐志江', '304028', '仓储课', 'scrypt:32768:8:1$Cs4xgc9baHGFRXtc$8e77ca594015d9da076ededf729e62475094347ea69a4538a9edd187e9865e325be61e3e721154fd939d69f69bc3117d842669e372381f453ce7437758340696', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('309016', '309016@example.com', '殷莲莲', '309016', '品管课', 'scrypt:32768:8:1$b5eXVnefiEMEhMvH$6ab7ee1fbcc0846e247b297ff1e2290f8a68331f5b4717173bb263a5ae621d88c36ee64f391939545d5152eca072a3b8164da20318c7b538b6d5e426041b8cdd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('402046', '402046@example.com', '赵琴', '402046', '供应链部', 'scrypt:32768:8:1$QDAHJOiqLUVAXy3c$cd27b0bbf06fcd99d76ed3695ca5a1b997ad5e1de05f7141c52ecd0627987eff367b29418bf25bb8b73a980d0406c0c6cbc4cfaf918fd0388820723e0fd2c33c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('402074', '402074@example.com', '雒贞', '402074', '品保课', 'scrypt:32768:8:1$q4tFOWrj7gF23iPL$6fda3fecc547b03cbd46dfc598f96dccb2fa86e0d55feb1f0f92d0a631402d8d803a1ceb53b9803ab1ed8b51cdd1169d7dd2699fe2f1ed7a6ef46aa19dcb2569', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('406006', '406006@example.com', '曹连波', '406006', '生一加工', 'scrypt:32768:8:1$nVWB6bwLg7aOHdwR$a3e6978e228f058cca28f7ac21e7fd25ef73d3003117fd940ba6ec46a5269b4673ab83499e7965c99225b82a66bc56b65180e22aa7d5aa71275a1508c1ad2a90', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('408117', '408117@example.com', '田胜超', '408117', '生一冲压B车间', 'scrypt:32768:8:1$8KDfcKg0VS8Fa5ju$859312ded3329d8c3eece99389bc6efac43252aa127a737a991b6696f597d1b5ae1ae5cecfd31530a292e1692697a24362be0e59aaae0b898bf22268b7f1779d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('408197', '408197@example.com', '柳光跃', '408197', '生产一部', 'scrypt:32768:8:1$99cHBq4iLtTnFqcl$83d75b17ef776a734c63ad4ea5aca860731220eed54b4afa464af8318b4aa1341cbdb59f3e77eb305fac910a38187d87d4559daddc4065c36d6f63e8543a9a87', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('502043', '502043@example.com', '翟胜超', '502043', '维修A组', 'scrypt:32768:8:1$NSw49SrbJSS7k6Bk$85db9f4577ab0e2b5c538274a3f59ca396a6d77a471a906f3266f46a7f759dc0cda2d91e193c75a082986db567040310cd65d18a5e23d5a2cdc893cd424229fe', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('506002', '506002@example.com', '李书奎', '506002', '公用课', 'scrypt:32768:8:1$lSXhcZQrEc8iY3fA$635b81db503493823d4179329dfcf6dd664e1518d1a2865a01dcb15b05a8d81153ebdb25a46f7b27ac85b9fd61e8f928b9f1e13c71fd8739efb9e7e2e698f9d6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('507128', '507128@example.com', '刘文猛', '507128', 'PE课', 'scrypt:32768:8:1$ydogZ4qpODJ5CIVi$caab497e8e68593501aac171b8204c4e99bc386740a4a86d25bfbcba6190b4707b03fc2a670b2766bea51bdbf0c0b2165161a069c103a1fd791bbaae46007405', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('507131', '507131@example.com', '崔雪', '507131', '业务部', 'scrypt:32768:8:1$WSYXBmLysb2ZFuFc$3c5cdd90780f271805b65f12adf7f2941fe7017e35d70bcb2c5af91d2a1b35ec6e51fb34a67a7f56cd3477bab9131e3b7551e1c2a42f2beec05547510b2cffdd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('507135', '507135@example.com', '潘建华', '507135', '生管课', 'scrypt:32768:8:1$E2LBzBivukGx7TGg$4ad43a8d13ae5f4064a3459b57458eac74a698dd9d3969aa2d1500ac0cc62ebb67c7bef50adb26eb495618af41f3d0e953a3f65a45f7749ded1a8c34dfd53ae1', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('507290', '507290@example.com', '刘兵迁', '507290', '总务课', 'scrypt:32768:8:1$siO9Vo9kSijuDJZH$aceb2733e245f52eed4b5ee3e4b3b8d4d9e127b5d0115d7490a3ec1ad6391107991358ea334cae79facfedd7b8a7d3660b35def461f5b029d78ad1be0faf57d7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('508019', '508019@example.com', '马恩阳', '508019', '公用课', 'scrypt:32768:8:1$96mka4XOrTQJUbcU$7363156dc66a66ad5f937e652a8ec01f6317c2ec51b1cef207ea4f37d6b6350ead42ef93c10701219d0e3ddfa6c8c9528c991104692e8ba36fd98e09503f7c26', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('509158', '509158@example.com', '刘曾瑞', '509158', '生二下料', 'scrypt:32768:8:1$hCayZJZ1oQutPbcP$27a40b2c91f84a5a2b8dd8edcac6cd7d5b969336ee128f51fc23a11cc9ad89cf92c038f58e7064b6c6e07fde63ecf5fd6486c9acad50d998f783a1ce31890f4e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('605002', '605002@example.com', '李新华', '605002', '仓储课', 'scrypt:32768:8:1$aE7h4cJey9ItT5su$719e12a8eb1b4105b95bda4e2e65bc1b0371c00c252a7aa2e9dd3fd1a5e1cc76e0af925a6ff33d91a6ea32d709ae99510f1677f830d0d266379d2d3a1dcd85d3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('606001', '606001@example.com', '张海林', '606001', '业一课', 'scrypt:32768:8:1$aXMaVTzYjMHWn4iP$911249a7ecda39e35ff38bf875f3aa9d4e207aa7def21462032097ddf7d3a4ddc1afd60e9afa2f7fa6e61f9f2971067d888ddd302f19533e409d4994ee5b4c57', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('607417', '607417@example.com', '常胜党', '607417', '维修B组', 'scrypt:32768:8:1$V6owN9nTRP61DWri$f71e0f8713758f99a68bba3cf43cdde9700ad3f21b585ae99df628201722083392845399d3b65572ecd30baf081ed66671923bd7192514b35106059216d1415f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('608220', '608220@example.com', '李忠华', '608220', '加工组', 'scrypt:32768:8:1$2Bv8Q7GhPXlohFdP$41590930061e87321524c88cdc8ce7f16deb05218ece82c4339e330491c0cb9bddc4b1d07d48f5e1e5826a180b7d42cedf0484e238171c980ac0eecc76125a4e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('703691', '703691@example.com', '杜松波', '703691', '仓储课', 'scrypt:32768:8:1$GBQIINZZlHBHWO6z$e7c2664e7a9f008c77a6f6ba7629903adf4953d0daee256e9dc31f340cea420f38c26ab5d744b27345b6929776a78d83e492e01f71f6afc02c98597b092b3a40', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('704099', '704099@example.com', '王家瑞', '704099', '研发中心技术课', 'scrypt:32768:8:1$0brpkc6FdWKN5y9J$1404c937726d5fbe578bf267658c26c2db3b1f8e883c4656dc4bca1d00cde8d6d51e2c96d956b305643e6e56262472cb8d934d78696ab677d492a2b85b94d1dc', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('705141', '705141@example.com', '徐超', '705141', '生二折弯', 'scrypt:32768:8:1$eX7ujwbwAsUamwzN$ef117b6b4cc7b1b77f35f03a1450fb033dd8d959cd27f921aeb71a38f7fe1332732a7ede53e75b8f990b37300d964d9d2af1b5849d37ac5bc86123e4a4634803', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('705352', '705352@example.com', '谢晓鹏', '705352', '生管课', 'scrypt:32768:8:1$rdtIcm5CeKcuQwxW$8618ccbcbc627c6ffaf5ed56708738dd9af38d321e8da7761fb1fdd3a2da6e93b5047ef0a625ee7532a308556f254b54ac9b94b28f5870d9697de2a63ab05f72', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('705353', '705353@example.com', '唐永礼', '705353', '生产二部', 'scrypt:32768:8:1$6uexyCRAJl4JYoUf$bfb82f7e12dbc9da9f5ca2a69724a5c5ee9e08d408d31bfce4a20daf201a5d5b5350d4854bb5be8291ed5e484ad1cf6284d1ff004a2d2acaa91fef4223499e1f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('706003', '706003@example.com', '魏宝平', '706003', '生二加工', 'scrypt:32768:8:1$iQwtjaGmipoRsdIB$424ace24e38eec50c7933e66d780490d6af07d01e20286214b71a86db92689c7dcd2704dfe81ec0b4eb906cb1a7a371eca7852350db4155451fd16815169ff50', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('708834', '708834@example.com', '陈杰', '708834', '生二折弯', 'scrypt:32768:8:1$ZWxLlfqe7HyRETz6$7cff6b2ca10486a04d3536e4fccad450f9d501c5ddb67ae1af5f8b06b1c972011097014de26dad1f315ac8eb8367bc971b049ce1b368d6e017b07b918ef883e8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7090745', '7090745@example.com', '刘江', '7090745', '供应链部', 'scrypt:32768:8:1$Zpu32VrB8tQyO7dD$513a98322b7f57356181e76049f89b725de7feb5e999c65f7d60d30c1bbf8adb7074c49e09fb9f316864f495d9f9b42b7d408e5a38f21eea1bbed3c9c4442a6b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7100278', '7100278@example.com', '刘本现', '7100278', '公用课', 'scrypt:32768:8:1$uvrTNQHpAygWEWBQ$62ccf5b440757fc1bdeba6bbc6085e195791cefcc6771babe2483799ed13a2c96539d88b3658db3e5af97f1d54d5d37112bf36701fc0ce6accc3993807de6991', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7100652', '7100652@example.com', '张小奇', '7100652', '生管课', 'scrypt:32768:8:1$8gS02djRSTMSFDVZ$362afddb114758c8e6b89688bb14f10c4943d159bc08eb6c864eba5f96746b4c69f336c22123a8a6923291c8e96ea65c8a77cefbc3679379e5b312c08bbc8e28', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7100757', '7100757@example.com', '李琳', '7100757', '生一冲压A车间', 'scrypt:32768:8:1$vRdjL2jTpXlQ3Fyl$1cf9254583e527d766ec7bd5ac317d5da1ec6127182a7f5d055e96f0509250e664f0aa171a057b04611112fee05846cb721f07ea34579f7c0b48785fdd6b8d54', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7110116', '7110116@example.com', '潘兵兵', '7110116', '生二包装', 'scrypt:32768:8:1$EXDoPZyxcps5xHyl$d06950d4caed8440fe5b73c426e4659e01bb402a8c3791ebfb8abaf29670ea9377913d028b6da92f120a2d7f97fe91a966f537e27a6e22e0a5a929c8911dc67f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7110227', '7110227@example.com', '刘秀', '7110227', '总务课', 'scrypt:32768:8:1$X5AuzHtmIo1K3OUi$ea2bae8fdfb8e2da5f025c7d6da502c7c025acd83bd1c90a376a6e7a782ab3d8bf4443cb4b34d5f0becb1e4f966b3a7b865a5d71ae955a485d33ed1a71287d1d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('7120283', '7120283@example.com', '全龙波', '7120283', '仓储课', 'scrypt:32768:8:1$nvg2JVhtaXmc6uQx$1c39b48339d538d8a198038bf3abbc204647434841a097ece355c9af3f16f3a1a151fdbd84557916fb0ed967738b023f19dc76f7cc5168ff908a52b40c46ed2c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8010177', '8010177@example.com', '李迎春', '8010177', '生一组装B车间', 'scrypt:32768:8:1$moDUZF1hTP4jA6v8$6bf54146e064d2b0f1103759f5e0aab5690000409eef639c0620d1b1cacfa02217cd20664d79391628c8678217145356b7451fccabf9a686515e0271a3549760', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8030177', '8030177@example.com', '宋委委', '8030177', '自动化组', 'scrypt:32768:8:1$1NwrN3SWUOVEA2P5$57836f0d30c86fce3362de1d97298046b15e5edadc2ba168b906779b1bb12fca64a0ced01881d849be58d8065a9546f652d4d5cacac84db1fdecb6b9b31aa2af', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8030183', '8030183@example.com', '李小丹', '8030183', '总经理室', 'scrypt:32768:8:1$HoWUcCNvrSNNo8Ay$22b026eb15704e8405382ae8121cf39e047a2d1a00390cc9fe3025920297969a8d0f2abe0a3a4971e1bfff44121096408b897057d056dd3e554dae619117ec51', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8040445', '8040445@example.com', '王磊', '8040445', '生一冲压B车间', 'scrypt:32768:8:1$zCjIXUmJLXQVXpTM$40aa7812cf28ec7a2334c8f94665e810c71bfcff43282438a154a7bc0512b285a3e25613e1a87e2b574cf65a596bc752a72de81ec1c389b75a54b38a0c4f46b4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8050039', '8050039@example.com', '文新峰', '8050039', '公用课', 'scrypt:32768:8:1$gJAAIfgxJflLOfF1$1b0cb19f1631087efeb7283bf1250e9aafc7d6a060825473480cb7965ba7a59bbb425fb8bf89de8e4b54ed21275c5705ad8397f709068ca1094f3e1aae8e4541', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8070467', '8070467@example.com', '朱丽芳', '8070467', '总账课', 'scrypt:32768:8:1$UNV6SiNmax1Dzqov$93d8baf8effa1283045883b34f23c1994a2bfe369cd222dda7e1df563fb44a1b9cbb0ab4b7de5e501f348e99a314db782f69db11ed210088dde746800c33b4e0', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('8090515', '8090515@example.com', '贾非贤', '8090515', '业二课', 'scrypt:32768:8:1$pWZHIFdOhghqfAAB$c43418a753ecc70d00e9e998de98af1a4ef5749f615dde3d23c333d6d315bccfafbbbd4266da855b1a11d41d974a6d2c451117f6b0fc0822c0b557af7657c768', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('9020190', '9020190@example.com', '武守庆', '9020190', '生一组装B车间', 'scrypt:32768:8:1$KD8afvjqe1vPq3gG$6fd2f8cb09359349c0a525cdf35f4973cf865976cd46f0662ca469cffd0b4a7a76dd17985919d522633f0a8e1dff79bfc99e906b0b6a66895ec5e208c5a58c44', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('9050447', '9050447@example.com', '徐雷', '9050447', '生一组装C车间', 'scrypt:32768:8:1$QHiCJD5G7bRoaV7y$6f2f7509e743b4122f8b06ae7526a12495b0a9bd6dabb14f635e8bbb3d52ed123147a83755c7624992eb5b005a7b45e2d912e96453c9b87bcbf3b7ac59893226', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('9060298', '9060298@example.com', '潘辉', '9060298', '生管课', 'scrypt:32768:8:1$bALUPsz4gDmsyxjY$8d02de5ddf7401b6d0f99fb4179e46d5d5ec273d76bf820f48c680f2e6cf55a51ddcdacfa9f4582cfed0ec87243d5660c6db95ef3babd0b69400dbbe2476cfd7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('9070040', '9070040@example.com', '吴志强', '9070040', '生一冲压A车间', 'scrypt:32768:8:1$I4lE6LF1Zq2mUwdp$a0db5c475e350caef062a0e6aa3875b5c7922a484071f3158139953cbf6ee9183eea957fe1827dae83ecc5f17502ee22fda4794423107ed05ed0b02ba537dcfc', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('9070234', '9070234@example.com', '赵祥文', '9070234', '仓储课', 'scrypt:32768:8:1$l1CvHS4e1Rhkb2mi$294e4093f22e7458a8b1eb1a72073429fac2c9fffd3d2d5f45134bd04d8f834de1cf945ff916ccb2aa5ef5762c84a28951d8e38a59a60a2d19d7b99d7a44ba06', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('9120197', '9120197@example.com', '卢强', '9120197', '生一加工', 'scrypt:32768:8:1$eXXY004LUuEBz3kL$ccb358ef06fe0675aa6acec96be6698fe90731b88d9960ebc2f80af369a597459a388811be4dc5f7a322c727602101d31141029ef17307cb2f1ef436c5214c55', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('10010337', '10010337@example.com', '周井兵', '10010337', '生一冲压B车间', 'scrypt:32768:8:1$icO8NEZ0CoUeW98I$e053d5a4506cf22137c313a63689b1ac48f6906603949c3d7e498e38bd5adfcd1bea68de37d702e92f068b92f3f60041b4fd2a0ae54d5ab14122e86203c28192', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('10080188', '10080188@example.com', '陶莉萍', '10080188', '业务部', 'scrypt:32768:8:1$zgDO6DTfyRwWtyhF$830e95063579c47d39406d0b7f97565423a52208c37c4443273490b139b10e5560de19b3fd2469cd4bf1d0fee071feda5147cbcf49518649f68892b5bcbff17a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('11010204', '11010204@example.com', '吴桂霞', '11010204', '生一组装B车间', 'scrypt:32768:8:1$J5MBf3vKsZx8x2YT$baac70e319e991611704c75a461be800c6b5c1f5a48458d3da46f113de177ac21c6b3cb433feb0a1772608081aeda12d4246716138ca26212885db8bf8a469c7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('11070381', '11070381@example.com', '韦荣富', '11070381', 'NCT工程课', 'scrypt:32768:8:1$zccyQ7SBvdeCSJ2i$aaf65993992a08496520044963f1cf3c18c7772dc3a044a9debfc2796fae385a84ca6e3c7a598d51f5b562d931c45078095d28c662e9bab1f8eca32d5ffdc6c0', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('11090752', '11090752@example.com', '张香丽', '11090752', '生管课', 'scrypt:32768:8:1$1khM7p2Idy5RI6Ys$9e1534495aad2e8fcb40fe9ef8b6a818465472a5c5823274227f013ec27015dfb43173770a23cfd5d86ff04ab02d24ceb28d1b279b005ed81cbd52705d32e586', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('11100690', '11100690@example.com', '李正阳', '11100690', '生一冲压B车间', 'scrypt:32768:8:1$dfgKolqJf0aC0LPY$7c5cc748a80afc83d6e86ea1373d83dfef99995de7a862f84133c75e5e38eb4fe7eaa5f7ce70cc9589ab859d525d7354d61cb50be745d74bd53a691667648fa8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('11100729', '11100729@example.com', '查培波', '11100729', '生产一部', 'scrypt:32768:8:1$HbzDLw0zkPLWk8SX$29ab16b1da32b34c37eb817379792327dcef9760bfd8ec6c4e4462580a04a2107d4bda42a2ce865928ad3ad6ed3cac1025a645dd14a6a7fb5d143b0d0d07d1f5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('11120432', '11120432@example.com', '刘勇', '11120432', '总务课', 'scrypt:32768:8:1$0zUk9qkTvFqlVkoI$6a7704edf78d57f727d6c60a16bcd4ba210f87701a9e63b2cec3d59d215c308856805e4ac53c65d90346b6c26a7a3f5113cafd59b9e163f77cc48d01ae876c26', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12020356', '12020356@example.com', '程盼盼', '12020356', '生产二部', 'scrypt:32768:8:1$f8dluYxhQnCIM9hX$e5d1549bd02fd569a2113d2d3ad155d1d1df665b4d4f4cb10a817e9ba6c8bcfc511a3516883986e63eca43ebb481d4ae104f751cc73ac88d84bf40a28b9dfc48', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12020399', '12020399@example.com', '苗海霞', '12020399', '生一加工', 'scrypt:32768:8:1$5QLRY6S76EZLmjQi$c1bc6d4e42b890c47c1c0488fb4132a2c00a57341f5c74bb40496eb44bc7bc2009e41988635794b2a1e26bbbd72a483a93dd7c1ffca3c179576bb09e56ce50a8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12021314', '12021314@example.com', '曹海周', '12021314', '生产二部', 'scrypt:32768:8:1$aGx68Zozr3ql02R4$4b4d0c62e45e9fff4c4435ab3840952948fe9ced75f2511e6eecd55401d6e48e047e4d770595f3fe3079a065fcbaeecf66e08c1dc6ab9922761f0eb631786199', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12030660', '12030660@example.com', '丁宇峰', '12030660', 'NCT工程课', 'scrypt:32768:8:1$JjQz4fPPdGZleYkV$2826a6bcd1601fb373534d2c6660e153fec0a43c16ce75c3f975774b7e8be121812da66521fbf8ebc14f87909c4e0217b96014b86d083184efee83488bf2ec2a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12040417', '12040417@example.com', '李东', '12040417', '仓储课', 'scrypt:32768:8:1$YYeh7HwSUlf8wcSs$a60a2d1999cf6337814b607a60667e460b734d4ce4f9a20989982eca4b06ad7a52f23ea6801d65fd7aaa5456b1d2ac63ba73a522faf3a8c115bd53aeeb97b961', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12070189', '12070189@example.com', '杨为强', '12070189', '生二加工', 'scrypt:32768:8:1$egiVTdmg3DycXa4v$139eca698ecb932241383847a2eddf244b5644bee19bd9106fecfe353db7c35a89c354f67cedc11ef0c2ac219fcf98015170cf8cf21b0b344b548f2d9c53caca', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12090453', '12090453@example.com', '马波涛', '12090453', '生二折弯', 'scrypt:32768:8:1$SJOjvBGWd9BmUGwV$a86d05fcddd7f9e78678678deeec14470c93bf68864b5bf20bdae8666753e696ceeb2d3728d6934af2258c15a7a9a7f1ab95d7432610dfd3ac61fef5ae53d3de', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('12090501', '12090501@example.com', '边伟亮', '12090501', '仓储课', 'scrypt:32768:8:1$WdTpxZRPUZVGxzml$bb8671c13099632baf9b11c2e8088686b4beae947d0cd8e6b907c5ee64a02ea7a96d2eb9af7b1924f255a3b81588e05b077f08f141084a903cf38a79feb041e2', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13040172', '13040172@example.com', '李磊', '13040172', '仓储课', 'scrypt:32768:8:1$7DERPzCO2AacgFjn$baab78ddcd0d39eea2090294c837e472f6d38dea8bb544de3e8263763aaaaef95f6d59efeaa8bab6654a92c9cceca01076d75237fcd54b7219dd2ae0b330cdb5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13070377', '13070377@example.com', '尚佳', '13070377', '成本课', 'scrypt:32768:8:1$T6o5KErASeWzbbD7$083bbdd583debc57c98e9c56618e14702fdd80c736252bd04e2b56d9e881420f63dcf162433e9161a9778aedf4c8c5fdb495e3420109fe839f2bcac53b646237', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13080115', '13080115@example.com', '张进喜', '13080115', '仓储课', 'scrypt:32768:8:1$UYKMXBfURJj6X2tr$ad1004a215ff278251c055be64ab94dd57e712b1fcd7814b789ea7271e8fbb033f6875760fe54507b927c1dc34d347ec2867844982a238754d28f9c358943dd3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13090195', '13090195@example.com', '李闯', '13090195', '生三液体涂装', 'scrypt:32768:8:1$SugNqM3nuSfPdOvr$0fd6501ba1f5ff3f37990cf151b741757b5a3e664d970e08fbee0629fe4775990a40d43ecfa0e97aa5ca4e3892576e8a5122d7a34a6a5bf551e6585564eb067d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13090494', '13090494@example.com', '沈来琼', '13090494', '生一组装A车间', 'scrypt:32768:8:1$zEeocZ7IA8Cn4WOi$9594a613a65b241a759de05e4ba7263081d2873212d4caa3fca01b4bf6a4b0ff9531a86a3fed98597d641f7a133af15bde0130f3cde78138a840479eddb8a92c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13100147', '13100147@example.com', '程心意', '13100147', '仓储课', 'scrypt:32768:8:1$3oFRWbZS4SzSzZBZ$a63084a036e8120b9569991868d15a20a3b1be656254156c2e32059870d587f9203f93c9ee31c8a4aace95fa194941b144bfe3a94a94faa5ec1a64a82ca2db7b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13110328', '13110328@example.com', '张强', '13110328', '生二包装B车间', 'scrypt:32768:8:1$UAUuBk1MVKYSmYvO$357ad5154751fb5e0e5ffcf68759df3bb7599eebc8893f347b0efe644e921325938445fb189ee4b1e4f40e4378b989738aae7acd7b3eed54b2a7ee6c36973f24', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13120147', '13120147@example.com', '夏云辉', '13120147', '液冷组装', 'scrypt:32768:8:1$C4LUm3wgFdJkoQrV$5c608ddecfdc565e1d8558e8c3cffa5f1249ff85c2b495016e59718a36ad71985e0c280ddec7c425438fa5840da06b11552f1b18c9ae696ed436a3c1b1e70a27', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13120327', '13120327@example.com', '杨艳', '13120327', '生产二部', 'scrypt:32768:8:1$dfbJsXHYQRBtED2B$e52251880c6f6489447501c0e697ae412b4cd10df8fa37e8d93e0d71db45cc753d66cb88a99fb7d98afcea55575654cd6a13424bc54e3b87397553e06430ef79', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13120357', '13120357@example.com', '谢正梅', '13120357', '研发中心测试中心', 'scrypt:32768:8:1$leFyA4qzqvuJHaom$28d3bf935ab2bc5654cc2e8e891149c0cf9ba352cd3100bc55f153ec052b2a90f7c7622bcc4714320dcf6c759cda934b745644221166747c4ca7e3c35ba5874d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('13120387', '13120387@example.com', '尤程程', '13120387', '生一冲压B车间', 'scrypt:32768:8:1$5BjQvMBQ2AosHF6W$7fcc14c6af2f2c9ac83f64b2568a5e5508d18c845b3e72ffedaa4c236c78ba8c859a142bfb6e3c917ded84455249025ed999351677ee3fbc8867706a4e3335a3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14020567', '14020567@example.com', '江三平', '14020567', '生一冲压B车间', 'scrypt:32768:8:1$J9NM71dT7cl8wvhi$a5e04ab1bec5c91838e2ed398abfeae3967c3887aae53cf3f04cabe2fe43ac380c5ff6f5c8c276ba32d0a3385adac959967ccb527511479f110aefd84b75dfb9', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14020868', '14020868@example.com', '吕伟', '14020868', '仓储课', 'scrypt:32768:8:1$I3NgyUTXdaUaEOAC$dd55830adc59b7cd78a648c0156430edf3b4618d929d3b9e156f8a74629e54de301dae7a897e656a4cb500b39605535b733066812272df7677283a4fb9cc900b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14020877', '14020877@example.com', '黄红文', '14020877', '品管课', 'scrypt:32768:8:1$NfEZEJdHm99JU49L$091dbb1e52cfa372c7e539a4222b1d428ebdd13cbefa1149941a0a396a77c084ccb5a1559df27f349f1bf40950ff32f10990673ef14331d5ea7e93261a672de8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14020892', '14020892@example.com', '干云', '14020892', '模具设计', 'scrypt:32768:8:1$KdUvCEZWdGn93UdX$6b330d603395d948fed090432210d41ccebb161ddfeff2982240f9b7b34f7bd550a9e80b8adef5890007dd759034edbc700dcb69a50f69338e2e22ec23b8e4fd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14020935', '14020935@example.com', '徐秦彬', '14020935', '生三液体涂装', 'scrypt:32768:8:1$tBJBi0QaXwV6uyX4$eca329848c7def91d6ebc30784133bc51ef7535e213173923596d614448abde4d3fc17c7f1df1c91867e6e20515783a0393f7f5c0ee112393060ce85ef7c8ea7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14030062', '14030062@example.com', '许允德', '14030062', '生三粉体涂装', 'scrypt:32768:8:1$91t1NFokGy8Htwvn$650672a5e0bf20d8ed01131d3dc0283bee47ff9a216b01e20f515f7bf69086f369a758d59424d53bd5f67854b217317bfffb6494ad0d9d522729a9432c1108b6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14040008', '14040008@example.com', '叶平杰', '14040008', 'PE课', 'scrypt:32768:8:1$7qWK8lRf5fPtm4BC$e6c3cdd005b9a8a4d88af352a6b20df66098bcccc960d387a51d8bde76b15d2f7e2a1b0835ae74b03cf986ef73b9ea5099571080c577623d75bc347a92a0f126', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14040017', '14040017@example.com', '范勇磊', '14040017', '生二下料', 'scrypt:32768:8:1$uvWbrdqDu6XmAF9E$370b00363973dbe0b0b9f2cb8d16a15e69f1092ee324dc6a5161493958d4f925cbd1ff238644d1bd66156ddf1e3979e04dcf5cb28527a3febbf0520b4676d64f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14050136', '14050136@example.com', '双荣', '14050136', '生一组装B车间', 'scrypt:32768:8:1$C9bThRMvyNThtOgi$41405c56836167b0c2986992ceb542ee5b754d101b34ee8ba210a1386ffa92ceb523d40ccfcbd48766bc87b295025331e48470662af77a05eea6c01f1b5ed757', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14050369', '14050369@example.com', '周永江', '14050369', '生三粉体涂装', 'scrypt:32768:8:1$eDJ3v4lAyOzmpuyN$545f4bed65fea0c8a6882ce3b0b2457cd1412898a5dcd8e51f35c2ea5eb3724948582e9741a703de29e494ff1c2120fcaac84b1dd8ba5ff5256238e157b60f33', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14050494', '14050494@example.com', '吴文君', '14050494', '生二折弯', 'scrypt:32768:8:1$VGWI7TX00WhMKjYX$d0bf51302f1298bf81d77cb50ab632f31d7598656c45d2e52bb06b7c4279be911f147b81f1d7f90a16f4b21027e2c6d9f1d079fdbfd8df0145502f9dc54d11a6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14060051', '14060051@example.com', '高超', '14060051', '生产三部', 'scrypt:32768:8:1$3abZcBygNL6UWlPm$97a22a7acd8885c6fb53a53f0057fca4bb6f682052d900e5582f343c19b65d6745ec846646b85f0648aa92759a10c15379cf623da7635af090bb226701a0a4bc', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14070571', '14070571@example.com', '胥付合', '14070571', '生一组装B车间', 'scrypt:32768:8:1$YGhSo9haZVMZmWtK$5b722ab2c943ed6a97d1fe37317bf55a9cd8549bef339573b5f373256423efe9c60b32d0034706e0a17b2c6fe9bc7bb923b70cf73708080d1ffd524e6194d60c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14070572', '14070572@example.com', '李素真', '14070572', '生一组装B车间', 'scrypt:32768:8:1$pkPCgti6w6Vriuhy$261b169785e031ab65257900b0df00b2f7f14127860a822d8e979c0d98c652622a9e08dbfd6a0a85728f4dbd1788d3a2f745261397fe81bcb714d5c2edf91afd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14070588', '14070588@example.com', '武模博', '14070588', '仓储课', 'scrypt:32768:8:1$xWoAerG4ldYff0uZ$96bf7fae6d24465dfb3696831251c7115082a141308bb67a78e847e61334cb306ae859ee735f92bd07ffb0bdef78617dbe93bc57e1444f0701bd46dbad03b077', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14080161', '14080161@example.com', '王婷婷', '14080161', '生产三部', 'scrypt:32768:8:1$z37qhQboF0sAn9Or$c6807ea0e73c11e3e753426527b696d8857d7aa2dc84d009e5295373cae6e2bfa8d0b18089b100645dab6114ff3de6ad025ef9bd0d6f029b59470236fb1f0534', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14080379', '14080379@example.com', '孙成欢', '14080379', 'IE工程课', 'scrypt:32768:8:1$k1Ybc39mMGfGd9BC$c052350b0430491537a8134413f399a7b7eb5e71e8556b226a34f6c88ad173c9220f525f0f1b373db1e092faf4cc1ed55452225978be8df6fff36a0d62401b6a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14100422', '14100422@example.com', '薛岳', '14100422', '生产三部', 'scrypt:32768:8:1$MvFGqpnXulJmO2LO$96f5493d6b86828fdfb23dab4bda60e847b7ce4506b8a0222782fa5369116dcc4e2d024d6cc58360709f90d6199b6241498345d8f4e61ac61619148ca3c71d90', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14100527', '14100527@example.com', '徐翔', '14100527', 'PE课', 'scrypt:32768:8:1$dsTvhArY1enDAXKN$fa1d96dffa09df86b9dd74dc4a478debf771be0a62493f42bb0d67340f35db3e17e5afc762a9bad33307d23c590bbe23b1e193ec48d44031b6273c6d1e888d2d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('14100793', '14100793@example.com', '李宁波', '14100793', '生二下料', 'scrypt:32768:8:1$1N39yMfbWfe9xU0W$1d04758fea70417b09ac676e050103d0476a91d4f24d1cdcbffa452528e5266a05972fe23a679f37793adbc97f1a585e0a6ae78c93dff8058bbffda723f66fdb', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15010408', '15010408@example.com', '占水明', '15010408', '维修A组', 'scrypt:32768:8:1$xGR4DYo5Xv2m0zF2$a9220dffc3a9e6da4c10cd478996c6b9fb5b98a6d4316a9d2f1180e350a92b933146236bd7c272d60ade668fae90ee659ad4eeadbb5890abb6c0902e533526f8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15010464', '15010464@example.com', '李娜', '15010464', '仓储课', 'scrypt:32768:8:1$e8a4cplUxDLIjN5h$1c63a871fce64e0cff17c5f7d3e68e57e6a24dc7f8295f2e92c12f572b1b8d163d021b9e99909a664f20faf2b70b2d16396ae82cc8c1aa4dcb043dd1c4a9095d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15020049', '15020049@example.com', '王申申', '15020049', '品管课', 'scrypt:32768:8:1$H3wPIZAMC7VC4l7K$f0330d2765c6f1639483811054542da55d502c535b62eb2f014833b2019f5faf97c9acb2d5633d4a06df7b5462375fafdd5867b38aafda756b911e452d34bc80', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15030018', '15030018@example.com', '郑彦红', '15030018', '生一组装A车间', 'scrypt:32768:8:1$Qb8XYBXkCOhzxGox$da42cf519935f586e043053214ca5a46b14e37be607e0275a2fb7ff2767bfb370b673b46e93896bfbd70a8741c5d1bb0326bfc04ceadb2a1d845688cef97cc10', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15030100', '15030100@example.com', '张起文', '15030100', '生一冲压A车间', 'scrypt:32768:8:1$HKjpjNK0uvTmcxHP$3136e645e9b2ffac5dec5882d6fccd6956437618d73f14dd1157adeb5e5de293a7ed8a2e02093412ad8df34d2f1d892dd5c5065c9d7f7905ccd2051314bd1185', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15030174', '15030174@example.com', '周亚斌', '15030174', 'PE课', 'scrypt:32768:8:1$B5sEoc3bR4M0p93F$1ea3da3fc2ae3443677d379ad9edd594ed89d2000c8fead85364784f54b938d42bbc67ec70cd15639b8252215e96311a6d2269e4aaef990f009701d9b45466fa', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15040016', '15040016@example.com', '姚倩倩', '15040016', '生管课', 'scrypt:32768:8:1$dn2aHKW0FdeVRHyW$ece48959f2110f7e92937ffe13ef978b0ca996449404acb8f3bb0e80ddf5b2c6534a3e290031a79d72e07cc29a158896577d5797159ebbfc1efa4d5e233afbcf', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15040094', '15040094@example.com', '毕桂兰', '15040094', '生二包装C车间', 'scrypt:32768:8:1$8jIkrIoH2yNO0gMw$36a41f6673978e23a7ffa0f61e091ae1e5af9c430f44e3e95ab5831681183db16c75fb5e45a58d16ca360181e997cf41f5b241ac97689ea16ccb5c3aa9f7018d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15040157', '15040157@example.com', '唐艳', '15040157', '业二课', 'scrypt:32768:8:1$H71eEeREckP4KIvP$55c4ff1a6dfd774e9938c2890055162e155cb74132ca8103e2a88e7b4873e873852f1a0ae0fcb658909bde34c3b7672f5167ed70c9a28672120089f1d43ed91e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15050006', '15050006@example.com', '刘斌', '15050006', '生一冲压A车间', 'scrypt:32768:8:1$BvZIR1ozCiV95W4D$e4de187c14f861c73fea4364a3dbe3d6afcdbae2327741039610f444f428a4b47f345df40c895ec811adcc6a4b4e6981898f607def490b2f640ef04213cda5a3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15050034', '15050034@example.com', '徐新生', '15050034', '维修B组', 'scrypt:32768:8:1$SakUloRDuA6AKzPR$933a80f7d833a8ce454cb02c2adf443ef22bb4d194f2a220de9691265f4a9e475ecd44c7ba478ccc48aabb430f91e208518e2b5ca79b8ff1c31bf31408565e26', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15050099', '15050099@example.com', '王素艳', '15050099', '生一组装A车间', 'scrypt:32768:8:1$FSEmKQit85yNKq8a$3a9992c6acaedfeb668f7c7995a5f778b288cb1d30bc5ad50f8af4b1ee63ae791a68019a3ba2defbe278cb80161c894252f8b4ff9f6e03c0f77bd834b87e680f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15060220', '15060220@example.com', '胡福才', '15060220', '维修B组', 'scrypt:32768:8:1$XFeYeROQS6DKQ6Lf$f4a7caec15d58615fdfeac25820d1c7e0f5584a5302023c905cbe81d748c3a464092c5ac098b10336ae1f72b8b8a27e280c6d4ab375d6918a5498528d759d598', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15070046', '15070046@example.com', '王晓辉', '15070046', '生一组装B车间', 'scrypt:32768:8:1$KGGvV4Umnv3AqcPo$ac8592006913b066ec1ca101f362552c831492c4518d8e945f620dcde3d05079c79cd03b725bcde4b67a175332f710491ce6a67eb8cf5fea27dffb34ff6bf8e9', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15070145', '15070145@example.com', '苟永红', '15070145', '生一冲压B车间', 'scrypt:32768:8:1$lMWGIEspx2fHYRyS$009d142af5de7c875b76b2254075ec9923cf1ed9364ab9c512e1c3c5d88f9d45d4147ab1642bbb1206c906e811420a6ad733afc3a3cd94c53014e077391d209d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15070211', '15070211@example.com', '吉文博', '15070211', '仓储课', 'scrypt:32768:8:1$Xa6PN4rnDmFUf0DW$d5a0685a6b9cd59e975a33b0f063872b9e0310c5da40e5debffc4476ec29d411b690219adb320154252bf27a7c2a501c0b1434d6515ac7a4c28adab71082d817', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15080327', '15080327@example.com', '常永贤', '15080327', '仓储课', 'scrypt:32768:8:1$TUaRMLmtSLKB4aBS$820ae4fdf117087288a447788beaaf1e370f6a3c2554afc28d4675d14e80d89d0f2daddc70fe951e167f86105380e983ca33fb36408445e7706b8ad323af6b3e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15080332', '15080332@example.com', '卫宜飞', '15080332', '生产一部', 'scrypt:32768:8:1$FbwkqAFkMdeioR4L$911c7691592b08547058b1508a0a98999a322e8164819cc65e7c4f650477379b0f2dbfc872ea8771ae6070af7dc740fb396875e9ed00077e2151bcc386bd3824', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15080338', '15080338@example.com', '韩嫚', '15080338', '生管课', 'scrypt:32768:8:1$4dZU1qk3VvLS8C2N$0a4eb16be1594de93d97eb4775df3a8b3914479ccadd5bb526afa8149020a7e692a48ab88c29e23eab513ff38b3304f8a6203705e515a0ad21dbbbd4cdaca770', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15090002', '15090002@example.com', '姜春雷', '15090002', '生一冲压B车间', 'scrypt:32768:8:1$JwXe8AS2xFmKlTQi$3826b79247203ec86524c9d903c2e0700e28fe0f6aa20eea0b62f9c61e1aa0ae454346c91dbe46e32c49d73b4c89cd4f60a2de45dcd81a4a476a1a91243058e8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15090009', '15090009@example.com', '李玉红', '15090009', '生一组装A车间', 'scrypt:32768:8:1$Jw5PeDXcqEIKgIEe$1580558e30feeca15e2b3d1f4483d0ae5250c1a6281fa7005b75b3e8cbcb76c546a2f87e699461aae61c473f1fb7ccb881cde52d43a333c863d8f9f2793daaf7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15090105', '15090105@example.com', '孙二涛', '15090105', '品管课', 'scrypt:32768:8:1$9GoOi91L6wQLNRlj$70478736749c548fb7861ae720aab8f25550903c4128ba80da478267cc8bed9a5d43bbaee0c5579b181c3814a2f20c15d3c6f5a3aa0914260e2d0563f842dadf', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15090106', '15090106@example.com', '丁艳芳', '15090106', '模具课', 'scrypt:32768:8:1$notXuCYjaJkfwbov$300be9309048c42b5da36d4d036b564759721fa1acda503a55b5fba6a413062b636789ae21bf73144a2fac98230e656d0943fc18c611795e68389888caff4567', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15110043', '15110043@example.com', '石航武', '15110043', '品管课', 'scrypt:32768:8:1$ZAh6YHYUWby8ZxVv$6ef6224e751980bb4a03db58af352b079b72f8b7858dee9775e6914562c7ce7b495eb7e64303cae05402d2b0e50110c84597116660a0c63548e15cd8981fbe0b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15120002', '15120002@example.com', '段涛', '15120002', '仓储课', 'scrypt:32768:8:1$hsuXi0tlmk6wFQxX$d8db4d75576949f84899071a00f1f0f975bba2eb6f1f0cdd392e015e935372fc6ad6181b1aad67756c7563bff79adc2ed5de68d647993c699175257d3ed8bfc2', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15120016', '15120016@example.com', '吴金林', '15120016', '品管课', 'scrypt:32768:8:1$mRrks3QnLyLxr4K6$e13a483fe1d593e93cfe9a8a719087c3d3f940b9a760739769bf8b3492370710a40a55e55f947b9c781e7eba96a5578b1336a89b0d28939979bb4427768702f8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15120056', '15120056@example.com', '曹艳辉', '15120056', '仓储课', 'scrypt:32768:8:1$IhBua8aV5WTaFQes$3f163f1afad8f5c318fc278066cee65953cc52ca561c09e218945ef93a75f74b85fee7a9b399bc695cffcd4f8c32313218e092d11ad1a0dcbada99a181e7310a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('15120168', '15120168@example.com', '赵雷', '15120168', '品管课', 'scrypt:32768:8:1$m12Ndvk79Uq93esL$2fd2286be1110d11e0ca1ab35f1802996c4ee1d84333b7cb2ad6ba4fe935b8adc9f66a07556dcc5bb6ac5cb6f27968443a426707e91dd11d61ede6bb64b9daf1', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16010058', '16010058@example.com', '李三卫', '16010058', '生三补土/打磨', 'scrypt:32768:8:1$dmsqGvBeM5bSqFCj$654db4b31d7bd17a6f5ab8db4af8aef38ed6e807df082b5d9b5cd63190d1a0fdfef708fd544df880d9404716fa320becabc3bebef6e6c831ca9d9fa43d09a750', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020081', '16020081@example.com', '张京', '16020081', '生二焊接', 'scrypt:32768:8:1$15mga5ARkZZ03wwW$97d75b6c612b38434b2680da7fc5640bbec4c8a96dde63e82523458179772c5f7d3eb49d60c548e4043ac01bbd42a598a70e688b51ca72187a921f3b680e6f23', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020130', '16020130@example.com', '杨贺龙', '16020130', '加工组', 'scrypt:32768:8:1$L4tcRsnCScJDuzxA$17a2b78ebfd22cdb08f7d1a0e0ceb513a705c37d877e8a77963a5997079ad5baaa2d65aac891b8dbfc04029846a646f35785743fa4fb327e209a480dd3e33ca7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020223', '16020223@example.com', '吁养峰', '16020223', '仓储课', 'scrypt:32768:8:1$rSWFW6F0FWzz3JgI$9bc7043b869249da8c152039cd986ab59783c83ce954b38cf384ad648942f25324b7e9b5b03d28e5dbbeffa92b069313198c76efed0c87a487ed81deaa893a3c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020229', '16020229@example.com', '周双侠', '16020229', '生二包装B车间', 'scrypt:32768:8:1$Y89QcLNAeoqJJo5F$65c0fe4c92b6f68af917f5cac66a3c1a0089dbb2fda826fc7b2281b48395a7d5a4206752407b92c742e2aa5504e829386c1dba845aa01b12d290cc0bdfdfe236', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020230', '16020230@example.com', '宁嫚', '16020230', '生二包装B车间', 'scrypt:32768:8:1$0hUvOOqtVaUQ5f0c$5930a79d3ef2d8da3e941a7a156fafc9fb1366d5069d875d72879f2a5fa7f9769d8091a2b89f26a785ecd77afb1d4626cf3e9bcf1c30b743489416be4d1c6bce', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020231', '16020231@example.com', '刘光强', '16020231', '生二包装C车间', 'scrypt:32768:8:1$LcXaTNrcsyobiAFs$17c0f04a92928550848bc900e7275cb7a499e83c9ebc4b89253569cfd9f76919bc905a35aab7319aafc6180675efbc36b8493970380798f20eeddbf9fbf46a6e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020251', '16020251@example.com', '张贵', '16020251', '生一冲压A车间', 'scrypt:32768:8:1$n8MNSjPxfQTBJb7B$13c11632560ed46687675d48fd72e7aa1c2fc07ba47af5e77adf350bacbcacfe3d17c6d45b12552982e81ebfd0ab4416eb86ac328d52806c8d0599c732b0925e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16020271', '16020271@example.com', '顾来民', '16020271', '生一冲压A车间', 'scrypt:32768:8:1$dMiYA5ZUudUVcZCz$d0a6587f2d0fac4dba18122bdee70de395cc064396aab4ae80aaac39a6ffb34da21906485312d43bedb05fe9b17c62fe726ed2b7953cb368b6c32e38189d836f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16030001', '16030001@example.com', '王伟', '16030001', '生一冲压B车间', 'scrypt:32768:8:1$TOQZfltWodEl5skm$00fc39fc87575d85136258413433aa99e79ae8f784e814b89d344cc5996c76c77f86e60c8fca02d52c1ace0f91ae95d7c39b0c38a6c84f2c8303ae39af7cc1ed', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16030100', '16030100@example.com', '苗继伟', '16030100', '生一冲压A车间', 'scrypt:32768:8:1$8XtC261YVN79TXKh$895eecacf33e8236d712a5111b0632f367ff2140783f506d75506766612948b2bff96acc8809e1b1e44d541eda3af6237911437e6fe557f9b15ef59871790160', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16030116', '16030116@example.com', '汪斯硕', '16030116', 'NCT工程课', 'scrypt:32768:8:1$okPX1Xzy1qiU6Mj9$435ac543842836aa594efb39635070d0fe6b764cd6d8a8615fa6e75a5926a2e324fe55e9e76d335c7119b6f4749e2b5965ca77027bd407c7473bdd6c52b0199f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16030117', '16030117@example.com', '王士文', '16030117', '生一组装A车间', 'scrypt:32768:8:1$v3w47BfeiIe0PwVa$9725d784e0b952551c6622fba6ea1e1ae3f6d91da3751290788d0b1e8b2fe156b287ead810d559459eb2720b0b1974bfcd6a9591f52fcdec1c1bb703094ee36f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16030164', '16030164@example.com', '梅佳佳', '16030164', '关务组', 'scrypt:32768:8:1$isAdRcu0e70iBuhK$5c19e1bfb31ebcdddfbf0fb8e7a5f0882e1b402eac176bb39bf69cdd3e1326552508b24c6d1c98cf17b4cb4cbdcffd040db85f87e84d6e6ba7ce75e1e6de4c66', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16040056', '16040056@example.com', '朱文炳', '16040056', '关务组', 'scrypt:32768:8:1$ds3TQjfNXuW8enDk$f8ecad7b764abcc28a3fac938b5ce5541535eb0e12dd2f408630a41edaf7fba97fbe5bcbbcde6f339333a60fb9cac4ec55d593bd9cb87ba9353826d9a2e15d42', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16050101', '16050101@example.com', '刘亮亮', '16050101', 'IE工程课', 'scrypt:32768:8:1$ydvxfuLPMig17QdP$01d0bcb3f785f4d4a3dde73c5fc4baf89869aa1d072dc74e6524c9d2d2eefd4574e0f6eccc571762e87b228c99eb29c8760bffc213dfde2876ab9360e1f57dae', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16060111', '16060111@example.com', '韩轩', '16060111', 'PE课', 'scrypt:32768:8:1$iRrYreDw99Njqtbl$9e800f76fa683c486dcf5469b395fce2c7b407ea2627c9a7eac65d009b7650640a3b6966c748eefe293968684cb6cde437351ecd6b53213a6c8f8790b226c19a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16070041', '16070041@example.com', '马海燕', '16070041', 'NCT工程课', 'scrypt:32768:8:1$fggRNEAwr1Tfp954$7a914dfe6d8946c32461e6614dbc8d931a669882697557a4b0f4a2f8a3a5fca08853d6f3bcdfe0da0cfc30a3bd8fb9bcdc26fd9bef55ee77682b2cac45778d14', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16080186', '16080186@example.com', '赵银琴', '16080186', '总经理室', 'scrypt:32768:8:1$YA1wKb86T8iYxyeo$e59bd272c43d37d831fc47e4f4b2e6578d7e8278423c21e2b3de8bcad43afd28458f5b429832f7bebd72de73231611d9c806189c9e031e747cac13e077a59eff', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16090033', '16090033@example.com', '李新威', '16090033', '品管课', 'scrypt:32768:8:1$CJaQPRO0pvGYCnJg$c9841044f22a396f953e6e2f7a16fc88302c9ddebb8d7b2da2c45e4c8359ee8b8aec6281e3871fff0329800a62b9c5cd9288cfbaad33d91633bc811bb0ca77f3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16090091', '16090091@example.com', '韩李娜', '16090091', '生管课', 'scrypt:32768:8:1$pnp13MOLYbCtofiw$45ba9a8ab70a0520774f7993be58dc57bfcceb7efd82c845bd79da3935cecda6ff5c2e9b55d76848a2e164ad8b7476c6eb0b125d7e509c51267f294660e8e85b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16090132', '16090132@example.com', '吉玉娟', '16090132', '研发中心测试中心', 'scrypt:32768:8:1$1DjYKmkqLeEAAbEB$eb088eaa07a3e12fd6d03512c311a7bc74bf1a1a581737af73e8ad6e8aa6d89c8b946e41934c503bf88f08271a25a181ae30f4da395644a0f842c5347965ac64', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16090159', '16090159@example.com', '李振甲', '16090159', '资讯组', 'scrypt:32768:8:1$91K7CwHTh1XrRydf$266da90858269dade5d53c5af621f159d7e8c77962804b7e7552f149bbc6e91d1a9f44c0561f287b33f53eb5f4d9c74d1e85c2f2bfa9a912b7b76bfc710f339f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16090226', '16090226@example.com', '王欢', '16090226', '文管课', 'scrypt:32768:8:1$vWAVL1B7aboRIXb4$e0cb15c03663f78e199251043365e5fd6e6a3054baa80bd16cfe4fdf6e80a9564b8cf266fd9afdf55add2c42b2d7fb9a9edb8dac303e2ce124c71415717a3366', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16090494', '16090494@example.com', '梁银玲', '16090494', '生一组装A车间', 'scrypt:32768:8:1$zzZwWXGkdZ6z9rcQ$ae8215c29aff2b5f5e52c23c12a18a560cc7471d6989df384a68401e7f0a4b64df8117f190d9936947510945b8340fd84c48d1a59a8cc0a85d33498ac8c2ebff', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16100199', '16100199@example.com', '牛秀芳', '16100199', '生一冲压B车间', 'scrypt:32768:8:1$QJ6c2gBIwRqPjebL$1cf869e5115edb07e7e68b18564768289e0a82f31e5c426f361459c161ed1fd7ba87e10392bf62dcd1fa53ce7b2ae10f6f6120c177f6536fd59d3918eaacbca8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16100200', '16100200@example.com', '秦保林', '16100200', '生一冲压B车间', 'scrypt:32768:8:1$WcdMt7XwAlD42h7w$894d7e2ea1bb5ab5333ae8f1a4e5e69d40e8fd5e13255d3aee6742ecae7f10c55be2729bbe3487ce04accf0fd698480284bf7d0efed380a7098bdb547a40ba78', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16100208', '16100208@example.com', '陈天亮', '16100208', '生三粉体涂装', 'scrypt:32768:8:1$uUMapoVjG7QV37Os$c5a005bee6b6b1afca5803a4c36d2bf2efc950a8c19871433f46575a409629f72e2508a831ba062077c9a3dcd924db2ab8d49e1b05eb9dd0c63e7be626cf6e02', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('16100401', '16100401@example.com', '胡秀云', '16100401', '文管课', 'scrypt:32768:8:1$PG0FFlISfewtH1Z0$70a0cc3b8d45fd46ec5eeb15d9163cbcd6b664ec81c5bb522e4c5d76589bdbcf8fa54ca21387b49ec9c1ce541d452e43eb1e68e61af1744530be916f03c9dc89', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17010193', '17010193@example.com', '胡庆云', '17010193', '生一冲压A车间', 'scrypt:32768:8:1$AXAFml3inmLA9dlW$fd23dcb31f9a2cad1dc22192dfeffa77f4c464fe7fdc4c928d8125c6c212b059811e255afbe318542c129cc4147a4c8130d8b5e4fac0c8455d8363f20975ee82', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17020063', '17020063@example.com', '赵艳丽', '17020063', '生二包装', 'scrypt:32768:8:1$kbVOMaMKPM4CrE8e$259460f1adbc3a110b8d680124f5c60d93660b9d937b5888a68a19ae6f40f9724102417b4ab50a7403e3a29bfa76f346ee14db2c262e7e3c6df26c307f95fce2', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17030003', '17030003@example.com', '陈飞', '17030003', '品管课', 'scrypt:32768:8:1$D7Xn2nGN5hMLuBD4$d1807982d94a7899cd9e923f150f4dba94728900d13f881e3911fcd6ca7040779c7dcd415ceaadbfaec6a2045c466e2cf0e37e760bdbaf906043ad0dc36d4842', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17040001', '17040001@example.com', '王蕊', '17040001', '品管课', 'scrypt:32768:8:1$Defy9C8YFiknBwgB$87c085066270d4d376d8ff589bf862f211a19a9ce39465db61ddafca3f666ab1fb0e6a9723dcca6c57c4fff9109499569d4c92e9e4903c7c8cac2383a2c43faa', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17040025', '17040025@example.com', '程志蕊', '17040025', '品管课', 'scrypt:32768:8:1$6pOkQOOLvnHkXsnc$a0e93ae0616272f6bc5e02aab567121c153097f275efcf2b5bf80d426ab0da3a3e69e5b4527275cf36e08b78bb7565b31a27b7be23e8957af72ce1322073b3ab', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17040038', '17040038@example.com', '郭琼琼', '17040038', '品保部', 'scrypt:32768:8:1$SMFDXO7k3lYDpzGH$c9bd9884c19ea6fabcf10e3e4ee852a0dd04024930a6ded7ac0421ac52ea76a607b114269b8af4b9a8ab06636b8ee1adb28ed13f5cbec53ff7fa7d4e3187328b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17040041', '17040041@example.com', '宋妙宇', '17040041', '自动化组', 'scrypt:32768:8:1$CbHseCmPfQq6FiSz$ff44fc09b519509283e1fa78dac2a7037efe65bab177a1cb9e86f2eb206961c6b2d9487ddf30da79054a8e129f639f2677999e14e4fce2cf1460e80aafab22a0', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17040156', '17040156@example.com', '王小东', '17040156', '生一组装A车间', 'scrypt:32768:8:1$64nBLik0MGy9B9tT$60f421ef4fd120616a26e8f0291f0d7bf6aedd212b1af0bd147fa220a18a9937f9563466a073c5c259ed0210abcf4ef10929d79be033b311cd87af9e1e8adad7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17040173', '17040173@example.com', '张见常', '17040173', '生二下料', 'scrypt:32768:8:1$5vMZejACiZpAcPiz$0caa8abb24aa45e06bf660f0278cc36e686768b2578a072d5c539408b5860c8f92e3b8c29c951fa79e0d3a4158e55c4476b0ac58f840ede53607af9e37f4abed', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17050183', '17050183@example.com', '文亮亮', '17050183', '文管课', 'scrypt:32768:8:1$wUI5VJ5AgrnffMNm$e7a429eb44d323842db825c8bdb21072442f349ff3f13c7c66ca369994ae0dee5037c740915e5e66461252eadc42aea57d8363d73bb68d62583178389fcf418c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17060022', '17060022@example.com', '李梦慧', '17060022', '液冷组装', 'scrypt:32768:8:1$kgYvolEs89ABWbIL$74b5a2f89fef47765f4e71bbc5bd859eb6d92404f2677b93eb041c53cec6b5ecc9b1cc7f85509298e99a20a4c65bf953c7e8ca3e10a754e4c60f10d7084db042', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17070002', '17070002@example.com', '洪阳', '17070002', '研发中心测试中心', 'scrypt:32768:8:1$zQ8393j6rRTQFB9p$64065eabb293e631cc1402c10e370c1151c863586ade92ddbf32880a2a9b6aa78a9b8e4c2a316409353b18458689517f20161e6ffda7cf067d6c5b44a623a581', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17070063', '17070063@example.com', '纵丰剑', '17070063', '仓储课', 'scrypt:32768:8:1$MYPWGCdRIk0YEK3S$f2b6557ddb41869f00a8d26ce9d8f2fee0868f0108af01df45885dbafaf0a87b29cbcee21cac1a9aa9a78c01c6371785e49adbf1b15577d5ad169a7ea96c7d19', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17070141', '17070141@example.com', '朱佩', '17070141', '公用课', 'scrypt:32768:8:1$wz0zGOiCMmYmjhW4$ee939455cb9b5687ba9ec3df09037326c4fe254bb48ee9244bffb95359ba7631334f3d347692a00c7f35e7c3b1e1e091429464ee3b696336b7e289549ec1f5b2', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17080014', '17080014@example.com', '贾春平', '17080014', '生二包装C车间', 'scrypt:32768:8:1$hVPBwX1lZrWnPXqD$780e89e961ead8fe0ece05313a9059cd104f6e40cfabfe64e09f2cc180f5f63bfc0875c9f4df73b5e26f0185aceb87d6cce366f93c087af7e6ae42e304465a42', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17080015', '17080015@example.com', '何曙光', '17080015', '生二焊接', 'scrypt:32768:8:1$BXHgYGZ8Rcjh7cnB$ff98d5d7eacfb966a224147dbfbf9e9dfa50e75530515c99d3d0658864386594595cd1ddf1cd0e253b2970b68597cc619b7ce7a9c3457d8950a37af7bb8002cd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17080223', '17080223@example.com', '吴明合', '17080223', '生一冲压B车间', 'scrypt:32768:8:1$ieyeQCMhjpkFUh7B$46ec1a406d29bfbc0f003202a3e2aba5a8dbded446ac393e29c2cda9339e34ccf980f81fb3f6c0488640d60b746a40c66a82d24d3cabcae141df817e92d47308', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17090058', '17090058@example.com', '图求云', '17090058', '生二加工', 'scrypt:32768:8:1$WGZ5jFS863485cSH$1ac81459da614289597a729cbc97c4626fbf588bce7d0db42e0a4c2e3b471c8e71a6acadbc10f36c63d7ad4e91a8b6e2e294c5e494e602f768b89c2d3a64da4a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17090117', '17090117@example.com', '唐军', '17090117', '生一加工', 'scrypt:32768:8:1$uupBBp1GcBwmYpv7$190857884c0eede283b21ac52ef98e51320872e2268d397ed7944449031b0c90fad895a1cd1398feb1f3b040992a0d0fb7cd1514aecdf6c540f14596dc5f7476', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17090146', '17090146@example.com', '严小兵', '17090146', '生一组装A车间', 'scrypt:32768:8:1$dneBzWTSDNb1X1Is$2fb89df4145a2eb3177b04e74b3b5d4a7ee3657a08904d3690ef3ccafaf4d1e14c209e487708b9383e099a649db61e7e33f48d1380efe9a20d7beb1c603b5055', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17090227', '17090227@example.com', '吴娟娟', '17090227', '生一组装B车间', 'scrypt:32768:8:1$qQN66ycZsugNo7X0$0f2b70b39a4fc1c881abe65bde7fbbb6160936073c34a3eeae38c94ff14b0cad07e2395c16ad98cdb35cec7e54336a3e0b4150ecee1632a56d5abf1fa4a47637', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17100009', '17100009@example.com', '谭莹', '17100009', '业一课', 'scrypt:32768:8:1$2J3yXTCrvbTzlPnH$32c9273b23a2bc9a10224a5c826344c81b0802b326fdf6f43d1272a08ae9fd0787e1683139891d1088bcd35f8ce8cf81e5941da0515819090af42861771c8ab7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17100019', '17100019@example.com', '李想', '17100019', '生二下料', 'scrypt:32768:8:1$Zkr3eQAcYO3JZKDW$a172536293e7abef557291c18886b867db334417f518e99aabbf91d558074e2ffe800fe0ffd8940f38f7b537e97acc4e6e3453633f53a8506a66a60f8a285074', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17120042', '17120042@example.com', '金连党', '17120042', '生二加工', 'scrypt:32768:8:1$tCR1CcwgbKqvtBvr$11426b41cd39ba0d42a72d079114285ba62890d6e0fde442edd84bc56d719b27514cfc7567145f89f87134c229d58e16d2b95e9c9067718f874192614b3a7e39', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17120043', '17120043@example.com', '陈新立', '17120043', '生二焊接', 'scrypt:32768:8:1$3apa5YbPEZFp6gnU$119e5f9a8dc5f6ef46e6f1331c441bc23c3ee60546df5076ea35e85cabe98d3d472e44cb05aafeaf1caf1a2d85053639e833ed486dd8f367cf6c549c89b424c5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17120099', '17120099@example.com', '赵坤', '17120099', '业二课', 'scrypt:32768:8:1$5T02JKhwkuDTtBr9$dedee59f2a0271d16d26829ba96fb1b2b92a3dc8ab9259f3c3661cf967572e156151b3a5bb1ee2b4c634926f11f0641aaf5b8644d4f1643c912e37fbc9032e92', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('17120232', '17120232@example.com', '李飞', '17120232', '仓储课', 'scrypt:32768:8:1$c5gosYXAlnuHL8u3$4ab400a1e64fc658ecebe66c186a0f17b5be3e3b58cdd12eeb4a9dabece4a8806d195bf0934b0a4110f6748c19763adf3c013f0ce3bd24c6f982c6c59941a56d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18030161', '18030161@example.com', '许红花', '18030161', '品保部', 'scrypt:32768:8:1$kgaoW65kQqP3IJcP$9558f42480b7558a773a081f8a731d6195a224bcbc6bc3d978557ab1c9db28a856e84ef2b49b910abf2ef8bf7b695f61b21d9042f6d26a126ad0b34494174d16', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18030216', '18030216@example.com', '朱美霞', '18030216', '品管课', 'scrypt:32768:8:1$6U6REh4oa9pwgqHE$602d0725b4dbaf33d83c22ce9909f8f17d527b67f1ed7886bb622c7756e3943a0d7f7b9eb31a9f744bef2d6c6869dd786dc040d0d0087cfb53e8080cc0b93579', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18030250', '18030250@example.com', '黄全芳', '18030250', '品管课', 'scrypt:32768:8:1$RymMbWh77gmTjI3a$b76fb0b4c23251e728ddda536516c051f029a5342568168caf02803df28378f29a930a4ed68df8134c73c84af97e668fb4df4f1f2fa62310e9f82fe969e11dbf', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18030465', '18030465@example.com', '刘风昌', '18030465', '生产一部', 'scrypt:32768:8:1$Bxjpvelw6VmYPKYs$1882986c97ffafafc311b9ba62d2df1abc7c0a1d4bf2bdcce761351c1504db44931beada41a93cc75ba2b3d58689cd9b9fe958f5ec96f75a9d2d088dfa89cb63', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18030534', '18030534@example.com', '王味', '18030534', '品管课', 'scrypt:32768:8:1$ItenoiUwRXd48i5e$9f78cd6617998583bc32ae35737d09d701ab6636731f6d2c0387672d9d60d9de27f8304c3913a3d36b560548e224b6fda2d5283ba20b4dd0db71167a64beeeab', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18040074', '18040074@example.com', '刘健谊', '18040074', '资讯组', 'scrypt:32768:8:1$cRqrhlHT7NKeqpFC$1f238422949815997507f395fddcea561f8888d309aa290755a833f70c354565a1f516a82f12753c6060a469f2c27fcd7550c073bfc34b5822a78b217b1f6eb5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18040126', '18040126@example.com', '宋亚茹', '18040126', '品管课', 'scrypt:32768:8:1$3TGS8G0KtEPu05S4$9d3dce3cb95f6971139e55adaeb76a5b928ff7859c7fa8bcc70be3f2fac041de39eac06c8c85a21fc3df9e07cc0517d4ef3d718ed88b81ed52c03c49511b4663', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18040139', '18040139@example.com', '王淑静', '18040139', '生三粉体涂装', 'scrypt:32768:8:1$d8z4dooOHQzSKTRu$f949f952088d6f7b9f69edd479570eacae26e5080713cb590fb2fd87e52716b61977a4b5a823378360df27166f4a35391407b180b0ab0ead123d88e5c357f0d4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18040166', '18040166@example.com', '庄娜', '18040166', '供应链部', 'scrypt:32768:8:1$JugoEv05UN2hlVrR$16379a7e6261383c6d3904711b2c96dab7d5ddbc24fc09f1b80c05e4ec0776f79c15664ff1798b287f99e7a6a972e68d1b873040d218ed5f9906b0372d94dfeb', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18050003', '18050003@example.com', '武少勃', '18050003', '品管课', 'scrypt:32768:8:1$ffz6JXOKRQU3C8dZ$b5432171e37513307937cf8dc66d8dc3c46ca4a0c38a1e095c3adac51cc286af7f96fa9655211262849818636a9424c43b7a1228c8e29c75d0df174c657193b3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18050051', '18050051@example.com', '曾智刚', '18050051', '液冷组装', 'scrypt:32768:8:1$gnTPUE4JZxBC7FWp$320be10800b619bf6c7da65ee3a5dde6befb2231f16638d812a0b9e028845e30bb581c47217706a85a2583a71633dc7aa5facb89bd1be3abfece107302037028', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18050094', '18050094@example.com', '周丹', '18050094', '生二包装C车间', 'scrypt:32768:8:1$zDdVQFq567R7uEKD$094745d9252b42f46c163aeabf87fd34a5f3148ab0c3b38bf810e329f464be8f4de0a53c3882557b0d8713a2019c1085ff7a25ed786bd99920a4d0947e470615', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18050141', '18050141@example.com', '吴云飞', '18050141', '总务课', 'scrypt:32768:8:1$aXUP518BYnq6zluK$90a7e382528fe10d51936cb5af30ce9671528cfe202f003c62797c4a9ab5a8f9df4b95e9452d3dbabbd2b3d32390f23e4366ecb71f247707be534c4cd9ddb55a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18060150', '18060150@example.com', '路晓阁', '18060150', '品管课', 'scrypt:32768:8:1$2hpp1nBLYgCGmR8P$22d6717664c45956ea49f438d7e3bea2527a240e3e28913f53af023718e20c732db85f4209c5eecfc19b7400a4db6a28ab730106b42734c910719ae12a3ce8a9', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18060336', '18060336@example.com', '周何源', '18060336', '资讯组', 'scrypt:32768:8:1$dtxn5sVLNKvDw1pH$196e8b4ded244990b3ddb99ecf6891d8319ff6ffd90fc09a12439036f4106dabeec9740ad3fa0651caecf32248e619e7484a96d55a1a26b04e7d19b67ea1da3d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18070120', '18070120@example.com', '齐丽娜', '18070120', 'PE课', 'scrypt:32768:8:1$n6zanWkmdXdLE6eK$52ddd2a9b07faa8827192d483b30485b32e69689bc56c1ba7b2a00fb604f6b8b8ea341e44f3e4c4519cb101a540b500108e744049906afad23806ef230dec9ca', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18070258', '18070258@example.com', '马利波', '18070258', 'NCT工程课', 'scrypt:32768:8:1$4po19E62n2f3PAbc$7fa9ce12d455ec6a1c59a9546706546f741d2143edfd9cc5e177d6b1f7dc5ba11602ae3e2ae7847d6bfa028b0f7f6a69b9c89f012906424545820763721de6b8', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18070259', '18070259@example.com', '姚俊亚', '18070259', 'PE课', 'scrypt:32768:8:1$AR3M5anCNzX6KNQU$72c73082b45d402ef8bb3db77ed0d20a13a2c2b372a7c71fadf7605ca780179d16a084e894f9775884f4165ed7ba269384fdc586e326c60e01cc579114f88723', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18080021', '18080021@example.com', '孙光江', '18080021', '仓储课', 'scrypt:32768:8:1$hDNNQZCtOGU19O4f$0f0b006e39a5d2d9b5f7631570c8ac64824a5a4063b49630093dae25c5a90144b4932b5d5b1c62b982ac95115d9b39cd3284551de1f5b23983c4b3c4a083bb4d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18080074', '18080074@example.com', '侯景宇', '18080074', 'NCT工程课', 'scrypt:32768:8:1$Rl89gVUu2tMRo9Pb$e7c7ba28f8bb7244b295b6d28b1e4cb177fcfaebda2df1f46fe2f4466dc6d17de5c847ebf86fc422b3d14f7907d97b581ce476dea107e2e18f47e7ed9a81aa7a', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18080190', '18080190@example.com', '朱利勤', '18080190', '业二课', 'scrypt:32768:8:1$zag59UU8SeqvJ2l7$6da7be8f9e5114fbd8d2ed7254327d146b1695030a64e1fd1cd202d9e76251813e5fa1b6a46227fa7977123c7da2d3b3c27c6dff25c80a112aa52058797e4e39', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18080242', '18080242@example.com', '周坤元', '18080242', '人事课', 'scrypt:32768:8:1$rtsc84G0qloIOBAM$73487c72eda24aacab7cf6d91126c628b8785b39b71190f2f44ad5d0199890c2dbcb81cb60d8266860791230f7553edc696996557ed6946e17faf35bb7f6dad0', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18080446', '18080446@example.com', '孙凤侠', '18080446', '生一组装B车间', 'scrypt:32768:8:1$lW3co8hqkXCWwGAl$dbd18bf6468069ba570a56bebd0635eff515abd0f309d138ef2704efdcbb917fef7a29be8ac0a7d4ac69b600be4a102473f32a8c576a825822de26c57a7dac22', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18100051', '18100051@example.com', '黄德文', '18100051', '生三成型', 'scrypt:32768:8:1$UHPLYbk7bVCelZYw$af18fdcdf49652a2506eec1e5a69947be3e5bf85d365f5eacc8d32a47bab03b01eb9df9804613d36daf5f48f0d28f9d2266f0ad5e0416fb51cf846805aff2b27', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18100114', '18100114@example.com', '耿美华', '18100114', '生一冲压A车间', 'scrypt:32768:8:1$mMCCcIcANTwpYJuA$18b1b6d64bc5e48a96c46cfa3a35583d037e8cf6c39c713d10d3cb9cf34d8b54f5c5c68e015311d8f6ea96ae81a0e17b23535b912734b411bf7c6a7539e5e39f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18100413', '18100413@example.com', '艾勋勤', '18100413', '生二折弯', 'scrypt:32768:8:1$WotlEZ7HbIOkMDYj$3750b38bc3cea505e9f5b567b44d39834e51aac1b99f0e97ac10a304ed66679da80ba60ecd47b168b11ad76b88960f41653869aa49594b43081f31ff6e9e4b83', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18110127', '18110127@example.com', '骆建晖', '18110127', '生管课', 'scrypt:32768:8:1$9HrKYIZoGS7h1agy$8f1e460bedf1df8f6f8d43468c2b327445752c960a71fd65ae9b5769bdb354a71c46bfb0fb65a24b78d2293154ac292461dd9180d51a780380754dca711b79fd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18110253', '18110253@example.com', '肖文龙', '18110253', '品管课', 'scrypt:32768:8:1$iBvthzXccYGzuoet$299fc2bcadf5450585f500003ed75e3eba78578e96923445183c6fca32985c6d32ef7d5a44ec85dd79ff37963499107cb6c211641933a56f9fa53ed69dfb7453', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('18110284', '18110284@example.com', '张弟', '18110284', '生一组装A车间', 'scrypt:32768:8:1$Ka0uuDSmyJ29TgcP$2b5f2510962e4c01fe703e1cda06a1d83a3defdd401c5184b27c9c7fb42fe00b25a804f8d0c7cda863b6d76f90d4e0cf3274ef552cd79732376544793f238435', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19020074', '19020074@example.com', '张照伟', '19020074', '生二包装C车间', 'scrypt:32768:8:1$etXhK8NxZ8Pevem9$69ab32ac5d1d450312ed8a7fe6bb153eac30cdcd846cfc387145f4e8cb08c8cd0f69dff561220a3aecce8d39ce281ea3a4b44ed0f58354740848e99d9d087fd0', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19020075', '19020075@example.com', '张军燕', '19020075', '生二包装C车间', 'scrypt:32768:8:1$AZa1xmGdH7ngIP8T$5eb39ae17036d092966400cb783a616f5f714e6833002c6f1aea15d41ed359212b3eda2e8b2e4e0367bf58ee73907bb9a2f3a20ba81bcf982f60d36307a2ad52', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19020192', '19020192@example.com', '徐永风', '19020192', '生二折弯', 'scrypt:32768:8:1$xRPFQYGTw2IghEYD$9494f500753586ea3da5ff4d4085d01846e993fc1bf0ec36644bd57ff8b7352c28efc7c2cdff6cf1ba689fc110f6ba7d9588d9aef37846780542661037879e2d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19020354', '19020354@example.com', '郑忠英', '19020354', '品保课', 'scrypt:32768:8:1$av9p8mOSmm7e5EdL$4ff69a2d710070b947e57f1133ff705972b5251b4b8b160b317a785850880dc265488448de4c1a956fb1a2a1c8a86952bb1c732d9e160ae8404eeb2a27f59699', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19030077', '19030077@example.com', '贾亚东', '19030077', '生产二部', 'scrypt:32768:8:1$WUAFBioSABPZvsxk$91d6ec8bb3096c9c65980085e773ecef42216980d0389b9264ca734f134f0a732c00473012eb8f497120937b5881ebde79e015682face9a169268951dde266a5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19030079', '19030079@example.com', '费锦龙', '19030079', 'NCT工程课', 'scrypt:32768:8:1$rjjWAVcF1Qb3JFaB$00ad3aee8eae5f099e025fcb58d4e7ca93bd19efe76df9b4397a85a6c8aebea98cf8484151f1d9dfb668dd0c1f63b84a9044ac02f55e9a81e4ba7618dc3838c5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19030089', '19030089@example.com', '沈梅芬', '19030089', '业一课', 'scrypt:32768:8:1$D9Bvqp2He6hzbZFs$d1edec78ba57c8a82703e97933262962f6ebee2d79c481d9b616fef8021087d35b2d744a031438aa9cea4e0361befd532fdbf61b03ce14b651defe833bb02804', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19030099', '19030099@example.com', '张志华', '19030099', '生二折弯', 'scrypt:32768:8:1$Iucs5V9uGILirqPv$b18162c10d89a869d3209581a681577ed2886450d78af624b3ccb1cbeb1330a522ceb92c12e13111bd698ae02e1eec1ccf0a1bea1467bf3a1dd8c158217d477c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19030100', '19030100@example.com', '张占立', '19030100', '生二折弯', 'scrypt:32768:8:1$XNlh1SMLPXE4W57a$310e2005b6ec6de22c5cdd63bfb0eee3c072821fad8bf1750626437375899de65ad9b008b9f5d9b0558a3f8a79da413e416d1b0958f14f9036ca8dd4f06296ad', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19030105', '19030105@example.com', '黄沙沙', '19030105', 'PE课', 'scrypt:32768:8:1$nM8gfLq8FCVS8bYc$00a354b4075d0da0f83e210f4017de67861d147fa2369c28dcb0130fd449e2ce9aa749eb3776d4c3c23f58fe86b37ba424a616f31c276845f091f9d5b87f3093', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19050186', '19050186@example.com', '潘荣付', '19050186', '生二焊接', 'scrypt:32768:8:1$AnBLLuQczJbkrA9t$2012eb17af586d359aa5dda5bc959fcb3fad73f2c4db121999be1a8dda6327791079adcaed57ef711dfd0ed0b8a71d74ec993a3b2ce7b139d84e533a0c3edd3c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19060111', '19060111@example.com', '李琳', '19060111', '总账课', 'scrypt:32768:8:1$Ps23XplI3DGloODn$a6aca3f4ace8129f8bd72a116a421529d9c4d92df31b23920445ff33cb01d7e18287fb888b04ea0502f9b7c4864018cc6d1ba82ab319e8ac3500ca416df629e6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19060124', '19060124@example.com', '王瑞超', '19060124', '品管课', 'scrypt:32768:8:1$14VKkzrWVOinHVUC$a401b01b1fa048827411a781cf2e2e1b059bc670901f90e0a306d7cf3702b343b396b23a40b9f9a815c8a1fdce3f9c596f4a80c730320d9defbca1203d420489', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19060126', '19060126@example.com', '曾露', '19060126', '品管课', 'scrypt:32768:8:1$KQ1OQpwQgFgy0fnH$f0f76539c923272e03f269bde70050d4227bc312023ce6ae2b99650a0c2270dfcd23169b3849bfc7585ceb84b84a0c6667b0f35f8dc8851984362c6ceed2bc91', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19060127', '19060127@example.com', '王扩', '19060127', '品管课', 'scrypt:32768:8:1$PIkF2XuyI9tufHJ5$5253b28612c1369ecb709df53b4de94a97ed53c2a597deca66caf2edfa7647ff2baf784567dbcb88ed07864b6a897ad116784b2f7adaa0fd2bc24e9faf3abab5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19070131', '19070131@example.com', '龚平', '19070131', 'IE工程课', 'scrypt:32768:8:1$HiZ9gsgkt2vU81O6$ade06111c68f83f4cffee4695eec783607b5bc3ede817cea407d33a41f25e9a913fe04a9f5e6533cb2782713268ea59f8549fcc2d7bbe8d13dbe93fdcd881741', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19070195', '19070195@example.com', '赵生俊', '19070195', '生二焊接', 'scrypt:32768:8:1$tHCGgdbaK9uy4eN0$358ea116a5429400ffee5b998a86302e9faeab49d1a753ceb062e031513e3eb21eddee3db256fa38de67c25edce1e7efc44d48a1fe3db6ba15c51221a3ebd0e4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080001', '19080001@example.com', '王越', '19080001', '业一课', 'scrypt:32768:8:1$FoJ35gGZ5zKV4BYT$8d07f4d31381c95e04c19ed68804ddf0a5f6df74d5ac01fb52bd6b2de31f53aad44ee2704bf2510a284060b24aeb210e8f5790ac46bbbf5e04282f0cadb317b6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080002', '19080002@example.com', '建华货运1', '19080002', '仓储课', 'scrypt:32768:8:1$rMkrQo87CBYDMR5B$4008c6c3702f78e8d8178639f23812d96eaf284d324ec4ab90805d5a66d9c24520d222b3aa81b57e7ca7a8c07bb82975d9015ff2a9674da1d1ae7edc18d1c5b4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080003', '19080003@example.com', '建华货运2', '19080003', '仓储课', 'scrypt:32768:8:1$v58yNVtSEODw4TTh$cc0a055da49100e2093d8efd79fdbdc5818ab9c155b3368ecb82433a56a1ccc1c6cd1d7d4b719dc1caa6923f1cf7683d8c7bc2dcaad8966ad44826f6dfb58a21', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080004', '19080004@example.com', '建华货运3', '19080004', '仓储课', 'scrypt:32768:8:1$V4kZeK14njXxJKKl$c4a6334a358c7e148c83cf7156a6354a0a47232fb8ad9107b36e11de6975f5b6177d7a484ebc25a285a7fe5f0b5be976fdc9bccc2fac83f78ee3ca42a65e84b4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080005', '19080005@example.com', '建华货运4', '19080005', '仓储课', 'scrypt:32768:8:1$g8daaKGbfqoKfhXQ$152a89210d89a777806b33517b3799c6af61f6cd58cff1d1357e1213c0853188d3b10365c3fd994158e0e5ef3fe56286d7ebc756780513e82847bbf63531ada2', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080008', '19080008@example.com', '申佩荣', '19080008', '仓储课', 'scrypt:32768:8:1$ZPLVyiaBT7f25ohw$9efa6a941ab2f9119ea7b12caead23cd71b186eebb1953a92330df50dcb7aecf8ed93efa78072fd52f53269ec8e271712299231fe1df806988e53a9b3353da12', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080009', '19080009@example.com', '谷二保', '19080009', '仓储课', 'scrypt:32768:8:1$ej30FVs6nScjWEO8$f099446f4c0d46a9d9a1f369dd85a6a2323c4ceeafab9b4eaadda4967973cfe32b639f7940c686fc14a21504b04094774acad18cd75733664e121627679b6844', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080010', '19080010@example.com', '古冬冬', '19080010', '仓储课', 'scrypt:32768:8:1$hJvdz9iHsKqX0jkb$fd537892a19db77bdfda686dd07a75ff82bcd54902dec389bce4041e1a790d8e2d5aac15b8cbca35d052a5cf13f85fe324d345a8ba91784aa3440aba6e3c3087', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080012', '19080012@example.com', '赵帆', '19080012', '仓储课', 'scrypt:32768:8:1$k4hywnA4RX7GkoYg$9bb1bccc4a0934e51ffba9d78f21dac550c2c7759e482e1899b51df48b67f1561321b36f391a7acbbc53a30fc28de58328e37e995a4fb662e7f70d063cec8372', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19080013', '19080013@example.com', '陆建华', '19080013', '仓储课', 'scrypt:32768:8:1$Phc1gnILcyLa9oQJ$234227d58427ca1804171e6f18ed8c851e4d52dd906d876d545fd4090360b104f2d9a731c7b2ef8931650eb0af8c9fa14402621f96830de08df3dbd2d24c1c85', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19090011', '19090011@example.com', '祝德', '19090011', '品保部', 'scrypt:32768:8:1$zAlI2kWnH921T1dc$cb9c7abda89be1e1a3c583c4dc29eeeeed9d0d6a81786de3ba5614250c9e38f70c52cecc50cbe5fc4e95232c8ec96dbd27f7e895977b8abe53b3f4d64bf48eee', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19110076', '19110076@example.com', '雷伟鸿', '19110076', '制模组', 'scrypt:32768:8:1$XF6htxdSAznOTbA7$c072c3f69ce32c8f97a8c3698ddbf2ae4b2988bb5e9cc8e5c0e7d1d98c7efa84c9df4d134810fb6c574e7f81a3589ed7950f3a9291f9f4555f4f366fe96e1ccf', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('19120014', '19120014@example.com', '史俊兰', '19120014', 'NCT工程课', 'scrypt:32768:8:1$YKb9EBoNcmxeJKXw$0cdfbe1f552ed8ed8397a632942c68497d547849795522e2c53def52c2fe6805d5c1afdd4be94059078e2ba657efbbcda884bda2504d57b83f22453c02761fd7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20010069', '20010069@example.com', '张国香', '20010069', '生一组装B车间', 'scrypt:32768:8:1$QLm3m77ePtWDmdN5$0ae648e8e7ee6dfd8bb21d72763706efe7332447de9c8eb13a8060731202f3ae0ae67d07505f2c63f94de85103038aa6211e05bcf3356f3d225ca6313f2239e4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20010071', '20010071@example.com', '史磊', '20010071', '生一冲压B车间', 'scrypt:32768:8:1$d8YfufqAwaTB3Dlw$d2e650340023e7adc9fb09c7cd31bd3bdafae91d8e594193413f9d3b9888195c829edc8a3a3effd568f3622ba57f8a1b6975c2e314108f8085dcf25da60442f4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20020002', '20020002@example.com', '王宫超', '20020002', '仓储课', 'scrypt:32768:8:1$erFHWQK4p8Ipof6z$23ccbfe261b99033088c54170d6523700660e8c97fdba1db94209567aefea03881e5315923f17662ee5350615a56aac1ae14c8e3e214a9b196edd3b1c902fb86', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20020210', '20020210@example.com', '宋园园', '20020210', '生一组装B车间', 'scrypt:32768:8:1$nGjjU7cRtBKSOXrp$c3f353aafb8929ebae916eaa915ad6d6532e1ee9b26e24c343cc31f79373b304884702fc2bb020649e2bc52a9973ccff80dd2ca4f8ebbec8be8f54dfa51dd8f3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20030063', '20030063@example.com', '姜凌波', '20030063', '生产一部', 'scrypt:32768:8:1$VlXDJYz0lXeAhT2m$78a0ed95c1a53bacecc9b62a883e6a90f87697fed9d4b95267892baade72e09b710d6a914ac788f512a9adb0831e20ae947770c8bff7b289cdfe4c66c36cd163', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20030065', '20030065@example.com', '宋倩云', '20030065', '生一加工', 'scrypt:32768:8:1$V0nZVl75tIenLlnX$8b169f7b3b08473c854c7520d4fd2586c7aa521b993c45b39fb3f2b9d02b098525c04c898999fa1832c12ce3bce475d51883cc6b36aa34411d6b5707e150c8c7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20030169', '20030169@example.com', '邢振国', '20030169', '仓储课', 'scrypt:32768:8:1$QNu3NTQfxPF6yBJg$0190bae69a407fa2da866e8a37b7d0221792b1658114dad4539fe5bdbda2324645a30b9283b5c3373e52d81e52eb9ed9e624d07c1d88c818ea141e5e2482f026', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20040109', '20040109@example.com', '丁艳玲', '20040109', '生一组装B车间', 'scrypt:32768:8:1$oCGB453RVXL2iejh$f7d8e617f91febb286c5b06b3c74636bc006f3a9f6dc0b4f00641c9cff7f00d2fa717718beeaa99ca98a7577d2f11de661ef8a8cdecf308bfd967bcc4ca09f9c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20050287', '20050287@example.com', '周军涛', '20050287', '生二包装C车间', 'scrypt:32768:8:1$hJvZ38LDB4Kn2Oge$6701f5cab170e0412518281d89676beea06d6c0930d1da03a92a456a47eeb62d413e40acc10504a3e390e6b83715d18129ae935d9bebe70aa78128a198d256b3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20070077', '20070077@example.com', '常冰冰', '20070077', '生一冲压A车间', 'scrypt:32768:8:1$rDnqWyZvIN4sHFfJ$19edd07d99d65cd3ffcccea5ef3ad57508e0663b75ae3a0046de25facc766ce59c1c258d3c36397f098f767237cdb9511e226bdcc869d0516a079226653fc16d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20090013', '20090013@example.com', '李丽霞', '20090013', '生一组装B车间', 'scrypt:32768:8:1$CQFhaGyT1pE4r3dt$6610951bad33505b0be5b10a39ec357e6c6fc10f9f7718b10f1e304744bf51d9140da1bc7754b9e03cc319dc5c6cd002772bfd972c589de1ebb2a10739bc61ad', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20090024', '20090024@example.com', '张小娟', '20090024', '总务课', 'scrypt:32768:8:1$gxDwGDP4kc9OVO3x$bb0fc6d7725989dd1705114748397c565a09d7241d9278cecb75495d1d9faa063af82c4eb3f93e47ea65e3cc6907649c303900a939c805d76ace7eaf25dfa01e', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20090033', '20090033@example.com', '徐稻香', '20090033', '总务课', 'scrypt:32768:8:1$cobgZxmMLaWRxa6G$dd1f7084997ce9a974e74f717f53ed5362118f5a5e904d3cb59ec66ebcb96ba2a0930b870ee3c67e0d67d91430a254df97de9fc5aba6bd4034f5b8b09cf8e0bb', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20090040', '20090040@example.com', '张健', '20090040', '制模组', 'scrypt:32768:8:1$XacedfnQuNbAJeTZ$623080b99346ed235801ecb4ce542278fe004faff3aada85ed1e3968b3720fd70f280107afc25eac787052cd6872dfebd878541b76e3248aed982e03569e31b6', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20100080', '20100080@example.com', '徐兰娣', '20100080', '生一组装B车间', 'scrypt:32768:8:1$J1Q9FmpunZ6V5bV8$6651f2eaf415e88c7b61cc9301c432f7aa36bbdd549059b9833a5d26e8e9ecd161e5b411627120a51bbd13cae00d462281b4d3835e1cb17af6a42f8ea6a5505b', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20100223', '20100223@example.com', 'Kittiyaporn Ar-sa', '20100223', '财务部', 'scrypt:32768:8:1$F52HCXe0N32jrMdu$3d69598b4120f6624488fcc93746f985159212374c140eaffac9fb97c495d6d2ed397996966ea7186fb412d899560eb3620201f971520a4a0a398d51691bb311', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20120023', '20120023@example.com', '包杰', '20120023', '生二焊接', 'scrypt:32768:8:1$WgkWxK8HOsdWQSqm$4af5932078806c43777222e4705556c932a87d95b61af5eb3d5c4b760ea7ac12266dc3ca4f57a66273b0e35e48ececcf8a155989d1fd5d8844812b792364f620', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20120026', '20120026@example.com', '秦素娟', '20120026', '品保课', 'scrypt:32768:8:1$oPvqT2dRCCfaV4hH$fcaed888c61190e42c41214b2aec22bf82387b8fb340c71054e745f4a155ec3d5207beac8d30609be09defeb27cfc60ac8175516966c0cfd3555d1a7c07b9815', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('20120032', '20120032@example.com', '岳亮亮', '20120032', '生一冲压A车间', 'scrypt:32768:8:1$JLdPFFvEdtCjbPCf$76da14fea52d3f039f6c2af04eba6be1a8584cc97231eff3f9293ba249a1c7134ee52c964c5967fc2389b6c0061c91339519f68101609104b430f8b62adc1182', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21010029', '21010029@example.com', '郭守红', '21010029', '生三粉体涂装', 'scrypt:32768:8:1$ALXE1rIEwmru2MCh$12b436c8077fe6effc40ac4b86442105fbddac9ed69944219a5064a16ed016c3618d9976eccd6736441b2e775ede4d58954bb4b3da90c2e985e12d178b0e60f3', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21020011', '21020011@example.com', '苌佩文', '21020011', '品保课', 'scrypt:32768:8:1$mbH1r7OaeS4Dr0so$9adfb5eceec4fd0c5ec8a52c929fc70176ec85f2f20e5cee712b913591b0941bc453f139b7c891ec4176ba3064f32445fa1f25a7e86621f2ee0a0caa8a16ed43', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21020041', '21020041@example.com', '龚卫平', '21020041', '生三粉体涂装', 'scrypt:32768:8:1$ADMJVkHlpyXlOChh$e1c006e76386c4b9170465b8714614fc6d762952ced42d8c20c244a4e81410d78f7b02300277706c9492198cce3ba183c1a15ef4d15d523557fb997c4c0bac9d', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21020065', '21020065@example.com', '陈福喜', '21020065', '生一冲压B车间', 'scrypt:32768:8:1$U0LdZ9NDAuOT4xRy$05e576606150eaad4757b6ee9ecba1f052c76c4427e466ffbfbe1f11e79b2b473b040921e4aaa3a69a082f1176ec8701bcf04425093d25b8b46b0eacd65529d7', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21030001', '21030001@example.com', '雷锐', '21030001', '自动化组', 'scrypt:32768:8:1$Pv1komXtngefo2z5$2da4eff70a928602ee1a2b82895d622240d53ba6108102f9fcc8cdb76b1b1ace6892fcaf6508ef688bab34030dea2990f189aa90a73c07d9d1ed4eefd01fe987', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21030097', '21030097@example.com', '宁江勃', '21030097', '生二包装C车间', 'scrypt:32768:8:1$XMQxOhIJCD5L4jYk$f39232d71f83d9d898828221309fef9df6cac0d7ad7c3a042ad4042c67b0f88d4fc810961de4710db304bff98d03d77293d6144c6699b9f0ad050c764b892db5', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21030117', '21030117@example.com', '李建', '21030117', '品管课', 'scrypt:32768:8:1$2juF4EAPgErvepYx$2ed05f970d3c4f497a427f69eb1e220dc0c19eccb5bcc486a558233aeeaeb995c8b2da08c7c5eaf16442a38c23cb8efdbc8655b7901c63ca93a85110ddc6a7dd', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21030157', '21030157@example.com', '蔡静', '21030157', '生管课', 'scrypt:32768:8:1$ANgwYXzJdI9fpMLQ$07214deefc1ad3fdbdfeb47a20adbe8cf866f9172c8e50f59d8f0519c553ea1a2568a4191dcba9f8ee925c9e69005230736e87f8bf678e81c8732c7a34d0f94c', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21030159', '21030159@example.com', '包久伦', '21030159', '总务课', 'scrypt:32768:8:1$6nbRXq5JjI6Q57ru$be5c61ece1f2cea6b602f94040b95d5ed8fd3fc5de11a8a599417a6d31ada90f387fe017d3fe41af7f22b23e7732ec66cbd07d37861a4d3c60ecff7bd3c0b9b4', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21030255', '21030255@example.com', '朱南南', '21030255', '生一组装B车间', 'scrypt:32768:8:1$L0mzNTENGMpafwnj$6d8dea0d2439b1cd7656659fb1d3264d9fa4d5481175a0caaabae2cbc9254031d747f6ad62abd116703d12d7b25b5d37bfbd2d61212c269e996246073ada5a6f', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21040291', '21040291@example.com', '姜亚楠', '21040291', '品保部', 'scrypt:32768:8:1$ekd7XwbZBdRBwE5V$28c41dec8401257438b8ce70e97c5ddce193057c91f1a4107e91328bb5e0bc1f23b8a7db14d13d6f6887dea74a41077706036a477ecf242e3a5f3962a512ab23', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21050012', '21050012@example.com', '王超奎', '21050012', '仓储课', 'scrypt:32768:8:1$qEMyXjUyDiZe2qZS$93fd59ac73cedc6b7d5b89a4ddeae8da2ce606a273a81603b5f6855d1debe5e5a1e49f948520f752e4dca4085c673558ce9366dd13be872325f384aae0e83a02', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21050067', '21050067@example.com', '雷晓旭', '21050067', '维修B组', 'scrypt:32768:8:1$sVb2LXT2JIZdoE7A$8b2345e4812aef60abaecc2be38e9febf2efd8778ddb46c307c1722b2a96fc2b1784b906ab5129bd9c3dd801ddb32244dcbd24f00782554cf1a15651de903204', 'user', 'active', 'zh-CN');
INSERT INTO users (username, email, real_name, employee_id, department, password_hash, role, status, language)
VALUES ('21060015', '21060015@example.com', '王晨艳', '21060015', '人事课', 'scrypt:32768:8:1$RCF9e2brE0yFYrah$122e7effaf80023ed226d629696b9d94c47c3aa3ee61357c1459b98b97fb7b7291c3ca1b278c3207584554532cc890f7b47547957d1e1315a9a256cf7fd66424', 'user', 'active', 'zh-CN');
COMMIT;
+81 -8
View File
@@ -10,6 +10,9 @@
"dependencies": { "dependencies": {
"@tailwindcss/forms": "^0.5.11", "@tailwindcss/forms": "^0.5.11",
"@tailwindcss/typography": "^0.5.19", "@tailwindcss/typography": "^0.5.19",
"@vue-office/docx": "^1.6.3",
"@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^1.6.5",
"axios": "^1.13.5", "axios": "^1.13.5",
"highlight.js": "^11.11.1", "highlight.js": "^11.11.1",
"lucide-vue-next": "^0.575.0", "lucide-vue-next": "^0.575.0",
@@ -556,7 +559,6 @@
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==", "integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"undici-types": "~7.16.0" "undici-types": "~7.16.0"
} }
@@ -607,6 +609,57 @@
"vscode-uri": "^3.0.8" "vscode-uri": "^3.0.8"
} }
}, },
"node_modules/@vue-office/docx": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/@vue-office/docx/-/docx-1.6.3.tgz",
"integrity": "sha512-Cs+3CAaRBOWOiW4XAhTwwxJ0dy8cPIf6DqfNvYcD3YACiLwO4kuawLF2IAXxyijhbuOeoFsfvoVbOc16A/4bZA==",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
"@vue/composition-api": "^1.7.1",
"vue": "^2.0.0 || >=3.0.0",
"vue-demi": "^0.14.6"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vue-office/excel": {
"version": "1.7.14",
"resolved": "https://registry.npmjs.org/@vue-office/excel/-/excel-1.7.14.tgz",
"integrity": "sha512-pVUgt+emDQUnW7q22CfnQ+jl43mM/7IFwYzOg7lwOwPEbiVB4K4qEQf+y/bc4xGXz75w1/e3Kz3G6wAafmFBFg==",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
"@vue/composition-api": "^1.7.1",
"vue": "^2.0.0 || >=3.0.0",
"vue-demi": "^0.14.6"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vue-office/pdf": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@vue-office/pdf/-/pdf-1.6.5.tgz",
"integrity": "sha512-3BePzeA5wji2JoZGJhdlc3XEXs6gMcSnBXrBXlGGfhZHjNijxcHa9V5Ibm8dDKoEwPPsfg+kf4TGP9/2GBR8jQ==",
"hasInstallScript": true,
"license": "MIT",
"peerDependencies": {
"@vue/composition-api": "^1.7.1",
"vue": "^2.0.0 || >=3.0.0",
"vue-demi": "^0.14.6"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/@vue/compiler-core": { "node_modules/@vue/compiler-core": {
"version": "3.5.28", "version": "3.5.28",
"resolved": "https://mirrors.tencent.com/npm/@vue/compiler-core/-/compiler-core-3.5.28.tgz", "resolved": "https://mirrors.tencent.com/npm/@vue/compiler-core/-/compiler-core-3.5.28.tgz",
@@ -912,7 +965,6 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.9.0", "baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759", "caniuse-lite": "^1.0.30001759",
@@ -2003,7 +2055,6 @@
"resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz", "resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@@ -2048,7 +2099,6 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"nanoid": "^3.3.11", "nanoid": "^3.3.11",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
@@ -2390,7 +2440,6 @@
"resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz", "resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz",
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==", "integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@alloc/quick-lru": "^5.2.0", "@alloc/quick-lru": "^5.2.0",
"arg": "^5.0.2", "arg": "^5.0.2",
@@ -2492,7 +2541,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"devOptional": true, "devOptional": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"peer": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@@ -2551,7 +2599,6 @@
"integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==", "integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@oxc-project/runtime": "0.114.0", "@oxc-project/runtime": "0.114.0",
"lightningcss": "^1.31.1", "lightningcss": "^1.31.1",
@@ -2637,7 +2684,6 @@
"resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz", "resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz",
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==", "integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.5.28", "@vue/compiler-dom": "3.5.28",
"@vue/compiler-sfc": "3.5.28", "@vue/compiler-sfc": "3.5.28",
@@ -2654,6 +2700,33 @@
} }
} }
}, },
"node_modules/vue-demi": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
"hasInstallScript": true,
"license": "MIT",
"peer": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/vue-i18n": { "node_modules/vue-i18n": {
"version": "11.2.8", "version": "11.2.8",
"resolved": "https://mirrors.tencent.com/npm/vue-i18n/-/vue-i18n-11.2.8.tgz", "resolved": "https://mirrors.tencent.com/npm/vue-i18n/-/vue-i18n-11.2.8.tgz",
+3
View File
@@ -11,6 +11,9 @@
"dependencies": { "dependencies": {
"@tailwindcss/forms": "^0.5.11", "@tailwindcss/forms": "^0.5.11",
"@tailwindcss/typography": "^0.5.19", "@tailwindcss/typography": "^0.5.19",
"@vue-office/docx": "^1.6.3",
"@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^1.6.5",
"axios": "^1.13.5", "axios": "^1.13.5",
"highlight.js": "^11.11.1", "highlight.js": "^11.11.1",
"lucide-vue-next": "^0.575.0", "lucide-vue-next": "^0.575.0",
+354 -23
View File
@@ -1,15 +1,41 @@
<script setup lang="ts"> <script setup lang="ts">
/**
* FilePreviewModal.vue
* 文件用途:文件预览弹窗,用于在聊天页预览来源文件内容
* 引用文件:vue, marked
* 逻辑关系:
* - 接收 ChatView 传入的 file(name/url)与弹窗显隐状态
* - 根据扩展名选择预览模式(markdown/image/iframe)
* - 对 Office 文档在可公网 HTTPS 访问时走 Office 在线预览,否则降级为打开/下载
*/
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { marked } from 'marked'; import { marked } from 'marked';
import VueOfficeDocx from '@vue-office/docx';
import VueOfficeExcel from '@vue-office/excel';
import '@vue-office/docx/lib/index.css';
import '@vue-office/excel/lib/index.css';
interface PreviewFile { interface PreviewFile {
name: string; name: string;
url: string; url: string;
} }
interface ExcelPreviewData {
sheet_name: string;
sheets: string[];
columns: string[];
rows: Array<Array<string | number | boolean>>;
limit: number;
truncated: boolean;
}
type OfficeKind = 'docx' | 'excel' | null;
const props = defineProps<{ const props = defineProps<{
modelValue: boolean; modelValue: boolean;
file: PreviewFile | null; file: PreviewFile | null;
agentId?: number | null;
authHeaders?: Record<string, string>;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
@@ -19,7 +45,16 @@ const emit = defineEmits<{
const isLoading = ref(false); const isLoading = ref(false);
const error = ref(''); const error = ref('');
const markdownHtml = ref(''); const markdownHtml = ref('');
const excelPreview = ref<ExcelPreviewData | null>(null);
const officeSrc = ref<string | ArrayBuffer | Blob>('');
const officeKind = ref<OfficeKind>(null);
const officeObjectUrl = ref<string>('');
/**
* 从 URL 或文件名中提取扩展名。
* - 会先去掉 query 参数(兼容签名链接)。
* - 返回小写扩展名(不含点号)。
*/
const getExt = (raw: string) => { const getExt = (raw: string) => {
const clean = (raw.split('?')[0] ?? '').toLowerCase(); const clean = (raw.split('?')[0] ?? '').toLowerCase();
const i = clean.lastIndexOf('.'); const i = clean.lastIndexOf('.');
@@ -33,52 +68,248 @@ const ext = computed(() => {
return getExt(props.file?.name || ''); return getExt(props.file?.name || '');
}); });
const preferredMode = computed<'markdown' | 'image' | 'iframe'>(() => { const preferredMode = computed<'markdown' | 'image' | 'iframe' | 'sheet' | 'office'>(() => {
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'].includes(ext.value)) return 'image'; if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp'].includes(ext.value)) return 'image';
if (['md', 'markdown', 'txt'].includes(ext.value)) return 'markdown'; if (['md', 'markdown', 'txt', 'csv', 'vtt', 'properties', 'html', 'htm'].includes(ext.value)) return 'markdown';
if (['xlsx'].includes(ext.value)) return 'office';
if (['docx'].includes(ext.value)) return 'office';
return 'iframe'; return 'iframe';
}); });
const resolvedMode = ref<'markdown' | 'image' | 'iframe'>('iframe'); const resolvedMode = ref<'markdown' | 'image' | 'iframe' | 'sheet' | 'office'>('iframe');
const isOfficeDoc = computed(() => ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'].includes(ext.value));
/**
* 判断当前文件是否可使用微软 Office 在线预览。
* 实际条件:
* - 必须是 Office 文档类型;
* - 必须是 HTTPS;
* - 主机必须公网可达(非 localhost/私网网段)。
*/
const canUseOfficeOnlineViewer = computed(() => {
const raw = props.file?.url || '';
if (!raw || !isOfficeDoc.value) return false;
try {
const u = new URL(raw, window.location.origin);
// Office online viewer usually requires a publicly reachable HTTPS URL.
// Private-network or local addresses typically render as blank pages.
if (u.protocol !== 'https:') return false;
const host = u.hostname;
if (
host === 'localhost' ||
host === '127.0.0.1' ||
host === '::1' ||
/^10\./.test(host) ||
/^192\.168\./.test(host) ||
/^172\.(1[6-9]|2\d|3[0-1])\./.test(host)
) {
return false;
}
return true;
} catch {
return false;
}
});
const needsOfficeFallback = computed(
() => ['ppt', 'pptx'].includes(ext.value) && !canUseOfficeOnlineViewer.value
);
const previewRawUrl = computed(() => {
if (!props.file?.url || !props.agentId) return '';
const params = new URLSearchParams({
agent_id: String(props.agentId),
url: props.file.url,
name: props.file.name || '',
});
return `/api/chat/preview-file-raw?${params.toString()}`;
});
/**
* 计算 iframe 预览地址。
* - pdf/doc/docx 优先走后端同源代理地址;
* - Office 文档且满足公网 HTTPS 时,走微软在线预览;
* - 其余返回原始 URL,由浏览器自行处理。
*/
const iframeSrc = computed(() => { const iframeSrc = computed(() => {
if (!props.file?.url) return ''; if (!props.file?.url || !props.agentId) return '';
if (['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'].includes(ext.value)) { if (ext.value === 'pdf') {
return `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(props.file.url)}`; // PDF must use authenticated fetched blob URL; do not fallback to raw URL.
return officeObjectUrl.value;
}
if (isOfficeDoc.value && canUseOfficeOnlineViewer.value) {
return `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(previewRawUrl.value)}`;
}
if (['doc', 'docx'].includes(ext.value)) {
return previewRawUrl.value;
} }
return props.file.url; return props.file.url;
}); });
const close = () => emit('update:modelValue', false); const close = () => emit('update:modelValue', false);
const clearOfficeObjectUrl = () => {
if (officeObjectUrl.value) {
URL.revokeObjectURL(officeObjectUrl.value);
officeObjectUrl.value = '';
}
officeSrc.value = '';
officeKind.value = null;
};
const loadOfficeContent = async () => {
if (!props.file?.url) return;
if (!props.agentId) throw new Error('agent_id is required for office preview');
const params = new URLSearchParams({
agent_id: String(props.agentId),
url: props.file.url,
name: props.file.name || '',
});
const res = await fetch(`/api/chat/preview-file-raw?${params.toString()}`, {
headers: props.authHeaders || {},
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err?.error || `HTTP ${res.status}`);
}
const blob = await res.blob();
clearOfficeObjectUrl();
officeObjectUrl.value = URL.createObjectURL(blob);
officeSrc.value = officeObjectUrl.value;
if (ext.value === 'docx') officeKind.value = 'docx';
else if (ext.value === 'xlsx') officeKind.value = 'excel';
else officeKind.value = null;
};
const loadPdfContent = async () => {
if (!props.file?.url) return;
if (!props.agentId) throw new Error('agent_id is required for pdf preview');
const params = new URLSearchParams({
agent_id: String(props.agentId),
url: props.file.url,
name: props.file.name || '',
});
const res = await fetch(`/api/chat/preview-file-raw?${params.toString()}`, {
headers: props.authHeaders || {},
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err?.error || `HTTP ${res.status}`);
}
const buf = await res.arrayBuffer();
const head = new TextDecoder().decode(buf.slice(0, 5));
if (head !== '%PDF-') {
throw new Error('Invalid PDF binary from preview API');
}
clearOfficeObjectUrl();
const blob = new Blob([buf], { type: 'application/pdf' });
officeObjectUrl.value = URL.createObjectURL(blob);
};
/**
* 在弹窗/文件变化时加载预览内容。
* 流程:
* 1) 重置状态并按扩展名确定优先模式;
* 2) Excel 走后端 /preview-excel 返回表格数据;
* 3) 文本类走后端 /preview-text 返回文本并渲染 Markdown;
* 4) 其他格式交由 iframe 或降级策略处理;
* 5) 失败写入 error,前端展示可读错误信息。
*/
const loadContent = async () => { const loadContent = async () => {
error.value = ''; error.value = '';
markdownHtml.value = ''; markdownHtml.value = '';
excelPreview.value = null;
clearOfficeObjectUrl();
if (!props.modelValue || !props.file) return; if (!props.modelValue || !props.file) return;
if (!props.file?.url) return; if (!props.file?.url) return;
resolvedMode.value = preferredMode.value; resolvedMode.value = preferredMode.value;
if (ext.value === 'pdf') {
isLoading.value = true;
try {
await loadPdfContent();
resolvedMode.value = 'iframe';
} catch (e: any) {
error.value = e?.message || 'Failed to preview pdf';
resolvedMode.value = 'iframe';
} finally {
isLoading.value = false;
}
return;
}
if (preferredMode.value === 'office') {
isLoading.value = true;
try {
await loadOfficeContent();
if (!officeKind.value) {
throw new Error(`Unsupported office preview extension: ${ext.value}`);
}
resolvedMode.value = 'office';
} catch (e: any) {
error.value = e?.message || 'Failed to preview office file';
resolvedMode.value = 'iframe';
} finally {
isLoading.value = false;
}
return;
}
if (preferredMode.value === 'sheet') {
if (!props.agentId) {
error.value = 'agent_id is required for excel preview';
return;
}
isLoading.value = true;
try {
const params = new URLSearchParams({
agent_id: String(props.agentId),
url: props.file.url,
limit: '100',
});
const res = await fetch(`/api/chat/preview-excel?${params.toString()}`, {
headers: props.authHeaders || {},
});
const data = await res.json().catch(() => ({}));
if (!res.ok) {
throw new Error(data?.error || `HTTP ${res.status}`);
}
excelPreview.value = data as ExcelPreviewData;
resolvedMode.value = 'sheet';
} catch (e: any) {
error.value = e?.message || 'Failed to preview excel';
resolvedMode.value = 'iframe';
} finally {
isLoading.value = false;
}
return;
}
if (preferredMode.value !== 'markdown') return; if (preferredMode.value !== 'markdown') return;
isLoading.value = true; isLoading.value = true;
try { try {
const res = await fetch(props.file.url); if (!props.agentId) {
throw new Error('agent_id is required for text preview');
}
const params = new URLSearchParams({
agent_id: String(props.agentId),
url: props.file.url,
});
const res = await fetch(`/api/chat/preview-text?${params.toString()}`, {
headers: props.authHeaders || {},
});
if (!res.ok) { if (!res.ok) {
throw new Error(`HTTP ${res.status}`); const err = await res.json().catch(() => ({}));
throw new Error(err?.error || `HTTP ${res.status}`);
} }
const contentType = (res.headers.get('content-type') || '').toLowerCase(); const payload = await res.json();
if (contentType.startsWith('image/')) { const text = String(payload?.content || '');
resolvedMode.value = 'image';
return;
}
if (
contentType &&
!contentType.includes('text/') &&
!contentType.includes('markdown') &&
!contentType.includes('application/json')
) {
resolvedMode.value = 'iframe';
return;
}
const text = await res.text();
markdownHtml.value = marked.parse(text) as string; markdownHtml.value = marked.parse(text) as string;
} catch (e: any) { } catch (e: any) {
error.value = e?.message || 'Failed to load file'; error.value = e?.message || 'Failed to load file';
@@ -87,6 +318,12 @@ const loadContent = async () => {
} }
}; };
/**
* 响应式重载:
* - 弹窗显隐变化;
* - 文件 URL 变化;
* - 文件名变化。
*/
watch( watch(
() => [props.modelValue, props.file?.url, props.file?.name], () => [props.modelValue, props.file?.url, props.file?.name],
() => { () => {
@@ -94,6 +331,15 @@ watch(
}, },
{ immediate: true } { immediate: true }
); );
watch(
() => props.modelValue,
(v) => {
if (!v) {
clearOfficeObjectUrl();
}
}
);
</script> </script>
<template> <template>
@@ -118,9 +364,94 @@ watch(
class="prose prose-sm max-w-none bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-5" class="prose prose-sm max-w-none bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-5"
v-html="markdownHtml" v-html="markdownHtml"
></div> ></div>
<div
v-else-if="resolvedMode === 'sheet' && excelPreview"
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-4 overflow-auto"
>
<div class="mb-3 text-xs text-slate-500 dark:text-slate-400">
Sheet: {{ excelPreview.sheet_name }} | Rows: {{ excelPreview.rows.length }}
<span v-if="excelPreview.truncated"> (truncated)</span>
</div>
<table class="min-w-full text-xs border-collapse">
<thead>
<tr>
<th
v-for="(col, i) in excelPreview.columns"
:key="`h-${i}`"
class="sticky top-0 bg-slate-100 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 px-2 py-1 text-left font-semibold"
>
{{ col }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, ri) in excelPreview.rows" :key="`r-${ri}`">
<td
v-for="(cell, ci) in row"
:key="`c-${ri}-${ci}`"
class="border border-slate-200 dark:border-slate-700 px-2 py-1 align-top whitespace-pre-wrap break-words"
>
{{ cell }}
</td>
</tr>
</tbody>
</table>
</div>
<div
v-else-if="resolvedMode === 'office' && officeKind"
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-2 overflow-auto"
>
<VueOfficeDocx
v-if="officeKind === 'docx'"
:src="officeSrc"
style="height: 100%; width: 100%;"
/>
<VueOfficeExcel
v-else-if="officeKind === 'excel'"
:src="officeSrc"
style="height: 100%; width: 100%;"
/>
</div>
<div v-else-if="resolvedMode === 'image'" class="h-full flex items-center justify-center bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-2"> <div v-else-if="resolvedMode === 'image'" class="h-full flex items-center justify-center bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-2">
<img :src="file.url" :alt="file.name" class="max-w-full max-h-full object-contain" /> <img :src="file.url" :alt="file.name" class="max-w-full max-h-full object-contain" />
</div> </div>
<div
v-else-if="ext === 'pdf' && officeObjectUrl"
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 overflow-hidden"
>
<embed
:src="officeObjectUrl"
type="application/pdf"
class="w-full h-full min-h-[480px]"
/>
</div>
<div
v-else-if="needsOfficeFallback"
class="h-full rounded-lg border border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-900 p-6"
>
<!-- Graceful fallback for private/non-HTTPS Office links:
show actions instead of an empty iframe. -->
<div class="text-sm text-slate-700 dark:text-slate-200 font-semibold">Preview not available for this file URL</div>
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
This Office file uses a private or non-HTTPS link, so online preview cannot render it.
</div>
<div class="mt-4 flex gap-3">
<a
:href="previewRawUrl || file.url"
target="_blank"
class="px-3 py-2 rounded-lg bg-brand-600 text-white text-sm hover:bg-brand-700"
>
Open in new tab
</a>
<a
:href="previewRawUrl || file.url"
download
class="px-3 py-2 rounded-lg border border-slate-300 dark:border-slate-600 text-sm text-slate-700 dark:text-slate-200 hover:bg-slate-50 dark:hover:bg-slate-800"
>
Download file
</a>
</div>
</div>
<iframe <iframe
v-else v-else
:src="iframeSrc" :src="iframeSrc"
+158 -105
View File
@@ -8,6 +8,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
interface RetrieverResource { interface RetrieverResource {
// 知识库/检索来源的基础字段,具体键可能因后端返回而扩展
dataset_name?: string; dataset_name?: string;
document_name?: string; document_name?: string;
segment_id?: string; segment_id?: string;
@@ -17,12 +18,88 @@ interface RetrieverResource {
} }
interface ChatMessage { interface ChatMessage {
// 对话消息结构:用户/助手文本 + 可选的来源与归因信息
role: 'user' | 'assistant'; role: 'user' | 'assistant';
content: string; content: string;
retriever_resources?: RetrieverResource[]; retriever_resources?: RetrieverResource[];
attribution_parts?: string[]; attribution_parts?: string[];
} }
// 统一资源格式为数组,兼容 list 或 { data: list } 两种结构
const normalizeResources = (resources: any): RetrieverResource[] => {
if (!resources) return [];
if (Array.isArray(resources)) return resources;
if (Array.isArray(resources.data)) return resources.data;
return [];
};
// 将检索来源资源合并到消息中,并按文档名+片段ID+内容做去重
const addRetrieverResources = (msg: ChatMessage, resources: any) => {
const list = normalizeResources(resources);
if (list.length === 0) return;
if (!msg.retriever_resources) msg.retriever_resources = [];
for (const item of list) {
// 使用稳定键进行去重,避免同一条来源在多事件中重复展示
const key = `${item.document_name || ''}|${item.segment_id || ''}|${item.content || ''}`;
const exists = msg.retriever_resources.some(
(r) => `${r.document_name || ''}|${r.segment_id || ''}|${r.content || ''}` === key
);
if (!exists) {
msg.retriever_resources.push(item);
}
}
};
// 归一化并合并归因内容(支持 string/array/object),按文本去重
const addAttributionParts = (msg: ChatMessage, value: any) => {
if (!value) return;
if (!msg.attribution_parts) msg.attribution_parts = [];
// 只收集非空文本,且保证唯一
const pushUnique = (text: string) => {
const v = text.trim();
if (!v) return;
if (!msg.attribution_parts!.includes(v)) {
msg.attribution_parts!.push(v);
}
};
if (typeof value === 'string') {
pushUnique(value);
return;
}
if (Array.isArray(value)) {
for (const item of value) {
if (typeof item === 'string') {
pushUnique(item);
} else if (item && typeof item === 'object') {
pushUnique(item.content || item.text || item.title || JSON.stringify(item));
}
}
return;
}
if (typeof value === 'object') {
pushUnique(value.content || value.text || value.title || JSON.stringify(value));
}
};
// 从事件顶层与 metadata 中提取来源/归因信息并写回当前消息
const applyEventMetadata = (msg: ChatMessage, data: any) => {
const metadata = data?.metadata || {};
addRetrieverResources(msg, data?.retriever_resources);
addRetrieverResources(msg, metadata?.retriever_resources);
addRetrieverResources(msg, metadata?.retrieverResources);
addAttributionParts(msg, data?.annotations);
addAttributionParts(msg, data?.annotation_reply);
addAttributionParts(msg, metadata?.annotations);
addAttributionParts(msg, metadata?.annotation_reply);
addAttributionParts(msg, data?.citation);
addAttributionParts(msg, metadata?.citation);
};
export function useChat() { export function useChat() {
/** /**
* messages: 响应式消息列表,用于 UI 渲染 * messages: 响应式消息列表,用于 UI 渲染
@@ -81,6 +158,11 @@ export function useChat() {
* agentId: 目标 Agent ID * agentId: 目标 Agent ID
*/ */
const sendMessage = async (query: string, agentId: number) => { const sendMessage = async (query: string, agentId: number) => {
console.info('[chat][send] start', {
agentId,
queryLength: query.length,
conversationId: conversationId.value,
});
// 1. 乐观 UI 更新:立即将用户消息推入列表 // 1. 乐观 UI 更新:立即将用户消息推入列表
messages.value.push({ role: 'user', content: query }); messages.value.push({ role: 'user', content: query });
// 创建一个空的 Assistant 消息用于流式追加,并记录其索引 // 创建一个空的 Assistant 消息用于流式追加,并记录其索引
@@ -105,8 +187,15 @@ export function useChat() {
}) })
}); });
console.info('[chat][send] response', {
ok: response.ok,
status: response.status,
contentType: response.headers.get('content-type'),
});
if (!response.ok) { if (!response.ok) {
const err = await response.json().catch(() => ({})); const err = await response.json().catch(() => ({}));
console.error('[chat][send] non-ok response', err);
throw new Error(err.error || `Request failed with status ${response.status}`); throw new Error(err.error || `Request failed with status ${response.status}`);
} }
@@ -116,128 +205,92 @@ export function useChat() {
if (!reader) throw new Error('No reader'); if (!reader) throw new Error('No reader');
// 循环读取流数据 // Loop read SSE stream; use a buffer to avoid dropping partial chunks.
let buffer = '';
while (true) { while (true) {
const { done, value } = await reader.read(); const { done, value } = await reader.read();
if (done) break; if (done) break;
// 解码二进制块为文本 // Decode as stream and normalize CRLF so Windows-style SSE frames are parsed correctly.
const chunk = decoder.decode(value); buffer += decoder.decode(value, { stream: true });
// SSE 数据可能包含多行,按双换行符分割 buffer = buffer.replace(/\r\n/g, '\n');
const lines = chunk.split('\n\n'); const frames = buffer.split('\n\n');
buffer = frames.pop() || '';
for (const line of lines) {
if (line.startsWith('data: ')) { for (const frame of frames) {
try { const dataLines = frame
// 解析 JSON 数据 .split('\n')
const data = JSON.parse(line.slice(6)); .map((l) => l.trim())
// 仅处理 message 事件,追加 answer 到当前消息 .filter((l) => l.startsWith('data:'));
if (data.event === 'message') { if (dataLines.length === 0) continue;
const botMsg = messages.value[botMsgIndex];
if (!botMsg) continue; // SSE allows multiple data lines in one event.
botMsg.content += data.answer; const payload = dataLines
applyEventMetadata(botMsg, data); .map((l) => l.replace(/^data:\s?/, ''))
} else if (data.event === 'message_end') { .join('\n');
// 记录会话 ID,便于后续发送反馈 if (!payload) continue;
if (data.conversation_id) {
conversationId.value = data.conversation_id; try {
} const data = JSON.parse(payload);
const botMsg = messages.value[botMsgIndex]; const botMsg = messages.value[botMsgIndex];
if (!botMsg) continue; if (!botMsg) continue;
applyEventMetadata(botMsg, data); console.debug('[chat][sse] event', {
} else if (data.event === 'agent_message' || data.event === 'workflow_finished') { event: data?.event,
const botMsg = messages.value[botMsgIndex]; answerLength: typeof data?.answer === 'string' ? data.answer.length : 0,
if (!botMsg) continue; hasRetrieverResources: Boolean(data?.retriever_resources || data?.metadata?.retriever_resources),
applyEventMetadata(botMsg, data); conversationId: data?.conversation_id || conversationId.value,
} else if (data.event === 'error') { });
const botMsg = messages.value[botMsgIndex];
if (!botMsg) continue; if (data.event === 'message' || data.event === 'agent_message') {
botMsg.content += `\n[Error: ${data.message}]`; // event: message LLM 返回文本块事件,即:完整的文本以分块的方式输出。
} if (typeof data.answer === 'string' && data.answer.length > 0) {
} catch (e) { // answer: LLM 返回文本块内容
// 忽略 JSON 解析错误 (可能是 keep-alive 或非完整 JSON) botMsg.content += data.answer;
console.debug('[chat][sse] append answer chunk', {
event: data.event,
appended: data.answer.length,
total: botMsg.content.length,
});
}
applyEventMetadata(botMsg, data);
} else if (data.event === 'message_end' || data.event === 'workflow_finished') {
if (data.conversation_id) {
conversationId.value = data.conversation_id;
}
// Some providers may put final answer on message_end/workflow events.
if (typeof data.answer === 'string' && data.answer.length > 0) {
botMsg.content += data.answer;
console.debug('[chat][sse] append final answer', {
event: data.event,
appended: data.answer.length,
total: botMsg.content.length,
});
}
applyEventMetadata(botMsg, data);
} else if (data.event === 'error') {
botMsg.content += `\n[Error: ${data.message}]`;
console.error('[chat][sse] backend error event', data);
} }
} catch (e) {
// Ignore malformed or partial payload fragments.
console.warn('[chat][sse] parse failed', { payloadPreview: payload.slice(0, 200), error: e });
} }
} }
} }
} catch (e: any) { } catch (e: any) {
console.error(e); console.error('[chat][send] failed', e);
const botMsg = messages.value[botMsgIndex]; const botMsg = messages.value[botMsgIndex];
if (botMsg) { if (botMsg) {
botMsg.content += `\n[Error: ${e.message || 'Network Issue'}]`; botMsg.content += `\n[Error: ${e.message || 'Network Issue'}]`;
} }
} finally { } finally {
isThinking.value = false; isThinking.value = false;
console.info('[chat][send] end', {
messages: messages.value.length,
conversationId: conversationId.value,
});
} }
}; };
return { messages, isThinking, conversationId, sendMessage }; return { messages, isThinking, conversationId, sendMessage };
} }
const normalizeResources = (resources: any): RetrieverResource[] => {
if (!resources) return [];
if (Array.isArray(resources)) return resources;
if (Array.isArray(resources.data)) return resources.data;
return [];
};
const addRetrieverResources = (msg: ChatMessage, resources: any) => {
const list = normalizeResources(resources);
if (list.length === 0) return;
if (!msg.retriever_resources) msg.retriever_resources = [];
for (const item of list) {
const key = `${item.document_name || ''}|${item.segment_id || ''}|${item.content || ''}`;
const exists = msg.retriever_resources.some(
(r) => `${r.document_name || ''}|${r.segment_id || ''}|${r.content || ''}` === key
);
if (!exists) {
msg.retriever_resources.push(item);
}
}
};
const addAttributionParts = (msg: ChatMessage, value: any) => {
if (!value) return;
if (!msg.attribution_parts) msg.attribution_parts = [];
const pushUnique = (text: string) => {
const v = text.trim();
if (!v) return;
if (!msg.attribution_parts!.includes(v)) {
msg.attribution_parts!.push(v);
}
};
if (typeof value === 'string') {
pushUnique(value);
return;
}
if (Array.isArray(value)) {
for (const item of value) {
if (typeof item === 'string') {
pushUnique(item);
} else if (item && typeof item === 'object') {
pushUnique(item.content || item.text || item.title || JSON.stringify(item));
}
}
return;
}
if (typeof value === 'object') {
pushUnique(value.content || value.text || value.title || JSON.stringify(value));
}
};
const applyEventMetadata = (msg: ChatMessage, data: any) => {
const metadata = data?.metadata || {};
addRetrieverResources(msg, data?.retriever_resources);
addRetrieverResources(msg, metadata?.retriever_resources);
addRetrieverResources(msg, metadata?.retrieverResources);
addAttributionParts(msg, data?.annotations);
addAttributionParts(msg, data?.annotation_reply);
addAttributionParts(msg, metadata?.annotations);
addAttributionParts(msg, metadata?.annotation_reply);
addAttributionParts(msg, data?.citation);
addAttributionParts(msg, metadata?.citation);
};
+20 -11
View File
@@ -10,6 +10,15 @@ export const config = {
}, },
workspace: { workspace: {
enableFeedback: true, enableFeedback: true,
// 聊天窗口“源文件展示”开关配置
sourceFiles: {
// 是否显示源文件区域(包含上方文件按钮 + 下方“源文档”详情)
showSourceFiles: true,
// 是否显示 MD 源文件(文件名后缀为 .md/.markdown)
showMdFiles: true,
// 当 showMdFiles=true 时,MD 源文件是否默认展开“源文档”详情
expandMdByDefault: false,
},
modules: { modules: {
announcements: true, announcements: true,
favorites: true, favorites: true,
@@ -20,17 +29,17 @@ export const config = {
}, },
admin: { admin: {
modules: { modules: {
dashboard: true, dashboard: true, // 仪表盘
approvals: true, approvals: true, // 用户审批
users: true, users: true, // 用户管理
departments: true, departments: true, // 部门管理
agents: true, agents: true, // 应用管理
announcements: true, announcements: true, // 公告管理
questions: true, questions: true, // 常用问题
wecom: true, wecom: true, // 企业微信
permissions: true, permissions: true, // 应用权限
requests: true, requests: true, // 审批权限
reports: true reports: true, // 数据报表
} }
} }
}; };
+570 -26
View File
@@ -1,4 +1,4 @@
import { createI18n } from 'vue-i18n'; import { createI18n } from 'vue-i18n';
const messages = { const messages = {
@@ -33,8 +33,17 @@ const messages = {
rememberMe: 'Remember me for 30 days', rememberMe: 'Remember me for 30 days',
forgotPasswordDesc: 'Enter your email to reset your password', forgotPasswordDesc: 'Enter your email to reset your password',
findPassword: 'Find Password', findPassword: 'Find Password',
announcements: 'Announcements',
passwordResetEmailSent: '如果账号存在,重置链接已发送到您的邮箱。',
passwordResetRequestFailed: '请求密码重置失败',
wecomLogin: 'Login with WeCom', wecomLogin: 'Login with WeCom',
wecomConnecting: 'Connecting to WeCom...' wecomConnecting: 'Connecting to WeCom...',
wecomStartFailed: 'Failed to start WeCom login',
wecomInvalidState: 'Invalid WeCom login state',
wecomStateExpired: 'WeCom login session expired, please try again.',
wecomBindRequired: 'Current WeCom account is not bound to a local user, please contact admin.',
wecomAccountDisabled: 'Account is disabled, please contact admin.',
wecomLoginFailed: 'WeCom login failed'
}, },
landing: { landing: {
hero: { hero: {
@@ -57,12 +66,16 @@ const messages = {
failed: 'Registration failed', failed: 'Registration failed',
inputError: 'Please enter username and password', inputError: 'Please enter username and password',
requestFailed: 'Request failed', requestFailed: 'Request failed',
emailRequired: 'Email is required',
fields: { fields: {
realName: 'Real Name', realName: 'Real Name',
employeeId: 'Employee ID', employeeId: 'Employee ID',
phone: 'Phone Number' phone: 'Phone Number'
} }
}, },
common: {
errorOccurred: 'An error occurred'
},
workspace: { workspace: {
title: 'AI Workspace', title: 'AI Workspace',
userTitle: '{username}\'s AI Workspace', userTitle: '{username}\'s AI Workspace',
@@ -256,9 +269,13 @@ const messages = {
}, },
fields: { fields: {
name: 'Name', name: 'Name',
namePlaceholder: 'e.g. IT Department',
code: 'Code', code: 'Code',
codePlaceholder: 'e.g. DEPT-001',
company: 'Company', company: 'Company',
description: 'Description' companyPlaceholder: 'e.g. HQ',
description: 'Description',
descriptionPlaceholder: 'Department description...'
}, },
confirmDelete: 'Delete this department?', confirmDelete: 'Delete this department?',
msg: { msg: {
@@ -283,6 +300,7 @@ const messages = {
}, },
fields: { fields: {
name: 'Name', name: 'Name',
namePlaceholder: 'e.g. HR Assistant',
type: 'Integration Type', type: 'Integration Type',
types: { types: {
api: 'API Integration (Dify)', api: 'API Integration (Dify)',
@@ -291,12 +309,30 @@ const messages = {
appId: 'Dify App ID', appId: 'Dify App ID',
apiKey: 'API Key', apiKey: 'API Key',
baseUrl: 'API Base URL (Optional)', baseUrl: 'API Base URL (Optional)',
baseUrlPlaceholder: 'Default: Dify Config',
iframeUrl: 'Iframe URL', iframeUrl: 'Iframe URL',
description: 'Description', description: 'Description',
descPlaceholder: 'Briefly describe what this agent does...' descPlaceholder: 'Briefly describe what this agent does...'
}, },
confirmDelete: 'Are you sure you want to delete this agent?', confirmDelete: 'Are you sure you want to delete this agent?',
manageAccess: 'Manage Access' manageAccess: 'Manage Access',
test: 'Test',
delete: 'Delete Agent',
idLabel: 'ID',
urlLabel: 'URL',
testModalTitle: 'Agent Test',
testModalAgent: 'Agent',
testedAt: 'Test Time',
testing: 'Testing...',
retest: 'Retest',
testingInProgress: 'Running test, please wait...',
requestUrl: 'Request URL',
outputInfo: 'Output Information',
analysis: 'Final Analysis',
testDone: 'Test completed.',
testFailed: 'Test failed.',
testFailedRequestException: 'Test failed: request exception occurred.',
networkError: 'Network error'
}, },
// Common Questions // Common Questions
@@ -314,6 +350,7 @@ const messages = {
}, },
fields: { fields: {
title: 'Title', title: 'Title',
titlePlaceholder: 'e.g. Write Report',
targetAgent: 'Target Agent', targetAgent: 'Target Agent',
sortOrder: 'Sort Order', sortOrder: 'Sort Order',
content: 'Question Content', content: 'Question Content',
@@ -452,12 +489,108 @@ const messages = {
title: 'Data Reports: {table}', title: 'Data Reports: {table}',
subtitle: 'Raw data view and statistics', subtitle: 'Raw data view and statistics',
export: 'Export Excel', export: 'Export Excel',
columnSettings: 'Column Settings',
showSelection: 'Show Selection',
hideSelection: 'Hide Selection',
deleting: 'Deleting...',
deleteSelected: 'Delete Selected ({count})',
tableSettings: 'Table Settings',
resetLayout: 'Reset Layout',
wrapText: 'Wrap Text',
wrapMaxHeightPx: 'Max Wrap Height (px)',
advancedSortRules: 'Advanced Sort Rules (priority order)',
addRule: 'Add Rule',
noAdvancedSort: 'No advanced sort rules. Header click sorting will be used.',
sortAsc: 'Ascending',
sortDesc: 'Descending',
moveUp: 'Move Up',
moveDown: 'Move Down',
remove: 'Remove',
filterPlaceholder: 'Filter...',
totalRows: 'Total: {total}',
showingRange: 'Showing: {start}-{end} / {total}',
paginationSummary: 'Total {total} rows, page {page} / {pages}',
perPage: 'Per page',
itemsUnit: 'rows',
prevPage: 'Prev',
nextPage: 'Next',
enterFullscreen: 'Enter Fullscreen', enterFullscreen: 'Enter Fullscreen',
exitFullscreen: 'Exit Fullscreen', exitFullscreen: 'Exit Fullscreen',
noData: 'No data available for {table}', noData: 'No data available for {table}',
usage: 'Usage Analytics', usage: 'Usage Analytics',
byUser: 'Requests by User', byUser: 'Requests by User',
byAgent: 'Requests by Agent' byAgent: 'Requests by Agent',
columns: {
id: 'ID',
user_id: 'User ID',
username: 'Username',
real_name: 'Real Name',
email: 'Email',
phone_number: 'Phone',
department: 'Department',
employee_id: 'Employee ID',
role: 'Role',
status: 'Status',
is_active: 'Is Active',
language: 'Language',
default_agent_id: 'Default Agent ID',
default_agent: 'Default Agent',
created_at: 'Created At',
updated_at: 'Updated At',
last_login: 'Last Login',
last_login_at: 'Last Login At',
app_id: 'App ID',
dify_app_id: 'Dify App ID',
dify_api_key: 'Dify API Key',
api_base_url: 'API Base URL',
agent_id: 'Agent ID',
agent_name: 'Agent Name',
conversation_id: 'Conversation ID',
attribution_parts: 'Attribution Parts',
session_id: 'Session ID',
message_id: 'Message ID',
question: 'Question',
query: 'Query',
answer: 'Answer',
retriever_resources: 'Retriever Resources',
response: 'Response',
content: 'Content',
description: 'Description',
extra_config: 'Extra Config',
icon_url: 'Icon URL',
feedback: 'Feedback',
rating: 'Rating',
comment: 'Comment',
model: 'Model',
tokens: 'Tokens',
tokens_used: 'Tokens Used',
tokens_prompt: 'Prompt Tokens',
tokens_completion: 'Completion Tokens',
total_tokens: 'Total Tokens',
latency_ms: 'Latency (ms)',
latency: 'Latency',
cost: 'Cost',
ip: 'IP',
user_agent: 'User Agent',
source: 'Source',
type: 'Type',
title: 'Title',
name: 'Name',
code: 'Code',
company: 'Company',
theme_preference: 'Theme Preference',
password_hash: 'Password Hash',
reset_token: 'Reset Token',
reset_token_expiry: 'Reset Token Expiry'
},
tables: {
users: 'Users',
chat_logs: 'Chat Logs',
feedbacks: 'Feedbacks',
departments: 'Departments',
agents: 'Agents',
permission_requests: 'Permission Requests'
}
}, },
// Batch Edit // Batch Edit
@@ -476,7 +609,8 @@ const messages = {
// Common Messages // Common Messages
role: { role: {
user: 'User', user: 'User',
admin: 'Admin' admin: 'Admin',
guest: 'Guest'
}, },
status: { status: {
active: 'Active', active: 'Active',
@@ -499,6 +633,7 @@ const messages = {
}, },
chat: { chat: {
defaultTitle: 'Chat', defaultTitle: 'Chat',
assistantLabel: 'HXOPS AI Assistant',
placeholder: 'Ask anything...', placeholder: 'Ask anything...',
history: 'Chat History', history: 'Chat History',
noHistory: 'No history', noHistory: 'No history',
@@ -525,9 +660,15 @@ const messages = {
sent: 'Sent' sent: 'Sent'
} }
}, },
profile: { profile: {
title: 'Profile', title: 'Profile',
personalInfo: 'Personal Information', personalInfo: 'Personal Information',
department: 'Department',
language: 'Language',
roleAdmin: 'Administrator',
roleUser: 'User',
unsavedChanges: 'You have unsaved changes',
editHint: 'Switch to edit mode to update profile details',
security: 'Security', security: 'Security',
preferences: 'Preferences', preferences: 'Preferences',
edit: 'Edit', edit: 'Edit',
@@ -580,14 +721,23 @@ const messages = {
rememberMe: '30天内免登录', rememberMe: '30天内免登录',
forgotPasswordDesc: '输入您的邮箱以重置密码', forgotPasswordDesc: '输入您的邮箱以重置密码',
findPassword: '找回密码', findPassword: '找回密码',
announcements: '公告',
passwordResetEmailSent: '如果账号存在,重置链接已发送到您的邮箱。',
passwordResetRequestFailed: '请求密码重置失败',
wecomLogin: '企业微信登录', wecomLogin: '企业微信登录',
wecomConnecting: '正在连接企业微信...' wecomConnecting: '正在连接企业微信...',
wecomStartFailed: '启动企业微信登录失败',
wecomInvalidState: '企业微信登录状态无效',
wecomStateExpired: '企业微信登录会话已过期,请重试。',
wecomBindRequired: '当前企业微信账号未绑定本地用户,请联系管理员。',
wecomAccountDisabled: '账号已禁用,请联系管理员。',
wecomLoginFailed: '企业微信登录失败'
}, },
landing: { landing: {
hero: { hero: {
prefix: '释放', prefix: '释放',
highlight: '生成式 AI 的力量', highlight: '生成式 AI 的强大力量',
subtitle: '访问为您企业量身定制的强大 AI 助手套件。安全、可扩展、智能。' subtitle: '获取一套专为企业需求打造的强大 AI 智能体,安全、可扩展且智能。'
}, },
agent: { agent: {
role: 'AI 助手' role: 'AI 助手'
@@ -804,9 +954,13 @@ const messages = {
}, },
fields: { fields: {
name: '名称', name: '名称',
namePlaceholder: '例如:信息技术部',
code: '编码', code: '编码',
codePlaceholder: '例如:DEPT-001',
company: '公司', company: '公司',
description: '描述' companyPlaceholder: '例如:总部',
description: '描述',
descriptionPlaceholder: '请输入部门描述...'
}, },
confirmDelete: '确定删除该部门吗?', confirmDelete: '确定删除该部门吗?',
msg: { msg: {
@@ -831,6 +985,7 @@ const messages = {
}, },
fields: { fields: {
name: '名称', name: '名称',
namePlaceholder: '例如:人事助手',
type: '集成类型', type: '集成类型',
types: { types: {
api: 'API 集成 (Dify)', api: 'API 集成 (Dify)',
@@ -838,13 +993,31 @@ const messages = {
}, },
appId: 'Dify App ID', appId: 'Dify App ID',
apiKey: 'API Key', apiKey: 'API Key',
baseUrl: 'API Base URL (选填)', baseUrl: 'API 基础 URL(选填)',
baseUrlPlaceholder: '默认:使用 Dify 配置',
iframeUrl: 'Iframe URL', iframeUrl: 'Iframe URL',
description: '描述', description: '描述',
descPlaceholder: '简要描述该应用的功能...' descPlaceholder: '简要描述该应用的功能...'
}, },
confirmDelete: '确定要删除该应用吗?', confirmDelete: '确定要删除该应用吗?',
manageAccess: '管理权限' manageAccess: '管理权限',
test: '测试',
delete: '删除应用',
idLabel: 'ID',
urlLabel: '链接',
testModalTitle: '应用测试',
testModalAgent: '应用',
testedAt: '测试时间',
testing: '测试中...',
retest: '重新测试',
testingInProgress: '正在执行测试,请稍候...',
requestUrl: '请求地址',
outputInfo: '输出信息',
analysis: '最终结果分析',
testDone: '测试已完成。',
testFailed: '测试失败。',
testFailedRequestException: '测试失败:请求过程出现异常。',
networkError: '网络错误'
}, },
// Common Questions // Common Questions
@@ -862,6 +1035,7 @@ const messages = {
}, },
fields: { fields: {
title: '标题', title: '标题',
titlePlaceholder: '例如:写日报',
targetAgent: '目标应用', targetAgent: '目标应用',
sortOrder: '排序', sortOrder: '排序',
content: '问题内容', content: '问题内容',
@@ -1000,12 +1174,108 @@ const messages = {
title: '数据报表: {table}', title: '数据报表: {table}',
subtitle: '原始数据与统计视图', subtitle: '原始数据与统计视图',
export: '导出 Excel', export: '导出 Excel',
columnSettings: '列设置',
showSelection: '显示选择',
hideSelection: '隐藏选择',
deleting: '删除中...',
deleteSelected: '删除所选({count})',
tableSettings: '表格设置',
resetLayout: '重置布局',
wrapText: '自动换行',
wrapMaxHeightPx: '换行最大高度(px)',
advancedSortRules: '高级排序规则(按顺序优先)',
addRule: '添加规则',
noAdvancedSort: '未设置高级排序规则,将使用表头点击排序。',
sortAsc: '升序',
sortDesc: '降序',
moveUp: '上移',
moveDown: '下移',
remove: '删除',
filterPlaceholder: '筛选...',
totalRows: '总数:{total}',
showingRange: '显示:{start}-{end} / {total}',
paginationSummary: '共 {total} 条,当前第 {page} / {pages} 页',
perPage: '每页',
itemsUnit: '条',
prevPage: '上一页',
nextPage: '下一页',
enterFullscreen: '进入全屏', enterFullscreen: '进入全屏',
exitFullscreen: '退出全屏', exitFullscreen: '退出全屏',
noData: '暂无数据: {table}', noData: '暂无数据: {table}',
usage: '使用分析', usage: '使用分析',
byUser: '按用户统计', byUser: '按用户统计',
byAgent: '按应用统计' byAgent: '按应用统计',
columns: {
id: 'ID',
user_id: '用户 ID',
username: '用户名',
real_name: '真实姓名',
email: '邮箱',
phone_number: '手机号',
department: '部门',
employee_id: '工号',
role: '角色',
status: '状态',
is_active: '是否启用',
language: '语言',
default_agent_id: '默认应用 ID',
default_agent: '默认应用',
created_at: '创建时间',
updated_at: '更新时间',
last_login: '最近登录',
last_login_at: '最近登录时间',
app_id: '应用 ID',
dify_app_id: 'Dify 应用 ID',
dify_api_key: 'Dify API 密钥',
api_base_url: 'API 基础 URL',
agent_id: '应用 ID',
agent_name: '应用名称',
conversation_id: '会话 ID',
attribution_parts: '归因片段',
session_id: '会话 ID',
message_id: '消息 ID',
question: '问题',
query: '提问',
answer: '回答',
retriever_resources: '检索资源',
response: '回复',
content: '内容',
description: '描述',
extra_config: '扩展配置',
icon_url: '图标 URL',
feedback: '反馈',
rating: '评分',
comment: '评论',
model: '模型',
tokens: 'Token 数',
tokens_used: '已用 Token',
tokens_prompt: '提示词 Token',
tokens_completion: '补全 Token',
total_tokens: '总 Token',
latency_ms: '延迟(毫秒)',
latency: '延迟',
cost: '费用',
ip: 'IP',
user_agent: '用户代理',
source: '来源',
type: '类型',
title: '标题',
name: '名称',
code: '编码',
company: '公司',
theme_preference: '主题偏好',
password_hash: '密码哈希',
reset_token: '重置令牌',
reset_token_expiry: '重置令牌过期时间'
},
tables: {
users: '用户',
chat_logs: '聊天日志',
feedbacks: '反馈',
departments: '部门',
agents: '应用',
permission_requests: '权限申请'
}
}, },
// Batch Edit // Batch Edit
@@ -1024,7 +1294,8 @@ const messages = {
// Common Messages // Common Messages
role: { role: {
user: '普通用户', user: '普通用户',
admin: '管理员' admin: '管理员',
guest: '访客'
}, },
status: { status: {
active: '启用', active: '启用',
@@ -1047,6 +1318,7 @@ const messages = {
}, },
chat: { chat: {
defaultTitle: '对话', defaultTitle: '对话',
assistantLabel: '和信 AI 助手',
placeholder: '请输入问题...', placeholder: '请输入问题...',
history: '历史记录', history: '历史记录',
noHistory: '暂无历史记录', noHistory: '暂无历史记录',
@@ -1076,6 +1348,12 @@ const messages = {
profile: { profile: {
title: '个人资料', title: '个人资料',
personalInfo: '基本信息', personalInfo: '基本信息',
department: '部门',
language: '语言',
roleAdmin: '管理员',
roleUser: '普通用户',
unsavedChanges: '您有未保存的更改',
editHint: '切换到编辑模式以更新个人资料',
security: '安全设置', security: '安全设置',
preferences: '偏好设置', preferences: '偏好设置',
edit: '编辑', edit: '编辑',
@@ -1115,6 +1393,11 @@ const messages = {
usernameRequired: '請輸入用戶名', usernameRequired: '請輸入用戶名',
loginRequired: '請先登錄後再進入對話', loginRequired: '請先登錄後再進入對話',
requestFailed: '登錄請求失敗', requestFailed: '登錄請求失敗',
forgotPassword: '忘記密碼?',
rememberMe: '30天內免登入',
announcements: '公告',
forgotPasswordDesc: '輸入您的郵箱以重設密碼',
findPassword: '找回密碼',
wecomLogin: '企業微信登錄', wecomLogin: '企業微信登錄',
wecomConnecting: '正在連接企業微信...' wecomConnecting: '正在連接企業微信...'
}, },
@@ -1334,9 +1617,13 @@ const messages = {
}, },
fields: { fields: {
name: '名稱', name: '名稱',
namePlaceholder: '例如:資訊技術部',
code: '編碼', code: '編碼',
codePlaceholder: '例如:DEPT-001',
company: '公司', company: '公司',
description: '描述' companyPlaceholder: '例如:總部',
description: '描述',
descriptionPlaceholder: '請輸入部門描述...'
}, },
confirmDelete: '確定刪除該部門嗎?', confirmDelete: '確定刪除該部門嗎?',
msg: { msg: {
@@ -1361,6 +1648,7 @@ const messages = {
}, },
fields: { fields: {
name: '名稱', name: '名稱',
namePlaceholder: '例如:人事助手',
type: '集成類型', type: '集成類型',
types: { types: {
api: 'API 集成 (Dify)', api: 'API 集成 (Dify)',
@@ -1368,13 +1656,31 @@ const messages = {
}, },
appId: 'Dify App ID', appId: 'Dify App ID',
apiKey: 'API Key', apiKey: 'API Key',
baseUrl: 'API Base URL (選填)', baseUrl: 'API 基礎 URL(選填)',
baseUrlPlaceholder: '預設:使用 Dify 配置',
iframeUrl: 'Iframe URL', iframeUrl: 'Iframe URL',
description: '描述', description: '描述',
descPlaceholder: '簡要描述該應用的功能...' descPlaceholder: '簡要描述該應用的功能...'
}, },
confirmDelete: '確定要刪除該應用嗎?', confirmDelete: '確定要刪除該應用嗎?',
manageAccess: '管理權限' manageAccess: '管理權限',
test: '測試',
delete: '刪除應用',
idLabel: 'ID',
urlLabel: '連結',
testModalTitle: '應用測試',
testModalAgent: '應用',
testedAt: '測試時間',
testing: '測試中...',
retest: '重新測試',
testingInProgress: '正在執行測試,請稍候...',
requestUrl: '請求位址',
outputInfo: '輸出資訊',
analysis: '最終結果分析',
testDone: '測試已完成。',
testFailed: '測試失敗。',
testFailedRequestException: '測試失敗:請求過程發生異常。',
networkError: '網路錯誤'
}, },
// Common Questions // Common Questions
@@ -1392,6 +1698,7 @@ const messages = {
}, },
fields: { fields: {
title: '標題', title: '標題',
titlePlaceholder: '例如:寫日報',
targetAgent: '目標應用', targetAgent: '目標應用',
sortOrder: '排序', sortOrder: '排序',
content: '問題內容', content: '問題內容',
@@ -1530,12 +1837,108 @@ const messages = {
title: '數據報表: {table}', title: '數據報表: {table}',
subtitle: '原始數據與統計視圖', subtitle: '原始數據與統計視圖',
export: '導出 Excel', export: '導出 Excel',
columnSettings: '列設置',
showSelection: '顯示選擇',
hideSelection: '隱藏選擇',
deleting: '刪除中...',
deleteSelected: '刪除所選({count})',
tableSettings: '表格設置',
resetLayout: '重置佈局',
wrapText: '自動換行',
wrapMaxHeightPx: '換行最大高度(px)',
advancedSortRules: '高級排序規則(按順序優先)',
addRule: '添加規則',
noAdvancedSort: '未設置高級排序規則,將使用表頭點擊排序。',
sortAsc: '升序',
sortDesc: '降序',
moveUp: '上移',
moveDown: '下移',
remove: '刪除',
filterPlaceholder: '篩選...',
totalRows: '總數:{total}',
showingRange: '顯示:{start}-{end} / {total}',
paginationSummary: '共 {total} 條,當前第 {page} / {pages} 頁',
perPage: '每頁',
itemsUnit: '條',
prevPage: '上一頁',
nextPage: '下一頁',
enterFullscreen: '進入全屏', enterFullscreen: '進入全屏',
exitFullscreen: '退出全屏', exitFullscreen: '退出全屏',
noData: '暫無數據: {table}', noData: '暫無數據: {table}',
usage: '使用分析', usage: '使用分析',
byUser: '按用戶統計', byUser: '按用戶統計',
byAgent: '按應用統計' byAgent: '按應用統計',
columns: {
id: 'ID',
user_id: '用戶 ID',
username: '用戶名',
real_name: '真實姓名',
email: '郵箱',
phone_number: '手機號',
department: '部門',
employee_id: '工號',
role: '角色',
status: '狀態',
is_active: '是否啟用',
language: '語言',
default_agent_id: '默認應用 ID',
default_agent: '默認應用',
created_at: '創建時間',
updated_at: '更新時間',
last_login: '最近登錄',
last_login_at: '最近登錄時間',
app_id: '應用 ID',
dify_app_id: 'Dify 應用 ID',
dify_api_key: 'Dify API 金鑰',
api_base_url: 'API 基礎 URL',
agent_id: '應用 ID',
agent_name: '應用名稱',
conversation_id: '會話 ID',
attribution_parts: '歸因片段',
session_id: '會話 ID',
message_id: '消息 ID',
question: '問題',
query: '提問',
answer: '回答',
retriever_resources: '檢索資源',
response: '回覆',
content: '內容',
description: '描述',
extra_config: '擴展配置',
icon_url: '圖示 URL',
feedback: '反饋',
rating: '評分',
comment: '評論',
model: '模型',
tokens: 'Token 數',
tokens_used: '已用 Token',
tokens_prompt: '提示詞 Token',
tokens_completion: '補全 Token',
total_tokens: '總 Token',
latency_ms: '延遲(毫秒)',
latency: '延遲',
cost: '費用',
ip: 'IP',
user_agent: '用戶代理',
source: '來源',
type: '類型',
title: '標題',
name: '名稱',
code: '編碼',
company: '公司',
theme_preference: '主題偏好',
password_hash: '密碼雜湊',
reset_token: '重置令牌',
reset_token_expiry: '重置令牌過期時間'
},
tables: {
users: '用戶',
chat_logs: '聊天日誌',
feedbacks: '反饋',
departments: '部門',
agents: '應用',
permission_requests: '權限申請'
}
}, },
// Batch Edit // Batch Edit
@@ -1554,7 +1957,8 @@ const messages = {
// Common Messages // Common Messages
role: { role: {
user: '普通用戶', user: '普通用戶',
admin: '管理員' admin: '管理員',
guest: '訪客'
}, },
status: { status: {
active: '啟用', active: '啟用',
@@ -1577,6 +1981,7 @@ const messages = {
}, },
chat: { chat: {
defaultTitle: '對話', defaultTitle: '對話',
assistantLabel: 'HXOPS AI 助手',
placeholder: '請輸入問題...', placeholder: '請輸入問題...',
history: '歷史記錄', history: '歷史記錄',
noHistory: '暫無歷史記錄', noHistory: '暫無歷史記錄',
@@ -1606,6 +2011,12 @@ const messages = {
profile: { profile: {
title: '個人資料', title: '個人資料',
personalInfo: '基本信息', personalInfo: '基本信息',
department: '部門',
language: '語言',
roleAdmin: '管理員',
roleUser: '用戶',
unsavedChanges: '您有尚未保存的變更',
editHint: '切換到編輯模式以更新個人資料',
security: '安全設置', security: '安全設置',
preferences: '偏好設置', preferences: '偏好設置',
edit: '編輯', edit: '編輯',
@@ -1645,6 +2056,11 @@ const messages = {
usernameRequired: 'กรุณากรอกชื่อผู้ใช้', usernameRequired: 'กรุณากรอกชื่อผู้ใช้',
loginRequired: 'กรุณาเข้าสู่ระบบก่อนเริ่มการสนทนา', loginRequired: 'กรุณาเข้าสู่ระบบก่อนเริ่มการสนทนา',
requestFailed: 'คำขอเข้าสู่ระบบล้มเหลว', requestFailed: 'คำขอเข้าสู่ระบบล้มเหลว',
forgotPassword: 'ลืมรหัสผ่าน?',
rememberMe: 'จดจำการเข้าสู่ระบบ 30 วัน',
announcements: 'ประกาศ',
forgotPasswordDesc: 'กรอกอีเมลเพื่อรีเซ็ตรหัสผ่าน',
findPassword: 'ค้นหารหัสผ่าน',
wecomLogin: 'เข้าสู่ระบบด้วย WeCom', wecomLogin: 'เข้าสู่ระบบด้วย WeCom',
wecomConnecting: 'กำลังเชื่อมต่อ WeCom...' wecomConnecting: 'กำลังเชื่อมต่อ WeCom...'
}, },
@@ -1864,9 +2280,13 @@ const messages = {
}, },
fields: { fields: {
name: 'ชื่อ', name: 'ชื่อ',
namePlaceholder: 'เช่น แผนกไอที',
code: 'รหัส', code: 'รหัส',
codePlaceholder: 'เช่น DEPT-001',
company: 'บริษัท', company: 'บริษัท',
description: 'คำอธิบาย' companyPlaceholder: 'เช่น สำนักงานใหญ่',
description: 'คำอธิบาย',
descriptionPlaceholder: 'กรอกรายละเอียดแผนก...'
}, },
confirmDelete: 'ลบแผนกนี้หรือไม่?', confirmDelete: 'ลบแผนกนี้หรือไม่?',
msg: { msg: {
@@ -1891,6 +2311,7 @@ const messages = {
}, },
fields: { fields: {
name: 'ชื่อ', name: 'ชื่อ',
namePlaceholder: 'เช่น ผู้ช่วยฝ่ายบุคคล',
type: 'ประเภทการรวม', type: 'ประเภทการรวม',
types: { types: {
api: 'การรวม API (Dify)', api: 'การรวม API (Dify)',
@@ -1899,12 +2320,30 @@ const messages = {
appId: 'Dify App ID', appId: 'Dify App ID',
apiKey: 'API Key', apiKey: 'API Key',
baseUrl: 'API Base URL (ไม่บังคับ)', baseUrl: 'API Base URL (ไม่บังคับ)',
baseUrlPlaceholder: 'ค่าเริ่มต้น: ใช้การตั้งค่า Dify',
iframeUrl: 'Iframe URL', iframeUrl: 'Iframe URL',
description: 'คำอธิบาย', description: 'คำอธิบาย',
descPlaceholder: 'อธิบายสั้นๆ เกี่ยวกับตัวแทนนี้...' descPlaceholder: 'อธิบายสั้นๆ เกี่ยวกับตัวแทนนี้...'
}, },
confirmDelete: 'คุณแน่ใจหรือไม่ว่าต้องการลบตัวแทนนี้?', confirmDelete: 'คุณแน่ใจหรือไม่ว่าต้องการลบตัวแทนนี้?',
manageAccess: 'จัดการสิทธิ์' manageAccess: 'จัดการสิทธิ์',
test: 'ทดสอบ',
delete: 'ลบแอป',
idLabel: 'ID',
urlLabel: 'ลิงก์',
testModalTitle: 'ทดสอบแอป',
testModalAgent: 'แอป',
testedAt: 'เวลาทดสอบ',
testing: 'กำลังทดสอบ...',
retest: 'ทดสอบอีกครั้ง',
testingInProgress: 'กำลังดำเนินการทดสอบ โปรดรอสักครู่...',
requestUrl: 'ที่อยู่คำขอ',
outputInfo: 'ข้อมูลเอาต์พุต',
analysis: 'วิเคราะห์ผลลัพธ์สุดท้าย',
testDone: 'ทดสอบเสร็จสิ้น',
testFailed: 'ทดสอบล้มเหลว',
testFailedRequestException: 'ทดสอบล้มเหลว: เกิดข้อผิดพลาดระหว่างการร้องขอ',
networkError: 'เครือข่ายผิดพลาด'
}, },
// Common Questions // Common Questions
@@ -1922,6 +2361,7 @@ const messages = {
}, },
fields: { fields: {
title: 'หัวข้อ', title: 'หัวข้อ',
titlePlaceholder: 'เช่น เขียนรายงาน',
targetAgent: 'ตัวแทนเป้าหมาย', targetAgent: 'ตัวแทนเป้าหมาย',
sortOrder: 'ลำดับการเรียง', sortOrder: 'ลำดับการเรียง',
content: 'เนื้อหาคำถาม', content: 'เนื้อหาคำถาม',
@@ -2060,12 +2500,108 @@ const messages = {
title: 'รายงานข้อมูล: {table}', title: 'รายงานข้อมูล: {table}',
subtitle: 'มุมมองข้อมูลดิบและสถิติ', subtitle: 'มุมมองข้อมูลดิบและสถิติ',
export: 'ส่งออก Excel', export: 'ส่งออก Excel',
columnSettings: 'ตั้งค่าคอลัมน์',
showSelection: 'แสดงการเลือก',
hideSelection: 'ซ่อนการเลือก',
deleting: 'กำลังลบ...',
deleteSelected: 'ลบที่เลือก ({count})',
tableSettings: 'ตั้งค่าตาราง',
resetLayout: 'รีเซ็ตเลย์เอาต์',
wrapText: 'ตัดบรรทัดอัตโนมัติ',
wrapMaxHeightPx: 'ความสูงสูงสุดของการตัดบรรทัด (px)',
advancedSortRules: 'กฎการเรียงลำดับขั้นสูง (เรียงตามลำดับความสำคัญ)',
addRule: 'เพิ่มกฎ',
noAdvancedSort: 'ยังไม่มีกฎการเรียงขั้นสูง จะใช้การคลิกหัวตารางเพื่อเรียงลำดับ',
sortAsc: 'จากน้อยไปมาก',
sortDesc: 'จากมากไปน้อย',
moveUp: 'เลื่อนขึ้น',
moveDown: 'เลื่อนลง',
remove: 'ลบ',
filterPlaceholder: 'กรอง...',
totalRows: 'ทั้งหมด: {total}',
showingRange: 'แสดง: {start}-{end} / {total}',
paginationSummary: 'ทั้งหมด {total} รายการ, หน้า {page} / {pages}',
perPage: 'ต่อหน้า',
itemsUnit: 'รายการ',
prevPage: 'ก่อนหน้า',
nextPage: 'ถัดไป',
enterFullscreen: 'เต็มหน้าจอ', enterFullscreen: 'เต็มหน้าจอ',
exitFullscreen: 'ออกจากเต็มหน้าจอ', exitFullscreen: 'ออกจากเต็มหน้าจอ',
noData: 'ไม่มีข้อมูลสำหรับ {table}', noData: 'ไม่มีข้อมูลสำหรับ {table}',
usage: 'การวิเคราะห์การใช้งาน', usage: 'การวิเคราะห์การใช้งาน',
byUser: 'ตามผู้ใช้', byUser: 'ตามผู้ใช้',
byAgent: 'ตามตัวแทน' byAgent: 'ตามตัวแทน',
columns: {
id: 'ID',
user_id: 'รหัสผู้ใช้',
username: 'ชื่อผู้ใช้',
real_name: 'ชื่อจริง',
email: 'อีเมล',
phone_number: 'เบอร์โทร',
department: 'แผนก',
employee_id: 'รหัสพนักงาน',
role: 'บทบาท',
status: 'สถานะ',
is_active: 'เปิดใช้งาน',
language: 'ภาษา',
default_agent_id: 'รหัสตัวแทนเริ่มต้น',
default_agent: 'ตัวแทนเริ่มต้น',
created_at: 'เวลาสร้าง',
updated_at: 'เวลาอัปเดต',
last_login: 'เข้าสู่ระบบล่าสุด',
last_login_at: 'เวลาเข้าสู่ระบบล่าสุด',
app_id: 'รหัสแอป',
dify_app_id: 'Dify App ID',
dify_api_key: 'Dify API Key',
api_base_url: 'API Base URL',
agent_id: 'รหัสตัวแทน',
agent_name: 'ชื่อตัวแทน',
conversation_id: 'รหัสบทสนทนา',
attribution_parts: 'ส่วนที่อ้างอิง',
session_id: 'รหัสเซสชัน',
message_id: 'รหัสข้อความ',
question: 'คำถาม',
query: 'คำถาม',
answer: 'คำตอบ',
retriever_resources: 'ทรัพยากรที่ดึงข้อมูล',
response: 'การตอบกลับ',
content: 'เนื้อหา',
description: 'คำอธิบาย',
extra_config: 'การตั้งค่าเพิ่มเติม',
icon_url: 'URL ไอคอน',
feedback: 'ข้อเสนอแนะ',
rating: 'คะแนน',
comment: 'ความคิดเห็น',
model: 'โมเดล',
tokens: 'โทเค็น',
tokens_used: 'โทเค็นที่ใช้',
tokens_prompt: 'โทเค็นพรอมป์ต์',
tokens_completion: 'โทเค็นผลลัพธ์',
total_tokens: 'โทเค็นรวม',
latency_ms: 'ความหน่วง (ms)',
latency: 'ความหน่วง',
cost: 'ค่าใช้จ่าย',
ip: 'IP',
user_agent: 'User Agent',
source: 'แหล่งที่มา',
type: 'ประเภท',
title: 'หัวข้อ',
name: 'ชื่อ',
code: 'รหัส',
company: 'บริษัท',
theme_preference: 'ค่ากำหนดธีม',
password_hash: 'แฮชรหัสผ่าน',
reset_token: 'โทเค็นรีเซ็ต',
reset_token_expiry: 'เวลาหมดอายุโทเค็นรีเซ็ต'
},
tables: {
users: 'ผู้ใช้',
chat_logs: 'บันทึกแชท',
feedbacks: 'ข้อเสนอแนะ',
departments: 'แผนก',
agents: 'ตัวแทน',
permission_requests: 'คำขอสิทธิ์'
}
}, },
// Batch Edit // Batch Edit
@@ -2084,7 +2620,8 @@ const messages = {
// Common Messages // Common Messages
role: { role: {
user: 'ผู้ใช้ทั่วไป', user: 'ผู้ใช้ทั่วไป',
admin: 'ผู้ดูแลระบบ' admin: 'ผู้ดูแลระบบ',
guest: 'ผู้เยี่ยมชม'
}, },
status: { status: {
active: 'ใช้งาน', active: 'ใช้งาน',
@@ -2107,6 +2644,7 @@ const messages = {
}, },
chat: { chat: {
defaultTitle: 'แชท', defaultTitle: 'แชท',
assistantLabel: 'ผู้ช่วย AI ของ HXOPS',
placeholder: 'ถามอะไรก็ได้...', placeholder: 'ถามอะไรก็ได้...',
history: 'ประวัติการแชท', history: 'ประวัติการแชท',
noHistory: 'ไม่มีประวัติ', noHistory: 'ไม่มีประวัติ',
@@ -2136,6 +2674,12 @@ const messages = {
profile: { profile: {
title: 'โปรไฟล์', title: 'โปรไฟล์',
personalInfo: 'ข้อมูลส่วนตัว', personalInfo: 'ข้อมูลส่วนตัว',
department: 'แผนก',
language: 'ภาษา',
roleAdmin: 'ผู้ดูแลระบบ',
roleUser: 'ผู้ใช้',
unsavedChanges: 'คุณมีการเปลี่ยนแปลงที่ยังไม่ได้บันทึก',
editHint: 'สลับไปที่โหมดแก้ไขเพื่ออัปเดตรายละเอียดโปรไฟล์',
security: 'ความปลอดภัย', security: 'ความปลอดภัย',
preferences: 'การตั้งค่า', preferences: 'การตั้งค่า',
edit: 'แก้ไข', edit: 'แก้ไข',
+2 -4
View File
@@ -1,6 +1,4 @@
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@@ -22,7 +20,7 @@
} }
html { html {
font-family: 'Manrope', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif; font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', 'Helvetica Neue', Arial, system-ui, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
background-color: var(--bg-page); background-color: var(--bg-page);
@@ -48,7 +46,7 @@
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-family: 'Space Grotesk', 'Manrope', sans-serif; font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI Semibold', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
@apply tracking-tight font-semibold text-slate-900; @apply tracking-tight font-semibold text-slate-900;
} }
+145 -90
View File
@@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
/** /**
@@ -17,7 +17,7 @@ import ThemeToggleButton from '../components/ThemeToggleButton.vue';
import { loadReportLayoutPref, saveReportLayoutPref } from '../composables/useReportLayoutStorage'; import { loadReportLayoutPref, saveReportLayoutPref } from '../composables/useReportLayoutStorage';
import { import {
ArrowLeft, ArrowLeft,
Save, // Save,
Plus, Plus,
Trash2, Trash2,
UserPlus, UserPlus,
@@ -56,7 +56,6 @@ const sidebarItems = computed(() => {
{ id: 'wecom', icon: Link2, label: t('admin.nav.wecom') }, { id: 'wecom', icon: Link2, label: t('admin.nav.wecom') },
{ id: 'permissions', icon: Users, label: t('admin.nav.permissions') }, { id: 'permissions', icon: Users, label: t('admin.nav.permissions') },
{ id: 'requests', icon: ShieldCheck, label: t('admin.nav.requests'), badge: permissionRequests.value.filter(r => r.status === 'pending').length }, { id: 'requests', icon: ShieldCheck, label: t('admin.nav.requests'), badge: permissionRequests.value.filter(r => r.status === 'pending').length },
{ id: 'reports', icon: BarChart2, label: t('admin.nav.reports') },
]; ];
return items.filter(item => { return items.filter(item => {
@@ -233,7 +232,7 @@ const openEditUserModal = (user: UserRow) => {
email: user.email, email: user.email,
department: user.department || '', department: user.department || '',
role: user.role, role: user.role,
password: '', // 留空表示不修改 password: '', // Keep empty unless user updates password.
real_name: user.real_name || '', real_name: user.real_name || '',
employee_id: user.employee_id || '', employee_id: user.employee_id || '',
phone_number: user.phone_number || '', phone_number: user.phone_number || '',
@@ -416,7 +415,7 @@ const openReportTab = (table: string) => {
} else { } else {
const newTab: ReportTab = { const newTab: ReportTab = {
id: Date.now().toString(), id: Date.now().toString(),
label: table.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()), label: getReportTableLabel(table),
type: 'table', type: 'table',
table: table, table: table,
filter: {} filter: {}
@@ -1033,9 +1032,9 @@ watch(activeModule, async (value) => {
* saveConfig * saveConfig
* 用途:目前仅作为“保存成功”提示,核心配置变更在具体操作时已写入后台 * 用途:目前仅作为“保存成功”提示,核心配置变更在具体操作时已写入后台
*/ */
const saveConfig = () => { // const saveConfig = () => {
alert(t('admin.msg.allSaved')); // alert(t('admin.msg.allSaved'));
}; // };
const pendingUsers = computed(() => users.value.filter(u => u.status === 'pending')); const pendingUsers = computed(() => users.value.filter(u => u.status === 'pending'));
const activeUsers = computed(() => users.value.filter(u => u.status !== 'pending')); const activeUsers = computed(() => users.value.filter(u => u.status !== 'pending'));
@@ -1116,7 +1115,7 @@ const runAgentTest = async (agent?: AgentRow) => {
success: !!data.success, success: !!data.success,
request_url: data.request_url || '', request_url: data.request_url || '',
output_info: data.output_info || '', output_info: data.output_info || '',
analysis: data.analysis || (res.ok ? '测试已完成。' : '测试失败。'), analysis: data.analysis || (res.ok ? t('admin.agent.testDone') : t('admin.agent.testFailed')),
http_status: data.http_status, http_status: data.http_status,
tested_at: data.tested_at tested_at: data.tested_at
}; };
@@ -1137,8 +1136,8 @@ const runAgentTest = async (agent?: AgentRow) => {
agentTestResult.value = { agentTestResult.value = {
success: false, success: false,
request_url: '', request_url: '',
output_info: e?.message || 'Network error', output_info: e?.message || t('admin.agent.networkError'),
analysis: '测试失败:请求过程出现异常。', analysis: t('admin.agent.testFailedRequestException'),
http_status: 0 http_status: 0
}; };
} finally { } finally {
@@ -1492,6 +1491,18 @@ const visibleReportKeys = computed(() => {
if (chatLogsColumns.value.length === 0) return Object.keys(tableData.value[0] || {}); if (chatLogsColumns.value.length === 0) return Object.keys(tableData.value[0] || {});
return chatLogsColumns.value.filter((c) => c.visible).map((c) => c.key); return chatLogsColumns.value.filter((c) => c.visible).map((c) => c.key);
}); });
const getReportColumnLabel = (key: string) => {
const i18nKey = `admin.report.columns.${key}`;
const translated = t(i18nKey);
if (translated && translated !== i18nKey) return translated;
return key.replace(/_/g, ' ').replace(/\b\w/g, (m) => m.toUpperCase());
};
const getReportTableLabel = (table: string) => {
const i18nKey = `admin.report.tables.${table}`;
const translated = t(i18nKey);
if (translated && translated !== i18nKey) return translated;
return table.replace(/_/g, ' ').replace(/\b\w/g, (m) => m.toUpperCase());
};
const getReportRowId = (row: any) => Number(row?.id); const getReportRowId = (row: any) => Number(row?.id);
const allReportRowsSelected = computed(() => { const allReportRowsSelected = computed(() => {
if (!isChatLogsTable.value || paginatedSortedTableData.value.length === 0) return false; if (!isChatLogsTable.value || paginatedSortedTableData.value.length === 0) return false;
@@ -1507,7 +1518,49 @@ const getColumnWidthStyle = (key: string) => {
maxWidth: `${col.width}px`, maxWidth: `${col.width}px`,
}; };
}; };
const getReportCellValue = (row: any, key: string) => row?.[key];
// 报表值翻译辅助:优先返回 i18n 文案;若没有配置对应翻译则回退原始值
const getTranslatedValue = (i18nKey: string, fallbackValue: any) => {
const translated = t(i18nKey);
return translated && translated !== i18nKey ? translated : fallbackValue;
};
const getReportCellValue = (row: any, key: string) => {
const value = row?.[key];
// 根据 is_active 这一列的值进行多语言翻译(布尔值兼容多种后端返回格式)
if (key === 'is_active') {
const truthy = value === true || value === 1 || value === '1' || value === 'true' || value === 'True';
return truthy ? t('admin.status.active') : t('admin.status.disabled');
}
// 用户报表值翻译:角色(guest/user/admin) -> 中文角色名
if (key === 'role' && typeof value === 'string') {
return getTranslatedValue(`admin.role.${value}`, value);
}
// 用户报表值翻译:状态(active/disabled/pending/rejected) -> 中文状态名
if (key === 'status' && typeof value === 'string') {
return getTranslatedValue(`admin.status.${value}`, value);
}
// 用户报表值翻译:主题偏好(light/dark/system) -> 中文主题名
if (key === 'theme_preference' && typeof value === 'string') {
return getTranslatedValue(`theme.${value}`, value);
}
// 用户报表值翻译:语言(zh-CN/zh-TW/en/th) -> 语言名称
if (key === 'language' && typeof value === 'string') {
const languageLabelMap: Record<string, string> = {
'zh-CN': '简体中文',
'zh-TW': '繁體中文',
en: 'English',
th: 'ไทย',
};
return languageLabelMap[value] || value;
}
return value;
};
const normalizeSortValue = (v: any) => { const normalizeSortValue = (v: any) => {
if (v === null || v === undefined) return null; if (v === null || v === undefined) return null;
if (typeof v === 'number') return v; if (typeof v === 'number') return v;
@@ -1595,7 +1648,7 @@ const onReportHeaderClick = (key: string) => {
}; };
const getHeaderSortMark = (key: string) => { const getHeaderSortMark = (key: string) => {
if (reportHeaderSort.value?.key !== key) return ''; if (reportHeaderSort.value?.key !== key) return '';
return reportHeaderSort.value.direction === 'asc' ? '▲' : '▼'; return reportHeaderSort.value.direction === 'asc' ? '↑' : '↓';
}; };
const addChatLogsSortRule = () => { const addChatLogsSortRule = () => {
const keys = visibleReportKeys.value; const keys = visibleReportKeys.value;
@@ -1960,13 +2013,13 @@ const handlePermissionImport = async (event: Event) => {
</select> </select>
</div> </div>
<button <!-- <button
@click="saveConfig" @click="saveConfig"
class="hidden md:flex items-center gap-2 px-5 py-2.5 bg-slate-900 dark:bg-slate-700 text-white rounded-xl hover:bg-slate-800 dark:hover:bg-slate-600 transition-all shadow-lg shadow-slate-200 active:scale-95" class="hidden md:flex items-center gap-2 px-5 py-2.5 bg-slate-900 dark:bg-slate-700 text-white rounded-xl hover:bg-slate-800 dark:hover:bg-slate-600 transition-all shadow-lg shadow-slate-200 active:scale-95"
> >
<Save class="w-4 h-4" /> <Save class="w-4 h-4" />
<span class="font-medium text-sm">{{ t('admin.save') }}</span> <span class="font-medium text-sm">{{ t('admin.save') }}</span>
</button> </button> -->
</div> </div>
</header> </header>
@@ -2019,7 +2072,7 @@ const handlePermissionImport = async (event: Event) => {
:class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-50 text-brand-700' : 'text-slate-500 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-slate-100'" :class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-50 text-brand-700' : 'text-slate-500 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-slate-900 dark:hover:text-slate-100'"
> >
<div class="w-1.5 h-1.5 rounded-full" :class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-600' : 'bg-slate-300'"></div> <div class="w-1.5 h-1.5 rounded-full" :class="(activeModule === 'reports' && currentTable === table) ? 'bg-brand-600' : 'bg-slate-300'"></div>
{{ table.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()) }} {{ getReportTableLabel(table) }}
</button> </button>
</div> </div>
</div> </div>
@@ -2044,7 +2097,7 @@ const handlePermissionImport = async (event: Event) => {
<div class="p-3 bg-brand-50 rounded-xl group-hover:bg-brand-100 transition-colors"> <div class="p-3 bg-brand-50 rounded-xl group-hover:bg-brand-100 transition-colors">
<Bot class="w-6 h-6 text-brand-600" /> <Bot class="w-6 h-6 text-brand-600" />
</div> </div>
<span class="text-xs font-medium text-green-600 bg-green-50 px-2 py-1 rounded-full">+2 new</span> <span class="text-xs font-medium text-green-600 bg-green-50 px-2 py-1 rounded-full">+2 {{ t('admin.dash.new') }}</span>
</div> </div>
<div class="text-3xl font-bold text-slate-900 dark:text-slate-100 mb-1">{{ agents.length }}</div> <div class="text-3xl font-bold text-slate-900 dark:text-slate-100 mb-1">{{ agents.length }}</div>
<div class="text-sm text-slate-500 dark:text-slate-400 font-medium">{{ t('admin.dash.activeAgents') }}</div> <div class="text-sm text-slate-500 dark:text-slate-400 font-medium">{{ t('admin.dash.activeAgents') }}</div>
@@ -2097,13 +2150,6 @@ const handlePermissionImport = async (event: Event) => {
<h2 class="text-lg font-bold text-slate-900">{{ t('admin.approval.title') }}</h2> <h2 class="text-lg font-bold text-slate-900">{{ t('admin.approval.title') }}</h2>
<p class="text-sm text-slate-500 mt-1">{{ t('admin.approval.subtitle') }}</p> <p class="text-sm text-slate-500 mt-1">{{ t('admin.approval.subtitle') }}</p>
</div> </div>
<button
@click="openCreateUserModal"
class="flex items-center gap-2 px-4 py-2 bg-brand-600 text-white rounded-xl hover:bg-brand-700 transition-all shadow-lg shadow-brand-200 active:scale-95 text-sm font-medium"
>
<Plus class="w-4 h-4" />
<span class="font-medium">{{ t('admin.approval.addUser') }}</span>
</button>
</div> </div>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="w-full"> <table class="w-full">
@@ -2317,19 +2363,19 @@ const handlePermissionImport = async (event: Event) => {
<div class="space-y-4"> <div class="space-y-4">
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.name') }}</label> <label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.name') }}</label>
<input v-model="editingDept.name" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" placeholder="e.g. IT Department" /> <input v-model="editingDept.name" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" :placeholder="t('admin.dept.fields.namePlaceholder')" />
</div> </div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.code') }}</label> <label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.code') }}</label>
<input v-model="editingDept.code" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" placeholder="e.g. DEPT-001" /> <input v-model="editingDept.code" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" :placeholder="t('admin.dept.fields.codePlaceholder')" />
</div> </div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.company') }}</label> <label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.company') }}</label>
<input v-model="editingDept.company" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" placeholder="e.g. HQ" /> <input v-model="editingDept.company" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" :placeholder="t('admin.dept.fields.companyPlaceholder')" />
</div> </div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.description') }}</label> <label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.dept.fields.description') }}</label>
<textarea v-model="editingDept.description" rows="3" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" placeholder="Department description..."></textarea> <textarea v-model="editingDept.description" rows="3" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" :placeholder="t('admin.dept.fields.descriptionPlaceholder')"></textarea>
</div> </div>
<div class="flex justify-end gap-2 pt-2"> <div class="flex justify-end gap-2 pt-2">
@@ -2404,7 +2450,7 @@ const handlePermissionImport = async (event: Event) => {
v-model="newAgent.name" v-model="newAgent.name"
type="text" type="text"
class="w-full border-gray-200 rounded-xl px-4 py-3 text-base focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none transition-all shadow-sm" class="w-full border-gray-200 rounded-xl px-4 py-3 text-base focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none transition-all shadow-sm"
placeholder="e.g. HR Assistant" :placeholder="t('admin.agent.fields.namePlaceholder')"
/> />
</div> </div>
<div class="space-y-2"> <div class="space-y-2">
@@ -2438,7 +2484,7 @@ const handlePermissionImport = async (event: Event) => {
v-model="newAgent.api_base_url" v-model="newAgent.api_base_url"
type="text" type="text"
class="w-full border-gray-200 rounded-xl px-4 py-3 text-sm font-mono bg-white focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none shadow-sm" class="w-full border-gray-200 rounded-xl px-4 py-3 text-sm font-mono bg-white focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none shadow-sm"
placeholder="Default: Dify Config" :placeholder="t('admin.agent.fields.baseUrlPlaceholder')"
/> />
</div> </div>
</template> </template>
@@ -2511,10 +2557,10 @@ const handlePermissionImport = async (event: Event) => {
</td> </td>
<td class="px-8 py-5 font-mono text-xs text-gray-500 max-w-xs truncate"> <td class="px-8 py-5 font-mono text-xs text-gray-500 max-w-xs truncate">
<span v-if="agent.type === 'api'" class="flex items-center gap-1"> <span v-if="agent.type === 'api'" class="flex items-center gap-1">
<span class="text-gray-400">ID:</span> {{ agent.dify_app_id }} <span class="text-gray-400">{{ t('admin.agent.idLabel') }}:</span> {{ agent.dify_app_id }}
</span> </span>
<span v-else class="flex items-center gap-1" :title="agent.extra_config?.iframe_url"> <span v-else class="flex items-center gap-1" :title="agent.extra_config?.iframe_url">
<span class="text-gray-400">URL:</span> {{ agent.extra_config?.iframe_url }} <span class="text-gray-400">{{ t('admin.agent.urlLabel') }}:</span> {{ agent.extra_config?.iframe_url }}
</span> </span>
</td> </td>
<td class="px-8 py-5"> <td class="px-8 py-5">
@@ -2530,21 +2576,21 @@ const handlePermissionImport = async (event: Event) => {
<button <button
@click.stop="openAgentTestModal(agent)" @click.stop="openAgentTestModal(agent)"
class="p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all" class="p-2 text-emerald-600 bg-emerald-50 hover:bg-emerald-100 rounded-lg transition-all"
title="测试应用" :title="t('admin.agent.test')"
> >
测试 {{ t('admin.agent.test') }}
</button> </button>
<button <button
@click.stop="openAgentPermissionModal(agent)" @click.stop="openAgentPermissionModal(agent)"
class="p-2 text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-lg transition-all" class="p-2 text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-lg transition-all"
title="Manage Access" :title="t('admin.agent.manageAccess')"
> >
<Users class="w-5 h-5" /> <Users class="w-5 h-5" />
</button> </button>
<button <button
@click.stop="deleteAgent(agent.id)" @click.stop="deleteAgent(agent.id)"
class="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all" class="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all"
title="Delete Agent" :title="t('admin.agent.delete')"
> >
<Trash2 class="w-5 h-5" /> <Trash2 class="w-5 h-5" />
</button> </button>
@@ -2620,7 +2666,7 @@ const handlePermissionImport = async (event: Event) => {
<div class="space-y-4"> <div class="space-y-4">
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.question.fields.title') }}</label> <label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.question.fields.title') }}</label>
<input v-model="newQuestion.title" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" placeholder="e.g. Write Report" /> <input v-model="newQuestion.title" class="w-full px-3 py-2 border rounded-xl text-sm focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none" :placeholder="t('admin.question.fields.titlePlaceholder')" />
</div> </div>
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.question.fields.targetAgent') }}</label> <label class="text-xs font-semibold text-gray-500 uppercase">{{ t('admin.question.fields.targetAgent') }}</label>
@@ -2868,20 +2914,20 @@ const handlePermissionImport = async (event: Event) => {
<div class="bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden"> <div class="bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden">
<div class="px-5 py-4 border-b border-gray-100 flex flex-col md:flex-row md:items-center md:justify-between gap-3"> <div class="px-5 py-4 border-b border-gray-100 flex flex-col md:flex-row md:items-center md:justify-between gap-3">
<h3 class="font-semibold text-gray-900">{{ t('admin.wecom.auditTitle') }}</h3> <h3 class="font-semibold text-gray-900">{{ t('admin.wecom.auditTitle') }}</h3>
<div class="flex flex-wrap items-center gap-2"> <div class="flex w-full md:w-auto flex-wrap md:flex-nowrap items-center justify-start md:justify-end gap-2">
<select v-model="wecomAuditSourceFilter" class="px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white"> <select v-model="wecomAuditSourceFilter" class="h-11 min-w-[112px] px-3 border border-gray-200 rounded-lg text-sm bg-white shrink-0">
<option value="all">{{ t('admin.wecom.filters.allSources') }}</option> <option value="all">{{ t('admin.wecom.filters.allSources') }}</option>
<option value="wecom">{{ t('admin.wecom.sources.wecom') }}</option> <option value="wecom">{{ t('admin.wecom.sources.wecom') }}</option>
<option value="password">{{ t('admin.wecom.sources.password') }}</option> <option value="password">{{ t('admin.wecom.sources.password') }}</option>
</select> </select>
<select v-model="wecomAuditStatusFilter" class="px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white"> <select v-model="wecomAuditStatusFilter" class="h-11 min-w-[112px] px-3 border border-gray-200 rounded-lg text-sm bg-white shrink-0">
<option value="all">{{ t('admin.wecom.filters.allStatus') }}</option> <option value="all">{{ t('admin.wecom.filters.allStatus') }}</option>
<option value="success">{{ t('admin.wecom.auditStatus.success') }}</option> <option value="success">{{ t('admin.wecom.auditStatus.success') }}</option>
<option value="failed">{{ t('admin.wecom.auditStatus.failed') }}</option> <option value="failed">{{ t('admin.wecom.auditStatus.failed') }}</option>
</select> </select>
<button <button
@click="exportWecomAudits" @click="exportWecomAudits"
class="inline-flex items-center gap-2 px-3 py-2 border border-gray-200 rounded-lg text-sm text-gray-700 bg-white hover:bg-gray-50" class="inline-flex h-11 items-center gap-2 px-3 border border-gray-200 rounded-lg text-sm text-gray-700 bg-white hover:bg-gray-50 shrink-0"
> >
<Download class="w-4 h-4" /> <Download class="w-4 h-4" />
{{ t('admin.wecom.exportAudit') }} {{ t('admin.wecom.exportAudit') }}
@@ -2992,17 +3038,17 @@ const handlePermissionImport = async (event: Event) => {
<span class="inline-flex h-8 w-8 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-cyan-500 shadow-md shadow-cyan-200/70"> <span class="inline-flex h-8 w-8 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-cyan-500 shadow-md shadow-cyan-200/70">
<BarChart2 class="w-4 h-4 text-white" /> <BarChart2 class="w-4 h-4 text-white" />
</span> </span>
{{ t('admin.report.title', { table: currentTable.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()) }) }} {{ t('admin.report.title', { table: getReportTableLabel(currentTable) }) }}
</h2> </h2>
<div class="flex flex-wrap items-center gap-2 text-xs"> <div class="flex flex-wrap items-center gap-2 text-xs">
<span class="inline-flex items-center rounded-full border border-slate-200 bg-slate-50 px-3 py-1 font-medium text-slate-600"> <span class="inline-flex items-center rounded-full border border-slate-200 bg-slate-50 px-3 py-1 font-medium text-slate-600">
{{ t('admin.report.subtitle') }} {{ t('admin.report.subtitle') }}
</span> </span>
<span v-if="isChatLogsTable" class="inline-flex items-center rounded-full border border-cyan-200 bg-cyan-50 px-3 py-1 font-semibold text-cyan-700"> <span v-if="isChatLogsTable" class="inline-flex items-center rounded-full border border-cyan-200 bg-cyan-50 px-3 py-1 font-semibold text-cyan-700">
Total: {{ chatLogsTotal }} {{ t('admin.report.totalRows', { total: chatLogsTotal }) }}
</span> </span>
<span class="inline-flex items-center rounded-full border border-indigo-200 bg-indigo-50 px-3 py-1 font-semibold text-indigo-700"> <span class="inline-flex items-center rounded-full border border-indigo-200 bg-indigo-50 px-3 py-1 font-semibold text-indigo-700">
Showing: {{ reportRangeStart }}-{{ reportRangeEnd }} / {{ reportTotalRows }} {{ t('admin.report.showingRange', { start: reportRangeStart, end: reportRangeEnd, total: reportTotalRows }) }}
</span> </span>
</div> </div>
</div> </div>
@@ -3010,17 +3056,17 @@ const handlePermissionImport = async (event: Event) => {
<button <button
@click="showChatLogsColumnPanel = !showChatLogsColumnPanel" @click="showChatLogsColumnPanel = !showChatLogsColumnPanel"
class="inline-flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-semibold text-slate-700 border border-slate-300 bg-white hover:bg-slate-50 hover:border-slate-400 transition-colors" class="inline-flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-semibold text-slate-700 border border-slate-300 bg-white hover:bg-slate-50 hover:border-slate-400 transition-colors"
title="Column Settings" :title="t('admin.report.columnSettings')"
> >
<Settings2 class="w-4 h-4" /> <Settings2 class="w-4 h-4" />
<span>Column Settings</span> <span>{{ t('admin.report.columnSettings') }}</span>
</button> </button>
<button <button
v-if="isChatLogsTable" v-if="isChatLogsTable"
@click="showChatLogsSelection = !showChatLogsSelection" @click="showChatLogsSelection = !showChatLogsSelection"
class="px-3 py-2 border border-slate-300 rounded-xl text-xs font-medium text-slate-600 hover:bg-slate-50" class="px-3 py-2 border border-slate-300 rounded-xl text-xs font-medium text-slate-600 hover:bg-slate-50"
> >
{{ showChatLogsSelection ? 'Hide Selection' : 'Show Selection' }} {{ showChatLogsSelection ? t('admin.report.hideSelection') : t('admin.report.showSelection') }}
</button> </button>
<button <button
v-if="isChatLogsTable && showChatLogsSelection" v-if="isChatLogsTable && showChatLogsSelection"
@@ -3028,7 +3074,7 @@ const handlePermissionImport = async (event: Event) => {
:disabled="selectedReportRowIds.length === 0 || isDeletingChatLogs" :disabled="selectedReportRowIds.length === 0 || isDeletingChatLogs"
class="flex items-center gap-2 px-4 py-2 bg-rose-600 text-white text-sm font-medium rounded-xl hover:bg-rose-700 transition-all shadow-md shadow-rose-200 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed" class="flex items-center gap-2 px-4 py-2 bg-rose-600 text-white text-sm font-medium rounded-xl hover:bg-rose-700 transition-all shadow-md shadow-rose-200 active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed"
> >
{{ isDeletingChatLogs ? 'Deleting...' : `Delete Selected (${selectedReportRowIds.length})` }} {{ isDeletingChatLogs ? t('admin.report.deleting') : t('admin.report.deleteSelected', { count: selectedReportRowIds.length }) }}
</button> </button>
<button <button
@@ -3056,21 +3102,21 @@ const handlePermissionImport = async (event: Event) => {
class="p-4 md:p-5 rounded-2xl border border-slate-200 bg-white/90 shadow-sm" class="p-4 md:p-5 rounded-2xl border border-slate-200 bg-white/90 shadow-sm"
> >
<div class="flex items-center justify-between mb-3"> <div class="flex items-center justify-between mb-3">
<div class="text-sm font-semibold text-slate-800">Table Settings</div> <div class="text-sm font-semibold text-slate-800">{{ t('admin.report.tableSettings') }}</div>
<button <button
@click="resetChatLogsColumns" @click="resetChatLogsColumns"
class="text-xs px-3 py-1.5 rounded-lg bg-slate-50 border border-slate-200 hover:bg-slate-100 text-slate-700" class="text-xs px-3 py-1.5 rounded-lg bg-slate-50 border border-slate-200 hover:bg-slate-100 text-slate-700"
> >
Reset Layout {{ t('admin.report.resetLayout') }}
</button> </button>
</div> </div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 mb-3"> <div class="grid grid-cols-1 md:grid-cols-2 gap-3 mb-3">
<label class="flex items-center gap-2 px-3 py-2 bg-slate-50 rounded-lg border border-slate-200 text-xs text-slate-700"> <label class="flex items-center gap-2 px-3 py-2 bg-slate-50 rounded-lg border border-slate-200 text-xs text-slate-700">
<input type="checkbox" v-model="chatLogsWrapEnabled" class="w-4 h-4 rounded text-blue-600 focus:ring-blue-500" /> <input type="checkbox" v-model="chatLogsWrapEnabled" class="w-4 h-4 rounded text-blue-600 focus:ring-blue-500" />
<span>换行</span> <span>{{ t('admin.report.wrapText') }}</span>
</label> </label>
<label class="flex items-center gap-2 px-3 py-2 bg-slate-50 rounded-lg border border-slate-200 text-xs text-slate-700"> <label class="flex items-center gap-2 px-3 py-2 bg-slate-50 rounded-lg border border-slate-200 text-xs text-slate-700">
<span>换行最大高度(px)</span> <span>{{ t('admin.report.wrapMaxHeightPx') }}</span>
<input <input
v-model.number="chatLogsWrapMaxHeight" v-model.number="chatLogsWrapMaxHeight"
type="number" type="number"
@@ -3081,15 +3127,15 @@ const handlePermissionImport = async (event: Event) => {
</div> </div>
<div class="mb-3 p-3 bg-slate-50 rounded-xl border border-slate-200"> <div class="mb-3 p-3 bg-slate-50 rounded-xl border border-slate-200">
<div class="flex items-center justify-between mb-2"> <div class="flex items-center justify-between mb-2">
<span class="text-xs font-semibold text-slate-700">高级排序规则(按顺序优先)</span> <span class="text-xs font-semibold text-slate-700">{{ t('admin.report.advancedSortRules') }}</span>
<button <button
@click="addChatLogsSortRule" @click="addChatLogsSortRule"
class="text-xs px-2 py-1 rounded border border-slate-300 hover:bg-white text-slate-700" class="text-xs px-2 py-1 rounded border border-slate-300 hover:bg-white text-slate-700"
> >
+ 添加规则 + {{ t('admin.report.addRule') }}
</button> </button>
</div> </div>
<div v-if="chatLogsSortRules.length === 0" class="text-xs text-slate-500">未设置高级排序,将使用列头点击排序。</div> <div v-if="chatLogsSortRules.length === 0" class="text-xs text-slate-500">{{ t('admin.report.noAdvancedSort') }}</div>
<div v-else class="space-y-2"> <div v-else class="space-y-2">
<div <div
v-for="(rule, ridx) in chatLogsSortRules" v-for="(rule, ridx) in chatLogsSortRules"
@@ -3098,16 +3144,16 @@ const handlePermissionImport = async (event: Event) => {
> >
<span class="col-span-1 text-slate-500">{{ ridx + 1 }}.</span> <span class="col-span-1 text-slate-500">{{ ridx + 1 }}.</span>
<select v-model="rule.key" class="col-span-4 px-2 py-1 border border-slate-300 rounded"> <select v-model="rule.key" class="col-span-4 px-2 py-1 border border-slate-300 rounded">
<option v-for="k in Object.keys(tableData[0] || {})" :key="`rule-key-${k}`" :value="k">{{ k }}</option> <option v-for="k in Object.keys(tableData[0] || {})" :key="`rule-key-${k}`" :value="k">{{ getReportColumnLabel(k) }}</option>
</select> </select>
<select v-model="rule.direction" class="col-span-3 px-2 py-1 border border-slate-300 rounded"> <select v-model="rule.direction" class="col-span-3 px-2 py-1 border border-slate-300 rounded">
<option value="asc">正序</option> <option value="asc">{{ t('admin.report.sortAsc') }}</option>
<option value="desc">倒序</option> <option value="desc">{{ t('admin.report.sortDesc') }}</option>
</select> </select>
<div class="col-span-4 flex items-center justify-end gap-1"> <div class="col-span-4 flex items-center justify-end gap-1">
<button @click="moveChatLogsSortRule(ridx, -1)" class="px-2 py-1 rounded border border-slate-300 hover:bg-slate-50">上移</button> <button @click="moveChatLogsSortRule(ridx, -1)" class="px-2 py-1 rounded border border-slate-300 hover:bg-slate-50">{{ t('admin.report.moveUp') }}</button>
<button @click="moveChatLogsSortRule(ridx, 1)" class="px-2 py-1 rounded border border-slate-300 hover:bg-slate-50">下移</button> <button @click="moveChatLogsSortRule(ridx, 1)" class="px-2 py-1 rounded border border-slate-300 hover:bg-slate-50">{{ t('admin.report.moveDown') }}</button>
<button @click="removeChatLogsSortRule(ridx)" class="px-2 py-1 rounded border border-red-200 text-red-600 hover:bg-red-50">删除</button> <button @click="removeChatLogsSortRule(ridx)" class="px-2 py-1 rounded border border-red-200 text-red-600 hover:bg-red-50">{{ t('admin.report.remove') }}</button>
</div> </div>
</div> </div>
</div> </div>
@@ -3120,18 +3166,18 @@ const handlePermissionImport = async (event: Event) => {
> >
<label class="flex items-center gap-2 min-w-0"> <label class="flex items-center gap-2 min-w-0">
<input type="checkbox" v-model="col.visible" class="w-4 h-4 rounded text-blue-600 focus:ring-blue-500" /> <input type="checkbox" v-model="col.visible" class="w-4 h-4 rounded text-blue-600 focus:ring-blue-500" />
<span class="text-xs text-slate-700 truncate">{{ col.key }}</span> <span class="text-xs text-slate-700 truncate">{{ getReportColumnLabel(col.key) }}</span>
</label> </label>
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<button @click="moveChatLogsColumn(col.key, -1)" class="text-xs px-1.5 py-0.5 rounded border border-slate-300 hover:bg-white">◀</button> <button @click="moveChatLogsColumn(col.key, -1)" class="text-xs px-1.5 py-0.5 rounded border border-slate-300 hover:bg-white">&lt;</button>
<button @click="moveChatLogsColumn(col.key, 1)" class="text-xs px-1.5 py-0.5 rounded border border-slate-300 hover:bg-white">▶</button> <button @click="moveChatLogsColumn(col.key, 1)" class="text-xs px-1.5 py-0.5 rounded border border-slate-300 hover:bg-white">&gt;</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="tableData.length === 0" class="text-center text-slate-400 py-20 bg-slate-50 rounded-2xl border border-dashed border-slate-300"> <div v-if="tableData.length === 0" class="text-center text-slate-400 py-20 bg-slate-50 rounded-2xl border border-dashed border-slate-300">
<p>{{ t('admin.report.noData', { table: currentTable }) }}</p> <p>{{ t('admin.report.noData', { table: getReportTableLabel(currentTable) }) }}</p>
</div> </div>
<div v-else class="overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-[0_12px_40px_-28px_rgba(15,23,42,0.5)]"> <div v-else class="overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-[0_12px_40px_-28px_rgba(15,23,42,0.5)]">
@@ -3156,19 +3202,19 @@ const handlePermissionImport = async (event: Event) => {
@dragover.prevent @dragover.prevent
@drop="onColumnDrop(String(key))" @drop="onColumnDrop(String(key))"
> >
<div class="flex flex-col gap-2 min-w-[120px]"> <div class="flex flex-col gap-2 min-w-0">
<button <button
@click="onReportHeaderClick(String(key))" @click="onReportHeaderClick(String(key))"
class="text-left hover:text-blue-700 transition-colors" class="text-left hover:text-blue-700 transition-colors"
> >
{{ key }} <span class="text-[10px] text-blue-600">{{ getHeaderSortMark(String(key)) }}</span> {{ getReportColumnLabel(String(key)) }} <span class="text-[10px] text-blue-600">{{ getHeaderSortMark(String(key)) }}</span>
</button> </button>
<input <input
v-model="columnFilters[key]" v-model="columnFilters[key]"
@input="handleFilterChange" @input="handleFilterChange"
type="text" type="text"
class="w-full px-2 py-1 text-xs border border-slate-300 rounded focus:ring-1 focus:ring-sky-500 outline-none font-normal normal-case bg-white/95" class="w-full px-2 py-1 text-xs border border-slate-300 rounded focus:ring-1 focus:ring-sky-500 outline-none font-normal normal-case bg-white/95"
placeholder="Filter..." :placeholder="t('admin.report.filterPlaceholder')"
/> />
</div> </div>
<span <span
@@ -3206,11 +3252,11 @@ const handlePermissionImport = async (event: Event) => {
<div v-if="tableData.length > 0" class="flex flex-col gap-3 rounded-2xl border border-slate-200 bg-white/80 px-4 py-3 md:flex-row md:items-center md:justify-between"> <div v-if="tableData.length > 0" class="flex flex-col gap-3 rounded-2xl border border-slate-200 bg-white/80 px-4 py-3 md:flex-row md:items-center md:justify-between">
<div class="text-sm text-slate-600"> <div class="text-sm text-slate-600">
共 {{ reportTotalRows }} 条,当前第 {{ reportCurrentPage }} / {{ reportTotalPages }} 页 {{ t('admin.report.paginationSummary', { total: reportTotalRows, page: reportCurrentPage, pages: reportTotalPages }) }}
</div> </div>
<div class="flex flex-wrap items-center gap-2"> <div class="flex flex-wrap items-center gap-2">
<label class="flex items-center gap-2 text-xs text-slate-600"> <label class="flex items-center gap-2 text-xs text-slate-600">
<span>每页</span> <span>{{ t('admin.report.perPage') }}</span>
<span class="relative inline-flex items-center"> <span class="relative inline-flex items-center">
<select <select
v-model.number="reportPageSize" v-model.number="reportPageSize"
@@ -3222,14 +3268,14 @@ const handlePermissionImport = async (event: Event) => {
<path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z" clip-rule="evenodd" /> <path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z" clip-rule="evenodd" />
</svg> </svg>
</span> </span>
<span>条</span> <span>{{ t('admin.report.itemsUnit') }}</span>
</label> </label>
<button <button
@click="prevReportPage" @click="prevReportPage"
:disabled="reportCurrentPage <= 1" :disabled="reportCurrentPage <= 1"
class="rounded-lg border border-slate-300 px-2.5 py-1.5 text-xs text-slate-700 hover:bg-slate-50 disabled:opacity-40 disabled:cursor-not-allowed" class="rounded-lg border border-slate-300 px-2.5 py-1.5 text-xs text-slate-700 hover:bg-slate-50 disabled:opacity-40 disabled:cursor-not-allowed"
> >
上一页 {{ t('admin.report.prevPage') }}
</button> </button>
<button <button
v-for="btn in reportPageButtons" v-for="btn in reportPageButtons"
@@ -3250,17 +3296,17 @@ const handlePermissionImport = async (event: Event) => {
:disabled="reportCurrentPage >= reportTotalPages" :disabled="reportCurrentPage >= reportTotalPages"
class="rounded-lg border border-slate-300 px-2.5 py-1.5 text-xs text-slate-700 hover:bg-slate-50 disabled:opacity-40 disabled:cursor-not-allowed" class="rounded-lg border border-slate-300 px-2.5 py-1.5 text-xs text-slate-700 hover:bg-slate-50 disabled:opacity-40 disabled:cursor-not-allowed"
> >
下一页 {{ t('admin.report.nextPage') }}
</button> </button>
</div> </div>
</div> </div>
<!-- Statistics Charts --> <!-- Statistics Charts -->
<div v-if="currentTable === 'chat_logs' && usageReport" class="mt-10 border-t border-slate-200 pt-10"> <div v-if="currentTable === 'chat_logs' && usageReport" class="mt-10 border-t border-slate-200 pt-10">
<h3 class="font-bold text-lg mb-6 text-slate-900">Usage Analytics</h3> <h3 class="font-bold text-lg mb-6 text-slate-900">{{ t('admin.report.usage') }}</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8"> <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<div class="bg-white border border-slate-200 rounded-2xl p-6 shadow-sm"> <div class="bg-white border border-slate-200 rounded-2xl p-6 shadow-sm">
<h4 class="text-sm font-bold text-slate-500 uppercase tracking-wider mb-4">Requests by User</h4> <h4 class="text-sm font-bold text-slate-500 uppercase tracking-wider mb-4">{{ t('admin.report.byUser') }}</h4>
<div class="space-y-3"> <div class="space-y-3">
<div v-for="u in usageReport.by_user" :key="u.username" class="flex items-center justify-between p-3 bg-slate-50 rounded-xl"> <div v-for="u in usageReport.by_user" :key="u.username" class="flex items-center justify-between p-3 bg-slate-50 rounded-xl">
<span class="font-medium text-slate-700">{{ u.username }}</span> <span class="font-medium text-slate-700">{{ u.username }}</span>
@@ -3269,7 +3315,7 @@ const handlePermissionImport = async (event: Event) => {
</div> </div>
</div> </div>
<div class="bg-white border border-slate-200 rounded-2xl p-6 shadow-sm"> <div class="bg-white border border-slate-200 rounded-2xl p-6 shadow-sm">
<h4 class="text-sm font-bold text-slate-500 uppercase tracking-wider mb-4">Requests by Agent</h4> <h4 class="text-sm font-bold text-slate-500 uppercase tracking-wider mb-4">{{ t('admin.report.byAgent') }}</h4>
<div class="space-y-3"> <div class="space-y-3">
<div v-for="a in usageReport.by_agent" :key="a.agent" class="flex items-center justify-between p-3 bg-slate-50 rounded-xl"> <div v-for="a in usageReport.by_agent" :key="a.agent" class="flex items-center justify-between p-3 bg-slate-50 rounded-xl">
<span class="font-medium text-slate-700">{{ a.agent }}</span> <span class="font-medium text-slate-700">{{ a.agent }}</span>
@@ -3285,10 +3331,16 @@ const handlePermissionImport = async (event: Event) => {
</main> </main>
<!-- User Modal --> <!-- User Modal -->
<div v-if="showUserModal" class="fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50 transition-opacity animate-fade-in"> <!-- 用户弹窗:外层允许滚动,避免小屏/高缩放下被裁切 -->
<div class="bg-white rounded-2xl shadow-2xl w-full max-w-md p-8 transform transition-all scale-100"> <div v-if="showUserModal" class="fixed inset-0 bg-black/40 backdrop-blur-sm flex items-start sm:items-center justify-center z-50 transition-opacity animate-fade-in p-3 sm:p-4 overflow-y-auto">
<h3 class="text-xl font-bold text-gray-900 mb-6">{{ editingUser.id ? t('admin.user.editUser') : t('admin.user.createUser') }}</h3> <!-- 弹窗主体:限制最大高度并采用纵向布局,便于“头部/内容/底部按钮”分区 -->
<div class="space-y-5"> <div class="bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[92vh] flex flex-col transform transition-all scale-100">
<!-- 头部固定区域 -->
<div class="px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-gray-100">
<h3 class="text-xl font-bold text-gray-900">{{ editingUser.id ? t('admin.user.editUser') : t('admin.user.createUser') }}</h3>
</div>
<!-- 内容滚动区域:字段较多时在此区域滚动,不挤压底部操作按钮 -->
<div class="px-5 sm:px-8 py-5 space-y-5 overflow-y-auto">
<div class="space-y-1.5"> <div class="space-y-1.5">
<label class="block text-xs font-semibold text-gray-500 uppercase tracking-wider">{{ t('admin.user.fields.realName') }}</label> <label class="block text-xs font-semibold text-gray-500 uppercase tracking-wider">{{ t('admin.user.fields.realName') }}</label>
<input <input
@@ -3316,7 +3368,8 @@ const handlePermissionImport = async (event: Event) => {
<div class="space-y-1.5 col-span-1 md:col-span-2"> <div class="space-y-1.5 col-span-1 md:col-span-2">
<label class="block text-xs font-semibold text-gray-500 uppercase tracking-wider">{{ t('admin.user.fields.allowedAgents') }}</label> <label class="block text-xs font-semibold text-gray-500 uppercase tracking-wider">{{ t('admin.user.fields.allowedAgents') }}</label>
<div class="grid grid-cols-2 gap-3 mt-2"> <!-- 可用应用:小屏单列,大屏双列,避免窄屏内容拥挤或溢出 -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 mt-2">
<label <label
v-for="agent in agents" v-for="agent in agents"
:key="agent.id" :key="agent.id"
@@ -3383,7 +3436,8 @@ const handlePermissionImport = async (event: Event) => {
/> />
</div> </div>
</div> </div>
<div class="flex justify-end gap-3 mt-8"> <!-- 底部固定操作区:始终可见,避免页面过长时按钮被滚动到视口外 -->
<div class="px-5 sm:px-8 py-4 border-t border-gray-100 flex justify-end gap-3 bg-white rounded-b-2xl">
<button <button
class="px-5 py-2.5 text-gray-600 hover:bg-gray-100 rounded-xl text-sm font-medium transition-colors" class="px-5 py-2.5 text-gray-600 hover:bg-gray-100 rounded-xl text-sm font-medium transition-colors"
@click="showUserModal = false" @click="showUserModal = false"
@@ -3406,8 +3460,8 @@ const handlePermissionImport = async (event: Event) => {
<div class="bg-white rounded-2xl shadow-xl w-full max-w-3xl max-h-[90vh] flex flex-col animate-fade-in-up"> <div class="bg-white rounded-2xl shadow-xl w-full max-w-3xl max-h-[90vh] flex flex-col animate-fade-in-up">
<div class="px-8 py-6 border-b border-gray-100 flex justify-between items-start"> <div class="px-8 py-6 border-b border-gray-100 flex justify-between items-start">
<div> <div>
<h3 class="text-lg font-bold text-gray-900">应用测试</h3> <h3 class="text-lg font-bold text-gray-900">{{ t('admin.agent.testModalTitle') }}</h3>
<p class="text-sm text-gray-500 mt-1">应用:<span class="font-medium text-blue-600">{{ testingAgent.name }}</span></p> <p class="text-sm text-gray-500 mt-1">{{ t('admin.agent.testModalAgent') }}:<span class="font-medium text-blue-600">{{ testingAgent.name }}</span></p>
</div> </div>
<button @click="showAgentTestModal = false" class="p-2 hover:bg-gray-100 rounded-full text-gray-400 hover:text-gray-600 transition-colors">✕</button> <button @click="showAgentTestModal = false" class="p-2 hover:bg-gray-100 rounded-full text-gray-400 hover:text-gray-600 transition-colors">✕</button>
</div> </div>
@@ -3415,32 +3469,32 @@ const handlePermissionImport = async (event: Event) => {
<div class="flex-1 overflow-y-auto p-8 space-y-5"> <div class="flex-1 overflow-y-auto p-8 space-y-5">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div class="text-sm text-gray-600"> <div class="text-sm text-gray-600">
<span v-if="agentTestResult?.tested_at">测试时间:{{ agentTestResult.tested_at }}</span> <span v-if="agentTestResult?.tested_at">{{ t('admin.agent.testedAt') }}:{{ agentTestResult.tested_at }}</span>
</div> </div>
<button <button
@click="runAgentTest()" @click="runAgentTest()"
:disabled="isTestingAgent" :disabled="isTestingAgent"
class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700 disabled:opacity-50" class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700 disabled:opacity-50"
> >
{{ isTestingAgent ? '测试中...' : '重新测试' }} {{ isTestingAgent ? t('admin.agent.testing') : t('admin.agent.retest') }}
</button> </button>
</div> </div>
<div v-if="isTestingAgent" class="text-sm text-gray-500">正在执行测试,请稍候...</div> <div v-if="isTestingAgent" class="text-sm text-gray-500">{{ t('admin.agent.testingInProgress') }}</div>
<template v-if="agentTestResult"> <template v-if="agentTestResult">
<div> <div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">请求地址</div> <div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">{{ t('admin.agent.requestUrl') }}</div>
<div class="p-3 rounded-lg bg-gray-50 border border-gray-200 text-sm font-mono break-all">{{ agentTestResult.request_url || '-' }}</div> <div class="p-3 rounded-lg bg-gray-50 border border-gray-200 text-sm font-mono break-all">{{ agentTestResult.request_url || '-' }}</div>
</div> </div>
<div> <div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">输出信息</div> <div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">{{ t('admin.agent.outputInfo') }}</div>
<pre class="p-3 rounded-lg bg-gray-50 border border-gray-200 text-sm whitespace-pre-wrap break-all max-h-64 overflow-y-auto">{{ agentTestResult.output_info || '-' }}</pre> <pre class="p-3 rounded-lg bg-gray-50 border border-gray-200 text-sm whitespace-pre-wrap break-all max-h-64 overflow-y-auto">{{ agentTestResult.output_info || '-' }}</pre>
</div> </div>
<div> <div>
<div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">最终结果分析</div> <div class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">{{ t('admin.agent.analysis') }}</div>
<div <div
class="p-3 rounded-lg border text-sm" class="p-3 rounded-lg border text-sm"
:class="agentTestResult.success ? 'bg-green-50 border-green-200 text-green-800' : 'bg-red-50 border-red-200 text-red-800'" :class="agentTestResult.success ? 'bg-green-50 border-green-200 text-green-800' : 'bg-red-50 border-red-200 text-red-800'"
@@ -3654,3 +3708,4 @@ const handlePermissionImport = async (event: Event) => {
</div> </div>
</div> </div>
</template> </template>
+114 -33
View File
@@ -25,6 +25,7 @@ const { t, locale } = useI18n();
const renderMarkdown = (text: string) => { const renderMarkdown = (text: string) => {
if (!text) return ''; if (!text) return '';
try { try {
// 把 # 标题、代码块、[链接](url) 等 Markdown 解析成 HTML
return marked.parse(text); return marked.parse(text);
} catch (e) { } catch (e) {
return text; return text;
@@ -63,6 +64,22 @@ interface SourceFileLink {
url: string; url: string;
} }
// 源文件展示配置(来自 config.ts)
const sourceFileConfig = {
// 是否显示整个“源文件”区域
showSourceFiles: config.workspace?.sourceFiles?.showSourceFiles !== false,
// 是否显示 MD 源文件(.md/.markdown)
showMdFiles: config.workspace?.sourceFiles?.showMdFiles !== false,
// MD 源文件是否默认展开“源文档”详情
expandMdByDefault: config.workspace?.sourceFiles?.expandMdByDefault === true,
};
const PREFERRED_SOURCE_EXTS = new Set([
'pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'csv',
'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp',
'txt', 'rtf', 'md', 'markdown',
]);
const safeDecode = (value: string) => { const safeDecode = (value: string) => {
try { try {
return decodeURIComponent(value); return decodeURIComponent(value);
@@ -92,6 +109,45 @@ const normalizeUrl = (url: string) => {
return ''; return '';
}; };
const getUrlExt = (url: string) => {
const clean = (url.split('?')[0] || '').toLowerCase();
const idx = clean.lastIndexOf('.');
if (idx < 0) return '';
return clean.slice(idx + 1);
};
const isChunkLikeLink = (url: string) => {
// 保留原始 Markdown 文件链接;仅过滤明显的分片/切片类链接。
return /segment|chunk|fragments?|split/i.test(url);
};
const isPreferredSourceLink = (url: string) => {
const ext = getUrlExt(url);
return PREFERRED_SOURCE_EXTS.has(ext);
};
const isNoisySourceUrl = (url: string) => {
// 带签名参数的下载链接在 UI 中可读性差(如 download?version_id=...&token=...)。
return /(?:^|\/)download\?/i.test(url) || /[?&](token|version_id|kind)=/i.test(url);
};
const isNoisySourceName = (name: string) => {
// 兜底过滤:名称如果本质是查询串而不是文件名,则不展示。
const n = (name || '').trim().toLowerCase();
return n.startsWith('download?') || n.includes('token=') || n.includes('version_id=');
};
const looksLikeFileName = (name: string) => {
const n = (name || '').trim();
if (!n) return false;
// 保留中英文文件名,如 员工手册.doc
return /\.[A-Za-z0-9]{2,8}$/.test(n);
};
const isMarkdownFileName = (name: string) => /\.(md|markdown)$/i.test((name || '').trim());
const isMarkdownByUrl = (url: string) => /\.(md|markdown)(?:$|\?)/i.test((url || '').toLowerCase());
const extractUrlsFromText = (text: string) => { const extractUrlsFromText = (text: string) => {
if (!text) return []; if (!text) return [];
const urls: string[] = []; const urls: string[] = [];
@@ -139,11 +195,13 @@ const getSourceLinks = (resources: any[] = []): SourceFileLink[] => {
const map = new Map<string, SourceFileLink>(); const map = new Map<string, SourceFileLink>();
for (const item of resources) { for (const item of resources) {
const directCandidates = [ const directCandidates = [
item?.source_download_url,
item?.url, item?.url,
item?.file_url, item?.file_url,
item?.document_url, item?.document_url,
item?.source_url, item?.source_url,
item?.download_url, item?.download_url,
item?.metadata?.source_download_url,
item?.metadata?.url, item?.metadata?.url,
item?.metadata?.file_url, item?.metadata?.file_url,
item?.metadata?.document_url, item?.metadata?.document_url,
@@ -157,7 +215,7 @@ const getSourceLinks = (resources: any[] = []): SourceFileLink[] => {
...extractUrlsFromText(serialized), ...extractUrlsFromText(serialized),
]; ];
// Parse explicit file URL array if Dify provides it. // 若 Dify 返回了 files 数组,额外补充其显式文件链接。
const files = Array.isArray(item?.files) ? item.files : []; const files = Array.isArray(item?.files) ? item.files : [];
for (const f of files) { for (const f of files) {
const fu = normalizeUrl(f?.url || f?.download_url || f?.file_url || ''); const fu = normalizeUrl(f?.url || f?.download_url || f?.file_url || '');
@@ -167,56 +225,72 @@ const getSourceLinks = (resources: any[] = []): SourceFileLink[] => {
} }
for (const url of discovered) { for (const url of discovered) {
const name = item?.document_name || item?.title || decodeURIComponent(url.split('/').pop() || 'source-file'); if (isChunkLikeLink(url)) continue;
// URL 若为噪声签名链接,且没有可用文件名元数据,则跳过。
if (isNoisySourceUrl(url) && !item?.source_filename && !item?.document_name) continue;
const name = item?.source_filename || item?.document_name || item?.title || safeDecode(url.split('/').pop() || 'source-file');
// Skip links whose display name itself is noisy.
if (isNoisySourceName(name)) continue;
// 根据配置决定是否显示 MD 文件
if (!sourceFileConfig.showMdFiles && (isMarkdownFileName(name) || isMarkdownByUrl(url))) continue;
const key = `${name}|${url}`; const key = `${name}|${url}`;
if (!map.has(key)) { if (!map.has(key)) {
map.set(key, { name, url }); map.set(key, { name, url });
} }
} }
} }
return Array.from(map.values()); const links = Array.from(map.values());
const preferred = links.filter((l) => isPreferredSourceLink(l.url));
return preferred.length > 0 ? preferred : links;
}; };
const getMessageLinks = (msg: any): SourceFileLink[] => { const getMessageLinks = (msg: any): SourceFileLink[] => {
if (!sourceFileConfig.showSourceFiles) return [];
const map = new Map<string, SourceFileLink>(); const map = new Map<string, SourceFileLink>();
const merge = (links: SourceFileLink[]) => { const merge = (links: SourceFileLink[]) => {
for (const link of links) { for (const link of links) {
if (isChunkLikeLink(link.url)) continue;
// 文件名有效时,保留文件按钮(即便 URL 是临时签名地址)。
if (isNoisySourceName(link.name)) continue;
if (!sourceFileConfig.showMdFiles && (isMarkdownFileName(link.name) || isMarkdownByUrl(link.url))) continue;
if (isMarkdownFileName(link.name)) {
const key = `${link.name}|${link.url}`;
if (!map.has(key)) map.set(key, link);
continue;
}
if (isNoisySourceUrl(link.url) && !looksLikeFileName(link.name)) continue;
const key = `${link.name}|${link.url}`; const key = `${link.name}|${link.url}`;
if (!map.has(key)) map.set(key, link); if (!map.has(key)) map.set(key, link);
} }
}; };
if (msg?.retriever_resources) { if (msg?.retriever_resources) {
// 仅使用结构化 retriever_resources 生成源文件按钮,
// 避免把回答正文里的普通 URL 误显示为“源文件”。
merge(getSourceLinks(msg.retriever_resources)); merge(getSourceLinks(msg.retriever_resources));
} }
const contentLinks = extractUrlsFromText(msg?.content || ''); const links = Array.from(map.values());
for (const url of contentLinks) { const preferred = links.filter((l) => isPreferredSourceLink(l.url));
const name = safeDecode(url.split('/').pop() || 'source-file'); return preferred.length > 0 ? preferred : links;
merge([{ name, url }]); };
}
if (Array.isArray(msg?.attribution_parts)) { const getDisplayRetrieverResources = (msg: any): any[] => {
for (const part of msg.attribution_parts) { if (!sourceFileConfig.showSourceFiles) return [];
const urls = extractUrlsFromText(typeof part === 'string' ? part : JSON.stringify(part)); const list = Array.isArray(msg?.retriever_resources) ? msg.retriever_resources : [];
for (const url of urls) { if (sourceFileConfig.showMdFiles) return list;
const name = safeDecode(url.split('/').pop() || 'source-file'); return list.filter((doc: any) => {
merge([{ name, url }]); const name = doc?.source_filename || doc?.document_name || doc?.title || '';
} const url = doc?.source_download_url || doc?.url || doc?.file_url || doc?.document_url || '';
} return !(isMarkdownFileName(String(name)) || isMarkdownByUrl(String(url)));
} });
};
// 5) 最后兜底:扫描整条 assistant 消息的 JSON 字符串。 const shouldExpandSourceDetails = (msg: any): boolean => {
// 用途:覆盖 Dify 在未知嵌套字段里返回链接但未被上面路径命中的情况。 if (!sourceFileConfig.showSourceFiles) return false;
const fullMessageText = JSON.stringify(msg || {}); if (!sourceFileConfig.showMdFiles || !sourceFileConfig.expandMdByDefault) return false;
const allUrls = extractUrlsFromText(fullMessageText); return getMessageLinks(msg).some((link) => isMarkdownFileName(link.name) || isMarkdownByUrl(link.url));
for (const url of allUrls) {
const name = safeDecode(url.split('/').pop() || 'source-file');
merge([{ name, url }]);
}
return Array.from(map.values());
}; };
const filePreviewVisible = ref(false); const filePreviewVisible = ref(false);
@@ -506,7 +580,7 @@ const submitFeedback = async () => {
</button> </button>
<div> <div>
<p class="font-semibold tracking-tight text-slate-900 dark:text-slate-100">{{ currentAgent?.name || $t('chat.defaultTitle') }}</p> <p class="font-semibold tracking-tight text-slate-900 dark:text-slate-100">{{ currentAgent?.name || $t('chat.defaultTitle') }}</p>
<p class="text-xs text-slate-500 dark:text-slate-400">HXOPS AI Assistant</p> <p class="text-xs text-slate-500 dark:text-slate-400">{{ $t('chat.assistantLabel') }}</p>
</div> </div>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@@ -585,9 +659,10 @@ const submitFeedback = async () => {
</div> </div>
<div <div
v-if="msg.role === 'assistant' && ((msg.retriever_resources && msg.retriever_resources.length > 0) || (msg.attribution_parts && msg.attribution_parts.length > 0) || getMessageLinks(msg).length > 0)" v-if="sourceFileConfig.showSourceFiles && msg.role === 'assistant' && ((getDisplayRetrieverResources(msg).length > 0) || (msg.attribution_parts && msg.attribution_parts.length > 0) || getMessageLinks(msg).length > 0)"
class="mt-2 space-y-2" class="mt-2 space-y-2"
> >
<!-- 带有URL链接的源文件名称,支持预览 -->
<div v-if="getMessageLinks(msg).length > 0" class="flex flex-wrap gap-2"> <div v-if="getMessageLinks(msg).length > 0" class="flex flex-wrap gap-2">
<button <button
v-for="(file, linkIndex) in getMessageLinks(msg)" v-for="(file, linkIndex) in getMessageLinks(msg)"
@@ -600,15 +675,16 @@ const submitFeedback = async () => {
</div> </div>
<details <details
v-if="msg.retriever_resources && msg.retriever_resources.length > 0" v-if="getDisplayRetrieverResources(msg).length > 0"
class="rounded-xl border border-slate-200 bg-slate-50/90 px-4 py-3 dark:border-slate-700 dark:bg-slate-800/65" class="rounded-xl border border-slate-200 bg-slate-50/90 px-4 py-3 dark:border-slate-700 dark:bg-slate-800/65"
:open="shouldExpandSourceDetails(msg)"
> >
<summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300"> <summary class="cursor-pointer text-xs font-semibold uppercase tracking-wide text-slate-600 dark:text-slate-300">
源文档 ({{ msg.retriever_resources.length }}) 源文档 ({{ getDisplayRetrieverResources(msg).length }})
</summary> </summary>
<div class="mt-3 space-y-2"> <div class="mt-3 space-y-2">
<div <div
v-for="(doc, docIndex) in msg.retriever_resources" v-for="(doc, docIndex) in getDisplayRetrieverResources(msg)"
:key="`${doc.document_name || 'doc'}-${doc.segment_id || docIndex}`" :key="`${doc.document_name || 'doc'}-${doc.segment_id || docIndex}`"
class="rounded-lg border border-slate-200 bg-white p-3 dark:border-slate-700 dark:bg-slate-900" class="rounded-lg border border-slate-200 bg-white p-3 dark:border-slate-700 dark:bg-slate-900"
> >
@@ -773,5 +849,10 @@ const submitFeedback = async () => {
</div> </div>
</div> </div>
<FilePreviewModal v-model="filePreviewVisible" :file="previewFile" /> <FilePreviewModal
v-model="filePreviewVisible"
:file="previewFile"
:agent-id="agentId"
:auth-headers="getAuthHeaders()"
/>
</template> </template>
+7 -5
View File
@@ -246,7 +246,9 @@ const handleChangePassword = async () => {
const handleLogout = () => { const handleLogout = () => {
localStorage.removeItem('hxops_user'); localStorage.removeItem('hxops_user');
router.push('/'); sessionStorage.removeItem('hxops_user');
sessionStorage.removeItem('hxops_wecom_state');
router.replace('/');
}; };
onMounted(() => { onMounted(() => {
@@ -290,7 +292,7 @@ onMounted(() => {
<h2 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ user.real_name || user.username }}</h2> <h2 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ user.real_name || user.username }}</h2>
<p class="text-slate-500 dark:text-slate-400 text-sm mt-1">{{ user.email }}</p> <p class="text-slate-500 dark:text-slate-400 text-sm mt-1">{{ user.email }}</p>
<div class="mt-4 inline-flex items-center px-3 py-1 rounded-full bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-300 text-xs font-medium"> <div class="mt-4 inline-flex items-center px-3 py-1 rounded-full bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-300 text-xs font-medium">
{{ user.role === 'admin' ? 'Administrator' : 'User' }} {{ user.role === 'admin' ? ($t('profile.roleAdmin') || 'Administrator') : ($t('profile.roleUser') || 'User') }}
</div> </div>
</div> </div>
@@ -315,7 +317,7 @@ onMounted(() => {
{{ isEditing ? ($t('profile.edit') || 'Edit') : ($t('profile.personalInfo') || 'Personal Information') }} {{ isEditing ? ($t('profile.edit') || 'Edit') : ($t('profile.personalInfo') || 'Personal Information') }}
</div> </div>
<div class="text-xs text-slate-500 dark:text-slate-400"> <div class="text-xs text-slate-500 dark:text-slate-400">
{{ isEditing ? 'You have unsaved changes' : 'Switch to edit mode to update profile details' }} {{ isEditing ? ($t('profile.unsavedChanges') || 'You have unsaved changes') : ($t('profile.editHint') || 'Switch to edit mode to update profile details') }}
</div> </div>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@@ -379,7 +381,7 @@ onMounted(() => {
<div> <div>
<label class="text-xs font-medium text-slate-500 uppercase flex items-center gap-1.5 mb-1.5"> <label class="text-xs font-medium text-slate-500 uppercase flex items-center gap-1.5 mb-1.5">
<Building class="w-3.5 h-3.5" /> {{ $t('admin.user.dept') || 'Department' }} <Building class="w-3.5 h-3.5" /> {{ $t('profile.department') || 'Department' }}
</label> </label>
<input v-if="isEditing" v-model="user.department" type="text" class="input-field" /> <input v-if="isEditing" v-model="user.department" type="text" class="input-field" />
<div v-else class="p-2.5 bg-slate-50 dark:bg-slate-800 rounded-lg text-slate-700 dark:text-slate-300 border border-slate-200 dark:border-slate-700 text-sm font-medium"> <div v-else class="p-2.5 bg-slate-50 dark:bg-slate-800 rounded-lg text-slate-700 dark:text-slate-300 border border-slate-200 dark:border-slate-700 text-sm font-medium">
@@ -418,7 +420,7 @@ onMounted(() => {
<div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div> <div>
<label class="text-xs font-medium text-slate-500 uppercase mb-1.5 block">Language</label> <label class="text-xs font-medium text-slate-500 uppercase mb-1.5 block">{{ $t('profile.language') || 'Language' }}</label>
<select <select
v-model="user.language" v-model="user.language"
:disabled="!isEditing" :disabled="!isEditing"
+56 -42
View File
@@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
/** /**
* WorkspaceView.vue * WorkspaceView.vue
* 文件用途:用户工作台,支持自定义布局、收藏、嵌入 Agent * 鏂囦欢鐢ㄩ€旓細鐢ㄦ埛宸ヤ綔鍙帮紝鏀寔鑷畾涔夊竷灞€銆佹敹钘忋€佸祵鍏?Agent
* 引用文件:vue, vue-router, lucide-vue-next, 后端 /api/user 接口 * 寮曠敤鏂囦欢锛歷ue, vue-router, lucide-vue-next, 鍚庣 /api/user 鎺ュ彛
*/ */
import { ref, onMounted, computed, watch } from 'vue'; import { ref, onMounted, computed, watch } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@@ -19,6 +19,7 @@ import {
Edit, Edit,
ExternalLink, ExternalLink,
Bot, Bot,
Lock,
User, User,
LogOut, LogOut,
Megaphone, Megaphone,
@@ -120,7 +121,7 @@ const isWecomLoggingIn = ref(false);
const handleForgotPassword = async () => { const handleForgotPassword = async () => {
if (!forgotPasswordForm.value.email) { if (!forgotPasswordForm.value.email) {
alert(t('register.email') + ' is required'); alert(t('register.emailRequired'));
return; return;
} }
@@ -133,21 +134,21 @@ const handleForgotPassword = async () => {
const data = await res.json(); const data = await res.json();
if (res.ok) { if (res.ok) {
alert(t('login.passwordResetEmailSent') || 'If the account exists, a reset link has been sent to your email.'); alert(t('login.passwordResetEmailSent'));
showForgotPasswordModal.value = false; showForgotPasswordModal.value = false;
forgotPasswordForm.value = { email: '' }; forgotPasswordForm.value = { email: '' };
} else { } else {
alert(data.error || 'Failed to request password reset'); alert(data.error || t('login.passwordResetRequestFailed'));
} }
} catch (e) { } catch (e) {
console.error('Password reset error', e); console.error('Password reset error', e);
alert('An error occurred'); alert(t('common.errorOccurred'));
} }
}; };
/* /*
const showLoginTip = () => { const showLoginTip = () => {
alert(t('login.pleaseLoginFirst') || 'Please login to access this agent.'); alert(t('login.pleaseLoginFirst'));
}; };
*/ */
const userReport = ref<any>(null); const userReport = ref<any>(null);
@@ -399,11 +400,11 @@ const handleLogin = async () => {
const err = await res.json(); const err = await res.json();
// Handle specific error messages if needed, or just alert // Handle specific error messages if needed, or just alert
let msg = err.error || t('login.failed'); let msg = err.error || t('login.failed');
if (err.error === 'User not found') msg = t('login.userNotFound') || 'User not found'; if (err.error === 'User not found') msg = t('login.userNotFound');
if (err.error === 'Incorrect password') msg = t('login.incorrectPassword') || 'Incorrect password'; if (err.error === 'Incorrect password') msg = t('login.incorrectPassword');
if (err.error === 'Account is disabled') msg = t('login.accountDisabled') || 'Account is disabled'; if (err.error === 'Account is disabled') msg = t('login.accountDisabled');
if (err.error === 'Database connection failed') msg = t('login.dbConnectionFailed') || 'Database connection failed'; if (err.error === 'Database connection failed') msg = t('login.dbConnectionFailed');
if (err.error === 'Internal server error') msg = t('login.internalError') || 'Internal server error'; if (err.error === 'Internal server error') msg = t('login.internalError');
alert(msg); alert(msg);
return; return;
@@ -426,7 +427,7 @@ const handleLogin = async () => {
} }
} catch (e) { } catch (e) {
console.error(e); console.error(e);
alert(t('login.requestFailed') || 'Login request failed. Please check your network or server status.'); alert(t('login.requestFailed'));
} }
}; };
@@ -438,7 +439,7 @@ const handleWecomLogin = async () => {
const res = await fetch(`${api}?redirect_uri=${encodeURIComponent(redirectUri)}`); const res = await fetch(`${api}?redirect_uri=${encodeURIComponent(redirectUri)}`);
const data = await res.json(); const data = await res.json();
if (!res.ok || !data.url) { if (!res.ok || !data.url) {
alert(data.error || 'Failed to start WeCom login'); alert(data.error || t('login.wecomStartFailed'));
return; return;
} }
if (data.state) { if (data.state) {
@@ -447,7 +448,7 @@ const handleWecomLogin = async () => {
window.location.href = data.url; window.location.href = data.url;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
alert('Failed to start WeCom login'); alert(t('login.wecomStartFailed'));
} }
}; };
@@ -461,7 +462,7 @@ const tryWecomCallbackLogin = async () => {
const expectedState = sessionStorage.getItem('hxops_wecom_state'); const expectedState = sessionStorage.getItem('hxops_wecom_state');
if (expectedState && state && state !== expectedState) { if (expectedState && state && state !== expectedState) {
alert('Invalid WeCom login state'); alert(t('login.wecomInvalidState'));
return true; return true;
} }
@@ -476,13 +477,13 @@ const tryWecomCallbackLogin = async () => {
const data = await res.json(); const data = await res.json();
if (!res.ok) { if (!res.ok) {
const rawError = String(data.error || ''); const rawError = String(data.error || '');
let friendly = rawError || 'WeCom login failed'; let friendly = rawError || t('login.wecomLoginFailed');
if (rawError.includes('Invalid or expired WeCom state')) { if (rawError.includes('Invalid or expired WeCom state')) {
friendly = '企业微信登录会话已过期,请重新点击企业微信登录'; friendly = t('login.wecomStateExpired');
} else if (rawError.includes('bind WeCom account') || rawError.includes('No linked account found')) { } else if (rawError.includes('bind WeCom account') || rawError.includes('No linked account found')) {
friendly = '当前企业微信账号未绑定本系统用户,请联系管理员在后台完成绑定'; friendly = t('login.wecomBindRequired');
} else if (rawError.includes('Account is disabled')) { } else if (rawError.includes('Account is disabled')) {
friendly = '账号已被禁用,请联系管理员'; friendly = t('login.wecomAccountDisabled');
} }
alert(friendly); alert(friendly);
return true; return true;
@@ -495,7 +496,7 @@ const tryWecomCallbackLogin = async () => {
return true; return true;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
alert('WeCom login failed'); alert(t('login.wecomLoginFailed'));
return true; return true;
} finally { } finally {
isWecomLoggingIn.value = false; isWecomLoggingIn.value = false;
@@ -587,7 +588,7 @@ const toggleFavorite = async (agentId: number) => {
// Quick Questions // Quick Questions
const getAgentName = (agentId: number) => { const getAgentName = (agentId: number) => {
const agent = agents.value.find(a => a.id === agentId); const agent = agents.value.find(a => a.id === agentId);
return agent ? agent.name : t('workspace.unknownAgent', 'Unknown Agent'); return agent ? agent.name : t('workspace.unknownAgent');
}; };
const openAddQuestionForm = () => { const openAddQuestionForm = () => {
@@ -614,7 +615,7 @@ const cancelAddQuestion = () => {
const saveQuickQuestion = async () => { const saveQuickQuestion = async () => {
if (!newQuestion.value.title || !newQuestion.value.question || !newQuestion.value.agent_id) { if (!newQuestion.value.title || !newQuestion.value.question || !newQuestion.value.agent_id) {
alert(t('workspace.quickQuestions.addTitle') + ' (Please fill all fields)'); alert(t('workspace.quickQuestions.msg.fillAll'));
return; return;
} }
@@ -705,8 +706,8 @@ onMounted(async () => {
<template> <template>
<div class="min-h-screen bg-gray-50 dark:bg-slate-950 font-sans text-slate-800 dark:text-slate-200"> <div class="min-h-screen bg-gray-50 dark:bg-slate-950 font-sans text-slate-800 dark:text-slate-200">
<!-- Top Right Controls --> <!-- 右上角全局控件:仅未登录页固定显示,避免与已登录头部区域重叠 -->
<div class="fixed top-4 right-4 z-50 flex items-center gap-2"> <div v-if="!isLoggedIn" class="fixed top-4 right-4 z-50 flex items-center gap-2">
<ThemeToggleButton /> <ThemeToggleButton />
<select v-model="locale" class="bg-white/80 dark:bg-slate-900/80 backdrop-blur-md shadow-sm border border-slate-200 dark:border-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 cursor-pointer outline-none rounded-full px-3 py-1.5 transition-all hover:shadow-md"> <select v-model="locale" class="bg-white/80 dark:bg-slate-900/80 backdrop-blur-md shadow-sm border border-slate-200 dark:border-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 cursor-pointer outline-none rounded-full px-3 py-1.5 transition-all hover:shadow-md">
<option value="en">English</option> <option value="en">English</option>
@@ -732,12 +733,22 @@ onMounted(async () => {
</div> </div>
<div class="flex items-center gap-4"> <div class="flex items-center gap-4">
<!-- 已登录页将主题与语言切换放入头部右侧,避免不同分辨率下被遮挡 -->
<div class="flex items-center gap-2">
<ThemeToggleButton />
<select v-model="locale" class="bg-white/80 dark:bg-slate-900/80 backdrop-blur-md shadow-sm border border-slate-200 dark:border-slate-700 text-xs font-medium text-slate-600 dark:text-slate-300 hover:text-slate-800 dark:hover:text-slate-100 cursor-pointer outline-none rounded-full px-3 py-1.5 transition-all hover:shadow-md">
<option value="en">English</option>
<option value="zh-CN">简体中文</option>
<option value="zh-TW">繁體中文</option>
<option value="th">ไทย</option>
</select>
</div>
<!-- User Profile Dropdown --> <!-- User Profile Dropdown -->
<div class="relative"> <div class="relative">
<button @click="showUserDropdown = !showUserDropdown" class="flex items-center gap-3 pl-3 pr-2 py-1.5 rounded-full hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors border border-transparent hover:border-slate-200 dark:hover:border-slate-700"> <button @click="showUserDropdown = !showUserDropdown" class="flex items-center gap-3 pl-3 pr-2 py-1.5 rounded-full hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors border border-transparent hover:border-slate-200 dark:hover:border-slate-700">
<div class="text-right hidden sm:block"> <div class="text-right hidden sm:block">
<div class="text-sm font-bold text-slate-900 dark:text-slate-100 leading-tight">{{ currentUser?.username }}</div> <div class="text-sm font-bold text-slate-900 dark:text-slate-100 leading-tight">{{ currentUser?.username }}</div>
<div class="text-[10px] font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wide">{{ currentUser?.role === 'admin' ? 'Admin' : 'User' }}</div> <div class="text-[10px] font-medium text-slate-500 dark:text-slate-400 uppercase tracking-wide">{{ currentUser?.role }}</div>
</div> </div>
<div class="w-9 h-9 bg-brand-100 rounded-full flex items-center justify-center text-brand-600 font-bold border-2 border-white shadow-sm"> <div class="w-9 h-9 bg-brand-100 rounded-full flex items-center justify-center text-brand-600 font-bold border-2 border-white shadow-sm">
{{ (currentUser?.username || 'U').charAt(0).toUpperCase() }} {{ (currentUser?.username || 'U').charAt(0).toUpperCase() }}
@@ -755,7 +766,7 @@ onMounted(async () => {
<button @click="navigateToProfile" class="w-full text-left px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-brand-600 flex items-center gap-2"> <button @click="navigateToProfile" class="w-full text-left px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-brand-600 flex items-center gap-2">
<User class="w-4 h-4" /> <User class="w-4 h-4" />
{{ $t('profile.title') || 'My Profile' }} {{ $t('profile.title') }}
</button> </button>
<button v-if="currentUser?.role === 'admin'" @click="router.push('/admin')" class="w-full text-left px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-brand-600 flex items-center gap-2"> <button v-if="currentUser?.role === 'admin'" @click="router.push('/admin')" class="w-full text-left px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-brand-600 flex items-center gap-2">
@@ -786,30 +797,32 @@ onMounted(async () => {
</div> </div>
<!-- Not Logged In (Login Screen) --> <!-- Not Logged In (Login Screen) -->
<div v-else-if="!isLoggedIn" class="min-h-[calc(100vh-4rem)] flex items-center justify-center -mt-16 md:-mt-20"> <div v-else-if="!isLoggedIn" class="min-h-[calc(100vh-4rem)] flex items-center justify-center">
<div class="w-full max-w-6xl grid grid-cols-1 lg:grid-cols-2 gap-12 items-center p-4"> <div class="w-full max-w-6xl grid grid-cols-1 lg:grid-cols-2 gap-12 items-center p-4">
<!-- Hero Section --> <!-- Hero Section -->
<div class="hidden lg:block space-y-8 animate-slide-up"> <div class="hidden lg:block space-y-8 animate-slide-up">
<!--
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-brand-50 text-brand-600 text-sm font-medium border border-brand-100"> <div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-brand-50 text-brand-600 text-sm font-medium border border-brand-100">
<span class="relative flex h-2 w-2"> <span class="relative flex h-2 w-2">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-400 opacity-75"></span> <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-brand-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-2 w-2 bg-brand-500"></span> <span class="relative inline-flex rounded-full h-2 w-2 bg-brand-500"></span>
</span> </span>
Enterprise AI Gateway {{ $t('title') }}
</div> </div>
-->
<h1 class="text-5xl font-bold text-slate-900 leading-tight"> <h1 class="text-5xl font-bold text-slate-900 leading-tight">
Unleash the Power of <br/> {{ $t('landing.hero.prefix') }} <br/>
<span class="text-transparent bg-clip-text bg-gradient-to-r from-brand-600 to-purple-600">Generative AI</span> <span class="text-transparent bg-clip-text bg-gradient-to-r from-brand-600 to-purple-600">{{ $t('landing.hero.highlight') }}</span>
</h1> </h1>
<p class="text-lg text-slate-600 max-w-md leading-relaxed"> <p class="text-lg text-slate-600 max-w-md leading-relaxed">
Access a suite of powerful AI agents tailored for your enterprise needs. Secure, scalable, and intelligent. {{ $t('landing.hero.subtitle') }}
</p> </p>
<!-- Announcements List --> <!-- Announcements List -->
<div v-if="announcements.length > 0" class="bg-white/60 dark:bg-slate-900/70 backdrop-blur-sm rounded-2xl border border-slate-100 dark:border-slate-700 p-6 shadow-sm"> <div v-if="announcements.length > 0" class="bg-white/60 dark:bg-slate-900/70 backdrop-blur-sm rounded-2xl border border-slate-100 dark:border-slate-700 p-6 shadow-sm">
<h3 class="text-sm font-bold text-slate-900 mb-4 flex items-center gap-2"> <h3 class="text-sm font-bold text-slate-900 mb-4 flex items-center gap-2">
<Megaphone class="w-4 h-4 text-brand-600" /> <Megaphone class="w-4 h-4 text-brand-600" />
{{ $t('login.announcements') || 'Announcements' }} {{ $t('login.announcements') }}
</h3> </h3>
<div class="space-y-3"> <div class="space-y-3">
<div v-for="ann in announcements.slice(0, 3)" :key="ann.id" <div v-for="ann in announcements.slice(0, 3)" :key="ann.id"
@@ -824,7 +837,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
<div class="grid grid-cols-2 gap-4"> <div v-if="isLoggedIn" class="grid grid-cols-2 gap-4">
<div v-for="agent in publicAgents.slice(0, 4)" :key="agent.id" <div v-for="agent in publicAgents.slice(0, 4)" :key="agent.id"
class="bg-white dark:bg-slate-900 p-4 rounded-xl border border-slate-100 dark:border-slate-700 shadow-sm flex items-center gap-3"> class="bg-white dark:bg-slate-900 p-4 rounded-xl border border-slate-100 dark:border-slate-700 shadow-sm flex items-center gap-3">
<div class="w-10 h-10 bg-brand-50 rounded-lg flex items-center justify-center text-brand-600 shrink-0"> <div class="w-10 h-10 bg-brand-50 rounded-lg flex items-center justify-center text-brand-600 shrink-0">
@@ -832,7 +845,7 @@ onMounted(async () => {
</div> </div>
<div class="truncate"> <div class="truncate">
<div class="font-semibold text-slate-900 text-sm truncate">{{ agent.name }}</div> <div class="font-semibold text-slate-900 text-sm truncate">{{ agent.name }}</div>
<div class="text-xs text-slate-500 truncate">AI Assistant</div> <div class="text-xs text-slate-500 truncate">{{ $t('landing.agent.role') }}</div>
</div> </div>
</div> </div>
@@ -864,7 +877,7 @@ onMounted(async () => {
<div class="flex items-center gap-2 mt-2"> <div class="flex items-center gap-2 mt-2">
<input type="checkbox" id="rememberMe" v-model="rememberMe" class="rounded border-slate-300 text-brand-600 focus:ring-brand-500 w-4 h-4" /> <input type="checkbox" id="rememberMe" v-model="rememberMe" class="rounded border-slate-300 text-brand-600 focus:ring-brand-500 w-4 h-4" />
<label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') || 'Remember me for 30 days' }}</label> <label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') }}</label>
</div> </div>
<button @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4"> <button @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
@@ -877,21 +890,22 @@ onMounted(async () => {
:disabled="isWecomLoggingIn" :disabled="isWecomLoggingIn"
class="btn-secondary w-full py-3 text-base mt-3 disabled:opacity-60 disabled:cursor-not-allowed" class="btn-secondary w-full py-3 text-base mt-3 disabled:opacity-60 disabled:cursor-not-allowed"
> >
{{ isWecomLoggingIn ? ($t('login.wecomConnecting') || 'Connecting to WeCom...') : ($t('login.wecomLogin') || 'Login with WeCom') }} {{ isWecomLoggingIn ? $t('login.wecomConnecting') : $t('login.wecomLogin') }}
</button> </button>
<div class="flex justify-between items-center pt-4 mt-2 border-t border-slate-100/50"> <div class="flex justify-between items-center pt-4 mt-2 border-t border-slate-100/50">
<button @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors"> <button @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors">
{{ $t('login.forgotPassword') }} {{ $t('login.forgotPassword') }}
</button> </button>
<button @click="showRegisterModal = true" class="text-sm font-semibold text-brand-600 hover:text-brand-700 hover:underline transition-colors"> <!-- 点击注册 -->
<!-- <button @click="showRegisterModal = true" class="text-sm font-semibold text-brand-600 hover:text-brand-700 hover:underline transition-colors">
{{ $t('login.registerLink') }} {{ $t('login.registerLink') }}
</button> </button> -->
</div> </div>
</div> </div>
<!-- Public Agents Showcase Mobile --> <!-- Public Agents Showcase Mobile -->
<div v-if="publicAgents.length > 0" class="mt-8 pt-6 border-t border-slate-100 lg:hidden"> <div v-if="isLoggedIn && publicAgents.length > 0" class="mt-8 pt-6 border-t border-slate-100 lg:hidden">
<div class="grid grid-cols-4 gap-3"> <div class="grid grid-cols-4 gap-3">
<div v-for="agent in publicAgents.slice(0, 4)" :key="agent.id" <div v-for="agent in publicAgents.slice(0, 4)" :key="agent.id"
class="flex flex-col items-center"> class="flex flex-col items-center">
@@ -1097,7 +1111,7 @@ onMounted(async () => {
<Lock class="w-6 h-6" /> <Lock class="w-6 h-6" />
</div> </div>
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ $t('login.forgotPassword') }}</h3> <h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ $t('login.forgotPassword') }}</h3>
<p class="text-slate-500 dark:text-slate-400 text-sm mt-2">{{ $t('login.forgotPasswordDesc') || 'Enter your email to reset your password' }}</p> <p class="text-slate-500 dark:text-slate-400 text-sm mt-2">{{ $t('login.forgotPasswordDesc') }}</p>
</div> </div>
<div class="space-y-4"> <div class="space-y-4">
@@ -1107,7 +1121,7 @@ onMounted(async () => {
<div class="flex justify-end gap-3 mt-8"> <div class="flex justify-end gap-3 mt-8">
<button @click="showForgotPasswordModal = false" class="btn-secondary flex-1">{{ $t('register.cancel') }}</button> <button @click="showForgotPasswordModal = false" class="btn-secondary flex-1">{{ $t('register.cancel') }}</button>
<button @click="handleForgotPassword" class="btn-primary flex-1">{{ $t('login.findPassword') || 'Find Password' }}</button> <button @click="handleForgotPassword" class="btn-primary flex-1">{{ $t('login.findPassword') }}</button>
</div> </div>
</div> </div>
</div> </div>
+163
View File
@@ -0,0 +1,163 @@
param(
[ValidateSet("sqlite", "postgres")]
[string]$DbMode = "sqlite",
[string]$DatabaseUrl = "",
[switch]$SkipInstall
)
$ErrorActionPreference = "Stop"
function Test-CommandExists {
param([string]$Name)
return $null -ne (Get-Command $Name -ErrorAction SilentlyContinue)
}
function Get-PythonCommand {
$candidates = @(
"py -3.12",
"py -3.11",
"py -3",
"python"
)
foreach ($candidate in $candidates) {
try {
$parts = $candidate.Split(" ", 2)
$exe = $parts[0]
$args = if ($parts.Count -gt 1) { $parts[1] } else { "" }
if (-not (Test-CommandExists $exe)) {
continue
}
if ([string]::IsNullOrWhiteSpace($args)) {
& $exe --version | Out-Null
}
else {
& $exe $args --version | Out-Null
}
return $candidate
}
catch {
continue
}
}
throw "Python was not found. Please install Python 3.11+."
}
function Ensure-Backend {
param(
[string]$BackendPath,
[string]$PyCmd,
[string]$Mode,
[string]$DbUrl,
[bool]$DoInstall
)
Write-Host "[backend] preparing..." -ForegroundColor Cyan
Set-Location $BackendPath
if (-not (Test-Path ".\venv\Scripts\python.exe")) {
Write-Host "[backend] creating virtualenv..." -ForegroundColor Yellow
if ($PyCmd -like "py *") {
$parts = $PyCmd.Split(" ", 2)
& $parts[0] $parts[1] -m venv venv
}
else {
& $PyCmd -m venv venv
}
}
$venvPy = Join-Path $BackendPath "venv\Scripts\python.exe"
if ($DoInstall) {
Write-Host "[backend] installing python dependencies..." -ForegroundColor Yellow
& $venvPy -m pip install --upgrade pip
& $venvPy -m pip install -r requirements.txt
}
if ($Mode -eq "sqlite") {
Write-Host "[backend] initializing sqlite data..." -ForegroundColor Yellow
& $venvPy .\init_local_db.py
}
else {
if (-not [string]::IsNullOrWhiteSpace($DbUrl)) {
$env:DATABASE_URL = $DbUrl
Write-Host "[backend] DATABASE_URL set from parameter." -ForegroundColor Yellow
}
elseif (-not $env:DATABASE_URL) {
Write-Warning "DbMode=postgres but DATABASE_URL is not set. Using app default from backend/app/config.py."
}
Write-Host "[backend] initializing postgres data..." -ForegroundColor Yellow
& $venvPy .\init_db.py
& $venvPy .\fix_admin.py
}
}
function Ensure-Frontend {
param(
[string]$FrontendPath,
[bool]$DoInstall
)
if (-not (Test-CommandExists "npm")) {
throw "npm was not found. Please install Node.js (with npm)."
}
Write-Host "[frontend] preparing..." -ForegroundColor Cyan
Set-Location $FrontendPath
if ($DoInstall) {
Write-Host "[frontend] installing npm dependencies..." -ForegroundColor Yellow
npm install
}
}
function Start-BackendWindow {
param(
[string]$BackendPath,
[string]$Mode,
[string]$DbUrl
)
$dbExport = ""
if ($Mode -eq "postgres" -and -not [string]::IsNullOrWhiteSpace($DbUrl)) {
$escaped = $DbUrl.Replace("'", "''")
$dbExport = "`$env:DATABASE_URL='$escaped'; "
}
$cmd = "$dbExport Set-Location '$BackendPath'; .\venv\Scripts\python.exe .\run.py"
Start-Process powershell -ArgumentList @("-NoExit", "-ExecutionPolicy", "Bypass", "-Command", $cmd) | Out-Null
}
function Start-FrontendWindow {
param([string]$FrontendPath)
$cmd = "Set-Location '$FrontendPath'; npm run dev"
Start-Process powershell -ArgumentList @("-NoExit", "-ExecutionPolicy", "Bypass", "-Command", $cmd) | Out-Null
}
$repoRoot = Split-Path -Parent $PSScriptRoot
$backendDir = Join-Path $repoRoot "backend"
$frontendDir = Join-Path $repoRoot "frontend"
if (-not (Test-Path $backendDir)) { throw "backend directory not found: $backendDir" }
if (-not (Test-Path $frontendDir)) { throw "frontend directory not found: $frontendDir" }
$pythonCmd = Get-PythonCommand
$doInstall = -not $SkipInstall.IsPresent
Write-Host "== HXOPS local startup ==" -ForegroundColor Green
Write-Host "mode: $DbMode" -ForegroundColor Green
Ensure-Backend -BackendPath $backendDir -PyCmd $pythonCmd -Mode $DbMode -DbUrl $DatabaseUrl -DoInstall $doInstall
Ensure-Frontend -FrontendPath $frontendDir -DoInstall $doInstall
Start-BackendWindow -BackendPath $backendDir -Mode $DbMode -DbUrl $DatabaseUrl
Start-FrontendWindow -FrontendPath $frontendDir
Write-Host ""
Write-Host "Started in two new PowerShell windows." -ForegroundColor Green
Write-Host "Frontend URL: http://127.0.0.1:8881" -ForegroundColor Green
Write-Host "Default local admin (sqlite/init scripts): admin / Hxit@54321" -ForegroundColor Green