- 完成系统架构和数据模型设计,包括项目、工时记录、休息日和周期表模型 - 设计项目管理模块,支持传统项目与PSI项目管理及批量导入功能 - 规划工时记录模块,含日期、事件描述、项目选择及工时计算规则 - 定义休息日分类,支持周末、国定节假日、个人假期及调休工时管理 - 制定统计分析模块设计,支持按Cut-Off周期的周统计与项目工时分布 - 设计周期管理模块,提供周期设置及预设模板功能 - 制定用户界面布局及各页面表单、样式设计方案 - 规划RESTful API端点,涵盖项目、工时记录、休息日、周期及统计数据操作 - 设计数据流示意,阐明操作流程及前后端交互逻辑 - 制定数据存储方案,包括SQLite数据库配置及备份导出机制
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
from flask import Flask, render_template
|
|
from flask_cors import CORS
|
|
from sqlalchemy import create_engine
|
|
from backend.models.models import Base
|
|
from backend.api.projects import projects_bp
|
|
from backend.api.timerecords import timerecords_bp
|
|
from backend.api.statistics import statistics_bp
|
|
import os
|
|
|
|
def create_app():
|
|
app = Flask(__name__,
|
|
template_folder='../templates',
|
|
static_folder='../static')
|
|
|
|
# 启用CORS支持
|
|
CORS(app)
|
|
|
|
# 确保数据目录存在
|
|
os.makedirs('data', exist_ok=True)
|
|
|
|
# 创建数据库表
|
|
engine = create_engine('sqlite:///data/timetrack.db')
|
|
Base.metadata.create_all(engine)
|
|
|
|
# 注册蓝图
|
|
app.register_blueprint(projects_bp)
|
|
app.register_blueprint(timerecords_bp)
|
|
app.register_blueprint(statistics_bp)
|
|
|
|
# 主页路由
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
@app.route('/projects')
|
|
def projects():
|
|
return render_template('projects.html')
|
|
|
|
@app.route('/timerecords')
|
|
def timerecords():
|
|
return render_template('timerecords.html')
|
|
|
|
@app.route('/statistics')
|
|
def statistics():
|
|
return render_template('statistics.html')
|
|
|
|
return app
|
|
|
|
if __name__ == '__main__':
|
|
app = create_app()
|
|
app.run(debug=True, host='0.0.0.0', port=5000) |