Exemplo n.º 1
0
    def get(self, request):
        getParams = request.GET
        # employee_name= getParams.get('employee_name', '').strip()
        natural_week = getParams.get('natural_week', '')
        # department_name =u'销售部'
        #验证日期是否符合 2017-01的格式
        __match = re.compile('^\d{4}-\d{2}').match(natural_week)
        if __match:
            natural_week = __match.group()
        else:
            natural_week = get_day_of_week()

        user_id = get_user_id(request)

        data = WeekSummary.objects.filter(summary_owner=user_id).filter(
            natural_week=natural_week).all()

        result_field = [
            "id", "natural_week", "summary", "self_evaluation", "plan"
        ]
        data_dict = queryset_to_dict(data, result_field)
        content = dict_to_json(data_dict)

        response = my_response(code=0, msg=u"查询成功", content=content)
        return response
Exemplo n.º 2
0
 def get(self, request):
     data = SaleActiveType.objects.filter(closed_status=0).all()
     result_field = [
         "id", "active_type_name", "sale_active_type_remark", "create_time"
     ]
     data_dict = queryset_to_dict(data, result_field)
     content = dict_to_json(data_dict)
     response = my_response(code=0, msg=u"查询成功", content=content)
     return response
Exemplo n.º 3
0
 def get(self, request):
     data = DevProject.objects.filter(closed_status=0).all()
     result_field = [
         "id", "creater_id", "status", "dev_project_remark", "project_name",
         "create_time"
     ]
     data_dict = queryset_to_dict(data, result_field)
     content = dict_to_json(data_dict)
     response = my_response(code=0, msg=u"查询成功", content=content)
     return response
Exemplo n.º 4
0
 def get(self, request):
     data = SalePhase.objects.filter(closed_status=0).all()
     result_field = [
         "id", "phase_name", "description", "phase_count",
         "sale_phase_remark", "create_time"
     ]
     data_dict = queryset_to_dict(data, result_field)
     content = dict_to_json(data_dict)
     response = my_response(code=0, msg=u"查询成功", content=content)
     return response
Exemplo n.º 5
0
    def get(self, request):
        user_id = get_user_id(request)

        result_field = [
            "id", "full_name", "short_name", "contact_post", "contact_name",
            "contact_mdn", "contact_tel_num", "sale_customer_remark",
            "create_time"
        ]
        data = SaleCustomer.objects.filter(
            sale_customer_owner_id=user_id).all()
        data_dict = queryset_to_dict(data, result_field)
        content = dict_to_json(data_dict)
        response = my_response(code=0, msg=u"查询成功", content=content)
        return response
Exemplo n.º 6
0
    def get(self, request):
        getParams = request.GET
        # department_id = getParams.get('department_id', '')

        # if department_id:
        #     user_queryset=User.objects.filter(department_id=department_id).all()
        # else:
        user_queryset = User.objects.all()
        user_ids = tuple([i.id for i in user_queryset])
        data = User.objects.filter(pk__in=user_ids).all()
        query_field = [
            "id", "username", "chinese_name", "department", "position"
        ]
        data_dict = queryset_to_dict(data, query_field)
        content = dict_to_json(data_dict)

        response = my_response(code=0, msg=u"查询成功", content=content)
        return response