123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- from flask import request
- from flask_restx import Resource, Namespace, reqparse
- from app.defines import StatesCode
- ns = Namespace('organization', description='组织管理接口')
- @ns.route('/organization_list')
- class OrganizationListApi(Resource):
- # @ns.doc(id='get_organization_list', description='获取组织列表')
- @ns.doc(id='get_corporation_list', description='获取公司列表')
- @ns.expect()
- def get(self):
- """获取组织列表"""
- data = [
- {"name": "中讯邮电咨询设计院有限公司", "code": 4032, "corporate": "张三", "contacts": "张三",
- "mobile": "13912345678"},
- {"name": "北京电信设计院有限公司", "code": 9417, "corporate": "李四", "contacts": "李四",
- "mobile": "13912345670"}
- ]
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": data}
- @ns.route('/organization')
- class OrganizationApi(Resource):
- @ns.doc(id='get_organization', description='搜索公司')
- @ns.expect()
- def get(self):
- """搜索公司"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '查询'}
- @ns.doc(id='add_organization', description='添加公司')
- @ns.expect()
- def post(self):
- """添加公司"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '添加公司'}
- @ns.doc(id='delete_organization', description='添加公司')
- @ns.expect()
- def delete(self):
- """删除公司"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '删除公司'}
- @ns.route('/organization_details')
- class OrganizationDetailsApi(Resource):
- @ns.doc(id='get_organization_details', description='获取公司详情')
- @ns.expect()
- def get(self):
- """获取organization组织详情"""
- data = {
- "full_name": "北京电信规划设计院有限公司",
- "for_short": "北京规划院",
- "superior_company": "中讯邮电咨询设计有限公司",
- "credit_code": 9111111111,
- "registered_address": "北京海淀区首体南路9号",
- "business_address": "北京海淀区首体南路9号",
- "corporate": "张三",
- "company_code": 11111,
- "authorized_strength": 222,
- "staff_num": 100,
- }
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": data}
- @ns.doc(id='update_organization_details', description='修改公司详情')
- @ns.expect()
- def put(self):
- """更新organization组织详情"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '修改公司详情'}
- @ns.route('/department')
- class DepartmentApi(Resource):
- @ns.doc(id='add_department', description='添加部门')
- @ns.expect()
- def post(self):
- """添加部门"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '添加部门'}
- @ns.doc(id='delete_organization_details', description='删除部门')
- @ns.expect()
- def delete(self):
- """删除部门"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '删除部门'}
- @ns.route('/department_details')
- class DepartmentDetailsApi(Resource):
- @ns.doc(id='get_department_details', description='获取部门详情')
- @ns.expect()
- def get(self):
- """获取department部门详情"""
- data = {
- "iclass": "1",
- "parent_business": "智慧城市设计院",
- "department": "智慧楼宇BU",
- "principal": "张三",
- "liaison_officer": "李四",
- "duplicate_name": "z-智慧楼宇BU",
- "staff_num": 100,
- "freelance_staff": 100,
- "collaborative_work": 100,
- "etw": 100,
- "duties": "中讯邮电咨询设计有限公司"
- }
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": data}
- @ns.doc(id='update_organization_details', description='修改部门详情')
- @ns.expect()
- def put(self):
- """更新department部门详情"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": '修改部门详情'}
- @ns.route('/batch_delete_organization')
- class BatchDeleteOrganizationApi(Resource):
- @ns.doc(id='batch_delete_users', description='批量删除公司')
- @ns.expect()
- def delete(self):
- """批量删除公司"""
- return {"code": StatesCode.SUCCESS, "message": "成功", "data": "user004"}
|