|
@@ -80,7 +80,7 @@ async def get_dict_data_by_type(
|
|
):
|
|
):
|
|
try:
|
|
try:
|
|
# 根据 dict_type 查询字典数据
|
|
# 根据 dict_type 查询字典数据
|
|
- # dict_data = db.query(SysDictData).filter_by(dict_type=dictType).all()
|
|
|
|
|
|
+ # dict_data = dict_type_get_dict_data_info(db,'three_proofing')
|
|
query = db.query(ThreeProofingResponsibleType)
|
|
query = db.query(ThreeProofingResponsibleType)
|
|
|
|
|
|
# 添加查询条件
|
|
# 添加查询条件
|
|
@@ -256,3 +256,35 @@ async def delete_dict_data(
|
|
# 处理异常
|
|
# 处理异常
|
|
traceback.print_exc()
|
|
traceback.print_exc()
|
|
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e))
|
|
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e))
|
|
|
|
+
|
|
|
|
+@router.get('/treeData')
|
|
|
|
+async def get_dict_data_by_type(
|
|
|
|
+ db: Session = Depends(get_db),
|
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
|
+ user_id = Depends(valid_access_token)
|
|
|
|
+):
|
|
|
|
+ try:
|
|
|
|
+ # 根据 dict_type 查询字典数据
|
|
|
|
+ # dict_data = db.query(SysDictData).filter_by(dict_type=dictType).all()
|
|
|
|
+
|
|
|
|
+ dict_data_list = []
|
|
|
|
+ dict_data = dict_type_get_dict_data_info(db, 'three_proofing')
|
|
|
|
+ for parent_info in dict_data:
|
|
|
|
+ data = {"id":parent_info.dict_value,"label":parent_info.dict_label,"css_class":parent_info.css_class}
|
|
|
|
+ type_list = get_type_parent_id_by_type_list(db,parent_info.dict_value)
|
|
|
|
+ if type_info:
|
|
|
|
+ children = []
|
|
|
|
+ for type_info in type_list:
|
|
|
|
+ children.append({"id":type_info.id,"label":type_info.type_name,"parent_id":type_info.type_parent_id})
|
|
|
|
+ data['children']:children
|
|
|
|
+ dict_data_list.append(data)
|
|
|
|
+ result = {
|
|
|
|
+ "rows": dict_data_list,
|
|
|
|
+ "code": 200,
|
|
|
|
+ "msg": "查询成功"
|
|
|
|
+ }
|
|
|
|
+ return result
|
|
|
|
+
|
|
|
|
+ except Exception as e:
|
|
|
|
+ # 处理异常
|
|
|
|
+ raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e))
|