organization.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. from flask import request
  2. from flask_restx import Resource, Namespace, reqparse
  3. from app.defines import StatesCode
  4. ns = Namespace('organization', description='组织管理接口')
  5. @ns.route('/organization_list')
  6. class OrganizationListApi(Resource):
  7. # @ns.doc(id='get_organization_list', description='获取组织列表')
  8. @ns.doc(id='get_corporation_list', description='获取公司列表')
  9. @ns.expect()
  10. def get(self):
  11. """获取组织列表"""
  12. data = [
  13. {"name": "中讯邮电咨询设计院有限公司", "code": 4032, "corporate": "张三", "contacts": "张三",
  14. "mobile": "13912345678"},
  15. {"name": "北京电信设计院有限公司", "code": 9417, "corporate": "李四", "contacts": "李四",
  16. "mobile": "13912345670"}
  17. ]
  18. return {"code": StatesCode.SUCCESS, "message": "成功", "data": data}
  19. @ns.route('/organization')
  20. class OrganizationApi(Resource):
  21. @ns.doc(id='get_organization', description='搜索公司')
  22. @ns.expect()
  23. def get(self):
  24. """搜索公司"""
  25. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '查询'}
  26. @ns.doc(id='add_organization', description='添加公司')
  27. @ns.expect()
  28. def post(self):
  29. """添加公司"""
  30. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '添加公司'}
  31. @ns.doc(id='delete_organization', description='添加公司')
  32. @ns.expect()
  33. def delete(self):
  34. """删除公司"""
  35. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '删除公司'}
  36. @ns.route('/organization_details')
  37. class OrganizationDetailsApi(Resource):
  38. @ns.doc(id='get_organization_details', description='获取公司详情')
  39. @ns.expect()
  40. def get(self):
  41. """获取organization组织详情"""
  42. data = {
  43. "full_name": "北京电信规划设计院有限公司",
  44. "for_short": "北京规划院",
  45. "superior_company": "中讯邮电咨询设计有限公司",
  46. "credit_code": 9111111111,
  47. "registered_address": "北京海淀区首体南路9号",
  48. "business_address": "北京海淀区首体南路9号",
  49. "corporate": "张三",
  50. "company_code": 11111,
  51. "authorized_strength": 222,
  52. "staff_num": 100,
  53. }
  54. return {"code": StatesCode.SUCCESS, "message": "成功", "data": data}
  55. @ns.doc(id='update_organization_details', description='修改公司详情')
  56. @ns.expect()
  57. def put(self):
  58. """更新organization组织详情"""
  59. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '修改公司详情'}
  60. @ns.route('/department')
  61. class DepartmentApi(Resource):
  62. @ns.doc(id='add_department', description='添加部门')
  63. @ns.expect()
  64. def post(self):
  65. """添加部门"""
  66. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '添加部门'}
  67. @ns.doc(id='delete_organization_details', description='删除部门')
  68. @ns.expect()
  69. def delete(self):
  70. """删除部门"""
  71. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '删除部门'}
  72. @ns.route('/department_details')
  73. class DepartmentDetailsApi(Resource):
  74. @ns.doc(id='get_department_details', description='获取部门详情')
  75. @ns.expect()
  76. def get(self):
  77. """获取department部门详情"""
  78. data = {
  79. "iclass": "1",
  80. "parent_business": "智慧城市设计院",
  81. "department": "智慧楼宇BU",
  82. "principal": "张三",
  83. "liaison_officer": "李四",
  84. "duplicate_name": "z-智慧楼宇BU",
  85. "staff_num": 100,
  86. "freelance_staff": 100,
  87. "collaborative_work": 100,
  88. "etw": 100,
  89. "duties": "中讯邮电咨询设计有限公司"
  90. }
  91. return {"code": StatesCode.SUCCESS, "message": "成功", "data": data}
  92. @ns.doc(id='update_organization_details', description='修改部门详情')
  93. @ns.expect()
  94. def put(self):
  95. """更新department部门详情"""
  96. return {"code": StatesCode.SUCCESS, "message": "成功", "data": '修改部门详情'}
  97. @ns.route('/batch_delete_organization')
  98. class BatchDeleteOrganizationApi(Resource):
  99. @ns.doc(id='batch_delete_users', description='批量删除公司')
  100. @ns.expect()
  101. def delete(self):
  102. """批量删除公司"""
  103. return {"code": StatesCode.SUCCESS, "message": "成功", "data": "user004"}