|
@@ -21,7 +21,7 @@ router = APIRouter()
|
|
|
|
|
|
|
|
|
@router.get("/video/region/tree/{parent_id}")
|
|
|
-def read_all_regions(parent_id:str = 'root00000000',db: Session = Depends(get_db)):
|
|
|
+def read_all_regions(parent_id:str = '0',db: Session = Depends(get_db)):
|
|
|
def parent_id_get_region_info(parent_id):
|
|
|
query = db.query(TPVideoRegion)
|
|
|
query = query.filter(TPVideoRegion.parentIndexCode == parent_id)
|
|
@@ -31,19 +31,40 @@ def read_all_regions(parent_id:str = 'root00000000',db: Session = Depends(get_db
|
|
|
query = query.filter(TPVideoRegion.indexCode == id)
|
|
|
return query.first()
|
|
|
try:
|
|
|
- region_info = id_get_region_info(parent_id)
|
|
|
+ # region_info = id_get_region_info(parent_id)
|
|
|
region_list = parent_id_get_region_info(parent_id)
|
|
|
data = []
|
|
|
for info in region_list:
|
|
|
- isShowSelect = True
|
|
|
+ isShowSelect1 = True
|
|
|
if parent_id_get_region_info(info.indexCode):
|
|
|
- isShowSelect=False
|
|
|
+ isShowSelect1=False
|
|
|
if info.indexCode=='84021e2f6eba4e6b8ccc7d750fb833fa':
|
|
|
continue
|
|
|
- data.append({'id': info.indexCode,
|
|
|
- 'label': info.name,
|
|
|
- 'isShowSelect': isShowSelect,
|
|
|
- 'parentLabel': region_info.name})
|
|
|
+
|
|
|
+ if info.indexCode=='root00000000':
|
|
|
+ region_list = parent_id_get_region_info('root00000000')
|
|
|
+ children = []
|
|
|
+ for chil in region_list:
|
|
|
+ isShowSelect = True
|
|
|
+ if parent_id_get_region_info(chil.indexCode):
|
|
|
+ isShowSelect = False
|
|
|
+ if chil.indexCode == '84021e2f6eba4e6b8ccc7d750fb833fa':
|
|
|
+ continue
|
|
|
+
|
|
|
+ children.append({'id': chil.indexCode,
|
|
|
+ 'label': chil.name,
|
|
|
+ 'isShowSelect': isShowSelect
|
|
|
+ })
|
|
|
+ data.append({'id': info.indexCode,
|
|
|
+ 'label': info.name,
|
|
|
+ 'isShowSelect': isShowSelect1,
|
|
|
+ 'children': children
|
|
|
+ })
|
|
|
+ else:
|
|
|
+ data.append({'id': info.indexCode,
|
|
|
+ 'label': info.name,
|
|
|
+ 'isShowSelect': isShowSelect1
|
|
|
+ })
|
|
|
return {
|
|
|
"code": 200,
|
|
|
"msg": "成功",
|