fix: 自动创建KPI时补全所有NOT NULL字段(formula/data_source/data_owner/unit/entity_id)
This commit is contained in:
@@ -244,11 +244,17 @@ async def import_excel_smart(file: UploadFile = File(...), db: Session = Depends
|
||||
if not kpi_code:
|
||||
new_code = f"{stype_prefix}{len(kpis) + created_kpis + 1:03d}"
|
||||
new_kpi = KPIDefinition(
|
||||
entity_id=1,
|
||||
kpi_code=new_code,
|
||||
kpi_name=clean_name,
|
||||
dimension="finance",
|
||||
category="financial_report",
|
||||
formula="-",
|
||||
data_source_type="excel",
|
||||
data_source="Excel导入",
|
||||
data_owner="财务部",
|
||||
frequency="monthly",
|
||||
unit="元",
|
||||
status="active",
|
||||
)
|
||||
db.add(new_kpi)
|
||||
|
||||
Reference in New Issue
Block a user