diff --git a/app/run.py b/app/run.py index be2f470..2392e3c 100644 --- a/app/run.py +++ b/app/run.py @@ -1358,12 +1358,66 @@ def delete_history_records(): deleted_count += db.delete_record(record_id) return jsonify({ - "success": True, + "success": True, "message": f"成功删除 {deleted_count} 条记录", "deleted_count": deleted_count }) +# 获取任务最新转存记录日期 +@app.route("/task_latest_records") +def get_task_latest_records(): + if not is_login(): + return jsonify({"success": False, "message": "未登录"}) + + try: + # 初始化数据库 + db = RecordDB() + + # 获取所有任务的最新转存记录 + cursor = db.conn.cursor() + query = """ + SELECT task_name, MAX(transfer_time) as latest_transfer_time + FROM transfer_records + WHERE task_name != 'rename' + GROUP BY task_name + """ + cursor.execute(query) + results = cursor.fetchall() + + # 转换为字典格式 + task_latest_records = {} + for row in results: + task_name, latest_time = row + if latest_time: + try: + # 确保时间戳在合理范围内 + timestamp = int(latest_time) + if timestamp > 9999999999: # 检测是否为毫秒级时间戳(13位) + timestamp = timestamp / 1000 # 转换为秒级时间戳 + + if 0 < timestamp < 4102444800: # 从1970年到2100年的合理时间戳范围 + # 格式化为月-日格式 + date_obj = datetime.fromtimestamp(timestamp) + formatted_date = date_obj.strftime("%m-%d") + task_latest_records[task_name] = formatted_date + except (ValueError, TypeError, OverflowError): + pass # 忽略无效的时间戳 + + db.close() + + return jsonify({ + "success": True, + "data": task_latest_records + }) + + except Exception as e: + return jsonify({ + "success": False, + "message": f"获取任务最新记录失败: {str(e)}" + }) + + # 删除单条转存记录 @app.route("/delete_history_record", methods=["POST"]) def delete_history_record(): diff --git a/app/static/css/main.css b/app/static/css/main.css index 5154eb2..27e6fe9 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -4055,24 +4055,45 @@ table.selectable-records .expand-button:hover { } } +/* 任务最近更新日期样式 */ +.task-latest-date { + color: var(--dark-text-color); + font-size: 0.95rem; + font-weight: normal; + opacity: 1; + transition: opacity 0.2s ease; +} + +/* 悬停显示模式 */ +.task .btn:not(:hover) .task-latest-date.hover-only { + opacity: 0; +} + +.task .btn:hover .task-latest-date.hover-only { + opacity: 1; +} + +/* 显示设置行样式 */ +.display-setting-row > [class*='col-'] { + padding-left: 4px !important; + padding-right: 4px !important; +} + +.display-setting-row { + margin-left: -4px !important; + margin-right: -4px !important; +} + @media (min-width: 992px) { .display-setting-row > .col-lg-3 { padding-left: 4px !important; padding-right: 4px !important; } - .display-setting-row { - margin-left: -4px !important; - margin-right: -4px !important; - } } -.display-setting-row > [class*='col-'] { - padding-left: 4px !important; - padding-right: 4px !important; -} -.display-setting-row { - margin-left: -4px !important; - margin-right: -4px !important; +/* 调整显示设置第二行的上边距,使其与第一行保持8px间距 */ +.display-setting-row + .display-setting-row { + margin-top: -8px !important; } /* 文件整理性能设置样式 */ diff --git a/app/templates/index.html b/app/templates/index.html index b854762..41dfb67 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -705,6 +705,20 @@ +