|
@@ -68,6 +68,8 @@ class DeviceManagement(View):
|
|
|
return self.get_app_device_type_list(request_dict, response)
|
|
|
elif operation == 'getAppBundleIdList': # 获取app包id数据
|
|
|
return self.get_app_bundle_id_list(response)
|
|
|
+ elif operation == 'editAppDeviceType': # 编辑app设备类型数据
|
|
|
+ return self.edit_app_device_type(request_dict, response)
|
|
|
else:
|
|
|
return response.json(444, 'operation')
|
|
|
|
|
@@ -376,7 +378,7 @@ class DeviceManagement(View):
|
|
|
|
|
|
@staticmethod
|
|
|
def get_app_device_type_list(request_dict, response):
|
|
|
- app_bundle_id = request_dict.get('appBundleId', 'com.ansjer.zccloud')
|
|
|
+ app_bundle_id = request_dict.get('appBundleId', None)
|
|
|
lang = request_dict.get('lang', 'cn')
|
|
|
|
|
|
pageNo = request_dict.get('pageNo', None)
|
|
@@ -388,9 +390,9 @@ class DeviceManagement(View):
|
|
|
page = int(pageNo)
|
|
|
line = int(pageSize)
|
|
|
try:
|
|
|
- app_bundle_qs = AppBundle.objects.filter()
|
|
|
- if app_bundle_id:
|
|
|
- app_bundle_qs = app_bundle_qs.filter(app_bundle_id=app_bundle_id)
|
|
|
+ if not app_bundle_id:
|
|
|
+ app_bundle_id = 'com.ansjer.zccloud'
|
|
|
+ app_bundle_qs = AppBundle.objects.filter(app_bundle_id=app_bundle_id)
|
|
|
if lang:
|
|
|
app_bundle_qs = app_bundle_qs.filter(app_device_type__devicenamelanguage__lang=lang)
|
|
|
|
|
@@ -398,8 +400,8 @@ class DeviceManagement(View):
|
|
|
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'),
|
|
|
name=F('app_device_type__devicenamelanguage__name'),
|
|
|
- sort=F('app_device_type__devicenamelanguage__sort')).values('model', 'type', 'icon', 'lang', 'name',
|
|
|
- 'sort').order_by(
|
|
|
+ sort=F('app_device_type__devicenamelanguage__sort')).values('id', 'model', 'type', 'icon', 'lang',
|
|
|
+ 'name', 'sort').order_by(
|
|
|
'app_device_type__devicenamelanguage__sort')
|
|
|
if not app_bundle_qs.exists():
|
|
|
return response.json(0)
|
|
@@ -420,3 +422,19 @@ class DeviceManagement(View):
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
return response.json(500, repr(e))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def edit_app_device_type(request_dict, response):
|
|
|
+ app_device_type_id = request_dict.get('id', None)
|
|
|
+ model = request_dict.get('model', None)
|
|
|
+ type = request_dict.get('type', None)
|
|
|
+ lang = request_dict.get('lang', None)
|
|
|
+ name = request_dict.get('name', None)
|
|
|
+ sort = request_dict.get('sort', None)
|
|
|
+ icon = request_dict.get('icon', None)
|
|
|
+
|
|
|
+ try:
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(500, repr(e))
|