Commit 88ea9edd by 周立明

Merge branch 'v1.2' of http://192.168.3.233:8090/data_report/data-report into v1.2

2 parents 15118f4d 72d8e8e4
...@@ -33,5 +33,5 @@ INIT_NICKNAME=系统管理员 ...@@ -33,5 +33,5 @@ INIT_NICKNAME=系统管理员
# ---------- 服务 ---------- # ---------- 服务 ----------
FLASK_HOST=0.0.0.0 FLASK_HOST=0.0.0.0
FLASK_PORT=5000 FLASK_PORT=5001
FLASK_DEBUG=true FLASK_DEBUG=true
...@@ -181,4 +181,34 @@ class Config: ...@@ -181,4 +181,34 @@ class Config:
'主机厂数据表', '主机厂数据表',
], ],
}, },
# 阿维塔专项:当前仅需上传主机厂数据表;
# forms[0] 的附件表名为暂定,后续若改名只需改此处。
'avita_special': {
'name': '阿维塔专项',
'need_period': False,
'forms': [
'主机厂数据表',
],
},
# 零跑专项 / 岚图专项:无需上传 Excel,need_period=True 需要所属周期
'leapmotor_special': {
'name': '零跑专项',
'need_period': True,
'forms': [],
},
'voyah_special': {
'name': '岚图专项',
'need_period': True,
'forms': [],
},
# 通用+权益:支持按月/按周粒度,含 3 个附件
'common_equity': {
'name': '通用+权益',
'need_period': True,
'forms': [
'区域维度数据',
'汇总区数据',
'红黄门店数据',
],
},
} }
...@@ -11,7 +11,8 @@ class DataProcessTask(db.Model): ...@@ -11,7 +11,8 @@ class DataProcessTask(db.Model):
"""数据处理任务单据表""" """数据处理任务单据表"""
__tablename__ = 'data_process_task' __tablename__ = 'data_process_task'
__table_args__ = ( __table_args__ = (
db.UniqueConstraint('data_table_type', 'month', name='uq_task_type_month'), db.UniqueConstraint('data_table_type', 'month', 'period_start', 'period_end',
name='uq_task_type_month_period'),
{'comment': '数据处理任务单据表'}, {'comment': '数据处理任务单据表'},
) )
...@@ -19,8 +20,11 @@ class DataProcessTask(db.Model): ...@@ -19,8 +20,11 @@ class DataProcessTask(db.Model):
data_table_type = db.Column(db.String(50), nullable=False, comment='数据表类型编码(如 budget_achievement)') data_table_type = db.Column(db.String(50), nullable=False, comment='数据表类型编码(如 budget_achievement)')
data_table_type_name = db.Column(db.String(100), default='', comment='数据表类型中文名(如 预算达成数据)') data_table_type_name = db.Column(db.String(100), default='', comment='数据表类型中文名(如 预算达成数据)')
month = db.Column(db.String(7), nullable=False, comment='所属月份,格式 YYYY-MM') month = db.Column(db.String(7), nullable=False, comment='所属月份,格式 YYYY-MM')
period_start = db.Column(db.Date, nullable=True, comment='所属周期-开始日期(need_period 类型使用,如 2026-08-01)') period_type = db.Column(db.String(10), nullable=False, default='month',
period_end = db.Column(db.Date, nullable=True, comment='所属周期-结束日期(need_period 类型使用,如 2026-08-31)') comment='周期粒度:month 按月 / week 按周')
week_num = db.Column(db.Integer, nullable=True, comment='按周时的周序号 1-5;按月时为 NULL')
period_start = db.Column(db.Date, nullable=True, comment='所属周期-开始日期(事实日期区间,两种粒度都填)')
period_end = db.Column(db.Date, nullable=True, comment='所属周期-结束日期(事实日期区间,两种粒度都填)')
status = db.Column(db.String(20), nullable=False, default='PROCESSING', comment='状态:PROCESSING处理中 / COMPLETED已完成 / FAILED失败') status = db.Column(db.String(20), nullable=False, default='PROCESSING', comment='状态:PROCESSING处理中 / COMPLETED已完成 / FAILED失败')
error_msg = db.Column(db.String(500), default='', comment='失败原因(状态为 FAILED 时记录)') error_msg = db.Column(db.String(500), default='', comment='失败原因(状态为 FAILED 时记录)')
result_file_url = db.Column(db.String(500), default='', comment='结果 Excel 的 OSS 链接(完成后回填)') result_file_url = db.Column(db.String(500), default='', comment='结果 Excel 的 OSS 链接(完成后回填)')
...@@ -37,6 +41,8 @@ class DataProcessTask(db.Model): ...@@ -37,6 +41,8 @@ class DataProcessTask(db.Model):
'data_table_type': self.data_table_type, 'data_table_type': self.data_table_type,
'data_table_type_name': self.data_table_type_name, 'data_table_type_name': self.data_table_type_name,
'month': self.month, 'month': self.month,
'period_type': self.period_type or 'month',
'week_num': self.week_num,
'period_start': self.period_start.strftime('%Y-%m-%d') if self.period_start else '', 'period_start': self.period_start.strftime('%Y-%m-%d') if self.period_start else '',
'period_end': self.period_end.strftime('%Y-%m-%d') if self.period_end else '', 'period_end': self.period_end.strftime('%Y-%m-%d') if self.period_end else '',
'status': self.status, 'status': self.status,
......
...@@ -424,3 +424,29 @@ tbody tr:hover { background: #f8fafd; } ...@@ -424,3 +424,29 @@ tbody tr:hover { background: #f8fafd; }
animation: spin .8s linear infinite; animation: spin .8s linear infinite;
} }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes spin { to { transform: rotate(360deg); } }
/* 周期粒度分段按钮(按月/按周 切换) */
.seg-group {
display: inline-flex;
border: 1px solid #dcdfe6;
border-radius: 4px;
overflow: hidden;
background: #fff;
}
.seg-group .seg-btn {
padding: 4px 12px;
font-size: 13px;
border: none;
background: #fff;
color: #606266;
cursor: pointer;
border-right: 1px solid #dcdfe6;
transition: all .15s;
white-space: nowrap;
}
.seg-group .seg-btn:last-child { border-right: none; }
.seg-group .seg-btn:hover { color: #185fa5; }
.seg-group .seg-btn.active {
background: #185fa5;
color: #fff;
}
...@@ -53,6 +53,14 @@ ...@@ -53,6 +53,14 @@
</div> </div>
</div> </div>
<div class="filter-item"> <div class="filter-item">
<label>粒度</label>
<div class="seg-group" id="fPeriodTypeGroup">
<button type="button" class="seg-btn active" data-type="">全部</button>
<button type="button" class="seg-btn" data-type="month">按月</button>
<button type="button" class="seg-btn" data-type="week">按周</button>
</div>
</div>
<div class="filter-item">
<label>创建人</label> <label>创建人</label>
<input id="fCreator" maxlength="20" placeholder="请输入"> <input id="fCreator" maxlength="20" placeholder="请输入">
</div> </div>
...@@ -147,6 +155,18 @@ ...@@ -147,6 +155,18 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal-row" id="mPeriodTypeRow" style="display:none">
<label>周期粒度</label>
<div class="modal-control">
<div class="seg-group" id="mPeriodTypeGroup">
<button type="button" class="seg-btn active" data-type="month">按月</button>
<button type="button" class="seg-btn" data-type="week">按周</button>
</div>
<select id="mWeekSelect" style="display:none; margin-left:10px; min-width:140px;">
<!-- 由 JS 动态渲染 W1~W5 -->
</select>
</div>
</div>
<div class="modal-row" id="mPeriodRow" style="display:none"> <div class="modal-row" id="mPeriodRow" style="display:none">
<label class="required">所属周期</label> <label class="required">所属周期</label>
<div class="modal-control"> <div class="modal-control">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!