diff --git a/website/handlers/enterprise_device/handler.py b/website/handlers/enterprise_device/handler.py index 827bc1f..2809d24 100644 --- a/website/handlers/enterprise_device/handler.py +++ b/website/handlers/enterprise_device/handler.py @@ -134,6 +134,30 @@ class DeviceClassificationDeleteHandler(APIHandler): self.finish() +class DeviceClassificationEditHandler(APIHandler): + """ + - 描述:编辑设备分类 + - 请求方式:post + - 请求参数: + >- id + >- name + - 返回值:无 + """ + + @authenticated + @operation_log("企业管理", "设备管理", consts.op_type_edit_str, "编辑设备分类") + def post(self): + did = self.get_int_argument("id") + name = self.get_escaped_argument("name", "") + + with self.app_mysql.connect() as conn: + conn.execute( + text("update device_classification set name=:name WHERE id=:id"), + {"id": did, "name": name}, + ) + conn.commit() + self.finish() + class DeviceAddHandler(APIHandler): """ - 描述:企业节点,添加设备 diff --git a/website/handlers/enterprise_device/url.py b/website/handlers/enterprise_device/url.py index c012806..6d8aacc 100644 --- a/website/handlers/enterprise_device/url.py +++ b/website/handlers/enterprise_device/url.py @@ -5,10 +5,8 @@ from website.handlers.enterprise_device import handler handlers = [ ("/enterprise/device/classification/add", handler.DeviceClassificationAddHandler), ("/enterprise/device/classification", handler.DeviceClassificationHandler), - ( - "/enterprise/device/classification/delete", - handler.DeviceClassificationDeleteHandler, - ), + ("/enterprise/device/classification/delete", handler.DeviceClassificationDeleteHandler), + ("/enterprise/device/classification/edit", handler.DeviceClassificationEditHandler), ("/enterprise/entity/nodes/device/add", handler.DeviceAddHandler), ("/enterprise/entity/nodes/device/edit", handler.DeviceEditHandler), ("/enterprise/entity/nodes/device/delete", handler.DeviceDeleteHandler),