报表分组

This commit is contained in:
Àî×ÚÕñ 2022-08-29 15:45:42 +08:00
parent 5501e28b62
commit 373b214cff
2 changed files with 24 additions and 18 deletions

View File

@ -888,24 +888,30 @@ async def find_mode(
) -> schemas.Msg:
"""查找hr所有分组"""
data = await crud.api_interview_modes.get_interview_modes(db, data_in)
new_data = []
if data:
for i in data:
new_i = deepcopy(i)
tables = i['mode_list']
if tables:
new_tables = []
table_data = await crud.api_interview_tables.get_tables(db, {'table_id': {'$in': tables}})
for table in table_data:
new_table = {
'title': table['title'],
'url': table['url']
}
new_tables.append(new_table)
new_i['mode_list'] = new_tables
new_data.append(new_i)
return schemas.Msg(code=200, msg='ok', data=data)
return schemas.Msg(code=200, msg='ok', data=new_data)
@router.post("/find_mode_tables")
async def find_mode_tables(
request: Request,
data_in: schemas.UpdateModes,
db: AsyncIOMotorDatabase = Depends(get_database),
) -> schemas.Msg:
"""获取一条hr分组包含的报表"""
mode_data = await crud.api_interview_modes.get_one_mode(db, data_in.mode_id)
new_tables = []
if mode_data:
tables = mode_data['mode_list']
if tables:
table_data = await crud.api_interview_tables.get_tables(db, {'table_id': {'$in': tables}})
for table in table_data:
new_table = {
'table_id': table['table_id'],
'title': table['title'],
'url': table['url']
}
new_tables.append(new_table)
return schemas.Msg(code=200, msg='ok', data=new_tables)
@router.post("/update_mode")

View File

@ -28,4 +28,4 @@ class FindModes(BaseModel):
# 更新分组
class UpdateModes(BaseModel):
mode_id: str # 模板唯一id
update_data: dict # 更新的数据
update_data: dict = {} # 更新的数据