|
@@ -466,7 +466,7 @@ class DeviceManagement(View):
|
|
|
@staticmethod
|
|
|
def get_app_device_type_list(request_dict, response):
|
|
|
app_bundle_id = request_dict.get('app_bundle_id', None)
|
|
|
- lang = request_dict.get('lang', 'cn')
|
|
|
+ lang = request_dict.get('lang', None)
|
|
|
model = request_dict.get('model', None)
|
|
|
type = request_dict.get('type', None)
|
|
|
name = request_dict.get('name', None)
|
|
@@ -481,12 +481,17 @@ class DeviceManagement(View):
|
|
|
line = int(pageSize)
|
|
|
|
|
|
try:
|
|
|
- if not app_bundle_id:
|
|
|
- app_bundle_id = 'com.ansjer.zccloud'
|
|
|
- app_bundle_qs = AppBundle.objects.filter(app_bundle_id=app_bundle_id)
|
|
|
+ app_bundle_qs = AppBundle.objects.all()
|
|
|
+ if app_bundle_id:
|
|
|
+ app_bundle_qs = app_bundle_qs.filter(app_bundle_id=app_bundle_id)
|
|
|
if lang:
|
|
|
app_bundle_qs = app_bundle_qs.filter(app_device_type__devicenamelanguage__lang=lang)
|
|
|
-
|
|
|
+ if name:
|
|
|
+ app_bundle_qs = app_bundle_qs.filter(name=name)
|
|
|
+ if model:
|
|
|
+ app_bundle_qs = app_bundle_qs.filter(model=model)
|
|
|
+ if type:
|
|
|
+ app_bundle_qs = app_bundle_qs.filter(type=type)
|
|
|
app_bundle_qs = app_bundle_qs.annotate(
|
|
|
model=F('app_device_type__model'), type=F('app_device_type__type'), icon=F('app_device_type__icon'),
|
|
|
lang=F('app_device_type__devicenamelanguage__lang'),
|
|
@@ -499,13 +504,6 @@ class DeviceManagement(View):
|
|
|
'app_device_type__devicenamelanguage__sort')
|
|
|
if not app_bundle_qs.exists():
|
|
|
return response.json(0)
|
|
|
- app_bundle_qs = app_bundle_qs.all()
|
|
|
- if name:
|
|
|
- app_bundle_qs = app_bundle_qs.filter(name=name)
|
|
|
- if model:
|
|
|
- app_bundle_qs = app_bundle_qs.filter(model=model)
|
|
|
- if type:
|
|
|
- app_bundle_qs = app_bundle_qs.filter(type=type)
|
|
|
total = app_bundle_qs.count()
|
|
|
app_bundle_qs = app_bundle_qs[(page - 1) * line:page * line]
|
|
|
app_device_type_list = []
|